@chainflip/sdk 0.1.13 → 0.1.15
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/{chunk-CMPMNSTZ.mjs → chunk-SBTGTMCG.mjs} +23 -3
- package/dist/{enums-d5fa72fa.d.ts → enums-3131916c.d.ts} +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/funding.js +21 -2
- package/dist/funding.mjs +2 -1
- package/dist/swap.d.ts +9 -7
- package/dist/swap.js +688 -656
- package/dist/swap.mjs +84 -72
- package/package.json +3 -3
|
@@ -26,10 +26,10 @@ var Assets = arrayToMap([
|
|
|
26
26
|
"BTC"
|
|
27
27
|
]);
|
|
28
28
|
var ChainflipNetworks = arrayToMap([
|
|
29
|
+
"partnernet",
|
|
29
30
|
"sisyphos",
|
|
30
31
|
"perseverance",
|
|
31
|
-
"mainnet"
|
|
32
|
-
"partnernet"
|
|
32
|
+
"mainnet"
|
|
33
33
|
]);
|
|
34
34
|
var isTestnet = /* @__PURE__ */ __name((network) => network !== ChainflipNetworks.mainnet, "isTestnet");
|
|
35
35
|
var assetChains = {
|
|
@@ -2047,6 +2047,26 @@ __name(Vault__factory, "Vault__factory");
|
|
|
2047
2047
|
__publicField(Vault__factory, "abi", _abi3);
|
|
2048
2048
|
|
|
2049
2049
|
// ../shared/src/consts.ts
|
|
2050
|
+
var MINIMUM_DEPOSIT_AMOUNTS = {
|
|
2051
|
+
[ChainflipNetworks.partnernet]: {
|
|
2052
|
+
[Assets.ETH]: "0",
|
|
2053
|
+
[Assets.FLIP]: "0",
|
|
2054
|
+
[Assets.USDC]: "0",
|
|
2055
|
+
[Assets.BTC]: "0",
|
|
2056
|
+
[Assets.DOT]: "0"
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
var getMinimumDepositAmount = /* @__PURE__ */ __name((network, asset) => MINIMUM_DEPOSIT_AMOUNTS[network]?.[asset] ?? "0", "getMinimumDepositAmount");
|
|
2060
|
+
var MINIMUM_SWAP_AMOUNTS = {
|
|
2061
|
+
[ChainflipNetworks.partnernet]: {
|
|
2062
|
+
[Assets.ETH]: "580000000000000",
|
|
2063
|
+
[Assets.FLIP]: "1000000000000000000",
|
|
2064
|
+
[Assets.USDC]: "1000000",
|
|
2065
|
+
[Assets.BTC]: "390000",
|
|
2066
|
+
[Assets.DOT]: "2000000000"
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
var getMinimumSwapAmount = /* @__PURE__ */ __name((network, asset) => MINIMUM_SWAP_AMOUNTS[network]?.[asset] ?? "0", "getMinimumSwapAmount");
|
|
2050
2070
|
var ADDRESSES = {
|
|
2051
2071
|
[ChainflipNetworks.sisyphos]: {
|
|
2052
2072
|
FLIP_CONTRACT_ADDRESS: "0x2FD78122663A07672e9ac63486573A99EB00125d",
|
|
@@ -2125,4 +2145,4 @@ var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
|
|
|
2125
2145
|
return balance.toBigInt();
|
|
2126
2146
|
}, "getFlipBalance");
|
|
2127
2147
|
|
|
2128
|
-
export { Assets, ChainflipNetworks, Chains, StateChainGateway__factory, Vault__factory, __name, approve, assert, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds, checkAllowance, getFlipBalance, getStateChainGatewayContractAddress, getTokenContractAddress, getVaultManagerContractAddress, isString, isTestnet, isTokenCall, isTokenSwap };
|
|
2148
|
+
export { Assets, ChainflipNetworks, Chains, StateChainGateway__factory, Vault__factory, __name, __publicField, approve, assert, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds, checkAllowance, getFlipBalance, getMinimumDepositAmount, getMinimumSwapAmount, getStateChainGatewayContractAddress, getTokenContractAddress, getVaultManagerContractAddress, isString, isTestnet, isTokenCall, isTokenSwap };
|
|
@@ -5,7 +5,7 @@ declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot"]>;
|
|
|
5
5
|
type Chain = (typeof Chains)[keyof typeof Chains];
|
|
6
6
|
declare const Assets: ArrayToMap<readonly ["FLIP", "USDC", "DOT", "ETH", "BTC"]>;
|
|
7
7
|
type Asset = (typeof Assets)[keyof typeof Assets];
|
|
8
|
-
declare const ChainflipNetworks: ArrayToMap<readonly ["
|
|
8
|
+
declare const ChainflipNetworks: ArrayToMap<readonly ["partnernet", "sisyphos", "perseverance", "mainnet"]>;
|
|
9
9
|
type ChainflipNetwork = (typeof ChainflipNetworks)[keyof typeof ChainflipNetworks];
|
|
10
10
|
declare const assetChains: {
|
|
11
11
|
ETH: "Ethereum";
|
package/dist/funding.d.ts
CHANGED
package/dist/funding.js
CHANGED
|
@@ -777,10 +777,10 @@ var Assets = arrayToMap([
|
|
|
777
777
|
"BTC"
|
|
778
778
|
]);
|
|
779
779
|
var ChainflipNetworks = arrayToMap([
|
|
780
|
+
"partnernet",
|
|
780
781
|
"sisyphos",
|
|
781
782
|
"perseverance",
|
|
782
|
-
"mainnet"
|
|
783
|
-
"partnernet"
|
|
783
|
+
"mainnet"
|
|
784
784
|
]);
|
|
785
785
|
({
|
|
786
786
|
[Assets.ETH]: Chains.Ethereum,
|
|
@@ -825,6 +825,24 @@ var ChainflipNetworks = arrayToMap([
|
|
|
825
825
|
});
|
|
826
826
|
|
|
827
827
|
// ../shared/src/consts.ts
|
|
828
|
+
({
|
|
829
|
+
[ChainflipNetworks.partnernet]: {
|
|
830
|
+
[Assets.ETH]: "0",
|
|
831
|
+
[Assets.FLIP]: "0",
|
|
832
|
+
[Assets.USDC]: "0",
|
|
833
|
+
[Assets.BTC]: "0",
|
|
834
|
+
[Assets.DOT]: "0"
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
({
|
|
838
|
+
[ChainflipNetworks.partnernet]: {
|
|
839
|
+
[Assets.ETH]: "580000000000000",
|
|
840
|
+
[Assets.FLIP]: "1000000000000000000",
|
|
841
|
+
[Assets.USDC]: "1000000",
|
|
842
|
+
[Assets.BTC]: "390000",
|
|
843
|
+
[Assets.DOT]: "2000000000"
|
|
844
|
+
}
|
|
845
|
+
});
|
|
828
846
|
var ADDRESSES = {
|
|
829
847
|
[ChainflipNetworks.sisyphos]: {
|
|
830
848
|
FLIP_CONTRACT_ADDRESS: "0x2FD78122663A07672e9ac63486573A99EB00125d",
|
|
@@ -945,6 +963,7 @@ var getRedemptionDelay = /* @__PURE__ */ __name((options) => {
|
|
|
945
963
|
// src/funding/index.ts
|
|
946
964
|
var FundingSDK = class {
|
|
947
965
|
constructor(options) {
|
|
966
|
+
__publicField(this, "options");
|
|
948
967
|
this.options = {
|
|
949
968
|
signer: options.signer,
|
|
950
969
|
network: options.network ?? ChainflipNetworks.perseverance
|
package/dist/funding.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __name, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, StateChainGateway__factory } from './chunk-
|
|
1
|
+
import { __name, __publicField, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, StateChainGateway__factory } from './chunk-SBTGTMCG.mjs';
|
|
2
2
|
|
|
3
3
|
// ../shared/src/stateChainGateway/utils.ts
|
|
4
4
|
var getStateChainGateway = /* @__PURE__ */ __name((options) => {
|
|
@@ -49,6 +49,7 @@ var getRedemptionDelay = /* @__PURE__ */ __name((options) => {
|
|
|
49
49
|
// src/funding/index.ts
|
|
50
50
|
var FundingSDK = class {
|
|
51
51
|
constructor(options) {
|
|
52
|
+
__publicField(this, "options");
|
|
52
53
|
this.options = {
|
|
53
54
|
signer: options.signer,
|
|
54
55
|
network: options.network ?? ChainflipNetworks.perseverance
|
package/dist/swap.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ethers, { Signer } from 'ethers';
|
|
2
|
-
import { C as Chain, c as chainAssets, A as Asset, a as ChainflipNetwork } from './enums-
|
|
3
|
-
export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './enums-
|
|
2
|
+
import { C as Chain, c as chainAssets, A as Asset, a as ChainflipNetwork } from './enums-3131916c.js';
|
|
3
|
+
export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './enums-3131916c.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
@@ -70,7 +70,7 @@ declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
70
70
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
71
71
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
72
72
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
73
|
-
destAddress: z.ZodEffects<z.
|
|
73
|
+
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
|
|
74
74
|
destAsset: z.ZodLiteral<"BTC">;
|
|
75
75
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
76
76
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -130,9 +130,9 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
130
130
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
131
131
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
132
132
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
133
|
+
srcAsset: z.ZodLiteral<"FLIP">;
|
|
133
134
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
134
135
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
135
|
-
srcAsset: z.ZodLiteral<"FLIP">;
|
|
136
136
|
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
137
137
|
ccmMetadata: z.ZodObject<{
|
|
138
138
|
message: z.ZodString;
|
|
@@ -169,9 +169,9 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
169
169
|
}>, z.ZodObject<{
|
|
170
170
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
171
171
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
172
|
+
srcAsset: z.ZodLiteral<"USDC">;
|
|
172
173
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
173
174
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
174
|
-
srcAsset: z.ZodLiteral<"USDC">;
|
|
175
175
|
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
176
176
|
ccmMetadata: z.ZodObject<{
|
|
177
177
|
message: z.ZodString;
|
|
@@ -252,7 +252,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
252
252
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
253
253
|
srcAsset: z.ZodLiteral<"ETH">;
|
|
254
254
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
255
|
-
destAddress: z.ZodEffects<z.
|
|
255
|
+
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
|
|
256
256
|
destAsset: z.ZodLiteral<"BTC">;
|
|
257
257
|
}, "strip", z.ZodTypeAny, {
|
|
258
258
|
amount: string | bigint;
|
|
@@ -335,7 +335,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
335
335
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
336
336
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
337
337
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
338
|
-
destAddress: z.ZodEffects<z.
|
|
338
|
+
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
|
|
339
339
|
destAsset: z.ZodLiteral<"BTC">;
|
|
340
340
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
341
341
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -420,6 +420,8 @@ type AssetData = {
|
|
|
420
420
|
name: string;
|
|
421
421
|
symbol: string;
|
|
422
422
|
isMainnet: boolean;
|
|
423
|
+
minimumDepositAmount: string;
|
|
424
|
+
minimumSwapAmount: string;
|
|
423
425
|
};
|
|
424
426
|
}[keyof typeof chainAssets];
|
|
425
427
|
interface ChainsAndAssets {
|