@pioneer-platform/chainflip-client 0.1.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @pioneer-platform/chainflip-client
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Automated minor version bump for all packages
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @pioneer-platform/maya-network@8.5.0
13
+ - @pioneer-platform/loggerdog@8.5.0
14
+ - @pioneer-platform/pioneer-coins@9.5.0
15
+ - @pioneer-platform/pioneer-caip@9.4.0
16
+
17
+ ## 0.1.1
18
+
19
+ ### Patch Changes
20
+
21
+ - Automated patch version bump for all packages
22
+ - Updated dependencies
23
+ - @pioneer-platform/maya-network@8.4.1
24
+ - @pioneer-platform/loggerdog@8.4.1
25
+ - @pioneer-platform/pioneer-coins@9.4.1
26
+ - @pioneer-platform/pioneer-caip@9.3.1
27
+
3
28
  ## 0.1.0
4
29
 
5
30
  ### Minor Changes
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@pioneer-platform/chainflip-client",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "dependencies": {
7
- "@pioneer-platform/loggerdog": "^8.4.0",
8
- "@pioneer-platform/maya-network": "^8.4.0",
9
- "@pioneer-platform/pioneer-caip": "^9.3.0",
10
- "@pioneer-platform/pioneer-coins": "^9.4.0",
7
+ "@pioneer-platform/loggerdog": "^8.5.0",
8
+ "@pioneer-platform/maya-network": "^8.5.0",
9
+ "@pioneer-platform/pioneer-caip": "^9.4.0",
10
+ "@pioneer-platform/pioneer-coins": "^9.5.0",
11
11
  "@polkadot/api": "^10.13.1",
12
12
  "axios": "^1.6.0",
13
13
  "dotenv": "^8.2.0",
@@ -15,6 +15,13 @@
15
15
  "uuidv4": "^6.2.13",
16
16
  "web3": "1.10.3"
17
17
  },
18
+ "scripts": {
19
+ "npm": "pnpm i",
20
+ "test": "pnpm run build && node __tests__/test-module.js",
21
+ "build": "tsc -p .",
22
+ "prepublish": "pnpm run build",
23
+ "refresh": "rm -rf ./node_modules ./package-lock.json && pnpm install"
24
+ },
18
25
  "devDependencies": {
19
26
  "@types/jest": "^25.2.3",
20
27
  "@types/node": "^18.16.0",
@@ -25,12 +32,5 @@
25
32
  "ts-jest": "^29.0.5",
26
33
  "typescript": "^5.0.4"
27
34
  },
28
- "gitHead": "a76012f6693a12181c4744e53e977a9eaeef0ed3",
29
- "scripts": {
30
- "npm": "pnpm i",
31
- "test": "pnpm run build && node __tests__/test-module.js",
32
- "build": "tsc -p .",
33
- "prepublish": "pnpm run build",
34
- "refresh": "rm -rf ./node_modules ./package-lock.json && pnpm install"
35
- }
35
+ "gitHead": "a76012f6693a12181c4744e53e977a9eaeef0ed3"
36
36
  }
