@moonbeam-network/xcm-sdk 1.0.0-dev.21 → 1.0.0-dev.210

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.
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2022 PureStake
1
+ Copyright 2024 Moonbeam Foundation
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/README.md CHANGED
@@ -1,20 +1,10 @@
1
1
  The Moonbeam XCM SDK enables developers to easily transfer assets between chains, either between parachains or between a parachain and the relay chain, within the Polkadot/Kusama ecosystem. With the SDK, you don't need to worry about determining the multilocation of the origin or destination assets or which extrinsics are used on which networks to send XCM transfers.
2
2
 
3
- The XCM SDK offers helper functions, that provide a very simple interface to execute XCM transfers between chains in the Polkadot/Kusama ecosystem. In addition, the XCM config package allows any parachain project to add their information in a standard way, so they can be immediately supported by the XCM SDK.
3
+ The XCM SDK offers helper functions that provide a very simple interface to execute XCM transfers between chains in the Polkadot/Kusama ecosystem. In addition, the XCM config package allows any parachain project to add their information in a standard way, so they can be immediately supported by the XCM SDK.
4
4
 
5
5
  # Documentation
6
6
 
7
- ## v1 (current)
8
-
9
- - [readme](https://github.com/PureStake/xcm-sdk/tree/main)
10
- - [usage](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v1/xcm-sdk/)
11
- - [reference](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v1/reference/)
12
-
13
- ## v0 (previous)
14
-
15
- - [readme](https://github.com/PureStake/xcm-sdk/tree/v0)
16
- - [usage](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v0/xcm-sdk/)
17
- - [reference](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v0/reference/)
7
+ You can find the documentation at [https://moonbeam-foundation.github.io/xcm-sdk/latest/](https://moonbeam-foundation.github.io/xcm-sdk/latest/).
18
8
 
19
9
  # Installation
20
10
 
@@ -25,40 +15,30 @@ npm i @moonbeam-network/xcm-sdk
25
15
  :warning: You need to have peer dependencies of SDK installed as well.
26
16
 
27
17
  ```bash
28
- npm i @polkadot/api @polkadot/api-augment @polkadot/types @polkadot/util @polkadot/util-crypto @polkadot/apps-config ethers
18
+ npm i @polkadot/api @polkadot/util-crypto
29
19
  ```
30
20
 
31
21
  # Usage
32
22
 
33
- The following sections contain basic examples of how to work with the XCM SDK to build transfer data to transfer an asset from one chain to another and how to submit the transfer. For a detailed overview on how to use each method, including a reference to the parameters and returned data of each method exposed by the SDK, please refer to the [XCM SDK v1 docs](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v1/).
23
+ The following sections contain basic examples of how to work with the XCM SDK to build transfer data to transfer an asset from one chain to another and how to submit the transfer. For a detailed overview on how to use it, please refer to the [XCM SDK docs](https://moonbeam-foundation.github.io/xcm-sdk/latest/example-usage/xcm).
34
24
 
35
25
  ## Build XCM Transfer Data
36
26
 
37
27
  ```js
38
28
  import { Sdk } from '@moonbeam-network/xcm-sdk';
39
29
 
40
- const { assets, getTransferData } = Sdk();
41
-
42
- // You can build the XCM transfer data via the assets function
43
- const dataViaAssetsMethod = await assets()
44
- .asset('INSERT_ASSET')
45
- .source('INSERT_SOURCE_CHAIN')
46
- .destination('INSERT_DESTINATION_CHAIN')
47
- .accounts('INSERT_SOURCE_ADDRESS', 'INSERT_DESTINATION_ADDRESS', {
48
- evmSigner?: 'INSERT_EVM_SIGNER',
49
- polkadotSigner?: 'INSERT_POLKADOT_SIGNER',
50
- });
51
-
52
- // Or via the getTransferData function
53
- const dataViaGetTransferDataMethod = await getTransferData({
54
- destinationAddress: 'INSERT_DESTINATION_ADDRESS',
55
- destinationKeyOrChain: 'INSERT_DESTINATION_CHAIN',
56
- evmSigner?: 'INSERT_EVM_SIGNER',
57
- keyOrAsset: 'INSERT_ASSET',
58
- polkadotSigner?: 'INSERT_POLKADOT_SIGNER',
59
- sourceAddress: 'INSERT_SOURCE_ADDRESS',
60
- sourceKeyOrChain: 'INSERT_SOURCE_CHAIN',
61
- });
30
+ const transferData = async () => {
31
+ const transferData = await Sdk()
32
+ .setAsset(INSERT_ASSET)
33
+ .setSource(INSERT_SOURCE_CHAIN)
34
+ .setDestination(INSERT_DESTINATION_CHAIN)
35
+ .setAddresses({
36
+ sourceAddress: INSERT_SOURCE_ADDRESS,
37
+ destinationAddress: INSERT_DESTINATION_ADDRESS,
38
+ });
39
+ };
40
+
41
+ fromPolkadot();
62
42
  ```
63
43
 
64
44
  ## Transfer
@@ -66,30 +46,37 @@ const dataViaGetTransferDataMethod = await getTransferData({
66
46
  ```js
67
47
  ...
68
48
 
69
- const hash = await dataViaGetTransferDataMethod.transfer('INSERT_TRANSFER_AMOUNT');
49
+ const hash = await transferData.transfer(INSERT_TRANSFER_AMOUNT, { INSERT_SIGNERS });
70
50
  ```
71
51
 
72
52
  # Examples
73
53
 
74
- - [sdk](https://github.com/PureStake/xcm-sdk/blob/main/examples/sdk-simple)
54
+ - [sdk](https://github.com/moonbeam-foundation/xcm-sdk/blob/main/examples/sdk-simple)
75
55
 
76
56
  ```bash
77
- git clone git@github.com:PureStake/xcm-sdk.git
57
+ git clone git@github.com:moonbeam-foundation/xcm-sdk.git
78
58
  cd xcm-sdk
79
- npm i
59
+ pnpm install
80
60
  cd examples/sdk-simple
81
61
 
82
62
  # edit index.ts by adding your accounts
83
63
 
84
- npm start
64
+ pnpm run start
85
65
  ```
86
66
 
87
67
  # Contributing
88
68
 
69
+ First fork the repository and clone it.
70
+
71
+ ```bash
72
+ git clone git@github.com:YOUR_GITHUB_USERNAME/xcm-sdk.git
73
+ pnpm install
74
+ ```
75
+
76
+ Optionally, you can install the `pre-commit` hook to run the linter and tests before committing:
77
+
89
78
  ```bash
90
- git clone git@github.com:PureStake/xcm-sdk.git
91
- npm i
92
- npm run dev
79
+ pnpm lefthook install
93
80
  ```
94
81
 
95
82
  # Tests
@@ -97,14 +84,49 @@ npm run dev
97
84
  ## Unit tests
98
85
 
99
86
  ```bash
100
- npm run test
87
+ pnpm run test
101
88
  ```
102
89
 
103
90
  ## Acceptance tests
104
91
 
105
92
  ```bash
106
- cp .env.example .env
107
- # add private key and suri to .env file
93
+ pnpm run test:acc
94
+ ```
95
+
96
+ # Release
97
+
98
+ To create a dev version go to GitHub actions and run `publish dev versions` workflow.
99
+
100
+ To create a release version run:
101
+
102
+ ```bash
103
+ pnpm run changeset
104
+ ```
105
+
106
+ # Testing the change in the SDK locally
108
107
 
109
- npm run test:acc
108
+ Build the project:
109
+
110
+ ```bash
111
+ pnpm run build
112
+ ```
113
+
114
+ Link the SDK:
115
+
116
+ ```bash
117
+ pnpm run clean && pnpm run build && pnpm run link
118
+ ```
119
+
120
+ In your project where you would like to test the changes:
121
+
122
+ ```bash
123
+ pnpm link @moonbeam-network/xcm-types @moonbeam-network/xcm-utils @moonbeam-network/xcm-builder @moonbeam-network/xcm-config @moonbeam-network/xcm-sdk
124
+ ```
125
+
126
+ If you need you can link other packages too.
127
+
128
+ After testing is done, unlink the SDK:
129
+
130
+ ```bash
131
+ pnpm unlink @moonbeam-network/xcm-types @moonbeam-network/xcm-utils @moonbeam-network/xcm-builder @moonbeam-network/xcm-config @moonbeam-network/xcm-sdk
110
132
  ```
package/build/index.d.ts CHANGED
@@ -1,227 +1,196 @@
1
- import {
2
- SubstrateQueryConfig,
3
- ExtrinsicConfig,
4
- ContractConfig,
5
- } from '@moonbeam-network/xcm-builder';
6
- import {
7
- IConfigService,
8
- TransferConfig,
9
- FeeAssetConfig,
10
- } from '@moonbeam-network/xcm-config';
11
- import {
12
- AnyParachain,
13
- Asset,
14
- AssetAmount,
15
- ChainAssetId,
16
- AnyChain,
17
- Ecosystem,
18
- } from '@moonbeam-network/xcm-types';
1
+ import { AssetRoute, FeeConfig, ConfigService } from '@moonbeam-network/xcm-config';
2
+ import * as _moonbeam_network_xcm_types from '@moonbeam-network/xcm-types';
3
+ import { AssetAmount, AnyChain, AnyParachain, ChainAsset, Asset, EvmChain, EvmParachain, Ecosystem, AnyAsset } from '@moonbeam-network/xcm-types';
4
+ import { Signer, SubmittableExtrinsic } from '@polkadot/api/types';
5
+ import { IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
6
+ import { WalletClient, PublicClient, HttpTransport, Hash } from 'viem';
7
+ import { ContractConfig, ExtrinsicConfig, BalanceConfigBuilder, AssetMinConfigBuilder, FeeConfigBuilder, EvmQueryConfig, SubstrateQueryConfig } from '@moonbeam-network/xcm-builder';
19
8
  import { ApiPromise } from '@polkadot/api';
20
- import { Signer } from '@polkadot/api/types';
21
- import { IKeyringPair } from '@polkadot/types/types';
22
- import { Signer as Signer$1 } from 'ethers';
23
- import { WalletClient } from 'viem';
9
+ import { RuntimeDispatchInfo } from '@polkadot/types/interfaces';
10
+ import { HexString } from '@polkadot/util/types';
24
11
 
25
- declare class PolkadotService {
26
- #private;
27
- readonly api: ApiPromise;
28
- readonly chain: AnyParachain;
29
- readonly configService: IConfigService;
30
- constructor(
31
- api: ApiPromise,
32
- chain: AnyParachain,
33
- configService: IConfigService,
34
- );
35
- static create(
36
- chain: AnyParachain,
37
- configService: IConfigService,
38
- ): Promise<PolkadotService>;
39
- static createMulti(
40
- chains: AnyParachain[],
41
- configService: IConfigService,
42
- ): Promise<PolkadotService[]>;
43
- get decimals(): number;
44
- get asset(): Asset;
45
- get existentialDeposit(): AssetAmount;
46
- getAssetMeta(asset: ChainAssetId): Promise<
47
- | {
48
- symbol: string;
49
- decimals: number;
50
- }
51
- | undefined
52
- >;
53
- getAssetDecimalsFromQuery(asset: ChainAssetId): Promise<number | undefined>;
54
- getAssetDecimals(asset: Asset): Promise<number>;
55
- query(config: SubstrateQueryConfig): Promise<bigint>;
56
- getFee(account: string, config: ExtrinsicConfig): Promise<bigint>;
57
- transfer(
58
- account: string,
59
- config: ExtrinsicConfig,
60
- signer: Signer | IKeyringPair,
61
- ): Promise<string>;
62
- }
63
-
64
- type EvmSigner = Signer$1 | WalletClient;
12
+ type EvmSigner = WalletClient;
65
13
  interface Signers {
66
- /**
67
- * @deprecated ethersSigner - is deprecated and will be removed in v2, use evmSigner instead
68
- */
69
- ethersSigner?: Signer$1;
70
- evmSigner?: EvmSigner;
71
- polkadotSigner: Signer | IKeyringPair;
14
+ evmSigner?: EvmSigner;
15
+ polkadotSigner?: Signer | IKeyringPair;
72
16
  }
73
17
  interface TransferData {
74
- destination: DestinationChainTransferData;
75
- getEstimate(amount: number | string): AssetAmount;
76
- isSwapPossible: boolean;
77
- max: AssetAmount;
78
- min: AssetAmount;
79
- source: SourceChainTransferData;
80
- swap(): Promise<TransferData | undefined>;
81
- transfer(amount: bigint | number | string): Promise<string>;
18
+ destination: DestinationChainTransferData;
19
+ getEstimate(amount: number | string): AssetAmount;
20
+ max: AssetAmount;
21
+ min: AssetAmount;
22
+ source: SourceChainTransferData;
23
+ transfer(amount: bigint | number | string, signers: Signers, statusCallback?: (params: ISubmittableResult) => void): Promise<string>;
82
24
  }
83
25
  interface SourceChainTransferData extends ChainTransferData {
84
- destinationFeeBalance: AssetAmount;
85
- feeBalance: AssetAmount;
86
- max: AssetAmount;
26
+ destinationFee: AssetAmount;
27
+ destinationFeeBalance: AssetAmount;
28
+ feeBalance: AssetAmount;
29
+ max: AssetAmount;
30
+ }
31
+ interface SovereignAccountBalance {
32
+ feeAssetBalance: bigint | undefined;
33
+ transferAssetBalance: bigint;
34
+ }
35
+ interface DestinationChainTransferData extends ChainTransferData {
36
+ sovereignAccountBalances?: SovereignAccountBalance;
87
37
  }
88
- interface DestinationChainTransferData extends ChainTransferData {}
89
38
  interface ChainTransferData {
90
- balance: AssetAmount;
91
- chain: AnyChain;
92
- existentialDeposit: AssetAmount;
93
- fee: AssetAmount;
94
- min: AssetAmount;
39
+ balance: AssetAmount;
40
+ chain: AnyChain;
41
+ existentialDeposit?: AssetAmount;
42
+ fee: AssetAmount;
43
+ min: AssetAmount;
44
+ }
45
+
46
+ interface GetDestinationDataParams {
47
+ route: AssetRoute;
48
+ destinationAddress: string;
95
49
  }
50
+ declare function getDestinationData({ route, destinationAddress, }: GetDestinationDataParams): Promise<DestinationChainTransferData>;
96
51
 
97
52
  interface GetSourceDataParams {
98
- transferConfig: TransferConfig;
99
- destinationAddress: string;
100
- destinationFee: AssetAmount;
101
- evmSigner?: EvmSigner;
102
- polkadot: PolkadotService;
103
- sourceAddress: string;
104
- }
105
- declare function getSourceData({
106
- transferConfig,
107
- destinationAddress,
108
- destinationFee,
109
- evmSigner,
110
- polkadot,
111
- sourceAddress,
112
- }: GetSourceDataParams): Promise<SourceChainTransferData>;
113
- interface GetBalancesParams {
114
- address: string;
115
- balance: bigint;
116
- feeConfig: FeeAssetConfig | undefined;
117
- polkadot: PolkadotService;
118
- }
119
- declare function getFeeBalances({
120
- address,
121
- balance,
122
- feeConfig,
123
- polkadot,
124
- }: GetBalancesParams): Promise<bigint>;
53
+ route: AssetRoute;
54
+ destinationAddress: string;
55
+ destinationFee: AssetAmount;
56
+ sourceAddress: string;
57
+ }
58
+ declare function getSourceData({ route, destinationAddress, destinationFee, sourceAddress, }: GetSourceDataParams): Promise<SourceChainTransferData>;
125
59
  interface GetFeeParams {
126
- balance: bigint;
127
- contract?: ContractConfig;
128
- decimals: number;
129
- evmSigner?: EvmSigner;
130
- extrinsic?: ExtrinsicConfig;
131
- polkadot: PolkadotService;
132
- sourceAddress: string;
133
- }
134
- declare function getFee({
135
- balance,
136
- contract,
137
- decimals,
138
- evmSigner,
139
- extrinsic,
140
- polkadot,
141
- sourceAddress,
142
- }: GetFeeParams): Promise<bigint>;
143
- declare function getContractFee(
144
- balance: bigint,
145
- config: ContractConfig,
146
- decimals: number,
147
- evmSigner: EvmSigner,
148
- ): Promise<bigint>;
149
- declare function getExtrinsicFee(
150
- balance: bigint,
151
- extrinsic: ExtrinsicConfig,
152
- polkadot: PolkadotService,
153
- sourceAddress: string,
154
- ): Promise<bigint>;
60
+ balance: AssetAmount;
61
+ feeBalance: AssetAmount;
62
+ contract?: ContractConfig;
63
+ chain: AnyParachain;
64
+ destinationFee: AssetAmount;
65
+ extrinsic?: ExtrinsicConfig;
66
+ feeConfig?: FeeConfig;
67
+ sourceAddress: string;
68
+ }
69
+ declare function getFee({ balance, feeBalance, chain, contract, destinationFee, extrinsic, feeConfig, sourceAddress, }: GetFeeParams): Promise<AssetAmount>;
70
+ interface GetAssetsBalancesParams {
71
+ address: string;
72
+ chain: AnyParachain;
73
+ routes: AssetRoute[];
74
+ evmSigner?: EvmSigner;
75
+ }
76
+ declare function getAssetsBalances({ address, chain, routes, }: GetAssetsBalancesParams): Promise<AssetAmount[]>;
77
+
78
+ interface GetBalancesParams {
79
+ address: string;
80
+ asset: ChainAsset;
81
+ builder: BalanceConfigBuilder;
82
+ chain: AnyChain;
83
+ }
84
+ declare function getBalance({ address, asset, builder, chain, }: GetBalancesParams): Promise<AssetAmount>;
85
+ interface GetMinParams {
86
+ asset: Asset;
87
+ builder?: AssetMinConfigBuilder;
88
+ chain: AnyChain;
89
+ }
90
+ declare function getAssetMin({ asset, builder, chain, }: GetMinParams): Promise<AssetAmount>;
91
+ declare function getMin({ balance, existentialDeposit, fee, min, }: DestinationChainTransferData): AssetAmount;
155
92
  interface GetMaxParams {
156
- balanceAmount: AssetAmount;
157
- existentialDeposit: AssetAmount;
158
- feeAmount: AssetAmount;
159
- minAmount: AssetAmount;
160
- }
161
- declare function getMax({
162
- balanceAmount,
163
- existentialDeposit,
164
- feeAmount,
165
- minAmount,
166
- }: GetMaxParams): AssetAmount;
93
+ balance: AssetAmount;
94
+ existentialDeposit?: AssetAmount;
95
+ fee: AssetAmount;
96
+ min: AssetAmount;
97
+ }
98
+ declare function getMax({ balance, existentialDeposit, fee, min, }: GetMaxParams): AssetAmount;
99
+ interface GetDestinationFeeParams {
100
+ address: string;
101
+ asset: Asset;
102
+ feeAsset: Asset;
103
+ destination: AnyChain;
104
+ fee: number | FeeConfigBuilder;
105
+ source: AnyChain;
106
+ }
107
+ declare function getDestinationFee({ address, asset, destination, fee, feeAsset, source, }: GetDestinationFeeParams): Promise<AssetAmount>;
108
+ interface ConvertToChainDecimalsParams {
109
+ asset: AssetAmount;
110
+ target: ChainAsset;
111
+ }
112
+ declare function convertToChainDecimals({ asset, target, }: ConvertToChainDecimalsParams): AssetAmount;
113
+ declare function getExistentialDeposit(chain: AnyChain): Promise<AssetAmount | undefined>;
114
+ interface GetDestinationFeeBalanceParams {
115
+ balance: AssetAmount;
116
+ feeBalance: AssetAmount;
117
+ route: AssetRoute;
118
+ sourceAddress: string;
119
+ }
120
+ declare function getDestinationFeeBalance({ balance, feeBalance, route, sourceAddress, }: GetDestinationFeeBalanceParams): Promise<AssetAmount>;
121
+ interface GetExtrinsicFeeParams {
122
+ address: string;
123
+ balance: AssetAmount;
124
+ chain: AnyParachain;
125
+ extrinsic: ExtrinsicConfig;
126
+ feeBalance: AssetAmount;
127
+ feeConfig?: FeeConfig;
128
+ }
129
+ declare function getExtrinsicFee({ address, balance, chain, extrinsic, feeBalance, feeConfig, }: GetExtrinsicFeeParams): Promise<AssetAmount>;
130
+ interface GetContractFeeParams {
131
+ address: string;
132
+ balance: AssetAmount;
133
+ chain: EvmChain | EvmParachain;
134
+ contract: ContractConfig;
135
+ destinationFee: AssetAmount;
136
+ feeBalance: AssetAmount;
137
+ feeConfig?: FeeConfig;
138
+ }
139
+ declare function getContractFee({ address, balance, chain, contract, destinationFee, feeBalance, feeConfig, }: GetContractFeeParams): Promise<AssetAmount>;
140
+ interface ValidateSovereignAccountBalancesProps {
141
+ amount: bigint;
142
+ destinationData: DestinationChainTransferData;
143
+ sourceData: SourceChainTransferData;
144
+ }
145
+ declare function validateSovereignAccountBalances({ amount, sourceData, destinationData, }: ValidateSovereignAccountBalancesProps): void;
167
146
 
168
- interface SdkOptions extends Partial<Signers> {
169
- configService?: IConfigService;
170
- }
171
- declare function Sdk(options?: SdkOptions): {
172
- assets(ecosystem?: Ecosystem): {
173
- assets: Asset[];
174
- asset(keyOrAsset: string | Asset): {
175
- sourceChains: AnyChain[];
176
- source(keyOrChain: string | AnyChain): {
177
- destinationChains: AnyChain[];
178
- destination(destKeyOrChain: string | AnyChain): {
179
- accounts(
180
- sourceAddress: string,
181
- destinationAddress: string,
182
- signers?: Partial<Signers>,
183
- ): Promise<TransferData>;
147
+ interface SdkOptions {
148
+ configService?: ConfigService;
149
+ ecosystem?: Ecosystem;
150
+ }
151
+ declare function Sdk({ configService, ecosystem }?: SdkOptions): {
152
+ assets: _moonbeam_network_xcm_types.Asset[];
153
+ setAsset(asset: string | AnyAsset): {
154
+ sources: AnyChain[];
155
+ setSource(source: string | AnyChain): {
156
+ destinations: AnyChain[];
157
+ setDestination(destination: string | AnyChain): {
158
+ setAddresses({ sourceAddress, destinationAddress, }: {
159
+ sourceAddress: string;
160
+ destinationAddress: string;
161
+ }): Promise<TransferData>;
162
+ };
184
163
  };
185
- };
186
164
  };
187
- };
188
- getTransferData({
189
- destinationAddress,
190
- destinationKeyOrChain,
191
- ethersSigner,
192
- evmSigner,
193
- keyOrAsset,
194
- polkadotSigner,
195
- sourceAddress,
196
- sourceKeyOrChain,
197
- }: SdkTransferParams): Promise<TransferData>;
198
165
  };
199
- interface SdkTransferParams extends Partial<Signers> {
200
- destinationAddress: string;
201
- destinationKeyOrChain: string | AnyChain;
202
- keyOrAsset: string | Asset;
203
- sourceAddress: string;
204
- sourceKeyOrChain: string | AnyChain;
166
+ declare function getParachainBalances(chain: AnyParachain, address: string, service?: ConfigService): Promise<AssetAmount[]>;
167
+
168
+ declare class EvmService {
169
+ readonly chain: EvmChain | EvmParachain;
170
+ readonly client: PublicClient<HttpTransport>;
171
+ static create(chain: EvmChain | EvmParachain): EvmService;
172
+ constructor(chain: EvmChain | EvmParachain);
173
+ query(query: EvmQueryConfig): Promise<bigint>;
174
+ getFee(address: string, contract: ContractConfig): Promise<bigint>;
175
+ getBalance(address: string, contract: ContractConfig): Promise<bigint>;
176
+ transfer(signer: EvmSigner, contract: ContractConfig): Promise<Hash>;
205
177
  }
206
178
 
207
- export {
208
- ChainTransferData,
209
- DestinationChainTransferData,
210
- EvmSigner,
211
- GetBalancesParams,
212
- GetFeeParams,
213
- GetMaxParams,
214
- GetSourceDataParams,
215
- Sdk,
216
- SdkOptions,
217
- SdkTransferParams,
218
- Signers,
219
- SourceChainTransferData,
220
- TransferData,
221
- getContractFee,
222
- getExtrinsicFee,
223
- getFee,
224
- getFeeBalances,
225
- getMax,
226
- getSourceData,
227
- };
179
+ declare class PolkadotService {
180
+ #private;
181
+ readonly api: ApiPromise;
182
+ readonly chain: AnyParachain;
183
+ constructor(api: ApiPromise, chain: AnyParachain);
184
+ static create(chain: AnyParachain): Promise<PolkadotService>;
185
+ static createMulti(chains: AnyParachain[]): Promise<PolkadotService[]>;
186
+ get decimals(): number;
187
+ get existentialDeposit(): AssetAmount;
188
+ query(config: SubstrateQueryConfig): Promise<bigint>;
189
+ getExtrinsic(config: ExtrinsicConfig): SubmittableExtrinsic<'promise', ISubmittableResult>;
190
+ getExtrinsicCallHash(config: ExtrinsicConfig): HexString;
191
+ getPaymentInfo(account: string, config: ExtrinsicConfig): Promise<RuntimeDispatchInfo>;
192
+ getFee(account: string, config: ExtrinsicConfig): Promise<bigint>;
193
+ transfer(account: string, config: ExtrinsicConfig, signer: Signer | IKeyringPair, statusCallback?: (params: ISubmittableResult) => void): Promise<string>;
194
+ }
195
+
196
+ export { type ChainTransferData, type ConvertToChainDecimalsParams, type DestinationChainTransferData, EvmService, type EvmSigner, type GetAssetsBalancesParams, type GetBalancesParams, type GetContractFeeParams, type GetDestinationDataParams, type GetDestinationFeeBalanceParams, type GetDestinationFeeParams, type GetExtrinsicFeeParams, type GetFeeParams, type GetMaxParams, type GetMinParams, type GetSourceDataParams, PolkadotService, Sdk, type SdkOptions, type Signers, type SourceChainTransferData, type SovereignAccountBalance, type TransferData, convertToChainDecimals, getAssetMin, getAssetsBalances, getBalance, getContractFee, getDestinationData, getDestinationFee, getDestinationFeeBalance, getExistentialDeposit, getExtrinsicFee, getFee, getMax, getMin, getParachainBalances, getSourceData, validateSovereignAccountBalances };