@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,13 @@
|
|
|
1
|
+
import { OfflineSigner } from '@cosmjs/proto-signing/build/signer';
|
|
2
|
+
import { SigningStargateClient } from '@cosmjs/stargate';
|
|
3
|
+
|
|
4
|
+
type getSigningStargateClientProps = {
|
|
5
|
+
chainId: string;
|
|
6
|
+
getOfflineSigner?: (chainId: string) => Promise<OfflineSigner>;
|
|
7
|
+
};
|
|
8
|
+
declare const getSigningStargateClient: ({ chainId, getOfflineSigner, }: getSigningStargateClientProps) => Promise<{
|
|
9
|
+
stargateClient: SigningStargateClient;
|
|
10
|
+
signer: OfflineSigner;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
export { getSigningStargateClient, type getSigningStargateClientProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __async } from '../chunk-AXBFBHS2.mjs';
|
|
2
|
+
import { ClientState } from '../state/clientState.mjs';
|
|
3
|
+
import { SigningStargateClient } from '@cosmjs/stargate';
|
|
4
|
+
import { accountParser } from 'src/registry.mjs';
|
|
5
|
+
import { getRpcEndpointForChain } from '../private-functions/getRpcEndpointForChain.mjs';
|
|
6
|
+
|
|
7
|
+
var getSigningStargateClient = (_0) => __async(void 0, [_0], function* ({
|
|
8
|
+
chainId,
|
|
9
|
+
getOfflineSigner
|
|
10
|
+
}) {
|
|
11
|
+
var _a;
|
|
12
|
+
if (!getOfflineSigner) {
|
|
13
|
+
throw new Error("'getCosmosSigner' is not provided or configured in skip router");
|
|
14
|
+
}
|
|
15
|
+
if (!((_a = ClientState.signingStargateClientByChainId) == null ? void 0 : _a[chainId])) {
|
|
16
|
+
const [signer, endpoint] = yield Promise.all([
|
|
17
|
+
getOfflineSigner(chainId),
|
|
18
|
+
getRpcEndpointForChain(chainId)
|
|
19
|
+
]);
|
|
20
|
+
ClientState.signingStargateClientByChainId[chainId] = yield SigningStargateClient.connectWithSigner(endpoint, signer, {
|
|
21
|
+
aminoTypes: ClientState.aminoTypes,
|
|
22
|
+
registry: ClientState.registry,
|
|
23
|
+
accountParser
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
stargateClient: ClientState.signingStargateClientByChainId[chainId],
|
|
28
|
+
signer: yield getOfflineSigner(chainId)
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { getSigningStargateClient };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { S as SkipApiOptions } from '../apiState-CdzxTxYd.mjs';
|
|
2
|
+
import { L as ChainAffiliates } from '../swaggerTypes-O9-gvCT1.mjs';
|
|
3
|
+
|
|
4
|
+
type SetApiOptionsProps = {
|
|
5
|
+
chainIdsToAffiliates?: Record<string, ChainAffiliates>;
|
|
6
|
+
} & SkipApiOptions;
|
|
7
|
+
declare const setApiOptions: (options?: SetApiOptionsProps) => Promise<void>;
|
|
8
|
+
|
|
9
|
+
export { type SetApiOptionsProps, setApiOptions };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import '../chunk-AXBFBHS2.mjs';
|
|
2
|
+
import { ApiState } from 'src/state/apiState.mjs';
|
|
3
|
+
import { createRequestClient } from '../utils/generateApi.mjs';
|
|
4
|
+
|
|
5
|
+
var setApiOptions = (options = {}) => {
|
|
6
|
+
ApiState.client = createRequestClient({
|
|
7
|
+
baseUrl: options.apiUrl || "https://api.skip.build",
|
|
8
|
+
apiKey: options.apiKey
|
|
9
|
+
});
|
|
10
|
+
ApiState.setClientInitialized();
|
|
11
|
+
if (options.chainIdsToAffiliates) {
|
|
12
|
+
ApiState.cumulativeAffiliateFeeBPS = validateChainIdsToAffiliates(options.chainIdsToAffiliates);
|
|
13
|
+
ApiState.chainIdsToAffiliates = options.chainIdsToAffiliates;
|
|
14
|
+
}
|
|
15
|
+
return ApiState.clientInitialized;
|
|
16
|
+
};
|
|
17
|
+
function validateChainIdsToAffiliates(chainIdsToAffiliates) {
|
|
18
|
+
var _a;
|
|
19
|
+
const affiliatesArray = Object.values(chainIdsToAffiliates).map((chain) => chain.affiliates).filter((a) => a !== void 0);
|
|
20
|
+
const firstAffiliateBasisPointsFee = (_a = affiliatesArray[0]) == null ? void 0 : _a.reduce((acc, affiliate) => {
|
|
21
|
+
if (!affiliate.basisPointsFee) {
|
|
22
|
+
throw new Error("basisPointFee must exist in each affiliate");
|
|
23
|
+
}
|
|
24
|
+
return acc + parseInt(affiliate.basisPointsFee, 10);
|
|
25
|
+
}, 0);
|
|
26
|
+
const allBasisPointsAreEqual = affiliatesArray.every((affiliate) => {
|
|
27
|
+
const totalBasisPointsFee = affiliate.reduce((acc, affiliate2) => {
|
|
28
|
+
if (!affiliate2.basisPointsFee) {
|
|
29
|
+
throw new Error("basisPointFee must exist in each affiliate");
|
|
30
|
+
}
|
|
31
|
+
if (!affiliate2.address) {
|
|
32
|
+
throw new Error("address to receive fee must exist in each affiliate");
|
|
33
|
+
}
|
|
34
|
+
return acc + parseInt(affiliate2 == null ? void 0 : affiliate2.basisPointsFee, 10);
|
|
35
|
+
}, 0);
|
|
36
|
+
return totalBasisPointsFee === firstAffiliateBasisPointsFee;
|
|
37
|
+
});
|
|
38
|
+
if (!allBasisPointsAreEqual) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
"basisPointFee does not add up to the same number for each chain in chainIdsToAffiliates"
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return firstAffiliateBasisPointsFee == null ? void 0 : firstAffiliateBasisPointsFee.toFixed(0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { setApiOptions };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { s as setClientOptions } from '../setClientOptions-CVB_OUIn.mjs';
|
|
2
|
+
import '@cosmjs/proto-signing';
|
|
3
|
+
import '@cosmjs/stargate';
|
|
4
|
+
import '../apiState-CdzxTxYd.mjs';
|
|
5
|
+
import '../client-types-CVch1pZ-.mjs';
|
|
6
|
+
import '@cosmjs/amino';
|
|
7
|
+
import 'viem';
|
|
8
|
+
import '@solana/wallet-adapter-base';
|
|
9
|
+
import '../swaggerTypes-O9-gvCT1.mjs';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { __spreadValues } from '../chunk-AXBFBHS2.mjs';
|
|
2
|
+
import { AminoTypes, createDefaultAminoConverters, defaultRegistryTypes } from '@cosmjs/stargate';
|
|
3
|
+
import { createWasmAminoConverters } from '@cosmjs/cosmwasm-stargate/build/modules/wasm/aminomessages';
|
|
4
|
+
import { circleAminoConverters, circleProtoRegistry } from 'src/codegen/circle/client.mjs';
|
|
5
|
+
import { evmosAminoConverters, evmosProtoRegistry } from 'src/codegen/evmos/client.mjs';
|
|
6
|
+
import { Registry } from '@cosmjs/proto-signing/build/registry';
|
|
7
|
+
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx';
|
|
8
|
+
import { MsgExecute } from 'src/codegen/initia/move/v1/tx.mjs';
|
|
9
|
+
import { MsgInitiateTokenDeposit } from 'src/codegen/opinit/ophost/v1/tx.mjs';
|
|
10
|
+
import { ClientState } from '../state/clientState.mjs';
|
|
11
|
+
import { createRequestClient } from '../utils/generateApi.mjs';
|
|
12
|
+
import { ApiState } from 'src/state/apiState.mjs';
|
|
13
|
+
|
|
14
|
+
var setClientOptions = (options = {}) => {
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
ApiState.client = createRequestClient({
|
|
17
|
+
baseUrl: options.apiUrl || "https://api.skip.build",
|
|
18
|
+
apiKey: options.apiKey
|
|
19
|
+
});
|
|
20
|
+
ClientState.endpointOptions = (_a = options.endpointOptions) != null ? _a : {};
|
|
21
|
+
ClientState.aminoTypes = new AminoTypes(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, createDefaultAminoConverters()), createWasmAminoConverters()), circleAminoConverters), evmosAminoConverters), (_b = options.aminoTypes) != null ? _b : {}));
|
|
22
|
+
ClientState.registry = new Registry([
|
|
23
|
+
...defaultRegistryTypes,
|
|
24
|
+
["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract],
|
|
25
|
+
["/initia.move.v1.MsgExecute", MsgExecute],
|
|
26
|
+
["/opinit.ophost.v1.MsgInitiateTokenDeposit", MsgInitiateTokenDeposit],
|
|
27
|
+
...circleProtoRegistry,
|
|
28
|
+
...evmosProtoRegistry,
|
|
29
|
+
...(_c = options.registryTypes) != null ? _c : []
|
|
30
|
+
]);
|
|
31
|
+
ApiState.setClientInitialized();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { setClientOptions };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GeneratedType } from '@cosmjs/proto-signing';
|
|
2
|
+
import { AminoConverters } from '@cosmjs/stargate';
|
|
3
|
+
import { S as SkipApiOptions } from './apiState-CdzxTxYd.mjs';
|
|
4
|
+
import { E as EndpointOptions } from './client-types-CVch1pZ-.mjs';
|
|
5
|
+
|
|
6
|
+
type SkipClientOptions = SkipApiOptions & {
|
|
7
|
+
endpointOptions?: {
|
|
8
|
+
endpoints?: Record<string, EndpointOptions>;
|
|
9
|
+
getRpcEndpointForChain?: (chainId: string) => Promise<string>;
|
|
10
|
+
getRestEndpointForChain?: (chainId: string) => Promise<string>;
|
|
11
|
+
};
|
|
12
|
+
aminoTypes?: AminoConverters;
|
|
13
|
+
registryTypes?: Iterable<[string, GeneratedType]>;
|
|
14
|
+
cacheDurationMs?: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
declare const setClientOptions: (options?: SkipClientOptions) => void;
|
|
18
|
+
|
|
19
|
+
export { type SkipClientOptions as S, setClientOptions as s };
|