@chainflip/sdk 0.1.15 → 0.1.17

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.
@@ -1,4 +1,4 @@
1
- import { utils, Contract, BigNumber } from 'ethers';
1
+ import { BigNumber, utils, Contract } from 'ethers';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -142,7 +142,7 @@ var _abi = [
142
142
  type: "function"
143
143
  }
144
144
  ];
145
- var ERC20__factory = class {
145
+ var _ERC20__factory = class _ERC20__factory {
146
146
  static createInterface() {
147
147
  return new utils.Interface(_abi);
148
148
  }
@@ -150,8 +150,9 @@ var ERC20__factory = class {
150
150
  return new Contract(address, _abi, signerOrProvider);
151
151
  }
152
152
  };
153
- __name(ERC20__factory, "ERC20__factory");
154
- __publicField(ERC20__factory, "abi", _abi);
153
+ __name(_ERC20__factory, "ERC20__factory");
154
+ __publicField(_ERC20__factory, "abi", _abi);
155
+ var ERC20__factory = _ERC20__factory;
155
156
  var _abi2 = [
156
157
  {
157
158
  inputs: [
@@ -812,7 +813,7 @@ var _abi2 = [
812
813
  type: "function"
813
814
  }
814
815
  ];
815
- var StateChainGateway__factory = class {
816
+ var _StateChainGateway__factory = class _StateChainGateway__factory {
816
817
  static createInterface() {
817
818
  return new utils.Interface(_abi2);
818
819
  }
@@ -820,8 +821,9 @@ var StateChainGateway__factory = class {
820
821
  return new Contract(address, _abi2, signerOrProvider);
821
822
  }
822
823
  };
823
- __name(StateChainGateway__factory, "StateChainGateway__factory");
824
- __publicField(StateChainGateway__factory, "abi", _abi2);
824
+ __name(_StateChainGateway__factory, "StateChainGateway__factory");
825
+ __publicField(_StateChainGateway__factory, "abi", _abi2);
826
+ var StateChainGateway__factory = _StateChainGateway__factory;
825
827
  var _abi3 = [
826
828
  {
827
829
  inputs: [
@@ -2035,7 +2037,7 @@ var _abi3 = [
2035
2037
  type: "receive"
2036
2038
  }
2037
2039
  ];
2038
- var Vault__factory = class {
2040
+ var _Vault__factory = class _Vault__factory {
2039
2041
  static createInterface() {
2040
2042
  return new utils.Interface(_abi3);
2041
2043
  }
@@ -2043,8 +2045,9 @@ var Vault__factory = class {
2043
2045
  return new Contract(address, _abi3, signerOrProvider);
2044
2046
  }
2045
2047
  };
2046
- __name(Vault__factory, "Vault__factory");
2047
- __publicField(Vault__factory, "abi", _abi3);
2048
+ __name(_Vault__factory, "Vault__factory");
2049
+ __publicField(_Vault__factory, "abi", _abi3);
2050
+ var Vault__factory = _Vault__factory;
2048
2051
 
2049
2052
  // ../shared/src/consts.ts
2050
2053
  var MINIMUM_DEPOSIT_AMOUNTS = {
@@ -2053,7 +2056,7 @@ var MINIMUM_DEPOSIT_AMOUNTS = {
2053
2056
  [Assets.FLIP]: "0",
2054
2057
  [Assets.USDC]: "0",
2055
2058
  [Assets.BTC]: "0",
2056
- [Assets.DOT]: "0"
2059
+ [Assets.DOT]: "10000000000"
2057
2060
  }
2058
2061
  };
2059
2062
  var getMinimumDepositAmount = /* @__PURE__ */ __name((network, asset) => MINIMUM_DEPOSIT_AMOUNTS[network]?.[asset] ?? "0", "getMinimumDepositAmount");
@@ -0,0 +1,20 @@
1
+ import { Signer } from 'ethers';
2
+ import { a as ChainflipNetwork } from './enums-3131916c.js';
3
+
4
+ type SDKOptions = {
5
+ network?: Exclude<ChainflipNetwork, 'mainnet'>;
6
+ signer: Signer;
7
+ };
8
+ type TransactionHash = string;
9
+ declare class FundingSDK {
10
+ private readonly options;
11
+ constructor(options: SDKOptions);
12
+ fundStateChainAccount(accountId: `0x${string}`, amount: string): Promise<TransactionHash>;
13
+ executeRedemption(accountId: `0x${string}`): Promise<TransactionHash>;
14
+ getMinimumFunding(): Promise<bigint>;
15
+ getRedemptionDelay(): Promise<number>;
16
+ getFlipBalance(): Promise<bigint>;
17
+ approveStateChainGateway(amount: bigint | string | number, nonce?: bigint | string | number): Promise<TransactionHash | null>;
18
+ }
19
+
20
+ export { FundingSDK };
package/dist/funding.js CHANGED
@@ -78,7 +78,7 @@ var _abi = [
78
78
  type: "function"
79
79
  }
80
80
  ];
81
- var ERC20__factory = class {
81
+ var _ERC20__factory = class _ERC20__factory {
82
82
  static createInterface() {
83
83
  return new ethers.utils.Interface(_abi);
84
84
  }
@@ -86,8 +86,9 @@ var ERC20__factory = class {
86
86
  return new ethers.Contract(address, _abi, signerOrProvider);
87
87
  }
88
88
  };
89
- __name(ERC20__factory, "ERC20__factory");
90
- __publicField(ERC20__factory, "abi", _abi);
89
+ __name(_ERC20__factory, "ERC20__factory");
90
+ __publicField(_ERC20__factory, "abi", _abi);
91
+ var ERC20__factory = _ERC20__factory;
91
92
  var _abi2 = [
92
93
  {
93
94
  inputs: [
@@ -748,7 +749,7 @@ var _abi2 = [
748
749
  type: "function"
749
750
  }
750
751
  ];
751
- var StateChainGateway__factory = class {
752
+ var _StateChainGateway__factory = class _StateChainGateway__factory {
752
753
  static createInterface() {
753
754
  return new ethers.utils.Interface(_abi2);
754
755
  }
@@ -756,8 +757,9 @@ var StateChainGateway__factory = class {
756
757
  return new ethers.Contract(address, _abi2, signerOrProvider);
757
758
  }
758
759
  };
759
- __name(StateChainGateway__factory, "StateChainGateway__factory");
760
- __publicField(StateChainGateway__factory, "abi", _abi2);
760
+ __name(_StateChainGateway__factory, "StateChainGateway__factory");
761
+ __publicField(_StateChainGateway__factory, "abi", _abi2);
762
+ var StateChainGateway__factory = _StateChainGateway__factory;
761
763
 
762
764
  // ../shared/src/enums.ts
763
765
  var arrayToMap = /* @__PURE__ */ __name((array) => Object.fromEntries(array.map((key) => [
@@ -831,7 +833,7 @@ var ChainflipNetworks = arrayToMap([
831
833
  [Assets.FLIP]: "0",
832
834
  [Assets.USDC]: "0",
833
835
  [Assets.BTC]: "0",
834
- [Assets.DOT]: "0"
836
+ [Assets.DOT]: "10000000000"
835
837
  }
836
838
  });
837
839
  ({
@@ -961,7 +963,7 @@ var getRedemptionDelay = /* @__PURE__ */ __name((options) => {
961
963
  }, "getRedemptionDelay");
962
964
 
963
965
  // src/funding/index.ts
964
- var FundingSDK = class {
966
+ var _FundingSDK = class _FundingSDK {
965
967
  constructor(options) {
966
968
  __publicField(this, "options");
967
969
  this.options = {
@@ -1010,6 +1012,7 @@ var FundingSDK = class {
1010
1012
  return receipt && receipt.transactionHash;
1011
1013
  }
1012
1014
  };
1013
- __name(FundingSDK, "FundingSDK");
1015
+ __name(_FundingSDK, "FundingSDK");
1016
+ var FundingSDK = _FundingSDK;
1014
1017
 
1015
1018
  exports.FundingSDK = FundingSDK;
package/dist/funding.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { __name, __publicField, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, StateChainGateway__factory } from './chunk-SBTGTMCG.mjs';
1
+ import { __name, __publicField, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, StateChainGateway__factory } from './chunk-GANBXNEH.mjs';
2
2
 
3
3
  // ../shared/src/stateChainGateway/utils.ts
4
4
  var getStateChainGateway = /* @__PURE__ */ __name((options) => {
@@ -47,7 +47,7 @@ var getRedemptionDelay = /* @__PURE__ */ __name((options) => {
47
47
  }, "getRedemptionDelay");
48
48
 
49
49
  // src/funding/index.ts
50
- var FundingSDK = class {
50
+ var _FundingSDK = class _FundingSDK {
51
51
  constructor(options) {
52
52
  __publicField(this, "options");
53
53
  this.options = {
@@ -96,6 +96,7 @@ var FundingSDK = class {
96
96
  return receipt && receipt.transactionHash;
97
97
  }
98
98
  };
99
- __name(FundingSDK, "FundingSDK");
99
+ __name(_FundingSDK, "FundingSDK");
100
+ var FundingSDK = _FundingSDK;
100
101
 
101
102
  export { FundingSDK };
@@ -0,0 +1,560 @@
1
+ import ethers, { Signer } from 'ethers';
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
+ import { z } from 'zod';
5
+
6
+ declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
7
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
8
+ srcChain: z.ZodLiteral<"Ethereum">;
9
+ destChain: z.ZodLiteral<"Ethereum">;
10
+ destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
11
+ srcAsset: z.ZodLiteral<"FLIP">;
12
+ destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ amount: string | bigint;
15
+ srcChain: "Ethereum";
16
+ srcAsset: "FLIP";
17
+ destChain: "Ethereum";
18
+ destAddress: `0x${string}`;
19
+ destAsset: "USDC" | "ETH";
20
+ }, {
21
+ amount: string | bigint;
22
+ srcChain: "Ethereum";
23
+ srcAsset: "FLIP";
24
+ destChain: "Ethereum";
25
+ destAddress: `0x${string}`;
26
+ destAsset: "USDC" | "ETH";
27
+ }>, z.ZodObject<{
28
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
29
+ srcChain: z.ZodLiteral<"Ethereum">;
30
+ destChain: z.ZodLiteral<"Ethereum">;
31
+ destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
32
+ srcAsset: z.ZodLiteral<"USDC">;
33
+ destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ amount: string | bigint;
36
+ srcChain: "Ethereum";
37
+ srcAsset: "USDC";
38
+ destChain: "Ethereum";
39
+ destAddress: `0x${string}`;
40
+ destAsset: "FLIP" | "ETH";
41
+ }, {
42
+ amount: string | bigint;
43
+ srcChain: "Ethereum";
44
+ srcAsset: "USDC";
45
+ destChain: "Ethereum";
46
+ destAddress: `0x${string}`;
47
+ destAsset: "FLIP" | "ETH";
48
+ }>, z.ZodObject<{
49
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
50
+ srcChain: z.ZodLiteral<"Ethereum">;
51
+ destChain: z.ZodLiteral<"Polkadot">;
52
+ destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
53
+ destAsset: z.ZodLiteral<"DOT">;
54
+ srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ amount: string | bigint;
57
+ srcChain: "Ethereum";
58
+ srcAsset: "FLIP" | "USDC";
59
+ destChain: "Polkadot";
60
+ destAddress: string;
61
+ destAsset: "DOT";
62
+ }, {
63
+ amount: string | bigint;
64
+ srcChain: "Ethereum";
65
+ srcAsset: "FLIP" | "USDC";
66
+ destChain: "Polkadot";
67
+ destAddress: string;
68
+ destAsset: "DOT";
69
+ }>, z.ZodObject<{
70
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
71
+ srcChain: z.ZodLiteral<"Ethereum">;
72
+ destChain: z.ZodLiteral<"Bitcoin">;
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
+ destAsset: z.ZodLiteral<"BTC">;
75
+ srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
76
+ }, "strip", z.ZodTypeAny, {
77
+ amount: string | bigint;
78
+ srcChain: "Ethereum";
79
+ srcAsset: "FLIP" | "USDC";
80
+ destChain: "Bitcoin";
81
+ destAddress: string;
82
+ destAsset: "BTC";
83
+ }, {
84
+ amount: string | bigint;
85
+ srcChain: "Ethereum";
86
+ srcAsset: "FLIP" | "USDC";
87
+ destChain: "Bitcoin";
88
+ destAddress: string;
89
+ destAsset: "BTC";
90
+ }>]>;
91
+ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
92
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
93
+ srcChain: z.ZodLiteral<"Ethereum">;
94
+ srcAsset: z.ZodLiteral<"ETH">;
95
+ destChain: z.ZodLiteral<"Ethereum">;
96
+ destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
97
+ destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
98
+ ccmMetadata: z.ZodObject<{
99
+ message: z.ZodString;
100
+ gasBudget: z.ZodString;
101
+ }, "strip", z.ZodTypeAny, {
102
+ message: string;
103
+ gasBudget: string;
104
+ }, {
105
+ message: string;
106
+ gasBudget: string;
107
+ }>;
108
+ }, "strip", z.ZodTypeAny, {
109
+ amount: string | bigint;
110
+ srcChain: "Ethereum";
111
+ srcAsset: "ETH";
112
+ destChain: "Ethereum";
113
+ destAddress: `0x${string}`;
114
+ destAsset: "FLIP" | "USDC";
115
+ ccmMetadata: {
116
+ message: string;
117
+ gasBudget: string;
118
+ };
119
+ }, {
120
+ amount: string | bigint;
121
+ srcChain: "Ethereum";
122
+ srcAsset: "ETH";
123
+ destChain: "Ethereum";
124
+ destAddress: `0x${string}`;
125
+ destAsset: "FLIP" | "USDC";
126
+ ccmMetadata: {
127
+ message: string;
128
+ gasBudget: string;
129
+ };
130
+ }>, z.ZodUnion<[z.ZodObject<{
131
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
132
+ srcChain: z.ZodLiteral<"Ethereum">;
133
+ srcAsset: z.ZodLiteral<"FLIP">;
134
+ destChain: z.ZodLiteral<"Ethereum">;
135
+ destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
136
+ destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
137
+ ccmMetadata: z.ZodObject<{
138
+ message: z.ZodString;
139
+ gasBudget: z.ZodString;
140
+ }, "strip", z.ZodTypeAny, {
141
+ message: string;
142
+ gasBudget: string;
143
+ }, {
144
+ message: string;
145
+ gasBudget: string;
146
+ }>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ amount: string | bigint;
149
+ srcChain: "Ethereum";
150
+ srcAsset: "FLIP";
151
+ destChain: "Ethereum";
152
+ destAddress: `0x${string}`;
153
+ destAsset: "USDC" | "ETH";
154
+ ccmMetadata: {
155
+ message: string;
156
+ gasBudget: string;
157
+ };
158
+ }, {
159
+ amount: string | bigint;
160
+ srcChain: "Ethereum";
161
+ srcAsset: "FLIP";
162
+ destChain: "Ethereum";
163
+ destAddress: `0x${string}`;
164
+ destAsset: "USDC" | "ETH";
165
+ ccmMetadata: {
166
+ message: string;
167
+ gasBudget: string;
168
+ };
169
+ }>, z.ZodObject<{
170
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
171
+ srcChain: z.ZodLiteral<"Ethereum">;
172
+ srcAsset: z.ZodLiteral<"USDC">;
173
+ destChain: z.ZodLiteral<"Ethereum">;
174
+ destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
175
+ destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
176
+ ccmMetadata: z.ZodObject<{
177
+ message: z.ZodString;
178
+ gasBudget: z.ZodString;
179
+ }, "strip", z.ZodTypeAny, {
180
+ message: string;
181
+ gasBudget: string;
182
+ }, {
183
+ message: string;
184
+ gasBudget: string;
185
+ }>;
186
+ }, "strip", z.ZodTypeAny, {
187
+ amount: string | bigint;
188
+ srcChain: "Ethereum";
189
+ srcAsset: "USDC";
190
+ destChain: "Ethereum";
191
+ destAddress: `0x${string}`;
192
+ destAsset: "FLIP" | "ETH";
193
+ ccmMetadata: {
194
+ message: string;
195
+ gasBudget: string;
196
+ };
197
+ }, {
198
+ amount: string | bigint;
199
+ srcChain: "Ethereum";
200
+ srcAsset: "USDC";
201
+ destChain: "Ethereum";
202
+ destAddress: `0x${string}`;
203
+ destAsset: "FLIP" | "ETH";
204
+ ccmMetadata: {
205
+ message: string;
206
+ gasBudget: string;
207
+ };
208
+ }>]>, z.ZodUnion<[z.ZodObject<{
209
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
210
+ srcChain: z.ZodLiteral<"Ethereum">;
211
+ srcAsset: z.ZodLiteral<"ETH">;
212
+ destChain: z.ZodLiteral<"Ethereum">;
213
+ destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
214
+ destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
215
+ }, "strip", z.ZodTypeAny, {
216
+ amount: string | bigint;
217
+ srcChain: "Ethereum";
218
+ srcAsset: "ETH";
219
+ destChain: "Ethereum";
220
+ destAddress: `0x${string}`;
221
+ destAsset: "FLIP" | "USDC";
222
+ }, {
223
+ amount: string | bigint;
224
+ srcChain: "Ethereum";
225
+ srcAsset: "ETH";
226
+ destChain: "Ethereum";
227
+ destAddress: `0x${string}`;
228
+ destAsset: "FLIP" | "USDC";
229
+ }>, z.ZodObject<{
230
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
231
+ srcChain: z.ZodLiteral<"Ethereum">;
232
+ srcAsset: z.ZodLiteral<"ETH">;
233
+ destChain: z.ZodLiteral<"Polkadot">;
234
+ destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
235
+ destAsset: z.ZodLiteral<"DOT">;
236
+ }, "strip", z.ZodTypeAny, {
237
+ amount: string | bigint;
238
+ srcChain: "Ethereum";
239
+ srcAsset: "ETH";
240
+ destChain: "Polkadot";
241
+ destAddress: string;
242
+ destAsset: "DOT";
243
+ }, {
244
+ amount: string | bigint;
245
+ srcChain: "Ethereum";
246
+ srcAsset: "ETH";
247
+ destChain: "Polkadot";
248
+ destAddress: string;
249
+ destAsset: "DOT";
250
+ }>, z.ZodObject<{
251
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
252
+ srcChain: z.ZodLiteral<"Ethereum">;
253
+ srcAsset: z.ZodLiteral<"ETH">;
254
+ destChain: z.ZodLiteral<"Bitcoin">;
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
+ destAsset: z.ZodLiteral<"BTC">;
257
+ }, "strip", z.ZodTypeAny, {
258
+ amount: string | bigint;
259
+ srcChain: "Ethereum";
260
+ srcAsset: "ETH";
261
+ destChain: "Bitcoin";
262
+ destAddress: string;
263
+ destAsset: "BTC";
264
+ }, {
265
+ amount: string | bigint;
266
+ srcChain: "Ethereum";
267
+ srcAsset: "ETH";
268
+ destChain: "Bitcoin";
269
+ destAddress: string;
270
+ destAsset: "BTC";
271
+ }>]>, z.ZodUnion<[z.ZodObject<{
272
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
273
+ srcChain: z.ZodLiteral<"Ethereum">;
274
+ destChain: z.ZodLiteral<"Ethereum">;
275
+ destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
276
+ srcAsset: z.ZodLiteral<"FLIP">;
277
+ destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
278
+ }, "strip", z.ZodTypeAny, {
279
+ amount: string | bigint;
280
+ srcChain: "Ethereum";
281
+ srcAsset: "FLIP";
282
+ destChain: "Ethereum";
283
+ destAddress: `0x${string}`;
284
+ destAsset: "USDC" | "ETH";
285
+ }, {
286
+ amount: string | bigint;
287
+ srcChain: "Ethereum";
288
+ srcAsset: "FLIP";
289
+ destChain: "Ethereum";
290
+ destAddress: `0x${string}`;
291
+ destAsset: "USDC" | "ETH";
292
+ }>, z.ZodObject<{
293
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
294
+ srcChain: z.ZodLiteral<"Ethereum">;
295
+ destChain: z.ZodLiteral<"Ethereum">;
296
+ destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
297
+ srcAsset: z.ZodLiteral<"USDC">;
298
+ destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
299
+ }, "strip", z.ZodTypeAny, {
300
+ amount: string | bigint;
301
+ srcChain: "Ethereum";
302
+ srcAsset: "USDC";
303
+ destChain: "Ethereum";
304
+ destAddress: `0x${string}`;
305
+ destAsset: "FLIP" | "ETH";
306
+ }, {
307
+ amount: string | bigint;
308
+ srcChain: "Ethereum";
309
+ srcAsset: "USDC";
310
+ destChain: "Ethereum";
311
+ destAddress: `0x${string}`;
312
+ destAsset: "FLIP" | "ETH";
313
+ }>, z.ZodObject<{
314
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
315
+ srcChain: z.ZodLiteral<"Ethereum">;
316
+ destChain: z.ZodLiteral<"Polkadot">;
317
+ destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
318
+ destAsset: z.ZodLiteral<"DOT">;
319
+ srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
320
+ }, "strip", z.ZodTypeAny, {
321
+ amount: string | bigint;
322
+ srcChain: "Ethereum";
323
+ srcAsset: "FLIP" | "USDC";
324
+ destChain: "Polkadot";
325
+ destAddress: string;
326
+ destAsset: "DOT";
327
+ }, {
328
+ amount: string | bigint;
329
+ srcChain: "Ethereum";
330
+ srcAsset: "FLIP" | "USDC";
331
+ destChain: "Polkadot";
332
+ destAddress: string;
333
+ destAsset: "DOT";
334
+ }>, z.ZodObject<{
335
+ amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
336
+ srcChain: z.ZodLiteral<"Ethereum">;
337
+ destChain: z.ZodLiteral<"Bitcoin">;
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
+ destAsset: z.ZodLiteral<"BTC">;
340
+ srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
341
+ }, "strip", z.ZodTypeAny, {
342
+ amount: string | bigint;
343
+ srcChain: "Ethereum";
344
+ srcAsset: "FLIP" | "USDC";
345
+ destChain: "Bitcoin";
346
+ destAddress: string;
347
+ destAsset: "BTC";
348
+ }, {
349
+ amount: string | bigint;
350
+ srcChain: "Ethereum";
351
+ srcAsset: "FLIP" | "USDC";
352
+ destChain: "Bitcoin";
353
+ destAddress: string;
354
+ destAsset: "BTC";
355
+ }>]>]>;
356
+ type ExecuteSwapParams = z.infer<typeof executeSwapParamsSchema>;
357
+ type TokenSwapParams = z.infer<typeof tokenSwapParamsSchema>;
358
+ type Overrides = Omit<ethers.providers.TransactionRequest, 'to' | 'data' | 'value' | 'from'>;
359
+
360
+ declare const ccmMetadataSchema: z.ZodObject<{
361
+ gasBudget: z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber]>;
362
+ message: z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodString]>;
363
+ }, "strip", z.ZodTypeAny, {
364
+ message: string;
365
+ gasBudget: number | `0x${string}`;
366
+ }, {
367
+ message: string;
368
+ gasBudget: number | `0x${string}`;
369
+ }>;
370
+ type CcmMetadata = z.infer<typeof ccmMetadataSchema>;
371
+ declare const quoteResponseSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
372
+ id: z.ZodString;
373
+ intermediate_amount: z.ZodString;
374
+ egress_amount: z.ZodString;
375
+ }, "strip", z.ZodTypeAny, {
376
+ id: string;
377
+ intermediate_amount: string;
378
+ egress_amount: string;
379
+ }, {
380
+ id: string;
381
+ intermediate_amount: string;
382
+ egress_amount: string;
383
+ }>, {
384
+ id: string;
385
+ intermediateAmount: string;
386
+ egressAmount: string;
387
+ }, {
388
+ id: string;
389
+ intermediate_amount: string;
390
+ egress_amount: string;
391
+ }>, z.ZodEffects<z.ZodObject<{
392
+ id: z.ZodString;
393
+ egress_amount: z.ZodString;
394
+ }, "strip", z.ZodTypeAny, {
395
+ id: string;
396
+ egress_amount: string;
397
+ }, {
398
+ id: string;
399
+ egress_amount: string;
400
+ }>, {
401
+ id: string;
402
+ egressAmount: string;
403
+ }, {
404
+ id: string;
405
+ egress_amount: string;
406
+ }>]>;
407
+ type QuoteQueryResponse = z.infer<typeof quoteResponseSchema>;
408
+
409
+ interface ChainData {
410
+ id: Chain;
411
+ name: string;
412
+ isMainnet: boolean;
413
+ }
414
+ type AssetData = {
415
+ [K in keyof typeof chainAssets]: {
416
+ id: (typeof chainAssets)[K][number];
417
+ chain: K;
418
+ contractAddress: string | undefined;
419
+ decimals: number;
420
+ name: string;
421
+ symbol: string;
422
+ isMainnet: boolean;
423
+ minimumDepositAmount: string;
424
+ minimumSwapAmount: string;
425
+ };
426
+ }[keyof typeof chainAssets];
427
+ interface ChainsAndAssets {
428
+ srcChain: Chain;
429
+ destChain: Chain;
430
+ srcAsset: Asset;
431
+ destAsset: Asset;
432
+ }
433
+ interface QuoteRequest extends ChainsAndAssets {
434
+ amount: string;
435
+ }
436
+ interface QuoteResponse extends QuoteRequest {
437
+ quote: QuoteQueryResponse;
438
+ }
439
+ interface DepositAddressRequest extends QuoteRequest {
440
+ destAddress: string;
441
+ ccmMetadata?: CcmMetadata;
442
+ }
443
+ interface DepositAddressResponse extends DepositAddressRequest {
444
+ depositChannelId: string;
445
+ depositAddress: string;
446
+ }
447
+ interface SwapStatusRequest {
448
+ id: string;
449
+ }
450
+ interface CommonStatusFields extends ChainsAndAssets {
451
+ destAddress: string;
452
+ depositAddress: string | undefined;
453
+ depositAddressCreatedAt: number | undefined;
454
+ expectedDepositAmount: string | undefined;
455
+ }
456
+ type SwapStatusResponse = CommonStatusFields & ({
457
+ state: 'AWAITING_DEPOSIT';
458
+ depositAmount: string | undefined;
459
+ depositTransactionHash: string | undefined;
460
+ depositTransactionConfirmations: number | undefined;
461
+ } | {
462
+ state: 'DEPOSIT_RECEIVED';
463
+ swapId: string;
464
+ depositAmount: string;
465
+ depositReceivedAt: number;
466
+ depositReceivedBlockIndex: string;
467
+ } | {
468
+ state: 'SWAP_EXECUTED';
469
+ swapId: string;
470
+ depositAmount: string;
471
+ depositReceivedAt: number;
472
+ depositReceivedBlockIndex: string;
473
+ intermediateAmount: string | undefined;
474
+ swapExecutedAt: number;
475
+ swapExecutedBlockIndex: string;
476
+ } | {
477
+ state: 'EGRESS_SCHEDULED';
478
+ swapId: string;
479
+ depositAmount: string;
480
+ depositReceivedAt: number;
481
+ depositReceivedBlockIndex: string;
482
+ intermediateAmount: string | undefined;
483
+ swapExecutedAt: number;
484
+ swapExecutedBlockIndex: string;
485
+ egressAmount: string;
486
+ egressScheduledAt: number;
487
+ egressScheduledBlockIndex: string;
488
+ } | {
489
+ state: 'BROADCAST_REQUESTED';
490
+ swapId: string;
491
+ depositAmount: string;
492
+ depositReceivedAt: number;
493
+ depositReceivedBlockIndex: string;
494
+ intermediateAmount: string | undefined;
495
+ swapExecutedAt: number;
496
+ swapExecutedBlockIndex: string;
497
+ egressAmount: string;
498
+ egressScheduledAt: number;
499
+ egressScheduledBlockIndex: string;
500
+ broadcastRequestedAt: number;
501
+ broadcastRequestedBlockIndex: string;
502
+ } | {
503
+ state: 'BROADCAST_ABORTED';
504
+ swapId: string;
505
+ depositAmount: string;
506
+ depositReceivedAt: number;
507
+ depositReceivedBlockIndex: string;
508
+ intermediateAmount: string | undefined;
509
+ swapExecutedAt: number;
510
+ swapExecutedBlockIndex: string;
511
+ egressAmount: string;
512
+ egressScheduledAt: number;
513
+ egressScheduledBlockIndex: string;
514
+ broadcastRequestedAt: number;
515
+ broadcastRequestedBlockIndex: string;
516
+ broadcastAbortedAt: number;
517
+ broadcastAbortedBlockIndex: string;
518
+ } | {
519
+ state: 'COMPLETE';
520
+ swapId: string;
521
+ depositAmount: string;
522
+ depositReceivedAt: number;
523
+ depositReceivedBlockIndex: string;
524
+ intermediateAmount: string | undefined;
525
+ swapExecutedAt: number;
526
+ swapExecutedBlockIndex: string;
527
+ egressAmount: string;
528
+ egressScheduledAt: number;
529
+ egressScheduledBlockIndex: string;
530
+ broadcastRequestedAt: number;
531
+ broadcastRequestedBlockIndex: string;
532
+ broadcastSucceededAt: number;
533
+ broadcastSucceededBlockIndex: string;
534
+ });
535
+
536
+ type RequestOptions = {
537
+ signal?: AbortSignal;
538
+ };
539
+
540
+ type TransactionHash = string;
541
+ type SDKOptions = {
542
+ network?: Exclude<ChainflipNetwork, 'mainnet'>;
543
+ signer?: Signer;
544
+ backendUrl?: string;
545
+ };
546
+ declare class SwapSDK {
547
+ private readonly baseUrl;
548
+ private readonly network;
549
+ private readonly signer?;
550
+ constructor(options?: SDKOptions);
551
+ getChains(sourceChain?: Chain): Promise<ChainData[]>;
552
+ getAssets(chain: Chain): Promise<AssetData[]>;
553
+ getQuote(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponse>;
554
+ requestDepositAddress(depositAddressRequest: DepositAddressRequest, options?: RequestOptions): Promise<DepositAddressResponse>;
555
+ getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
556
+ executeSwap(params: ExecuteSwapParams, overrides?: Overrides): Promise<TransactionHash>;
557
+ approveVault(params: Pick<TokenSwapParams, 'srcAsset' | 'amount'>, overrides?: Overrides): Promise<TransactionHash | null>;
558
+ }
559
+
560
+ export { Asset, AssetData, Chain, ChainData, ChainflipNetwork, DepositAddressRequest, DepositAddressResponse, QuoteRequest, QuoteResponse, SDKOptions, SwapSDK, SwapStatusRequest, SwapStatusResponse, chainAssets };
package/dist/swap.d.ts CHANGED
@@ -455,6 +455,9 @@ interface CommonStatusFields extends ChainsAndAssets {
455
455
  }
456
456
  type SwapStatusResponse = CommonStatusFields & ({
457
457
  state: 'AWAITING_DEPOSIT';
458
+ depositAmount: string | undefined;
459
+ depositTransactionHash: string | undefined;
460
+ depositTransactionConfirmations: number | undefined;
458
461
  } | {
459
462
  state: 'DEPOSIT_RECEIVED';
460
463
  swapId: string;
package/dist/swap.js CHANGED
@@ -611,7 +611,7 @@ var _abi = [
611
611
  type: "function"
612
612
  }
613
613
  ];
614
- var ERC20__factory = class {
614
+ var _ERC20__factory = class _ERC20__factory {
615
615
  static createInterface() {
616
616
  return new ethers.utils.Interface(_abi);
617
617
  }
@@ -619,8 +619,9 @@ var ERC20__factory = class {
619
619
  return new ethers.Contract(address, _abi, signerOrProvider);
620
620
  }
621
621
  };
622
- __name(ERC20__factory, "ERC20__factory");
623
- __publicField(ERC20__factory, "abi", _abi);
622
+ __name(_ERC20__factory, "ERC20__factory");
623
+ __publicField(_ERC20__factory, "abi", _abi);
624
+ var ERC20__factory = _ERC20__factory;
624
625
  var _abi2 = [
625
626
  {
626
627
  inputs: [
@@ -1834,7 +1835,7 @@ var _abi2 = [
1834
1835
  type: "receive"
1835
1836
  }
1836
1837
  ];
1837
- var Vault__factory = class {
1838
+ var _Vault__factory = class _Vault__factory {
1838
1839
  static createInterface() {
1839
1840
  return new ethers.utils.Interface(_abi2);
1840
1841
  }
@@ -1842,8 +1843,9 @@ var Vault__factory = class {
1842
1843
  return new ethers.Contract(address, _abi2, signerOrProvider);
1843
1844
  }
1844
1845
  };
1845
- __name(Vault__factory, "Vault__factory");
1846
- __publicField(Vault__factory, "abi", _abi2);
1846
+ __name(_Vault__factory, "Vault__factory");
1847
+ __publicField(_Vault__factory, "abi", _abi2);
1848
+ var Vault__factory = _Vault__factory;
1847
1849
 
1848
1850
  // ../shared/src/consts.ts
1849
1851
  var MINIMUM_DEPOSIT_AMOUNTS = {
@@ -1852,7 +1854,7 @@ var MINIMUM_DEPOSIT_AMOUNTS = {
1852
1854
  [Assets.FLIP]: "0",
1853
1855
  [Assets.USDC]: "0",
1854
1856
  [Assets.BTC]: "0",
1855
- [Assets.DOT]: "0"
1857
+ [Assets.DOT]: "10000000000"
1856
1858
  }
1857
1859
  };
1858
1860
  var getMinimumDepositAmount = /* @__PURE__ */ __name((network, asset) => MINIMUM_DEPOSIT_AMOUNTS[network]?.[asset] ?? "0", "getMinimumDepositAmount");
@@ -2159,7 +2161,7 @@ var ApiService_default = {
2159
2161
  };
2160
2162
 
2161
2163
  // src/swap/sdk.ts
2162
- var SwapSDK = class {
2164
+ var _SwapSDK = class _SwapSDK {
2163
2165
  constructor(options = {}) {
2164
2166
  __publicField(this, "baseUrl");
2165
2167
  __publicField(this, "network");
@@ -2207,7 +2209,8 @@ var SwapSDK = class {
2207
2209
  return receipt && receipt.transactionHash;
2208
2210
  }
2209
2211
  };
2210
- __name(SwapSDK, "SwapSDK");
2212
+ __name(_SwapSDK, "SwapSDK");
2213
+ var SwapSDK = _SwapSDK;
2211
2214
 
2212
2215
  exports.Assets = Assets;
2213
2216
  exports.ChainflipNetworks = ChainflipNetworks;
package/dist/swap.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { isString, Chains, Assets, ChainflipNetworks, __name, __publicField, assert, getVaultManagerContractAddress, approve, isTokenCall, isTokenSwap, getTokenContractAddress, checkAllowance, Vault__factory, chainContractIds, assetContractIds, assetDecimals, isTestnet, getMinimumDepositAmount, getMinimumSwapAmount } from './chunk-SBTGTMCG.mjs';
2
- export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-SBTGTMCG.mjs';
1
+ import { isString, Chains, Assets, ChainflipNetworks, __name, __publicField, assert, getVaultManagerContractAddress, approve, isTokenCall, isTokenSwap, getTokenContractAddress, checkAllowance, Vault__factory, chainContractIds, assetContractIds, assetDecimals, isTestnet, getMinimumDepositAmount, getMinimumSwapAmount } from './chunk-GANBXNEH.mjs';
2
+ export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-GANBXNEH.mjs';
3
3
  import { encodeAddress, decodeAddress } from '@polkadot/util-crypto';
4
4
  import * as ethers from 'ethers';
5
5
  import { Signer } from 'ethers';
@@ -672,7 +672,7 @@ var ApiService_default = {
672
672
  };
673
673
 
674
674
  // src/swap/sdk.ts
675
- var SwapSDK = class {
675
+ var _SwapSDK = class _SwapSDK {
676
676
  constructor(options = {}) {
677
677
  __publicField(this, "baseUrl");
678
678
  __publicField(this, "network");
@@ -720,6 +720,7 @@ var SwapSDK = class {
720
720
  return receipt && receipt.transactionHash;
721
721
  }
722
722
  };
723
- __name(SwapSDK, "SwapSDK");
723
+ __name(_SwapSDK, "SwapSDK");
724
+ var SwapSDK = _SwapSDK;
724
725
 
725
726
  export { SwapSDK };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {
@@ -41,14 +41,14 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@polkadot/util": "^12.3.2",
45
- "@polkadot/util-crypto": "^12.0.1",
44
+ "@polkadot/util": "^12.4.1",
45
+ "@polkadot/util-crypto": "^12.3.2",
46
46
  "axios": "^1.4.0",
47
47
  "ethers": "5.7.2",
48
- "zod": "^3.21.4"
48
+ "zod": "^3.22.1"
49
49
  },
50
50
  "devDependencies": {
51
- "tsup": "^6.7.0"
51
+ "tsup": "^7.2.0"
52
52
  },
53
53
  "scripts": {
54
54
  "test": "jest --forceExit",