Closed rixhy-cyd closed 1 year ago
I haven't seen this, but I have seen ts complaining about import Long from 'long'
.
Do you have a suggestion for the fix?
or you mean to say that Long
is never imported?
or you mean to say that
Long
is never imported?
If I look into the code of that file where i get the error, Long was not imported
I haven't seen this, but I have seen ts complaining about
import Long from 'long'
.Do you have a suggestion for the fix?
Even am looking for the fix
I think I am able to fix if it's just missing an import.
Also am getting this import error
import { AminoMsg } from "@cosmjs/amino";
import { Long } from "../../../../helpers";
import { MsgCreateStableswapPool, MsgStableSwapAdjustScalingFactors } from "./tx";
export interface AminoMsgCreateStableswapPool extends AminoMsg {
type: "osmosis/gamm/create-stableswap-pool";
value: {
sender: string;
pool_params: {
swap_fee: string;
exit_fee: string;
};
initial_pool_liquidity: {
denom: string;
amount: string;
}[];
scaling_factors: Long[];
future_pool_governor: string;
};
}
export interface AminoMsgStableSwapAdjustScalingFactors extends AminoMsg {
type: "osmosis/gamm/stable-swap-adjust-scaling-factors";
value: {
sender: string;
pool_id: string;
scaling_factors: Long[];
};
}
export declare const AminoConverter: {
"/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool": {
aminoType: string;
toAmino: ({ sender, poolParams, initialPoolLiquidity, scalingFactors, futurePoolGovernor }: MsgCreateStableswapPool) => AminoMsgCreateStableswapPool["value"];
fromAmino: ({ sender, pool_params, initial_pool_liquidity, scaling_factors, future_pool_governor }: AminoMsgCreateStableswapPool["value"]) => MsgCreateStableswapPool;
};
"/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors": {
aminoType: string;
toAmino: ({ sender, poolId, scalingFactors }: MsgStableSwapAdjustScalingFactors) => AminoMsgStableSwapAdjustScalingFactors["value"];
fromAmino: ({ sender, pool_id, scaling_factors }: AminoMsgStableSwapAdjustScalingFactors["value"]) => MsgStableSwapAdjustScalingFactors;
};
};
what version are you running? This all seems to work.
If I use npm i osmojs it installs v0.28.0
and you don't see import { Long } from "../../../../helpers";
at the top of the files where Long
is used? I can't seem to find this missing as indicated.
node_modules/osmojs/types/codegen/osmosis/bundle.d.ts:1211:50 - error TS2304: Cannot find name 'Long'.
1211 scaling_factors: Long[];
node_modules/osmojs/types/codegen/osmosis/client.d.ts:589:30 - error TS2304: Cannot find name 'Long'.
589 scaling_factors: Long[];
You can see here that there it says to import it found this in node_modules/osmojs/types/codegen/osmosis/client.d.ts:
import { AminoMsg } from "@cosmjs/amino"; import { Long } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgStableSwapAdjustScalingFactors } from "./tx"; export interface AminoMsgCreateStableswapPool extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; value: { sender: string; pool_params: { swap_fee: string; exit_fee: string; }; initial_pool_liquidity: { denom: string; amount: string; }[]; scaling_factors: Long[]; future_pool_governor: string; }; } export interface AminoMsgStableSwapAdjustScalingFactors extends AminoMsg { type: "osmosis/gamm/stable-swap-adjust-scaling-factors"; value: { sender: string; pool_id: string; scaling_factors: Long[]; }; } export declare const AminoConverter: { "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool": { aminoType: string; toAmino: ({ sender, poolParams, initialPoolLiquidity, scalingFactors, futurePoolGovernor }: MsgCreateStableswapPool) => AminoMsgCreateStableswapPool["value"]; fromAmino: ({ sender, pool_params, initial_pool_liquidity, scaling_factors, future_pool_governor }: AminoMsgCreateStableswapPool["value"]) => MsgCreateStableswapPool; }; "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors": { aminoType: string; toAmino: ({ sender, poolId, scalingFactors }: MsgStableSwapAdjustScalingFactors) => AminoMsgStableSwapAdjustScalingFactors["value"]; fromAmino: ({ sender, pool_id, scaling_factors }: AminoMsgStableSwapAdjustScalingFactors["value"]) => MsgStableSwapAdjustScalingFactors; }; };
what version are you running? This all seems to work.
What version should I use
I don't see the issue with long in 0.28. It is exported from the helpers file:
import Long from 'long';
if (_m0.util.Long !== Long) {
_m0.util.Long = (Long as any);
_m0.configure();
}
export { Long };
I can only see screenshots, but do you see an import at the top of the file? I am starting to think it's an issue with something else besides the code or long type itself. Maybe the TS server.
for long maybe we can try
import * as Long from 'long';
instead of
import Long from 'long'
and then export it. This may fix that part.
I can only see screenshots, but do you see an import at the top of the file? I am starting to think it's an issue with something else besides the code or long type itself. Maybe the TS server.
Nope I don't see any import statements for Long in this file node_modules/osmojs/types/codegen/osmosis/client.d.ts
I can only see screenshots, but do you see an import at the top of the file? I am starting to think it's an issue with something else besides the code or long type itself. Maybe the TS server.
Nope I don't see any import statements for Long in this file node_modules/osmojs/types/codegen/osmosis/client.d.ts
ok, that's what I needed, thanks for the path. Will get this taken care of.
I can only see screenshots, but do you see an import at the top of the file? I am starting to think it's an issue with something else besides the code or long type itself. Maybe the TS server.
Nope I don't see any import statements for Long in this file node_modules/osmojs/types/codegen/osmosis/client.d.ts
ok, that's what I needed, thanks for the path. Will get this taken care of.
Thanks for looking into it, let me know if the issue is fixed
Successfully published:
- osmojs@0.29.0
should be fixed now @rishikhesh-cyD
long
is now imported: https://github.com/osmosis-labs/osmojs/blob/fbfcbab095397bdf4dc49e05007530ddb9bedc1b/packages/osmojs/types/codegen/osmosis/client.d.ts#L589 @pyramation still facing some issues with the long import
'Long' only refers to a type, but is being used as a namespace here. Also facing this error with ts in all the places where long is used inside the files of this path node_modules/cosmjs-types/tendermint/ @pyramation
Long is not imported into the file that throughs error
<img width="716" alt="Screenshot 2022-10-11 at 12 02 34 PM" src="https://user-images.githubusercontent.com/107479292/195014104-b7de1338-03ad