@moonbeam-network/xcm-types 4.3.7 → 4.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.d.mts +213 -0
  2. package/package.json +3 -3
@@ -0,0 +1,213 @@
1
+ import Big, { RoundingMode } from 'big.js';
2
+ import { Chain as Chain$3 } from '@wormhole-foundation/sdk-connect';
3
+ import { Address, Chain as Chain$1 } from 'viem';
4
+ import { Chain as Chain$2 } from 'viem/chains';
5
+
6
+ interface AssetConstructorParams {
7
+ key: string;
8
+ originSymbol: string;
9
+ }
10
+ declare class Asset {
11
+ readonly key: string;
12
+ readonly originSymbol: string;
13
+ constructor({ key, originSymbol }: AssetConstructorParams);
14
+ copyWith(params: Partial<AssetConstructorParams>): Asset;
15
+ isEqual(asset: Asset): boolean;
16
+ }
17
+
18
+ interface ChainAssetConstructorParams extends AssetConstructorParams {
19
+ address?: string;
20
+ decimals: number;
21
+ ids?: ChainAssetIds;
22
+ min?: number | bigint;
23
+ symbol?: string;
24
+ }
25
+ interface ChainAssetIds {
26
+ balanceId?: ChainAssetId;
27
+ id?: ChainAssetId;
28
+ minId?: ChainAssetId;
29
+ palletInstance?: number;
30
+ generalKey?: GeneralKey;
31
+ /**
32
+ * Position in memory of the allowance slot for the asset
33
+ * example for weTH = 4
34
+ * contract WETH9 {
35
+ * string public name = "Wrapped Ether"; // slot 0
36
+ * string public symbol = "WETH"; // slot 1
37
+ * uint8 public decimals = 18; // slot 2
38
+ * event Approval(address indexed src, address indexed guy, uint wad); // events do not consume storage slots
39
+ * event Transfer(address indexed src, address indexed dst, uint wad); // events do not consume storage slots
40
+ * event Deposit(address indexed dst, uint wad); // events do not consume storage slots
41
+ * event Withdrawal(address indexed src, uint wad); // events do not consume storage slots
42
+ * mapping (address => uint) public balanceOf; // slot 3
43
+ * mapping (address => mapping (address => uint)) public allowance; // slot 4
44
+ * } */
45
+ allowanceSlot?: number;
46
+ }
47
+ type ChainAssetId = string | number | bigint | {
48
+ [key: string]: ChainAssetId;
49
+ };
50
+ interface GeneralKey {
51
+ length: number;
52
+ data: string;
53
+ }
54
+ declare class ChainAsset extends Asset {
55
+ readonly address?: string;
56
+ readonly decimals: number;
57
+ readonly ids?: ChainAssetIds;
58
+ readonly min?: bigint;
59
+ readonly symbol?: string;
60
+ constructor({ address, decimals, ids, min, symbol, ...other }: ChainAssetConstructorParams);
61
+ static fromAsset(asset: Asset, params: Omit<ChainAssetConstructorParams, keyof AssetConstructorParams>): ChainAsset;
62
+ copyWith(params: Partial<ChainAssetConstructorParams>): ChainAsset;
63
+ getSymbol(): string;
64
+ getAssetId(): ChainAssetId;
65
+ getAssetRegisteredId(): ChainAssetId | undefined;
66
+ getBalanceAssetId(): ChainAssetId;
67
+ getMinAssetId(): ChainAssetId;
68
+ getAssetPalletInstance(): number;
69
+ getAssetMin(): bigint;
70
+ getGeneralKey(): GeneralKey | undefined;
71
+ hasOnlyAddress(): this is {
72
+ address: string;
73
+ };
74
+ }
75
+
76
+ interface AssetAmountConstructorParams extends ChainAssetConstructorParams {
77
+ amount: number | bigint;
78
+ decimals: number;
79
+ symbol?: string;
80
+ }
81
+ declare class AssetAmount extends ChainAsset {
82
+ readonly amount: bigint;
83
+ constructor({ amount, ...other }: AssetAmountConstructorParams);
84
+ static fromChainAsset(asset: ChainAsset, params: Omit<AssetAmountConstructorParams, keyof ChainAssetConstructorParams>): AssetAmount;
85
+ isSame(asset: ChainAsset | AssetAmount): boolean;
86
+ isEqual(asset: AssetAmount): boolean;
87
+ copyWith(params: Partial<AssetAmountConstructorParams>): AssetAmount;
88
+ convertDecimals(decimals: number): AssetAmount;
89
+ toBig(): Big;
90
+ toBigDecimal(maxDecimal?: number, roundType?: RoundingMode): Big;
91
+ toDecimal(maxDecimal?: number, roundType?: RoundingMode): string;
92
+ }
93
+
94
+ type AnyAsset = Asset | ChainAsset | AssetAmount;
95
+
96
+ interface EvmChainConstructorParams extends ChainConstructorParams {
97
+ id: number;
98
+ rpc: string;
99
+ contracts?: Contracts$1;
100
+ }
101
+ type Contracts$1 = {
102
+ Gateway?: Address;
103
+ };
104
+ declare class EvmChain extends Chain {
105
+ readonly id: number;
106
+ readonly rpc: string;
107
+ readonly contracts?: Contracts$1;
108
+ static is(obj: unknown): obj is EvmChain;
109
+ constructor({ id, rpc, contracts, ...others }: EvmChainConstructorParams);
110
+ getViemChain(): Chain$1;
111
+ copyWith(params: Partial<EvmChainConstructorParams>): EvmChain;
112
+ }
113
+
114
+ interface ParachainConstructorParams extends ChainConstructorParams {
115
+ checkSovereignAccountBalances?: boolean;
116
+ genesisHash: string;
117
+ isRelay?: boolean;
118
+ parachainId: number;
119
+ relayGenesisHash?: string;
120
+ ss58Format: number;
121
+ usesChainDecimals?: boolean;
122
+ weight?: number;
123
+ ws: string[];
124
+ }
125
+ declare class Parachain extends Chain {
126
+ readonly checkSovereignAccountBalances: boolean;
127
+ readonly genesisHash: string;
128
+ readonly isRelay: boolean;
129
+ readonly parachainId: number;
130
+ readonly ss58Format: number;
131
+ readonly usesChainDecimals: boolean;
132
+ readonly relayGenesisHash?: string;
133
+ readonly weight: number | undefined;
134
+ readonly ws: string[];
135
+ static is(obj: unknown): obj is Parachain;
136
+ static isExactly(obj: unknown): obj is Parachain;
137
+ constructor({ checkSovereignAccountBalances, genesisHash, isRelay, parachainId, relayGenesisHash, usesChainDecimals, ss58Format, weight, ws, ...others }: ParachainConstructorParams);
138
+ copyWith(params: Partial<ParachainConstructorParams>): Parachain;
139
+ }
140
+
141
+ interface EvmParachainConstructorParams extends ParachainConstructorParams {
142
+ id?: number;
143
+ rpc?: string;
144
+ isEvmSigner?: boolean;
145
+ contracts?: Contracts;
146
+ }
147
+ type Contracts = {
148
+ Batch?: Address;
149
+ XcmUtils?: Address;
150
+ Xtokens?: Address;
151
+ XcmPrecompile?: Address;
152
+ };
153
+ declare class EvmParachain extends Parachain {
154
+ readonly id: number;
155
+ readonly rpc: string;
156
+ readonly isEvmSigner: boolean;
157
+ readonly contracts?: Contracts;
158
+ readonly ws: string[];
159
+ static is(obj: unknown): obj is EvmParachain;
160
+ static isAnyParachain(obj: unknown): obj is EvmParachain | Parachain;
161
+ static isAnyEvmChain(obj: unknown): obj is EvmParachain | EvmChain;
162
+ constructor({ id, rpc, isEvmSigner, contracts, ...others }: EvmParachainConstructorParams);
163
+ getViemChain(): Chain$2;
164
+ copyWith(params: Partial<EvmParachainConstructorParams>): EvmParachain;
165
+ }
166
+
167
+ type AnyChain = EvmChain | Parachain | EvmParachain;
168
+ type AnyParachain = Parachain | EvmParachain;
169
+ declare enum Ecosystem {
170
+ Polkadot = "polkadot",
171
+ Kusama = "kusama",
172
+ AlphanetRelay = "alphanet-relay",
173
+ StagenetRelay = "stagenet-relay",
174
+ MoonlamaRelay = "moonlama-relay",
175
+ MoonsamaRelay = "moonsama-relay"
176
+ }
177
+ interface WormholeConfig {
178
+ name?: Chain$3;
179
+ }
180
+
181
+ interface ChainConstructorParams {
182
+ assets: Map<string, ChainAsset> | ChainAsset[];
183
+ ecosystem?: Ecosystem;
184
+ explorer?: Explorer;
185
+ isTestChain?: boolean;
186
+ key: string;
187
+ name: string;
188
+ nativeAsset: Asset;
189
+ wh?: WormholeConfig;
190
+ }
191
+ interface Explorer {
192
+ base: string;
193
+ txPath?: string;
194
+ }
195
+ declare abstract class Chain {
196
+ #private;
197
+ readonly assets: Map<string, ChainAsset>;
198
+ readonly ecosystem?: Ecosystem;
199
+ readonly explorer?: Explorer;
200
+ readonly isTestChain: boolean;
201
+ readonly key: string;
202
+ readonly name: string;
203
+ readonly wh?: WormholeConfig;
204
+ constructor({ assets, ecosystem, explorer, isTestChain, key, name, nativeAsset, wh, }: ChainConstructorParams);
205
+ get nativeAsset(): ChainAsset;
206
+ isEqual<T extends Chain>(chain: T): boolean;
207
+ getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset;
208
+ getWormholeName(): Chain$3;
209
+ }
210
+
211
+ type SetOptional<Base, Keys extends keyof Base> = Omit<Base, Keys> & Partial<Pick<Base, Keys>>;
212
+
213
+ export { type AnyAsset, type AnyChain, type AnyParachain, Asset, AssetAmount, type AssetAmountConstructorParams, type AssetConstructorParams, Chain, ChainAsset, type ChainAssetConstructorParams, type ChainAssetId, type ChainAssetIds, type ChainConstructorParams, Ecosystem, EvmChain, type EvmChainConstructorParams, EvmParachain, type EvmParachainConstructorParams, type GeneralKey, Parachain, type ParachainConstructorParams, type SetOptional, type WormholeConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonbeam-network/xcm-types",
3
- "version": "4.3.7",
3
+ "version": "4.3.8",
4
4
  "description": "Moonbeam XCM Types",
5
5
  "repository": {
6
6
  "directory": "packages/types",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/big.js": "^6.2.2",
40
- "@wormhole-foundation/sdk-connect": "^4.7.4"
40
+ "@wormhole-foundation/sdk-connect": "^4.10.0"
41
41
  },
42
42
  "peerDependencies": {
43
- "viem": "^2.44.2"
43
+ "viem": "^2.45.2"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsup",