@bronlabs/intents-sdk 1.0.17 → 1.0.19
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/abi/OracleAggregator.json +41 -40
- package/abi/OrderEngine.json +151 -24
- package/dist/networks/btc.d.ts +16 -0
- package/dist/networks/btc.js +132 -0
- package/dist/networks/btc.js.map +1 -0
- package/dist/networks/index.d.ts +1 -1
- package/package.json +4 -1
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"type": "address"
|
|
75
75
|
}
|
|
76
76
|
],
|
|
77
|
-
"name": "
|
|
77
|
+
"name": "deactivateOracle",
|
|
78
78
|
"outputs": [],
|
|
79
79
|
"stateMutability": "nonpayable",
|
|
80
80
|
"type": "function"
|
|
@@ -87,38 +87,39 @@
|
|
|
87
87
|
"type": "address"
|
|
88
88
|
}
|
|
89
89
|
],
|
|
90
|
-
"name": "
|
|
91
|
-
"outputs": [
|
|
92
|
-
|
|
90
|
+
"name": "getOracleStatus",
|
|
91
|
+
"outputs": [
|
|
92
|
+
{
|
|
93
|
+
"internalType": "bool",
|
|
94
|
+
"name": "",
|
|
95
|
+
"type": "bool"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"stateMutability": "view",
|
|
93
99
|
"type": "function"
|
|
94
100
|
},
|
|
95
101
|
{
|
|
96
|
-
"inputs": [
|
|
102
|
+
"inputs": [],
|
|
103
|
+
"name": "getTotalOraclesCount",
|
|
104
|
+
"outputs": [
|
|
97
105
|
{
|
|
98
|
-
"internalType": "
|
|
99
|
-
"name": "
|
|
100
|
-
"type": "
|
|
106
|
+
"internalType": "uint256",
|
|
107
|
+
"name": "",
|
|
108
|
+
"type": "uint256"
|
|
101
109
|
}
|
|
102
110
|
],
|
|
103
|
-
"
|
|
104
|
-
"outputs": [],
|
|
105
|
-
"stateMutability": "nonpayable",
|
|
111
|
+
"stateMutability": "view",
|
|
106
112
|
"type": "function"
|
|
107
113
|
},
|
|
108
114
|
{
|
|
109
115
|
"inputs": [
|
|
110
116
|
{
|
|
111
|
-
"internalType": "
|
|
112
|
-
"name": "
|
|
113
|
-
"type": "
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"internalType": "bool",
|
|
117
|
-
"name": "_isConfirmed",
|
|
118
|
-
"type": "bool"
|
|
117
|
+
"internalType": "contract IOrderEngine",
|
|
118
|
+
"name": "_orderEngine",
|
|
119
|
+
"type": "address"
|
|
119
120
|
}
|
|
120
121
|
],
|
|
121
|
-
"name": "
|
|
122
|
+
"name": "initialize",
|
|
122
123
|
"outputs": [],
|
|
123
124
|
"stateMutability": "nonpayable",
|
|
124
125
|
"type": "function"
|
|
@@ -159,24 +160,6 @@
|
|
|
159
160
|
"stateMutability": "nonpayable",
|
|
160
161
|
"type": "function"
|
|
161
162
|
},
|
|
162
|
-
{
|
|
163
|
-
"inputs": [
|
|
164
|
-
{
|
|
165
|
-
"internalType": "string",
|
|
166
|
-
"name": "_orderId",
|
|
167
|
-
"type": "string"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"internalType": "uint256",
|
|
171
|
-
"name": "_liquidationPrice",
|
|
172
|
-
"type": "uint256"
|
|
173
|
-
}
|
|
174
|
-
],
|
|
175
|
-
"name": "oracleLiquidationSetPrice",
|
|
176
|
-
"outputs": [],
|
|
177
|
-
"stateMutability": "nonpayable",
|
|
178
|
-
"type": "function"
|
|
179
|
-
},
|
|
180
163
|
{
|
|
181
164
|
"inputs": [
|
|
182
165
|
{
|
|
@@ -188,7 +171,7 @@
|
|
|
188
171
|
"name": "oracles",
|
|
189
172
|
"outputs": [
|
|
190
173
|
{
|
|
191
|
-
"internalType": "enum
|
|
174
|
+
"internalType": "enum IOracleAggregator.OracleStatus",
|
|
192
175
|
"name": "",
|
|
193
176
|
"type": "uint8"
|
|
194
177
|
}
|
|
@@ -242,6 +225,24 @@
|
|
|
242
225
|
"stateMutability": "nonpayable",
|
|
243
226
|
"type": "function"
|
|
244
227
|
},
|
|
228
|
+
{
|
|
229
|
+
"inputs": [
|
|
230
|
+
{
|
|
231
|
+
"internalType": "address",
|
|
232
|
+
"name": "_oracle",
|
|
233
|
+
"type": "address"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"internalType": "bool",
|
|
237
|
+
"name": "_isAccepted",
|
|
238
|
+
"type": "bool"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"name": "registerOracleResponse",
|
|
242
|
+
"outputs": [],
|
|
243
|
+
"stateMutability": "nonpayable",
|
|
244
|
+
"type": "function"
|
|
245
|
+
},
|
|
245
246
|
{
|
|
246
247
|
"inputs": [],
|
|
247
248
|
"name": "renounceOwnership",
|
|
@@ -275,4 +276,4 @@
|
|
|
275
276
|
"stateMutability": "nonpayable",
|
|
276
277
|
"type": "function"
|
|
277
278
|
}
|
|
278
|
-
]
|
|
279
|
+
]
|
package/abi/OrderEngine.json
CHANGED
|
@@ -85,19 +85,6 @@
|
|
|
85
85
|
"name": "OwnershipTransferred",
|
|
86
86
|
"type": "event"
|
|
87
87
|
},
|
|
88
|
-
{
|
|
89
|
-
"inputs": [],
|
|
90
|
-
"name": "MAX_ACTION_DURATION",
|
|
91
|
-
"outputs": [
|
|
92
|
-
{
|
|
93
|
-
"internalType": "uint256",
|
|
94
|
-
"name": "",
|
|
95
|
-
"type": "uint256"
|
|
96
|
-
}
|
|
97
|
-
],
|
|
98
|
-
"stateMutability": "view",
|
|
99
|
-
"type": "function"
|
|
100
|
-
},
|
|
101
88
|
{
|
|
102
89
|
"inputs": [
|
|
103
90
|
{
|
|
@@ -179,6 +166,32 @@
|
|
|
179
166
|
"stateMutability": "nonpayable",
|
|
180
167
|
"type": "function"
|
|
181
168
|
},
|
|
169
|
+
{
|
|
170
|
+
"inputs": [],
|
|
171
|
+
"name": "defaultSolverSettlementTime",
|
|
172
|
+
"outputs": [
|
|
173
|
+
{
|
|
174
|
+
"internalType": "uint256",
|
|
175
|
+
"name": "",
|
|
176
|
+
"type": "uint256"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"stateMutability": "view",
|
|
180
|
+
"type": "function"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"inputs": [],
|
|
184
|
+
"name": "defaultUserSettlementTime",
|
|
185
|
+
"outputs": [
|
|
186
|
+
{
|
|
187
|
+
"internalType": "uint256",
|
|
188
|
+
"name": "",
|
|
189
|
+
"type": "uint256"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"stateMutability": "view",
|
|
193
|
+
"type": "function"
|
|
194
|
+
},
|
|
182
195
|
{
|
|
183
196
|
"inputs": [
|
|
184
197
|
{
|
|
@@ -358,6 +371,16 @@
|
|
|
358
371
|
"internalType": "address",
|
|
359
372
|
"name": "_solverRegister",
|
|
360
373
|
"type": "address"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"internalType": "uint256",
|
|
377
|
+
"name": "_defaultUserSettlementTime",
|
|
378
|
+
"type": "uint256"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"internalType": "uint256",
|
|
382
|
+
"name": "_defaultSolverSettlementTime",
|
|
383
|
+
"type": "uint256"
|
|
361
384
|
}
|
|
362
385
|
],
|
|
363
386
|
"name": "initialize",
|
|
@@ -368,19 +391,20 @@
|
|
|
368
391
|
{
|
|
369
392
|
"inputs": [
|
|
370
393
|
{
|
|
371
|
-
"internalType": "
|
|
372
|
-
"name": "
|
|
373
|
-
"type": "
|
|
374
|
-
}
|
|
394
|
+
"internalType": "address",
|
|
395
|
+
"name": "",
|
|
396
|
+
"type": "address"
|
|
397
|
+
}
|
|
398
|
+
],
|
|
399
|
+
"name": "isBrodcaster",
|
|
400
|
+
"outputs": [
|
|
375
401
|
{
|
|
376
|
-
"internalType": "
|
|
377
|
-
"name": "
|
|
378
|
-
"type": "
|
|
402
|
+
"internalType": "bool",
|
|
403
|
+
"name": "",
|
|
404
|
+
"type": "bool"
|
|
379
405
|
}
|
|
380
406
|
],
|
|
381
|
-
"
|
|
382
|
-
"outputs": [],
|
|
383
|
-
"stateMutability": "nonpayable",
|
|
407
|
+
"stateMutability": "view",
|
|
384
408
|
"type": "function"
|
|
385
409
|
},
|
|
386
410
|
{
|
|
@@ -416,6 +440,109 @@
|
|
|
416
440
|
"stateMutability": "nonpayable",
|
|
417
441
|
"type": "function"
|
|
418
442
|
},
|
|
443
|
+
{
|
|
444
|
+
"inputs": [
|
|
445
|
+
{
|
|
446
|
+
"internalType": "string",
|
|
447
|
+
"name": "_orderId",
|
|
448
|
+
"type": "string"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"internalType": "string",
|
|
452
|
+
"name": "_newTxHash",
|
|
453
|
+
"type": "string"
|
|
454
|
+
}
|
|
455
|
+
],
|
|
456
|
+
"name": "replaceSolverTransaction",
|
|
457
|
+
"outputs": [],
|
|
458
|
+
"stateMutability": "nonpayable",
|
|
459
|
+
"type": "function"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"inputs": [
|
|
463
|
+
{
|
|
464
|
+
"internalType": "string",
|
|
465
|
+
"name": "_orderId",
|
|
466
|
+
"type": "string"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"internalType": "string",
|
|
470
|
+
"name": "_newTxHash",
|
|
471
|
+
"type": "string"
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
"name": "replaceUserTransaction",
|
|
475
|
+
"outputs": [],
|
|
476
|
+
"stateMutability": "nonpayable",
|
|
477
|
+
"type": "function"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"inputs": [
|
|
481
|
+
{
|
|
482
|
+
"internalType": "address",
|
|
483
|
+
"name": "_brodcaster",
|
|
484
|
+
"type": "address"
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
"internalType": "bool",
|
|
488
|
+
"name": "_isBrodcaster",
|
|
489
|
+
"type": "bool"
|
|
490
|
+
}
|
|
491
|
+
],
|
|
492
|
+
"name": "setBrodcaster",
|
|
493
|
+
"outputs": [],
|
|
494
|
+
"stateMutability": "nonpayable",
|
|
495
|
+
"type": "function"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"inputs": [
|
|
499
|
+
{
|
|
500
|
+
"internalType": "uint256",
|
|
501
|
+
"name": "_defaultSolverSettlementTime",
|
|
502
|
+
"type": "uint256"
|
|
503
|
+
}
|
|
504
|
+
],
|
|
505
|
+
"name": "setDefaultSolverSettlementTime",
|
|
506
|
+
"outputs": [],
|
|
507
|
+
"stateMutability": "nonpayable",
|
|
508
|
+
"type": "function"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"inputs": [
|
|
512
|
+
{
|
|
513
|
+
"internalType": "uint256",
|
|
514
|
+
"name": "_defaultUserSettlementTime",
|
|
515
|
+
"type": "uint256"
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
"name": "setDefaultUserSettlementTime",
|
|
519
|
+
"outputs": [],
|
|
520
|
+
"stateMutability": "nonpayable",
|
|
521
|
+
"type": "function"
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"inputs": [
|
|
525
|
+
{
|
|
526
|
+
"internalType": "string",
|
|
527
|
+
"name": "_networkId",
|
|
528
|
+
"type": "string"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"internalType": "uint256",
|
|
532
|
+
"name": "_userSettlementTime",
|
|
533
|
+
"type": "uint256"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"internalType": "uint256",
|
|
537
|
+
"name": "_solverSettlementTime",
|
|
538
|
+
"type": "uint256"
|
|
539
|
+
}
|
|
540
|
+
],
|
|
541
|
+
"name": "setNetworkSettings",
|
|
542
|
+
"outputs": [],
|
|
543
|
+
"stateMutability": "nonpayable",
|
|
544
|
+
"type": "function"
|
|
545
|
+
},
|
|
419
546
|
{
|
|
420
547
|
"inputs": [
|
|
421
548
|
{
|
|
@@ -537,4 +664,4 @@
|
|
|
537
664
|
"stateMutability": "nonpayable",
|
|
538
665
|
"type": "function"
|
|
539
666
|
}
|
|
540
|
-
]
|
|
667
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
import { Network, TransactionData } from './index.js';
|
|
3
|
+
export declare class BtcNetwork implements Network {
|
|
4
|
+
private readonly rpcUrl;
|
|
5
|
+
private readonly confirmations;
|
|
6
|
+
private readonly nativeAssetDecimals;
|
|
7
|
+
readonly retryDelay: number;
|
|
8
|
+
constructor(rpcUrl: string, confirmations?: number);
|
|
9
|
+
getDecimals(tokenAddress: string): Promise<number>;
|
|
10
|
+
getTxData(txHash: string, tokenAddress: string, recipientAddress: string): Promise<TransactionData | undefined>;
|
|
11
|
+
transfer(privateKey: string, to: string, value: BigNumber, tokenAddress: string): Promise<string>;
|
|
12
|
+
private getFeeRate;
|
|
13
|
+
private getUtxos;
|
|
14
|
+
private getAddressFromPrivateKey;
|
|
15
|
+
private rpcCall;
|
|
16
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
import * as bitcoin from 'bitcoinjs-lib';
|
|
3
|
+
import { ECPairFactory } from 'ecpair';
|
|
4
|
+
import * as ecc from 'tiny-secp256k1';
|
|
5
|
+
import { log } from '../utils.js';
|
|
6
|
+
import { randomUUID } from 'node:crypto';
|
|
7
|
+
const ECPair = ECPairFactory(ecc);
|
|
8
|
+
export class BtcNetwork {
|
|
9
|
+
constructor(rpcUrl, confirmations = 6) {
|
|
10
|
+
this.nativeAssetDecimals = 8;
|
|
11
|
+
this.retryDelay = 5000;
|
|
12
|
+
this.rpcUrl = rpcUrl;
|
|
13
|
+
this.confirmations = confirmations;
|
|
14
|
+
}
|
|
15
|
+
async getDecimals(tokenAddress) {
|
|
16
|
+
if (tokenAddress !== "0x0") {
|
|
17
|
+
throw new Error("Don't support tokens for BTC network");
|
|
18
|
+
}
|
|
19
|
+
return this.nativeAssetDecimals;
|
|
20
|
+
}
|
|
21
|
+
async getTxData(txHash, tokenAddress, recipientAddress) {
|
|
22
|
+
if (tokenAddress !== "0x0") {
|
|
23
|
+
throw new Error("Don't support tokens for BTC network");
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const tx = await this.rpcCall('getrawtransaction', [txHash, true]);
|
|
27
|
+
if (!tx)
|
|
28
|
+
return;
|
|
29
|
+
const output = tx.vout.find(vout => vout.scriptPubKey.addresses?.includes(recipientAddress));
|
|
30
|
+
if (!output) {
|
|
31
|
+
log.warn(`Transaction ${txHash} has no output to ${recipientAddress}`);
|
|
32
|
+
return {
|
|
33
|
+
to: recipientAddress,
|
|
34
|
+
token: tokenAddress,
|
|
35
|
+
amount: BigNumber.from(0),
|
|
36
|
+
confirmed: tx.confirmations >= this.confirmations
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
log.info(`Confirmations ${txHash}: ${tx.confirmations}`);
|
|
40
|
+
return {
|
|
41
|
+
to: recipientAddress,
|
|
42
|
+
token: tokenAddress,
|
|
43
|
+
amount: BigNumber.from(Math.round(output.value * 100000000)),
|
|
44
|
+
confirmed: tx.confirmations >= this.confirmations
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
log.warn(`Failed to get transaction data for ${txHash}: ${error}`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async transfer(privateKey, to, value, tokenAddress) {
|
|
53
|
+
if (tokenAddress !== "0x0") {
|
|
54
|
+
throw new Error("Don't support tokens for BTC network");
|
|
55
|
+
}
|
|
56
|
+
const keyPair = ECPair.fromWIF(privateKey);
|
|
57
|
+
const fromAddress = this.getAddressFromPrivateKey(privateKey);
|
|
58
|
+
const utxos = await this.getUtxos(fromAddress);
|
|
59
|
+
if (utxos.length === 0) {
|
|
60
|
+
throw new Error("No UTXOs available");
|
|
61
|
+
}
|
|
62
|
+
const targetAmount = value.toNumber();
|
|
63
|
+
const feeRate = await this.getFeeRate();
|
|
64
|
+
let inputAmount = 0;
|
|
65
|
+
const selectedUtxos = [];
|
|
66
|
+
for (const utxo of utxos) {
|
|
67
|
+
selectedUtxos.push(utxo);
|
|
68
|
+
inputAmount += utxo.value;
|
|
69
|
+
const estimatedFee = (selectedUtxos.length * 148 + 2 * 34 + 10) * feeRate;
|
|
70
|
+
if (inputAmount >= targetAmount + estimatedFee)
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
const estimatedFee = (selectedUtxos.length * 148 + 2 * 34 + 10) * feeRate;
|
|
74
|
+
const changeAmount = inputAmount - targetAmount - estimatedFee;
|
|
75
|
+
if (inputAmount < targetAmount + estimatedFee) {
|
|
76
|
+
throw new Error(`Insufficient funds. Need ${targetAmount + estimatedFee}, have ${inputAmount}`);
|
|
77
|
+
}
|
|
78
|
+
const psbt = new bitcoin.Psbt();
|
|
79
|
+
for (const utxo of selectedUtxos) {
|
|
80
|
+
psbt.addInput({
|
|
81
|
+
hash: utxo.txid,
|
|
82
|
+
index: utxo.vout,
|
|
83
|
+
nonWitnessUtxo: Buffer.from(await this.rpcCall('getrawtransaction', [utxo.txid]), 'hex')
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
psbt.addOutput({ address: to, value: targetAmount });
|
|
87
|
+
if (changeAmount > 546) {
|
|
88
|
+
psbt.addOutput({ address: fromAddress, value: changeAmount });
|
|
89
|
+
}
|
|
90
|
+
selectedUtxos.forEach((_, index) => psbt.signInput(index, keyPair));
|
|
91
|
+
psbt.finalizeAllInputs();
|
|
92
|
+
return await this.rpcCall('sendrawtransaction', [psbt.extractTransaction().toHex()]);
|
|
93
|
+
}
|
|
94
|
+
async getFeeRate() {
|
|
95
|
+
try {
|
|
96
|
+
const feeEstimate = await this.rpcCall('estimatesmartfee', [6]);
|
|
97
|
+
return feeEstimate?.feerate ? Math.ceil(feeEstimate.feerate * 100000000 / 1000) : 10;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return 10;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async getUtxos(address) {
|
|
104
|
+
const utxos = await this.rpcCall('listunspent', [1, 9999999, [address]]);
|
|
105
|
+
return utxos.map((utxo) => ({
|
|
106
|
+
txid: utxo.txid,
|
|
107
|
+
vout: utxo.vout,
|
|
108
|
+
value: Math.round(utxo.amount * 100000000),
|
|
109
|
+
scriptPubKey: utxo.scriptPubKey
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
getAddressFromPrivateKey(privateKey) {
|
|
113
|
+
return bitcoin.payments.p2pkh({ pubkey: ECPair.fromWIF(privateKey).publicKey }).address;
|
|
114
|
+
}
|
|
115
|
+
async rpcCall(method, params = []) {
|
|
116
|
+
const response = await fetch(this.rpcUrl, {
|
|
117
|
+
method: 'POST',
|
|
118
|
+
headers: { 'Content-Type': 'application/json' },
|
|
119
|
+
body: JSON.stringify({
|
|
120
|
+
jsonrpc: '1.0',
|
|
121
|
+
id: randomUUID(),
|
|
122
|
+
method,
|
|
123
|
+
params
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
const { result, error } = await response.json();
|
|
127
|
+
if (error)
|
|
128
|
+
throw new Error(`RPC Error: ${error.message}`);
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=btc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"btc.js","sourceRoot":"","sources":["../../src/networks/btc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAoBzC,MAAM,MAAM,GAAG,aAAa,CAAC,GA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KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,OAAQ,CAAC;IAC3F,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,SAAgB,EAAE;QACtD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;YACxC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,EAAE,EAAE,UAAU,EAAE;gBAChB,MAAM;gBACN,MAAM;aACP,CAAC;SACH,CAAC,CAAC;QAEH,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChD,IAAI,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,cAAc,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/dist/networks/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface TransactionData {
|
|
|
8
8
|
}
|
|
9
9
|
export interface Network {
|
|
10
10
|
getDecimals(tokenAddress: string): Promise<number>;
|
|
11
|
-
getTxData(txHash: string, tokenAddress: string): Promise<TransactionData | undefined>;
|
|
11
|
+
getTxData(txHash: string, tokenAddress: string, recipientAddress: string): Promise<TransactionData | undefined>;
|
|
12
12
|
transfer(privateKey: string, to: string, value: BigNumber, tokenAddress: string): Promise<string>;
|
|
13
13
|
readonly retryDelay: number;
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bronlabs/intents-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "SDK for Intents DeFi smart contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
"@solana/spl-token": "^0.3.11",
|
|
45
45
|
"@solana/web3.js": "^1.87.6",
|
|
46
46
|
"big.js": "^7.0.1",
|
|
47
|
+
"bitcoinjs-lib": "^6.1.7",
|
|
48
|
+
"ecpair": "^2.1.0",
|
|
49
|
+
"tiny-secp256k1": "^2.2.3",
|
|
47
50
|
"bs58": "^6.0.0",
|
|
48
51
|
"dotenv": "^16.5.0",
|
|
49
52
|
"ethers": "^5.8.0",
|