@paraspell/sdk-core 11.7.0 → 11.7.2
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/dist/index.cjs +263 -164
- package/dist/index.d.ts +42 -22
- package/dist/index.mjs +261 -166
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -192,6 +192,10 @@ type TDestWeight = {
|
|
|
192
192
|
ref_time: bigint;
|
|
193
193
|
proof_size: bigint;
|
|
194
194
|
};
|
|
195
|
+
type TTxPair<TRes> = {
|
|
196
|
+
tx: TRes;
|
|
197
|
+
txBypass: TRes;
|
|
198
|
+
};
|
|
195
199
|
type TXTransferMethod = 'transfer';
|
|
196
200
|
type TXTokensMethod = 'transfer' | 'transfer_multiasset' | 'transfer_multiassets';
|
|
197
201
|
type TPolkadotXcmMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'reserve_withdraw_assets' | 'transfer_assets';
|
|
@@ -452,10 +456,9 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
|
|
|
452
456
|
build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
|
|
453
457
|
private buildCommon;
|
|
454
458
|
private maybePerformXcmFormatCheck;
|
|
455
|
-
protected computeOverridenAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): bigint | "800";
|
|
456
|
-
protected overrideTxAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TRes>;
|
|
457
459
|
dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
|
|
458
460
|
dryRunPreview(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TDryRunPreviewOptions): Promise<TDryRunResult>;
|
|
461
|
+
private createTxs;
|
|
459
462
|
/**
|
|
460
463
|
* Returns the XCM fee for the transfer using dryRun or paymentInfo function.
|
|
461
464
|
*
|
|
@@ -639,15 +642,15 @@ type TGetTransferableAmountOptionsBase<TRes> = {
|
|
|
639
642
|
*/
|
|
640
643
|
currency: WithAmount<TCurrencyCore>;
|
|
641
644
|
/**
|
|
642
|
-
* The
|
|
645
|
+
* The transactions
|
|
643
646
|
*/
|
|
644
|
-
|
|
647
|
+
txs: TTxPair<TRes>;
|
|
645
648
|
feeAsset?: TCurrencyInput;
|
|
646
649
|
};
|
|
647
650
|
type TGetTransferableAmountOptions<TApi, TRes> = WithApi<TGetTransferableAmountOptionsBase<TRes>, TApi, TRes>;
|
|
648
651
|
type TGetMinTransferableAmountOptions<TApi, TRes> = WithApi<TGetTransferableAmountOptionsBase<TRes> & {
|
|
649
652
|
address: string;
|
|
650
|
-
builder: GeneralBuilder<TApi, TRes,
|
|
653
|
+
builder: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>;
|
|
651
654
|
}, TApi, TRes>;
|
|
652
655
|
type TVerifyEdOnDestinationOptionsBase<TRes> = {
|
|
653
656
|
/**
|
|
@@ -671,9 +674,9 @@ type TVerifyEdOnDestinationOptionsBase<TRes> = {
|
|
|
671
674
|
*/
|
|
672
675
|
currency: WithAmount<TCurrencyCore>;
|
|
673
676
|
/**
|
|
674
|
-
* The
|
|
677
|
+
* The transactions
|
|
675
678
|
*/
|
|
676
|
-
|
|
679
|
+
txs: TTxPair<TRes>;
|
|
677
680
|
feeAsset?: TCurrencyInput;
|
|
678
681
|
};
|
|
679
682
|
type TVerifyEdOnDestinationOptions<TApi, TRes> = WithApi<TVerifyEdOnDestinationOptionsBase<TRes>, TApi, TRes>;
|
|
@@ -753,6 +756,7 @@ type TBuilderConfig<TApi> = {
|
|
|
753
756
|
abstractDecimals?: boolean;
|
|
754
757
|
xcmFormatCheck?: boolean;
|
|
755
758
|
};
|
|
759
|
+
type TCreateTxsOptions<TApi, TRes> = Pick<TSendOptions<TApi, TRes>, 'api' | 'from' | 'to' | 'currency'>;
|
|
756
760
|
|
|
757
761
|
type TProviderEntry = {
|
|
758
762
|
name: string;
|
|
@@ -1142,9 +1146,9 @@ declare class UnableToComputeError extends Error {
|
|
|
1142
1146
|
|
|
1143
1147
|
type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
|
|
1144
1148
|
/**
|
|
1145
|
-
* The
|
|
1149
|
+
* The transactions
|
|
1146
1150
|
*/
|
|
1147
|
-
|
|
1151
|
+
txs: TTxPair<TRes>;
|
|
1148
1152
|
/**
|
|
1149
1153
|
* The origin chain
|
|
1150
1154
|
*/
|
|
@@ -1164,24 +1168,31 @@ type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
|
|
|
1164
1168
|
swapConfig?: TSwapConfig;
|
|
1165
1169
|
};
|
|
1166
1170
|
type TGetXcmFeeOptions<TApi, TRes, TDisableFallback extends boolean = boolean> = WithApi<TGetXcmFeeBaseOptions<TRes, TDisableFallback>, TApi, TRes>;
|
|
1167
|
-
type
|
|
1168
|
-
|
|
1171
|
+
type TGetXcmFeeInternalOptions<TApi, TRes, TDisableFallback extends boolean = boolean> = Omit<TGetXcmFeeOptions<TApi, TRes, TDisableFallback>, 'txs'> & {
|
|
1172
|
+
tx: TRes;
|
|
1173
|
+
useRootOrigin: boolean;
|
|
1174
|
+
};
|
|
1175
|
+
type TGetXcmFeeEstimateOptions<TApi, TRes> = Omit<TGetXcmFeeInternalOptions<TApi, TRes>, 'disableFallback' | 'useRootOrigin'>;
|
|
1176
|
+
type TGetOriginXcmFeeEstimateOptions<TApi, TRes> = Omit<TGetXcmFeeInternalOptions<TApi, TRes>, 'disableFallback' | 'address' | 'useRootOrigin'>;
|
|
1169
1177
|
type TGetXcmFeeBuilderOptions = {
|
|
1170
1178
|
disableFallback: boolean;
|
|
1171
1179
|
};
|
|
1172
1180
|
type TGetOriginXcmFeeBaseOptions<TRes> = {
|
|
1173
|
-
|
|
1181
|
+
txs: {
|
|
1182
|
+
tx: TRes;
|
|
1183
|
+
txBypass: TRes;
|
|
1184
|
+
};
|
|
1174
1185
|
origin: TSubstrateChain;
|
|
1175
1186
|
destination: TChain;
|
|
1176
1187
|
senderAddress: string;
|
|
1177
|
-
currency:
|
|
1188
|
+
currency: WithAmount<TCurrencyCore>;
|
|
1178
1189
|
feeAsset?: TCurrencyInput;
|
|
1179
1190
|
disableFallback: boolean;
|
|
1180
1191
|
useRootOrigin?: boolean;
|
|
1181
1192
|
};
|
|
1182
1193
|
type TGetOriginXcmFeeOptions<TApi, TRes> = WithApi<TGetOriginXcmFeeBaseOptions<TRes>, TApi, TRes>;
|
|
1183
|
-
type
|
|
1184
|
-
|
|
1194
|
+
type TGetOriginXcmFeeInternalOptions<TApi, TRes> = Omit<TGetOriginXcmFeeOptions<TApi, TRes>, 'txs'> & {
|
|
1195
|
+
tx: TRes;
|
|
1185
1196
|
};
|
|
1186
1197
|
type TSwapConfig = {
|
|
1187
1198
|
currencyTo: TCurrencyCore;
|
|
@@ -1373,7 +1384,7 @@ type TOriginFeeDetails = {
|
|
|
1373
1384
|
xcmFee: bigint;
|
|
1374
1385
|
};
|
|
1375
1386
|
type TGetTransferInfoOptionsBase<TRes> = {
|
|
1376
|
-
|
|
1387
|
+
txs: TTxPair<TRes>;
|
|
1377
1388
|
origin: TSubstrateChain;
|
|
1378
1389
|
destination: TChain;
|
|
1379
1390
|
senderAddress: string;
|
|
@@ -2129,7 +2140,7 @@ declare const getOriginXcmFee: <TApi, TRes>(options: TGetOriginXcmFeeOptions<TAp
|
|
|
2129
2140
|
|
|
2130
2141
|
declare const getOriginXcmFeeEstimate: <TApi, TRes>({ api, tx, origin, destination, currency, senderAddress, feeAsset }: TGetOriginXcmFeeEstimateOptions<TApi, TRes>) => Promise<TGetXcmFeeEstimateDetail>;
|
|
2131
2142
|
|
|
2132
|
-
declare const getOriginXcmFeeInternal: <TApi, TRes>({ api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, useRootOrigin }:
|
|
2143
|
+
declare const getOriginXcmFeeInternal: <TApi, TRes>({ api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, useRootOrigin }: TGetOriginXcmFeeInternalOptions<TApi, TRes>) => Promise<TXcmFeeDetail & {
|
|
2133
2144
|
forwardedXcms?: any;
|
|
2134
2145
|
destParaId?: number;
|
|
2135
2146
|
}>;
|
|
@@ -2138,16 +2149,18 @@ declare const getXcmFee: <TApi, TRes, TDisableFallback extends boolean>(options:
|
|
|
2138
2149
|
|
|
2139
2150
|
declare const getXcmFeeEstimate: <TApi, TRes>(options: TGetXcmFeeEstimateOptions<TApi, TRes>) => Promise<TGetXcmFeeEstimateResult>;
|
|
2140
2151
|
|
|
2152
|
+
declare const getXcmFeeInternal: <TApi, TRes, TDisableFallback extends boolean>({ api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin }: TGetXcmFeeInternalOptions<TApi, TRes, TDisableFallback>) => Promise<TGetXcmFeeResult<TDisableFallback>>;
|
|
2153
|
+
|
|
2141
2154
|
declare const getBridgeStatus: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>) => Promise<TBridgeStatus>;
|
|
2142
2155
|
|
|
2143
2156
|
declare const send: <TApi, TRes>(options: TSendOptions<TApi, TRes>) => Promise<TRes>;
|
|
2144
2157
|
|
|
2145
|
-
declare const getTransferInfo: <TApi, TRes>({ api,
|
|
2158
|
+
declare const getTransferInfo: <TApi, TRes>({ api, txs, origin, destination, senderAddress, ahAddress, address, currency, feeAsset }: TGetTransferInfoOptions<TApi, TRes>) => Promise<TTransferInfo>;
|
|
2146
2159
|
|
|
2147
|
-
declare const getMinTransferableAmountInternal: <TApi, TRes>({ api, origin, senderAddress, address, origin: chain, destination, currency,
|
|
2160
|
+
declare const getMinTransferableAmountInternal: <TApi, TRes>({ api, origin, senderAddress, address, origin: chain, destination, currency, feeAsset, txs, builder }: TGetMinTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
|
|
2148
2161
|
declare const getMinTransferableAmount: <TApi, TRes>(options: TGetMinTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
|
|
2149
2162
|
|
|
2150
|
-
declare const getTransferableAmountInternal: <TApi, TRes>({ api, senderAddress, origin: chain, destination, currency,
|
|
2163
|
+
declare const getTransferableAmountInternal: <TApi, TRes>({ api, senderAddress, origin: chain, destination, currency, txs, feeAsset }: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
|
|
2151
2164
|
declare const getTransferableAmount: <TApi, TRes>(options: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
|
|
2152
2165
|
|
|
2153
2166
|
declare const transferRelayToPara: <TApi, TRes>(options: TRelayToParaOptions<TApi, TRes>) => Promise<TRes>;
|
|
@@ -2176,6 +2189,13 @@ declare const maybeOverrideAsset: (version: Version, amount: bigint, asset: TAss
|
|
|
2176
2189
|
|
|
2177
2190
|
declare const sortAssets: (assets: TAsset[]) => TAsset[];
|
|
2178
2191
|
|
|
2192
|
+
declare const computeOverridenAmount: <TApi, TRes>(options: TCreateTxsOptions<TApi, TRes>) => bigint | "800";
|
|
2193
|
+
declare const overrideTxAmount: <TApi, TRes>(options: TCreateTxsOptions<TApi, TRes>, builder: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>) => Promise<TRes>;
|
|
2194
|
+
declare const createTxs: <TApi, TRes>(options: TCreateTxsOptions<TApi, TRes>, builder: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>) => Promise<{
|
|
2195
|
+
tx: Awaited<TRes>;
|
|
2196
|
+
txBypass: Awaited<TRes>;
|
|
2197
|
+
}>;
|
|
2198
|
+
|
|
2179
2199
|
declare const isConfig: <TApi>(value: any) => value is TBuilderConfig<TApi>;
|
|
2180
2200
|
|
|
2181
2201
|
declare const getChainVersion: <TApi, TRes>(chain: TChain) => Version;
|
|
@@ -2263,5 +2283,5 @@ declare const handleToAhTeleport: <TApi, TRes>(origin: TParachain, input: TPolka
|
|
|
2263
2283
|
|
|
2264
2284
|
declare const validateAddress: (address: TAddress, chain: TChain, isDestination?: boolean) => void;
|
|
2265
2285
|
|
|
2266
|
-
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
|
|
2267
|
-
export type { BuildHopInfoOptions, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase,
|
|
2286
|
+
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTxs, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, overrideTxAmount, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
|
|
2287
|
+
export type { BuildHopInfoOptions, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TBatchOptions, TBifrostToken, TBridgeStatus, TBuildDestInfoOptions, TBuilderConfig, TBuilderOptions, TBypassOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TCreateTxsOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignByAssetOptions, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeInternalOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeInternalOptions, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapConfig, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTxPair, TTypeAndThenCallContext, TTypeAndThenFees, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
|