@skip-go/client 0.17.2 → 1.0.0-alpha-0
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/api/getAssets.d.mts +19 -0
- package/dist/api/getAssets.mjs +25 -0
- package/dist/api/getAssetsBetweenChains.d.mts +56 -0
- package/dist/api/getAssetsBetweenChains.mjs +9 -0
- package/dist/api/getBridges.d.mts +54 -0
- package/dist/api/getBridges.mjs +10 -0
- package/dist/api/getChains.d.mts +41 -0
- package/dist/api/getChains.mjs +16 -0
- package/dist/api/getVenues.d.mts +13 -0
- package/dist/api/getVenues.mjs +10 -0
- package/dist/api/postAssetsFromSource.d.mts +13 -0
- package/dist/api/postAssetsFromSource.mjs +14 -0
- package/dist/api/postBalances.d.mts +35 -0
- package/dist/api/postBalances.mjs +16 -0
- package/dist/api/postIbcOriginAssets.d.mts +32 -0
- package/dist/api/postIbcOriginAssets.mjs +11 -0
- package/dist/api/postMessages.d.mts +528 -0
- package/dist/api/postMessages.mjs +10 -0
- package/dist/api/postMessagesDirect.d.mts +568 -0
- package/dist/api/postMessagesDirect.mjs +10 -0
- package/dist/api/postRecommendAssets.d.mts +40 -0
- package/dist/api/postRecommendAssets.mjs +13 -0
- package/dist/api/postRoute.d.mts +460 -0
- package/dist/api/postRoute.mjs +16 -0
- package/dist/api/postSubmitTransaction.d.mts +13 -0
- package/dist/api/postSubmitTransaction.mjs +10 -0
- package/dist/api/postTrackTransaction.d.mts +13 -0
- package/dist/api/postTrackTransaction.mjs +11 -0
- package/dist/api/postTransactionStatus.d.mts +559 -0
- package/dist/api/postTransactionStatus.mjs +10 -0
- package/dist/apiState-CdzxTxYd.d.mts +6 -0
- package/dist/chunk-AXBFBHS2.mjs +41 -0
- package/dist/client-types-CVch1pZ-.d.mts +60 -0
- package/dist/executeRoute-CRdeEz1o.d.mts +69 -0
- package/dist/generateApi-3mHZ6Zbr.d.mts +22 -0
- package/dist/index.d.mts +35 -0
- package/dist/index.mjs +24 -0
- package/dist/public-functions/executeRoute.d.mts +9 -0
- package/dist/public-functions/executeRoute.mjs +100 -0
- package/dist/public-functions/getFeeInfoForChain.d.mts +9 -0
- package/dist/public-functions/getFeeInfoForChain.mjs +47 -0
- package/dist/public-functions/getRecommendedGasPrice.d.mts +9 -0
- package/dist/public-functions/getRecommendedGasPrice.mjs +1366 -0
- package/dist/public-functions/getSigningStargateClient.d.mts +13 -0
- package/dist/public-functions/getSigningStargateClient.mjs +32 -0
- package/dist/public-functions/setApiOptions.d.mts +9 -0
- package/dist/public-functions/setApiOptions.mjs +46 -0
- package/dist/public-functions/setClientOptions.d.mts +9 -0
- package/dist/public-functions/setClientOptions.mjs +34 -0
- package/dist/setClientOptions-CVB_OUIn.d.mts +19 -0
- package/dist/swaggerTypes-O9-gvCT1.d.mts +1890 -0
- package/package.json +10 -4
- package/dist/index.d.ts +0 -2336
- package/dist/index.js +0 -264
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { aT as TransferStatus, R as Erc20Approval, ap as RouteResponse, V as CosmosMsg } from './swaggerTypes-O9-gvCT1.mjs';
|
|
2
|
+
import { A as ApiRequest } from './generateApi-3mHZ6Zbr.mjs';
|
|
3
|
+
import { S as SignerGetters, b as GasOptions, U as UserAddress } from './client-types-CVch1pZ-.mjs';
|
|
4
|
+
|
|
5
|
+
type CallbackStatus = "success" | "error" | "pending" | "completed";
|
|
6
|
+
type TransactionCallbacks = {
|
|
7
|
+
onTransactionSigned?: (txInfo: {
|
|
8
|
+
chainId: string;
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
onTransactionBroadcast?: (txInfo: {
|
|
11
|
+
txHash: string;
|
|
12
|
+
chainId: string;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
onTransactionTracked?: (txInfo: {
|
|
15
|
+
txHash: string;
|
|
16
|
+
chainId: string;
|
|
17
|
+
explorerLink: string;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
onTransactionCompleted?: (txInfo: {
|
|
20
|
+
chainId: string;
|
|
21
|
+
txHash: string;
|
|
22
|
+
status?: TransferStatus;
|
|
23
|
+
}) => Promise<void>;
|
|
24
|
+
onValidateGasBalance?: (value: {
|
|
25
|
+
chainId?: string;
|
|
26
|
+
txIndex?: number;
|
|
27
|
+
status: CallbackStatus;
|
|
28
|
+
}) => Promise<void>;
|
|
29
|
+
onApproveAllowance?: (value: {
|
|
30
|
+
allowance?: Erc20Approval;
|
|
31
|
+
status: CallbackStatus;
|
|
32
|
+
}) => Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Execute Route Options */
|
|
36
|
+
type ExecuteRouteOptions = SignerGetters & GasOptions & TransactionCallbacks & Pick<ApiRequest<"getMsgsV2">, "timeoutSeconds"> & {
|
|
37
|
+
route: RouteResponse;
|
|
38
|
+
/**
|
|
39
|
+
* Addresses should be in the same order with the `chainIDs` in the `route`
|
|
40
|
+
*/
|
|
41
|
+
userAddresses: UserAddress[];
|
|
42
|
+
simulate?: boolean;
|
|
43
|
+
slippageTolerancePercent?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Arbitrary Tx to be executed before or after route msgs
|
|
46
|
+
*/
|
|
47
|
+
beforeMsg?: CosmosMsg;
|
|
48
|
+
afterMsg?: CosmosMsg;
|
|
49
|
+
/**
|
|
50
|
+
* Set allowance amount to max if EVM transaction requires allowance approval.
|
|
51
|
+
*/
|
|
52
|
+
useUnlimitedApproval?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
/**
|
|
55
|
+
* If `skipApproval` is set to `true`, the router will bypass checking whether
|
|
56
|
+
* the signer has granted approval for the specified token contract on an EVM chain.
|
|
57
|
+
* This can be useful if approval has already been handled externally or there are race conditions.
|
|
58
|
+
*/
|
|
59
|
+
bypassApprovalCheck?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* defaults to true
|
|
62
|
+
* If `batchSimulate` is set to `true`, it will simulate all messages in a batch before the first tx run.
|
|
63
|
+
* If `batchSimulate` is set to `false`, it will simulate each message one by one.
|
|
64
|
+
*/
|
|
65
|
+
batchSimulate?: boolean;
|
|
66
|
+
};
|
|
67
|
+
declare const executeRoute: (options: ExecuteRouteOptions) => Promise<void>;
|
|
68
|
+
|
|
69
|
+
export { type ExecuteRouteOptions as E, type TransactionCallbacks as T, executeRoute as e };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { bc as Api } from './swaggerTypes-O9-gvCT1.mjs';
|
|
2
|
+
|
|
3
|
+
type CamelKey<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<CamelKey<U>>}` : S;
|
|
4
|
+
type Camel<T> = T extends (infer U)[] ? Camel<U>[] : T extends object ? {
|
|
5
|
+
[K in keyof T as K extends string ? CamelKey<K> : never]: Camel<T[K]>;
|
|
6
|
+
} : T;
|
|
7
|
+
|
|
8
|
+
type ApiInstance = InstanceType<typeof Api>;
|
|
9
|
+
type FunctionKeys<T> = {
|
|
10
|
+
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
11
|
+
}[keyof T];
|
|
12
|
+
type ValidApiMethodKeys = {
|
|
13
|
+
[K in FunctionKeys<ApiInstance>]: Awaited<ReturnType<ApiInstance[K]>> extends {
|
|
14
|
+
data: unknown;
|
|
15
|
+
} ? K : never;
|
|
16
|
+
}[FunctionKeys<ApiInstance>];
|
|
17
|
+
type ApiRequest<K extends ValidApiMethodKeys> = NonNullable<Camel<Parameters<ApiInstance[K]>[0]>>;
|
|
18
|
+
type ApiResponse<K extends ValidApiMethodKeys> = Camel<Awaited<ReturnType<ApiInstance[K]>> extends {
|
|
19
|
+
data: infer D;
|
|
20
|
+
} ? D extends object ? D : never : never>;
|
|
21
|
+
|
|
22
|
+
export type { ApiRequest as A, ApiResponse as a };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export { A as AcknowledgementErrorDetails, a as Affiliate, bc as Api, b8 as ApiConfig, b as ApiError, c as Asset, d as AssetBetweenChains, e as AssetRecommendation, f as AutopilotAction, g as AutopilotMsg, h as AutopilotMsgWrapper, i as AxelarTransfer, j as AxelarTransferInfo, k as AxelarTransferState, l as AxelarTransferType, m as AxelarTransferWrapper, B as BalanceRequestChainEntry, D as BalanceResponseChainEntry, z as BalanceResponseDenomEntry, E as BankSend, F as BankSendWrapper, H as Bridge, I as BridgeType, C as CCTPTransfer, n as CCTPTransferInfo, p as CCTPTransferState, o as CCTPTransferTxs, q as CCTPTransferWrapper, J as Chain, L as ChainAffiliates, al as ChainTransaction, K as ChainType, ba as ContentType, M as ContractCallWithTokenError, N as ContractCallWithTokenErrorType, O as ContractCallWithTokenTxs, P as CosmWasmContractMsg, Q as CosmWasmContractMsgWrapper, b0 as CosmosModuleSupport, V as CosmosMsg, W as CosmosTx, X as CosmosTxWrapper, R as Erc20Approval, U as Error, T as ErrorDetail, aV as EurekaTransfer, aW as EurekaTransferInfo, aX as EurekaTransferWrapper, Y as EvmSwap, Z as EvmSwapWrapper, _ as EvmTx, $ as EvmTxWrapper, b3 as Fee, a2 as FeeAsset, b2 as FeeType, b6 as FullRequestParams, a4 as GRPCStatusCode, a3 as GoFastFee, G as GoFastTransfer, y as GoFastTransferInfo, w as GoFastTransferState, x as GoFastTransferTxs, bb as HttpClient, b9 as HttpResponse, a5 as HyperlaneTransfer, a6 as HyperlaneTransferInfo, a7 as HyperlaneTransferState, a8 as HyperlaneTransferTransactions, a9 as HyperlaneTransferWrapper, aa as IBCTransferInfo, b1 as IbcCapabilities, aY as LayerZeroTransfer, aZ as LayerZeroTransferInfo, aO as LayerZeroTransferState, ah as LayerZeroTransferTransactions, a_ as LayerZeroTransferWrapper, ab as Msg, ad as MultiChainMsg, ae as MultiChainMsgWrapper, aJ as OPInitTransfer, aL as OPInitTransferInfo, aN as OPInitTransferState, aM as OPInitTransferTxs, aK as OPInitTransferWrapper, af as Operation, ag as OptionalAsset, ai as Packet, aj as PacketError, ak as PacketErrorType, am as PostHandler, b4 as QueryParamsType, an as Reason, a$ as RecommendationRequest, b7 as RequestParams, b5 as ResponseFormat, ao as RoutePriceWarningType, ap as RouteResponse, aq as SendTokenError, ar as SendTokenErrorType, as as SendTokenTxs, S as SmartRelayFeeQuote, aC as SmartSwapExactCoinIn, aE as SmartSwapInWrapper, aD as SmartSwapOptions, r as StargateTransfer, u as StargateTransferInfo, s as StargateTransferState, t as StargateTransferTxs, v as StargateTransferWrapper, at as StatusError, au as StatusErrorType, a0 as SvmTx, a1 as SvmTxWrapper, av as Swap, aw as SwapExactCoinIn, ax as SwapExactCoinOut, ay as SwapInWrapper, az as SwapOperation, aA as SwapOutWrapper, aB as SwapRoute, aF as SwapVenue, aG as SwapWrapper, aH as TransactionExecutionErrorDetails, aI as TransactionState, aP as Transfer, aS as TransferAssetRelease, aQ as TransferEvent, aR as TransferState, aT as TransferStatus, aU as TransferWrapper, ac as Tx } from './swaggerTypes-O9-gvCT1.mjs';
|
|
2
|
+
export { E as ExecuteRouteOptions, T as TransactionCallbacks, e as executeRoute } from './executeRoute-CRdeEz1o.mjs';
|
|
3
|
+
export { E as EndpointOptions, b as GasOptions, G as GetFallbackGasAmount, a as GetGasPrice, e as SignCosmosMessageAminoOptions, d as SignCosmosMessageDirectOptions, c as SignCosmosMessageOptionsBase, S as SignerGetters, T as TxResult, U as UserAddress, V as ValidateGasResult } from './client-types-CVch1pZ-.mjs';
|
|
4
|
+
export { assets } from './api/getAssets.mjs';
|
|
5
|
+
export { assetsBetweenChains } from './api/getAssetsBetweenChains.mjs';
|
|
6
|
+
export { bridges } from './api/getBridges.mjs';
|
|
7
|
+
export { chains } from './api/getChains.mjs';
|
|
8
|
+
export { venues } from './api/getVenues.mjs';
|
|
9
|
+
export { ibcOriginAssets } from './api/postIbcOriginAssets.mjs';
|
|
10
|
+
export { MessagesRequest, MessagesResponse, messages } from './api/postMessages.mjs';
|
|
11
|
+
export { messagesDirect } from './api/postMessagesDirect.mjs';
|
|
12
|
+
export { recommendAssets } from './api/postRecommendAssets.mjs';
|
|
13
|
+
export { assetsFromSource } from './api/postAssetsFromSource.mjs';
|
|
14
|
+
export { BalanceRequest, BalanceResponse, balances } from './api/postBalances.mjs';
|
|
15
|
+
export { RouteRequest, route } from './api/postRoute.mjs';
|
|
16
|
+
export { submitTransaction } from './api/postSubmitTransaction.mjs';
|
|
17
|
+
export { trackTransaction } from './api/postTrackTransaction.mjs';
|
|
18
|
+
export { TxStatusResponse, transactionStatus } from './api/postTransactionStatus.mjs';
|
|
19
|
+
export { getSigningStargateClient, getSigningStargateClientProps } from './public-functions/getSigningStargateClient.mjs';
|
|
20
|
+
export { S as SkipClientOptions, s as setClientOptions } from './setClientOptions-CVB_OUIn.mjs';
|
|
21
|
+
export { getRecommendedGasPrice } from './public-functions/getRecommendedGasPrice.mjs';
|
|
22
|
+
export { getFeeInfoForChain } from './public-functions/getFeeInfoForChain.mjs';
|
|
23
|
+
export { SetApiOptionsProps, setApiOptions } from './public-functions/setApiOptions.mjs';
|
|
24
|
+
import './generateApi-3mHZ6Zbr.mjs';
|
|
25
|
+
import '@cosmjs/amino';
|
|
26
|
+
import '@cosmjs/proto-signing';
|
|
27
|
+
import '@cosmjs/stargate';
|
|
28
|
+
import 'viem';
|
|
29
|
+
import '@solana/wallet-adapter-base';
|
|
30
|
+
import './apiState-CdzxTxYd.mjs';
|
|
31
|
+
import '@cosmjs/proto-signing/build/signer';
|
|
32
|
+
|
|
33
|
+
declare const GAS_STATION_CHAIN_IDS: string[];
|
|
34
|
+
|
|
35
|
+
export { GAS_STATION_CHAIN_IDS };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './chunk-AXBFBHS2.mjs';
|
|
2
|
+
export * from './types/index.mjs';
|
|
3
|
+
export { assets } from './api/getAssets.mjs';
|
|
4
|
+
export { assetsBetweenChains } from './api/getAssetsBetweenChains.mjs';
|
|
5
|
+
export { bridges } from './api/getBridges.mjs';
|
|
6
|
+
export { chains } from './api/getChains.mjs';
|
|
7
|
+
export { venues } from './api/getVenues.mjs';
|
|
8
|
+
export { ibcOriginAssets } from './api/postIbcOriginAssets.mjs';
|
|
9
|
+
export { messages } from './api/postMessages.mjs';
|
|
10
|
+
export { messagesDirect } from './api/postMessagesDirect.mjs';
|
|
11
|
+
export { recommendAssets } from './api/postRecommendAssets.mjs';
|
|
12
|
+
export { assetsFromSource } from './api/postAssetsFromSource.mjs';
|
|
13
|
+
export { balances } from './api/postBalances.mjs';
|
|
14
|
+
export { route } from './api/postRoute.mjs';
|
|
15
|
+
export { submitTransaction } from './api/postSubmitTransaction.mjs';
|
|
16
|
+
export { trackTransaction } from './api/postTrackTransaction.mjs';
|
|
17
|
+
export { transactionStatus } from './api/postTransactionStatus.mjs';
|
|
18
|
+
export { executeRoute } from './public-functions/executeRoute.mjs';
|
|
19
|
+
export { getSigningStargateClient } from './public-functions/getSigningStargateClient.mjs';
|
|
20
|
+
export { setClientOptions } from './public-functions/setClientOptions.mjs';
|
|
21
|
+
export { getRecommendedGasPrice } from './public-functions/getRecommendedGasPrice.mjs';
|
|
22
|
+
export { getFeeInfoForChain } from './public-functions/getFeeInfoForChain.mjs';
|
|
23
|
+
export { setApiOptions } from './public-functions/setApiOptions.mjs';
|
|
24
|
+
export { GAS_STATION_CHAIN_IDS } from './constants/constants.mjs';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { E as ExecuteRouteOptions, e as executeRoute } from '../executeRoute-CRdeEz1o.mjs';
|
|
2
|
+
import '../swaggerTypes-O9-gvCT1.mjs';
|
|
3
|
+
import '../generateApi-3mHZ6Zbr.mjs';
|
|
4
|
+
import '../client-types-CVch1pZ-.mjs';
|
|
5
|
+
import '@cosmjs/amino';
|
|
6
|
+
import '@cosmjs/proto-signing';
|
|
7
|
+
import '@cosmjs/stargate';
|
|
8
|
+
import 'viem';
|
|
9
|
+
import '@solana/wallet-adapter-base';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { __async, __spreadProps, __spreadValues } from '../chunk-AXBFBHS2.mjs';
|
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
|
3
|
+
import { ClientState } from '../state/clientState.mjs';
|
|
4
|
+
import { ChainType } from '../types/swaggerTypes.mjs';
|
|
5
|
+
import { bech32m, bech32 } from 'bech32';
|
|
6
|
+
import { executeTransactions } from '../private-functions/executeTransactions.mjs';
|
|
7
|
+
import { messages } from '../api/postMessages.mjs';
|
|
8
|
+
import { isAddress } from 'viem';
|
|
9
|
+
import { ApiState } from 'src/state/apiState.mjs';
|
|
10
|
+
|
|
11
|
+
var executeRoute = (options) => __async(void 0, null, function* () {
|
|
12
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
13
|
+
const { route, userAddresses, beforeMsg, afterMsg, timeoutSeconds } = options;
|
|
14
|
+
let addressList = [];
|
|
15
|
+
userAddresses.forEach((userAddress, index) => {
|
|
16
|
+
const requiredChainAddress = route.requiredChainAddresses[index];
|
|
17
|
+
if (requiredChainAddress === (userAddress == null ? void 0 : userAddress.chainId)) {
|
|
18
|
+
addressList.push(userAddress.address);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
if (addressList.length !== route.requiredChainAddresses.length) {
|
|
22
|
+
addressList = userAddresses.map((x) => x.address);
|
|
23
|
+
}
|
|
24
|
+
const validLength = addressList.length === route.requiredChainAddresses.length || addressList.length === ((_a = route.chainIds) == null ? void 0 : _a.length);
|
|
25
|
+
if (!validLength) {
|
|
26
|
+
throw new Error("executeRoute error: invalid address list");
|
|
27
|
+
}
|
|
28
|
+
const isUserAddressesValid = yield validateUserAddresses(userAddresses);
|
|
29
|
+
if (!isUserAddressesValid) {
|
|
30
|
+
throw new Error("executeRoute error: invalid user addresses");
|
|
31
|
+
}
|
|
32
|
+
const response = yield messages({
|
|
33
|
+
timeoutSeconds,
|
|
34
|
+
amountIn: route == null ? void 0 : route.amountIn,
|
|
35
|
+
amountOut: route.estimatedAmountOut || "0",
|
|
36
|
+
sourceAssetChainId: route == null ? void 0 : route.sourceAssetChainId,
|
|
37
|
+
sourceAssetDenom: route == null ? void 0 : route.sourceAssetDenom,
|
|
38
|
+
destAssetChainId: route == null ? void 0 : route.destAssetChainId,
|
|
39
|
+
destAssetDenom: route == null ? void 0 : route.destAssetDenom,
|
|
40
|
+
operations: route == null ? void 0 : route.operations,
|
|
41
|
+
addressList,
|
|
42
|
+
slippageTolerancePercent: options.slippageTolerancePercent || "1",
|
|
43
|
+
chainIdsToAffiliates: ApiState.chainIdsToAffiliates
|
|
44
|
+
});
|
|
45
|
+
if (beforeMsg && ((_c = (_b = response == null ? void 0 : response.txs) == null ? void 0 : _b.length) != null ? _c : 0) > 0) {
|
|
46
|
+
const firstTx = (_d = response == null ? void 0 : response.txs) == null ? void 0 : _d[0];
|
|
47
|
+
if (firstTx && "cosmosTx" in firstTx) {
|
|
48
|
+
(_f = (_e = firstTx.cosmosTx) == null ? void 0 : _e.msgs) == null ? void 0 : _f.unshift(beforeMsg);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (afterMsg && ((_h = (_g = response == null ? void 0 : response.txs) == null ? void 0 : _g.length) != null ? _h : 0) > 0) {
|
|
52
|
+
const lastTx = (_i = response == null ? void 0 : response.txs) == null ? void 0 : _i[response.txs.length - 1];
|
|
53
|
+
if (lastTx && "cosmosTx" in lastTx) {
|
|
54
|
+
(_k = (_j = lastTx.cosmosTx) == null ? void 0 : _j.msgs) == null ? void 0 : _k.push(afterMsg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
yield executeTransactions(__spreadProps(__spreadValues({}, options), { txs: response == null ? void 0 : response.txs }));
|
|
58
|
+
});
|
|
59
|
+
var validateUserAddresses = (userAddresses) => __async(void 0, null, function* () {
|
|
60
|
+
const chains = yield ClientState.getSkipChains();
|
|
61
|
+
const validations = userAddresses.map((userAddress) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
const chain = chains.find((chain2) => chain2.chainId === userAddress.chainId);
|
|
64
|
+
switch (chain == null ? void 0 : chain.chainType) {
|
|
65
|
+
case ChainType.Cosmos:
|
|
66
|
+
try {
|
|
67
|
+
if ((_a = chain.chainId) == null ? void 0 : _a.includes("penumbra")) {
|
|
68
|
+
try {
|
|
69
|
+
return chain.bech32Prefix === ((_b = bech32m.decode(userAddress.address, 143)) == null ? void 0 : _b.prefix);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
return ["penumbracompat1", "tpenumbra"].includes(
|
|
72
|
+
bech32.decode(userAddress.address, 1023).prefix
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return chain.bech32Prefix === bech32.decode(userAddress.address, 1023).prefix;
|
|
77
|
+
} catch (e) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
case ChainType.Evm:
|
|
81
|
+
try {
|
|
82
|
+
return isAddress(userAddress.address);
|
|
83
|
+
} catch (_error) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
case ChainType.Svm:
|
|
87
|
+
try {
|
|
88
|
+
const publicKey = new PublicKey(userAddress.address);
|
|
89
|
+
return PublicKey.isOnCurve(publicKey);
|
|
90
|
+
} catch (_error) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return validations.every((validation) => validation);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export { executeRoute };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { a2 as FeeAsset } from '../swaggerTypes-O9-gvCT1.mjs';
|
|
2
|
+
import { S as SkipApiOptions } from '../apiState-CdzxTxYd.mjs';
|
|
3
|
+
|
|
4
|
+
type GetFeeInfoForChainProps = {
|
|
5
|
+
chainId: string;
|
|
6
|
+
} & SkipApiOptions;
|
|
7
|
+
declare const getFeeInfoForChain: ({ chainId, apiUrl, apiKey }: GetFeeInfoForChainProps) => Promise<FeeAsset | undefined>;
|
|
8
|
+
|
|
9
|
+
export { type GetFeeInfoForChainProps, getFeeInfoForChain };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __async } from '../chunk-AXBFBHS2.mjs';
|
|
2
|
+
import { chains } from 'src/chains.mjs';
|
|
3
|
+
import { getDefaultGasTokenForChain } from '../private-functions/getDefaultGasTokenForChain.mjs';
|
|
4
|
+
import { ClientState } from 'src/state/clientState.mjs';
|
|
5
|
+
|
|
6
|
+
var getFeeInfoForChain = (_0) => __async(void 0, [_0], function* ({ chainId, apiUrl, apiKey }) {
|
|
7
|
+
var _a, _b, _c, _d, _e;
|
|
8
|
+
const skipChains = yield ClientState.getSkipChains({ apiUrl, apiKey });
|
|
9
|
+
const skipChain = skipChains.find((chain2) => chain2.chainId === chainId);
|
|
10
|
+
if (!skipChain) {
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
const defaultGasToken = yield getDefaultGasTokenForChain(chainId);
|
|
14
|
+
if (!defaultGasToken && !skipChain.feeAssets) {
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
const skipFeeInfo = defaultGasToken ? (_a = skipChain.feeAssets) == null ? void 0 : _a.find((skipFee) => skipFee.denom === defaultGasToken) : (_b = skipChain.feeAssets) == null ? void 0 : _b[0];
|
|
18
|
+
if (!skipFeeInfo && ((_d = (_c = skipChain.feeAssets) == null ? void 0 : _c[0]) == null ? void 0 : _d.gasPrice) !== null) {
|
|
19
|
+
return (_e = skipChain.feeAssets) == null ? void 0 : _e[0];
|
|
20
|
+
}
|
|
21
|
+
if (skipFeeInfo && skipFeeInfo.gasPrice !== null) {
|
|
22
|
+
return skipFeeInfo;
|
|
23
|
+
}
|
|
24
|
+
const chain = chains().find((chain2) => chain2.chain_id === chainId);
|
|
25
|
+
if (!chain) {
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
if (!chain.fees) {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
const registryFeeInfo = chain.fees.fee_tokens.find(
|
|
32
|
+
(feeToken) => feeToken.denom === defaultGasToken
|
|
33
|
+
);
|
|
34
|
+
if (!registryFeeInfo) {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
denom: registryFeeInfo.denom,
|
|
39
|
+
gasPrice: {
|
|
40
|
+
low: registryFeeInfo.low_gas_price ? `${registryFeeInfo.low_gas_price}` : "",
|
|
41
|
+
average: registryFeeInfo.average_gas_price ? `${registryFeeInfo.average_gas_price}` : "",
|
|
42
|
+
high: registryFeeInfo.high_gas_price ? `${registryFeeInfo.high_gas_price}` : ""
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export { getFeeInfoForChain };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GasPrice } from '@cosmjs/stargate';
|
|
2
|
+
import { S as SkipApiOptions } from '../apiState-CdzxTxYd.mjs';
|
|
3
|
+
|
|
4
|
+
type getRecommendedGasPriceProps = {
|
|
5
|
+
chainId: string;
|
|
6
|
+
} & SkipApiOptions;
|
|
7
|
+
declare const getRecommendedGasPrice: (props: getRecommendedGasPriceProps) => Promise<GasPrice | undefined>;
|
|
8
|
+
|
|
9
|
+
export { getRecommendedGasPrice, type getRecommendedGasPriceProps };
|