@paraspell/sdk-pjs 8.5.3 → 8.6.1
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/README.md +5 -0
- package/dist/index.cjs +1003 -1025
- package/dist/index.d.ts +72 -75
- package/dist/index.mjs +809 -830
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,61 +1,19 @@
|
|
|
1
1
|
import * as _paraspell_sdk_core from '@paraspell/sdk-core';
|
|
2
|
-
import { TApiOrUrl,
|
|
2
|
+
import { TApiOrUrl, Foreign, ForeignAbstract, Native, Override, getAllAssetsSymbols, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, TEvmBuilderOptions, TNodeWithRelayChains, TCurrencyInputWithAmount, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions, TNodeDotKsmWithRelayChains } from '@paraspell/sdk-core';
|
|
3
3
|
export * from '@paraspell/sdk-core';
|
|
4
|
-
import * as _snowbridge_api_dist_toPolkadot_v2 from '@snowbridge/api/dist/toPolkadot_v2';
|
|
5
|
-
import * as ethers from 'ethers';
|
|
6
|
-
import { Signer, AbstractProvider } from 'ethers';
|
|
7
|
-
import { SubmittableExtrinsic } from '@polkadot/api/types';
|
|
8
4
|
import * as _polkadot_api from '@polkadot/api';
|
|
9
5
|
import { ApiPromise } from '@polkadot/api';
|
|
6
|
+
import { SubmittableExtrinsic } from '@polkadot/api/types';
|
|
7
|
+
import { TEvmNodeFrom } from '@paraspell/sdk-core/src';
|
|
8
|
+
import * as ethers from 'ethers';
|
|
9
|
+
import { Signer, AbstractProvider } from 'ethers';
|
|
10
10
|
import { WalletClient } from 'viem';
|
|
11
|
+
import * as _snowbridge_api_dist_toPolkadot_v2 from '@snowbridge/api/dist/toPolkadot_v2';
|
|
11
12
|
|
|
12
13
|
type TPjsApi = ApiPromise;
|
|
13
14
|
type TPjsApiOrUrl = TApiOrUrl<TPjsApi>;
|
|
14
15
|
type Extrinsic = SubmittableExtrinsic<'promise'>;
|
|
15
16
|
|
|
16
|
-
declare const depositToken: (signer: Signer, amount: bigint, symbol: string) => Promise<{
|
|
17
|
-
result: ethers.ContractTransactionResponse;
|
|
18
|
-
receipt: ethers.ContractTransactionReceipt | null;
|
|
19
|
-
}>;
|
|
20
|
-
|
|
21
|
-
declare const approveToken: (signer: Signer, amount: bigint, symbol: string) => Promise<{
|
|
22
|
-
result: ethers.ContractTransactionResponse;
|
|
23
|
-
receipt: ethers.ContractTransactionReceipt | null;
|
|
24
|
-
}>;
|
|
25
|
-
|
|
26
|
-
declare const getTokenBalance: (signer: Signer, symbol: string) => Promise<bigint>;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Transfers assets from parachain to another parachain or from/to relay chain.
|
|
30
|
-
* @param options - The transfer options.
|
|
31
|
-
* @returns An extrinsic to be signed and sent.
|
|
32
|
-
*/
|
|
33
|
-
declare const send: (options: _paraspell_sdk_core.TSendBaseOptions & {
|
|
34
|
-
origin: _paraspell_sdk_core.TNodeDotKsmWithRelayChains;
|
|
35
|
-
currency: _paraspell_sdk_core.TCurrencyInputWithAmount;
|
|
36
|
-
} & {
|
|
37
|
-
api?: TPjsApiOrUrl;
|
|
38
|
-
}) => Promise<Extrinsic>;
|
|
39
|
-
declare const getDryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<Extrinsic> & {
|
|
40
|
-
api?: TPjsApiOrUrl;
|
|
41
|
-
}) => Promise<_paraspell_sdk_core.TDryRunResult>;
|
|
42
|
-
declare const transferEthToPolkadot: (options: Omit<TEvmBuilderOptions<TPjsApi, Extrinsic>, "api">) => Promise<{
|
|
43
|
-
response: ethers.TransactionResponse;
|
|
44
|
-
messageReceipt: _snowbridge_api_dist_toPolkadot_v2.MessageReceipt;
|
|
45
|
-
}>;
|
|
46
|
-
declare const getParaEthTransferFees: (api?: TPjsApiOrUrl) => Promise<[bigint, bigint]>;
|
|
47
|
-
|
|
48
|
-
declare const transfer_approveToken: typeof approveToken;
|
|
49
|
-
declare const transfer_depositToken: typeof depositToken;
|
|
50
|
-
declare const transfer_getDryRun: typeof getDryRun;
|
|
51
|
-
declare const transfer_getParaEthTransferFees: typeof getParaEthTransferFees;
|
|
52
|
-
declare const transfer_getTokenBalance: typeof getTokenBalance;
|
|
53
|
-
declare const transfer_send: typeof send;
|
|
54
|
-
declare const transfer_transferEthToPolkadot: typeof transferEthToPolkadot;
|
|
55
|
-
declare namespace transfer {
|
|
56
|
-
export { transfer_approveToken as approveToken, transfer_depositToken as depositToken, transfer_getDryRun as getDryRun, transfer_getParaEthTransferFees as getParaEthTransferFees, transfer_getTokenBalance as getTokenBalance, transfer_send as send, transfer_transferEthToPolkadot as transferEthToPolkadot };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
17
|
/**
|
|
60
18
|
* Retrieves the native balance for a given account on a specified node.
|
|
61
19
|
*
|
|
@@ -93,12 +51,7 @@ declare const getAssetBalance: (options: _paraspell_sdk_core.TGetAssetBalanceOpt
|
|
|
93
51
|
*
|
|
94
52
|
* @returns An extrinsic representing the claim transaction.
|
|
95
53
|
*/
|
|
96
|
-
declare const claimAssets: (options: {
|
|
97
|
-
node: _paraspell_sdk_core.TNodeWithRelayChains;
|
|
98
|
-
multiAssets: _paraspell_sdk_core.TMultiAsset[];
|
|
99
|
-
address: _paraspell_sdk_core.TAddress;
|
|
100
|
-
version?: _paraspell_sdk_core.TVersionClaimAssets;
|
|
101
|
-
} & {
|
|
54
|
+
declare const claimAssets: (options: _paraspell_sdk_core.TAssetClaimOptionsBase & {
|
|
102
55
|
api?: TPjsApiOrUrl;
|
|
103
56
|
}) => Promise<Extrinsic>;
|
|
104
57
|
declare const getOriginFeeDetails: (options: _paraspell_sdk_core.TGetOriginFeeDetailsOptionsBase & {
|
|
@@ -153,44 +106,54 @@ declare namespace assets {
|
|
|
153
106
|
/**
|
|
154
107
|
* Builder class for constructing transfers from Ethereum to Polkadot.
|
|
155
108
|
*/
|
|
156
|
-
declare class
|
|
157
|
-
_options:
|
|
158
|
-
constructor(
|
|
159
|
-
from(node:
|
|
109
|
+
declare class EvmBuilderCore<TApi, TRes, T extends Partial<TEvmBuilderOptions<TApi, TRes>> = object> {
|
|
110
|
+
protected readonly _options: T;
|
|
111
|
+
constructor(options: T);
|
|
112
|
+
from(node: TEvmNodeFrom): EvmBuilderCore<TApi, TRes, T & {
|
|
113
|
+
from: TEvmNodeFrom;
|
|
114
|
+
}>;
|
|
160
115
|
/**
|
|
161
116
|
* Specifies the destination node on Polkadot.
|
|
162
117
|
*
|
|
163
118
|
* @param node - The Polkadot node to which the transfer will be made.
|
|
164
119
|
* @returns An instance of EvmBuilder
|
|
165
120
|
*/
|
|
166
|
-
to(node: TNodeWithRelayChains):
|
|
121
|
+
to(node: TNodeWithRelayChains): EvmBuilderCore<TApi, TRes, T & {
|
|
122
|
+
to: TNodeWithRelayChains;
|
|
123
|
+
}>;
|
|
167
124
|
/**
|
|
168
125
|
* Specifies the currency to transfer.
|
|
169
126
|
*
|
|
170
127
|
* @param currency - The currency to be transferred.
|
|
171
128
|
* @returns An instance of EvmBuilder
|
|
172
129
|
*/
|
|
173
|
-
currency(currency: TCurrencyInputWithAmount):
|
|
130
|
+
currency(currency: TCurrencyInputWithAmount): EvmBuilderCore<TApi, TRes, T & {
|
|
131
|
+
currency: TCurrencyInputWithAmount;
|
|
132
|
+
}>;
|
|
174
133
|
/**
|
|
175
134
|
* Specifies the recipient address on Polkadot.
|
|
176
135
|
*
|
|
177
136
|
* @param address - The Polkadot address to receive the transfer.
|
|
178
137
|
* @returns An instance of EvmBuilder
|
|
179
138
|
*/
|
|
180
|
-
address(address: string, ahAddress?: string):
|
|
139
|
+
address(address: string, ahAddress?: string): EvmBuilderCore<TApi, TRes, T & {
|
|
140
|
+
address: string;
|
|
141
|
+
}>;
|
|
181
142
|
/**
|
|
182
143
|
* Specifies the signer for the Ethereum transaction.
|
|
183
144
|
*
|
|
184
145
|
* @param signer - The Ethereum signer to authorize the transfer.
|
|
185
146
|
* @returns An instance of EvmBuilder
|
|
186
147
|
*/
|
|
187
|
-
signer(signer: Signer | WalletClient):
|
|
148
|
+
signer(signer: Signer | WalletClient): EvmBuilderCore<TApi, TRes, T & {
|
|
149
|
+
signer: Signer | WalletClient;
|
|
150
|
+
}>;
|
|
188
151
|
/**
|
|
189
152
|
* Builds and executes the transfer from Ethereum to Polkadot.
|
|
190
153
|
*
|
|
191
154
|
* @throws Error if any required parameters are missing.
|
|
192
155
|
*/
|
|
193
|
-
build(): Promise<string>;
|
|
156
|
+
build(this: EvmBuilderCore<TApi, TRes, TEvmBuilderOptions<TApi, TRes>>): Promise<string>;
|
|
194
157
|
}
|
|
195
158
|
|
|
196
159
|
/**
|
|
@@ -199,19 +162,53 @@ declare class EvmBuilderClass<TApi, TRes> {
|
|
|
199
162
|
* @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
|
|
200
163
|
* @returns A new Builder instance.
|
|
201
164
|
*/
|
|
202
|
-
declare const Builder: (api?: TPjsApiOrUrl) =>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
165
|
+
declare const Builder: (api?: TPjsApiOrUrl) => GeneralBuilder$1<_polkadot_api.ApiPromise, Extrinsic, object>;
|
|
166
|
+
type GeneralBuilder<T extends Partial<TSendBaseOptions> = object> = GeneralBuilder$1<TPjsApi, Extrinsic, T>;
|
|
167
|
+
declare const EvmBuilder: (provider?: AbstractProvider) => EvmBuilderCore<unknown, unknown, {
|
|
168
|
+
api: _paraspell_sdk_core.IPolkadotApi<_polkadot_api.ApiPromise, Extrinsic>;
|
|
169
|
+
provider: AbstractProvider | undefined;
|
|
170
|
+
}>;
|
|
171
|
+
|
|
172
|
+
declare const approveToken: (signer: Signer, amount: bigint, symbol: string) => Promise<{
|
|
173
|
+
result: ethers.ContractTransactionResponse;
|
|
174
|
+
receipt: ethers.ContractTransactionReceipt | null;
|
|
175
|
+
}>;
|
|
176
|
+
|
|
177
|
+
declare const depositToken: (signer: Signer, amount: bigint, symbol: string) => Promise<{
|
|
178
|
+
result: ethers.ContractTransactionResponse;
|
|
179
|
+
receipt: ethers.ContractTransactionReceipt | null;
|
|
180
|
+
}>;
|
|
181
|
+
|
|
182
|
+
declare const getTokenBalance: (signer: Signer, symbol: string) => Promise<bigint>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Transfers assets from parachain to another parachain or from/to relay chain.
|
|
186
|
+
* @param options - The transfer options.
|
|
187
|
+
* @returns An extrinsic to be signed and sent.
|
|
188
|
+
*/
|
|
189
|
+
declare const send: (options: _paraspell_sdk_core.TSendBaseOptions & {
|
|
190
|
+
api?: TPjsApiOrUrl;
|
|
191
|
+
}) => Promise<Extrinsic>;
|
|
192
|
+
declare const getDryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<Extrinsic> & {
|
|
193
|
+
api?: TPjsApiOrUrl;
|
|
194
|
+
}) => Promise<_paraspell_sdk_core.TDryRunResult>;
|
|
195
|
+
declare const transferEthToPolkadot: (options: Omit<TEvmBuilderOptions<TPjsApi, Extrinsic>, "api">) => Promise<{
|
|
196
|
+
response: ethers.TransactionResponse;
|
|
197
|
+
messageReceipt: _snowbridge_api_dist_toPolkadot_v2.MessageReceipt;
|
|
198
|
+
}>;
|
|
199
|
+
declare const getParaEthTransferFees: (api?: TPjsApiOrUrl) => Promise<[bigint, bigint]>;
|
|
212
200
|
|
|
213
|
-
|
|
201
|
+
declare const transfer_approveToken: typeof approveToken;
|
|
202
|
+
declare const transfer_depositToken: typeof depositToken;
|
|
203
|
+
declare const transfer_getDryRun: typeof getDryRun;
|
|
204
|
+
declare const transfer_getParaEthTransferFees: typeof getParaEthTransferFees;
|
|
205
|
+
declare const transfer_getTokenBalance: typeof getTokenBalance;
|
|
206
|
+
declare const transfer_send: typeof send;
|
|
207
|
+
declare const transfer_transferEthToPolkadot: typeof transferEthToPolkadot;
|
|
208
|
+
declare namespace transfer {
|
|
209
|
+
export { transfer_approveToken as approveToken, transfer_depositToken as depositToken, transfer_getDryRun as getDryRun, transfer_getParaEthTransferFees as getParaEthTransferFees, transfer_getTokenBalance as getTokenBalance, transfer_send as send, transfer_transferEthToPolkadot as transferEthToPolkadot };
|
|
210
|
+
}
|
|
214
211
|
|
|
215
212
|
declare const createApiInstanceForNode: (node: TNodeDotKsmWithRelayChains) => Promise<_polkadot_api.ApiPromise>;
|
|
216
213
|
|
|
217
|
-
export { Builder, EvmBuilder, type Extrinsic,
|
|
214
|
+
export { Builder, EvmBuilder, type Extrinsic, type GeneralBuilder, type TPjsApi, type TPjsApiOrUrl, approveToken, assets, claimAssets, createApiInstanceForNode, depositToken, getAssetBalance, getBalanceForeign, getBalanceNative, getDryRun, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTokenBalance, getTransferInfo, getTransferableAmount, send, transferEthToPolkadot, verifyEdOnDestination, transfer as xcmPallet };
|