@@ -1,80 +0,0 @@
1
- export declare const chainflipGateway: ({
2
- inputs: {
3
- internalType: string;
4
- name: string;
5
- type: string;
6
- }[];
7
- stateMutability: string;
8
- type: string;
9
- anonymous?: undefined;
10
- name?: undefined;
11
- outputs?: undefined;
12
- } | {
13
- anonymous: boolean;
14
- inputs: {
15
- indexed: boolean;
16
- internalType: string;
17
- name: string;
18
- type: string;
19
- }[];
20
- name: string;
21
- type: string;
22
- stateMutability?: undefined;
23
- outputs?: undefined;
24
- } | {
25
- inputs: {
26
- internalType: string;
27
- name: string;
28
- type: string;
29
- }[];
30
- name: string;
31
- outputs: {
32
- internalType: string;
33
- name: string;
34
- type: string;
35
- }[];
36
- stateMutability: string;
37
- type: string;
38
- anonymous?: undefined;
39
- } | {
40
- inputs: {
41
- internalType: string;
42
- name: string;
43
- type: string;
44
- }[];
45
- name: string;
46
- outputs: {
47
- components: {
48
- internalType: string;
49
- name: string;
50
- type: string;
51
- }[];
52
- internalType: string;
53
- name: string;
54
- type: string;
55
- }[];
56
- stateMutability: string;
57
- type: string;
58
- anonymous?: undefined;
59
- } | {
60
- inputs: ({
61
- components: {
62
- internalType: string;
63
- name: string;
64
- type: string;
65
- }[];
66
- internalType: string;
67
- name: string;
68
- type: string;
69
- } | {
70
- internalType: string;
71
- name: string;
72
- type: string;
73
- components?: undefined;
74
- })[];
75
- name: string;
76
- outputs: never[];
77
- stateMutability: string;
78
- type: string;
79
- anonymous?: undefined;
80
- })[];
@@ -1,333 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chainflipGateway = void 0;
4
- exports.chainflipGateway = [
5
- {
6
- inputs: [
7
- { internalType: "contract IKeyManager", name: "keyManager", type: "address" },
8
- { internalType: "uint256", name: "minFunding", type: "uint256" },
9
- { internalType: "uint48", name: "redemptionDelay", type: "uint48" },
10
- ],
11
- stateMutability: "nonpayable",
12
- type: "constructor",
13
- },
14
- {
15
- anonymous: false,
16
- inputs: [
17
- { indexed: false, internalType: "bool", name: "communityGuardDisabled", type: "bool" },
18
- ],
19
- name: "CommunityGuardDisabled",
20
- type: "event",
21
- },
22
- {
23
- anonymous: false,
24
- inputs: [{ indexed: false, internalType: "address", name: "flip", type: "address" }],
25
- name: "FLIPSet",
26
- type: "event",
27
- },
28
- {
29
- anonymous: false,
30
- inputs: [
31
- { indexed: false, internalType: "uint256", name: "oldSupply", type: "uint256" },
32
- { indexed: false, internalType: "uint256", name: "newSupply", type: "uint256" },
33
- { indexed: false, internalType: "uint256", name: "stateChainBlockNumber", type: "uint256" },
34
- ],
35
- name: "FlipSupplyUpdated",
36
- type: "event",
37
- },
38
- {
39
- anonymous: false,
40
- inputs: [
41
- { indexed: true, internalType: "bytes32", name: "nodeID", type: "bytes32" },
42
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
43
- { indexed: false, internalType: "address", name: "funder", type: "address" },
44
- ],
45
- name: "Funded",
46
- type: "event",
47
- },
48
- {
49
- anonymous: false,
50
- inputs: [
51
- { indexed: false, internalType: "address", name: "to", type: "address" },
52
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
53
- ],
54
- name: "GovernanceWithdrawal",
55
- type: "event",
56
- },
57
- {
58
- anonymous: false,
59
- inputs: [
60
- { indexed: false, internalType: "uint256", name: "oldMinFunding", type: "uint256" },
61
- { indexed: false, internalType: "uint256", name: "newMinFunding", type: "uint256" },
62
- ],
63
- name: "MinFundingChanged",
64
- type: "event",
65
- },
66
- {
67
- anonymous: false,
68
- inputs: [
69
- { indexed: true, internalType: "bytes32", name: "nodeID", type: "bytes32" },
70
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
71
- ],
72
- name: "RedemptionExecuted",
73
- type: "event",
74
- },
75
- {
76
- anonymous: false,
77
- inputs: [
78
- { indexed: true, internalType: "bytes32", name: "nodeID", type: "bytes32" },
79
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
80
- ],
81
- name: "RedemptionExpired",
82
- type: "event",
83
- },
84
- {
85
- anonymous: false,
86
- inputs: [
87
- { indexed: true, internalType: "bytes32", name: "nodeID", type: "bytes32" },
88
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
89
- { indexed: true, internalType: "address", name: "redeemAddress", type: "address" },
90
- { indexed: false, internalType: "uint48", name: "startTime", type: "uint48" },
91
- { indexed: false, internalType: "uint48", name: "expiryTime", type: "uint48" },
92
- { indexed: false, internalType: "address", name: "executor", type: "address" },
93
- ],
94
- name: "RedemptionRegistered",
95
- type: "event",
96
- },
97
- {
98
- anonymous: false,
99
- inputs: [{ indexed: false, internalType: "bool", name: "suspended", type: "bool" }],
100
- name: "Suspended",
101
- type: "event",
102
- },
103
- {
104
- anonymous: false,
105
- inputs: [{ indexed: false, internalType: "address", name: "keyManager", type: "address" }],
106
- name: "UpdatedKeyManager",
107
- type: "event",
108
- },
109
- {
110
- inputs: [],
111
- name: "REDEMPTION_DELAY",
112
- outputs: [{ internalType: "uint48", name: "", type: "uint48" }],
113
- stateMutability: "view",
114
- type: "function",
115
- },
116
- {
117
- inputs: [],
118
- name: "disableCommunityGuard",
119
- outputs: [],
120
- stateMutability: "nonpayable",
121
- type: "function",
122
- },
123
- {
124
- inputs: [],
125
- name: "enableCommunityGuard",
126
- outputs: [],
127
- stateMutability: "nonpayable",
128
- type: "function",
129
- },
130
- {
131
- inputs: [{ internalType: "bytes32", name: "nodeID", type: "bytes32" }],
132
- name: "executeRedemption",
133
- outputs: [
134
- { internalType: "address", name: "", type: "address" },
135
- { internalType: "uint256", name: "", type: "uint256" },
136
- ],
137
- stateMutability: "nonpayable",
138
- type: "function",
139
- },
140
- {
141
- inputs: [
142
- { internalType: "bytes32", name: "nodeID", type: "bytes32" },
143
- { internalType: "uint256", name: "amount", type: "uint256" },
144
- ],
145
- name: "fundStateChainAccount",
146
- outputs: [],
147
- stateMutability: "nonpayable",
148
- type: "function",
149
- },
150
- {
151
- inputs: [],
152
- name: "getCommunityGuardDisabled",
153
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
154
- stateMutability: "view",
155
- type: "function",
156
- },
157
- {
158
- inputs: [],
159
- name: "getCommunityKey",
160
- outputs: [{ internalType: "address", name: "", type: "address" }],
161
- stateMutability: "view",
162
- type: "function",
163
- },
164
- {
165
- inputs: [],
166
- name: "getFLIP",
167
- outputs: [{ internalType: "contract IFLIP", name: "", type: "address" }],
168
- stateMutability: "view",
169
- type: "function",
170
- },
171
- {
172
- inputs: [],
173
- name: "getGovernor",
174
- outputs: [{ internalType: "address", name: "", type: "address" }],
175
- stateMutability: "view",
176
- type: "function",
177
- },
178
- {
179
- inputs: [],
180
- name: "getKeyManager",
181
- outputs: [{ internalType: "contract IKeyManager", name: "", type: "address" }],
182
- stateMutability: "view",
183
- type: "function",
184
- },
185
- {
186
- inputs: [],
187
- name: "getLastSupplyUpdateBlockNumber",
188
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
189
- stateMutability: "view",
190
- type: "function",
191
- },
192
- {
193
- inputs: [],
194
- name: "getMinimumFunding",
195
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
196
- stateMutability: "view",
197
- type: "function",
198
- },
199
- {
200
- inputs: [{ internalType: "bytes32", name: "nodeID", type: "bytes32" }],
201
- name: "getPendingRedemption",
202
- outputs: [
203
- {
204
- components: [
205
- { internalType: "uint256", name: "amount", type: "uint256" },
206
- { internalType: "address", name: "redeemAddress", type: "address" },
207
- { internalType: "uint48", name: "startTime", type: "uint48" },
208
- { internalType: "uint48", name: "expiryTime", type: "uint48" },
209
- { internalType: "address", name: "executor", type: "address" },
210
- ],
211
- internalType: "struct IStateChainGateway.Redemption",
212
- name: "",
213
- type: "tuple",
214
- },
215
- ],
216
- stateMutability: "view",
217
- type: "function",
218
- },
219
- {
220
- inputs: [],
221
- name: "getSuspendedState",
222
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
223
- stateMutability: "view",
224
- type: "function",
225
- },
226
- {
227
- inputs: [],
228
- name: "govUpdateFlipIssuer",
229
- outputs: [],
230
- stateMutability: "nonpayable",
231
- type: "function",
232
- },
233
- { inputs: [], name: "govWithdraw", outputs: [], stateMutability: "nonpayable", type: "function" },
234
- {
235
- inputs: [
236
- {
237
- components: [
238
- { internalType: "uint256", name: "sig", type: "uint256" },
239
- { internalType: "uint256", name: "nonce", type: "uint256" },
240
- { internalType: "address", name: "kTimesGAddress", type: "address" },
241
- ],
242
- internalType: "struct IShared.SigData",
243
- name: "sigData",
244
- type: "tuple",
245
- },
246
- { internalType: "bytes32", name: "nodeID", type: "bytes32" },
247
- { internalType: "uint256", name: "amount", type: "uint256" },
248
- { internalType: "address", name: "redeemAddress", type: "address" },
249
- { internalType: "uint48", name: "expiryTime", type: "uint48" },
250
- { internalType: "address", name: "executor", type: "address" },
251
- ],
252
- name: "registerRedemption",
253
- outputs: [],
254
- stateMutability: "nonpayable",
255
- type: "function",
256
- },
257
- { inputs: [], name: "resume", outputs: [], stateMutability: "nonpayable", type: "function" },
258
- {
259
- inputs: [{ internalType: "contract IFLIP", name: "flip", type: "address" }],
260
- name: "setFlip",
261
- outputs: [],
262
- stateMutability: "nonpayable",
263
- type: "function",
264
- },
265
- {
266
- inputs: [{ internalType: "uint256", name: "newMinFunding", type: "uint256" }],
267
- name: "setMinFunding",
268
- outputs: [],
269
- stateMutability: "nonpayable",
270
- type: "function",
271
- },
272
- { inputs: [], name: "suspend", outputs: [], stateMutability: "nonpayable", type: "function" },
273
- {
274
- inputs: [
275
- {
276
- components: [
277
- { internalType: "uint256", name: "sig", type: "uint256" },
278
- { internalType: "uint256", name: "nonce", type: "uint256" },
279
- { internalType: "address", name: "kTimesGAddress", type: "address" },
280
- ],
281
- internalType: "struct IShared.SigData",
282
- name: "sigData",
283
- type: "tuple",
284
- },
285
- { internalType: "address", name: "newIssuer", type: "address" },
286
- { internalType: "bool", name: "omitChecks", type: "bool" },
287
- ],
288
- name: "updateFlipIssuer",
289
- outputs: [],
290
- stateMutability: "nonpayable",
291
- type: "function",
292
- },
293
- {
294
- inputs: [
295
- {
296
- components: [
297
- { internalType: "uint256", name: "sig", type: "uint256" },
298
- { internalType: "uint256", name: "nonce", type: "uint256" },
299
- { internalType: "address", name: "kTimesGAddress", type: "address" },
300
- ],
301
- internalType: "struct IShared.SigData",
302
- name: "sigData",
303
- type: "tuple",
304
- },
305
- { internalType: "uint256", name: "newTotalSupply", type: "uint256" },
306
- { internalType: "uint256", name: "stateChainBlockNumber", type: "uint256" },
307
- ],
308
- name: "updateFlipSupply",
309
- outputs: [],
310
- stateMutability: "nonpayable",
311
- type: "function",
312
- },
313
- {
314
- inputs: [
315
- {
316
- components: [
317
- { internalType: "uint256", name: "sig", type: "uint256" },
318
- { internalType: "uint256", name: "nonce", type: "uint256" },
319
- { internalType: "address", name: "kTimesGAddress", type: "address" },
320
- ],
321
- internalType: "struct IShared.SigData",
322
- name: "sigData",
323
- type: "tuple",
324
- },
325
- { internalType: "contract IKeyManager", name: "keyManager", type: "address" },
326
- { internalType: "bool", name: "omitChecks", type: "bool" },
327
- ],
328
- name: "updateKeyManager",
329
- outputs: [],
330
- stateMutability: "nonpayable",
331
- type: "function",
332
- },
333
- ];
package/lib/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- declare const TAG = " | chainflip | ";
2
- type BaseDecimal = string | number;
3
- declare const uuid: any;
4
- declare const log: any;
5
- declare let Chain: any, caipToNetworkId: any, shortListSymbolToCaip: any, ChainToNetworkId: any, NetworkIdToChain: any, getChainEnumValue: any;
6
- declare const createMemo: any, parseMemo: any;
7
- declare const axios: any;
8
- declare let networkSupport: any[];
9
- declare let assetSupport: any[];
10
- declare const get_quote_info: (quoteId: string) => Promise<any>;
11
- declare const get_quote: (quote: any) => Promise<any>;
package/lib/index.js DELETED
@@ -1,194 +0,0 @@
1
- "use strict";
2
- /*
3
- chainflip Integration
4
- - Highlander
5
- */
6
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
- return new (P || (P = Promise))(function (resolve, reject) {
9
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
- step((generator = generator.apply(thisArg, _arguments || [])).next());
13
- });
14
- };
15
- const TAG = " | chainflip | ";
16
- const { uuid } = require('uuidv4');
17
- const log = require('@pioneer-platform/loggerdog')();
18
- let { Chain, caipToNetworkId, shortListSymbolToCaip, ChainToNetworkId, NetworkIdToChain, getChainEnumValue } = require("@pioneer-platform/pioneer-caip");
19
- const { createMemo, parseMemo } = require('@pioneer-platform/pioneer-coins');
20
- // Remove Polkadot API imports
21
- const axios = require('axios');
22
- let networkSupport = [
23
- ChainToNetworkId["BTC"],
24
- ChainToNetworkId["ETH"],
25
- ];
26
- let assetSupport = [
27
- shortListSymbolToCaip["BTC"],
28
- shortListSymbolToCaip["ETH"],
29
- ];
30
- module.exports = {
31
- init: function (settings) {
32
- return true;
33
- },
34
- networkSupport: function () {
35
- return networkSupport;
36
- },
37
- assetSupport: function () {
38
- return assetSupport;
39
- },
40
- getQuote: function (quote) {
41
- return get_quote(quote);
42
- },
43
- lookupTx: function (quoteId) {
44
- return get_quote_info(quoteId);
45
- },
46
- };
47
- const get_quote_info = function (quoteId) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- let tag = TAG + " | get_quote_info | ";
50
- try {
51
- let output = {};
52
- // Make a GET request using Axios
53
- const response = yield axios.get(`https://chainflip-swap.chainflip.io/swaps/${quoteId}`);
54
- // Assuming the response data is what you want to use
55
- output.data = response.data;
56
- return output;
57
- }
58
- catch (e) {
59
- console.error(tag, "e: ", e);
60
- throw e;
61
- }
62
- });
63
- };
64
- const get_quote = function (quote) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- let tag = TAG + " | get_quote | ";
67
- try {
68
- let output = {};
69
- output.steps = 1;
70
- output.memoless = true;
71
- output.complete = true;
72
- output.meta = {
73
- quoteMode: "CHANGELLY"
74
- };
75
- output.complete = true;
76
- if (!quote.sellAsset)
77
- throw new Error("missing sellAsset");
78
- if (!quote.buyAsset)
79
- throw new Error("missing buyAsset");
80
- if (!quote.sellAmount)
81
- throw new Error("missing sellAmount");
82
- if (!quote.recipientAddress)
83
- throw new Error("missing recipientAddress");
84
- if (!quote.slippage)
85
- throw new Error("missing slippage");
86
- if (!networkSupport.includes(caipToNetworkId(quote.buyAsset))) {
87
- throw new Error("unsupported buyAsset");
88
- }
89
- if (!networkSupport.includes(caipToNetworkId(quote.sellAsset))) {
90
- throw new Error("unsupported sellAsset");
91
- }
92
- output.sellAsset = {};
93
- output.sellAsset.caip = quote.sellAsset;
94
- output.sellAmount = quote.sellAmount;
95
- output.buyAsset = {};
96
- output.buyAsset.caip = quote.buyAsset;
97
- let chainSell = NetworkIdToChain[caipToNetworkId(quote.sellAsset)];
98
- let chainBuy = NetworkIdToChain[caipToNetworkId(quote.buyAsset)];
99
- log.info(tag, "chainSell: ", chainSell);
100
- log.info(tag, "chainBuy: ", chainBuy);
101
- let longNameSell = Object.keys(Chain).find(key => Chain[key] === chainSell);
102
- let longNameBuy = Object.keys(Chain).find(key => Chain[key] === chainBuy);
103
- log.info(tag, "chainSell: ", longNameSell);
104
- log.info(tag, "chainBuy: ", longNameBuy);
105
- const decimals = {
106
- 'BTC': 8, // Bitcoin uses 8 decimal places
107
- 'ETH': 18, // Ethereum uses 18 decimal places
108
- };
109
- // Helper function to scale the amount by the number of decimals
110
- function scaleAmount(amount, decimals) {
111
- return amount * Math.pow(10, decimals);
112
- }
113
- // Adjusting the amount according to the asset's decimals
114
- const amountToQuote = scaleAmount(quote.sellAmount, decimals[chainSell]); // Assumes 1 unit of the selling asset
115
- log.info(tag, "amountToQuote: ", amountToQuote);
116
- //get quote
117
- let params = {
118
- amount: amountToQuote,
119
- srcChain: longNameSell,
120
- srcAsset: chainSell,
121
- destChain: longNameBuy,
122
- destAsset: chainBuy
123
- };
124
- log.info(tag, "params: ", params);
125
- const responseQuote = yield axios.get('https://chainflip-swap.chainflip.io/quote', {
126
- params
127
- });
128
- function convertToReadableAmount(amount, decimals) {
129
- return amount / Math.pow(10, decimals);
130
- }
131
- console.log("responseQuote: ", responseQuote.data); // Handle the response data as needed
132
- const egressAmountReadable = convertToReadableAmount(responseQuote.data.egressAmount, decimals[chainBuy]);
133
- log.info(tag, "egressAmountReadable: ", egressAmountReadable);
134
- output.amountOut = egressAmountReadable;
135
- // //https://chainflip-swap.chainflip.io/trpc/openSwapDepositChannel?batch=1
136
- const url = 'https://chainflip-swap.chainflip.io/trpc/openSwapDepositChannel?batch=1';
137
- const data = {
138
- "0": {
139
- "json": {
140
- "srcChain": longNameSell,
141
- "destChain": longNameBuy,
142
- "srcAsset": chainSell,
143
- "destAsset": chainBuy,
144
- "amount": amountToQuote.toString(),
145
- "quote": responseQuote.data,
146
- "destAddress": quote.recipientAddress,
147
- }
148
- }
149
- };
150
- log.info("data good: ", data);
151
- const headers = {
152
- 'Accept': '*/*',
153
- 'Accept-Encoding': 'gzip, deflate, br, zstd',
154
- 'Accept-Language': 'en-US,en;q=0.9',
155
- 'Content-Type': 'application/json',
156
- 'Origin': 'https://swap.chainflip.io',
157
- 'Referer': 'https://swap.chainflip.io/',
158
- 'Sec-Ch-Ua': '"Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"',
159
- 'Sec-Ch-Ua-Mobile': '?0',
160
- 'Sec-Ch-Ua-Platform': '"macOS"',
161
- 'Sec-Fetch-Dest': 'empty',
162
- 'Sec-Fetch-Mode': 'cors',
163
- 'Sec-Fetch-Site': 'same-site',
164
- 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
165
- };
166
- const response = yield axios.post(url, data, { headers });
167
- // console.log(response); // Log the response data
168
- // console.log(response.data); // Log the response data
169
- // console.log(JSON.stringify(response.data)); // Log the response data
170
- let result = response.data[0].result.data.json;
171
- log.info(tag, "result: ", result);
172
- output.id = result.id;
173
- output.source = 'chainflip';
174
- output.inboundAddress = result.depositAddress;
175
- output.estimatedExpiryTime = result.estimatedExpiryTime;
176
- let tx = {
177
- type: "transfer",
178
- chain: caipToNetworkId(quote.sellAsset),
179
- txParams: {
180
- address: result.depositAddress,
181
- amount: quote.sellAmount
182
- }
183
- };
184
- output.txs = [tx];
185
- output.raw = data;
186
- return output;
187
- }
188
- catch (e) {
189
- console.error(tag, "e: ", e);
190
- console.error(tag, "e: ", JSON.stringify(e));
191
- throw e;
192
- }
193
- });
194
- };