@lifi/sdk-provider-bitcoin 4.0.0-alpha.2 → 4.0.0-alpha.21
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/cjs/BitcoinProvider.js +1 -1
- package/dist/cjs/BitcoinProvider.js.map +1 -1
- package/dist/cjs/client/publicClient.d.ts +1 -2
- package/dist/cjs/core/BitcoinStepExecutor.d.ts +15 -0
- package/dist/cjs/core/BitcoinStepExecutor.js +53 -0
- package/dist/cjs/core/BitcoinStepExecutor.js.map +1 -0
- package/dist/cjs/core/tasks/BitcoinSignAndExecuteTask.d.ts +5 -0
- package/dist/cjs/core/tasks/BitcoinSignAndExecuteTask.js +101 -0
- package/dist/cjs/core/tasks/BitcoinSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/BitcoinWaitForTransactionTask.d.ts +5 -0
- package/dist/cjs/core/tasks/BitcoinWaitForTransactionTask.js +45 -0
- package/dist/cjs/core/tasks/BitcoinWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/errors/parseBitcoinErrors.d.ts +2 -2
- package/dist/cjs/errors/parseBitcoinErrors.js +3 -3
- package/dist/cjs/errors/parseBitcoinErrors.js.map +1 -1
- package/dist/cjs/types.d.ts +7 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/BitcoinProvider.js +1 -1
- package/dist/esm/BitcoinProvider.js.map +1 -1
- package/dist/esm/client/publicClient.d.ts +1 -2
- package/dist/esm/core/BitcoinStepExecutor.d.ts +15 -0
- package/dist/esm/core/BitcoinStepExecutor.js +51 -0
- package/dist/esm/core/BitcoinStepExecutor.js.map +1 -0
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.d.ts +5 -0
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.js +106 -0
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.d.ts +5 -0
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.js +41 -0
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.js.map +1 -0
- package/dist/esm/errors/parseBitcoinErrors.d.ts +2 -2
- package/dist/esm/errors/parseBitcoinErrors.js +3 -3
- package/dist/esm/errors/parseBitcoinErrors.js.map +1 -1
- package/dist/esm/types.d.ts +7 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/client/publicClient.d.ts +1 -2
- package/dist/types/client/publicClient.d.ts.map +1 -1
- package/dist/types/core/BitcoinStepExecutor.d.ts +16 -0
- package/dist/types/core/BitcoinStepExecutor.d.ts.map +1 -0
- package/dist/types/core/tasks/BitcoinSignAndExecuteTask.d.ts +6 -0
- package/dist/types/core/tasks/BitcoinSignAndExecuteTask.d.ts.map +1 -0
- package/dist/types/core/tasks/BitcoinWaitForTransactionTask.d.ts +6 -0
- package/dist/types/core/tasks/BitcoinWaitForTransactionTask.d.ts.map +1 -0
- package/dist/types/errors/parseBitcoinErrors.d.ts +2 -2
- package/dist/types/errors/parseBitcoinErrors.d.ts.map +1 -1
- package/dist/types/types.d.ts +7 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/BitcoinProvider.ts +1 -1
- package/src/client/publicClient.ts +1 -1
- package/src/core/BitcoinStepExecutor.ts +98 -0
- package/src/core/tasks/BitcoinSignAndExecuteTask.ts +168 -0
- package/src/core/tasks/BitcoinWaitForTransactionTask.ts +74 -0
- package/src/errors/parseBitcoinErrors.ts +4 -4
- package/src/types.ts +13 -1
- package/src/version.ts +1 -1
- package/dist/cjs/BitcoinStepExecutor.d.ts +0 -12
- package/dist/cjs/BitcoinStepExecutor.js +0 -199
- package/dist/cjs/BitcoinStepExecutor.js.map +0 -1
- package/dist/esm/BitcoinStepExecutor.d.ts +0 -12
- package/dist/esm/BitcoinStepExecutor.js +0 -212
- package/dist/esm/BitcoinStepExecutor.js.map +0 -1
- package/dist/types/BitcoinStepExecutor.d.ts +0 -13
- package/dist/types/BitcoinStepExecutor.d.ts.map +0 -1
- package/src/BitcoinStepExecutor.ts +0 -344
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseError,
|
|
3
3
|
ErrorMessage,
|
|
4
|
+
type ExecutionAction,
|
|
4
5
|
LiFiErrorCode,
|
|
5
6
|
type LiFiStep,
|
|
6
|
-
type Process,
|
|
7
7
|
SDKError,
|
|
8
8
|
TransactionError,
|
|
9
9
|
UnknownError,
|
|
@@ -12,17 +12,17 @@ import {
|
|
|
12
12
|
export const parseBitcoinErrors = async (
|
|
13
13
|
e: Error,
|
|
14
14
|
step?: LiFiStep,
|
|
15
|
-
|
|
15
|
+
action?: ExecutionAction
|
|
16
16
|
): Promise<SDKError> => {
|
|
17
17
|
if (e instanceof SDKError) {
|
|
18
18
|
e.step = e.step ?? step
|
|
19
|
-
e.
|
|
19
|
+
e.action = e.action ?? action
|
|
20
20
|
return e
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const baseError = handleSpecificErrors(e)
|
|
24
24
|
|
|
25
|
-
return new SDKError(baseError, step,
|
|
25
|
+
return new SDKError(baseError, step, action)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const handleSpecificErrors = (e: any) => {
|
package/src/types.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import type { Client } from '@bigmi/core'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ChainType,
|
|
4
|
+
type LiFiStepExtended,
|
|
5
|
+
type SDKProvider,
|
|
6
|
+
type StepExecutorContext,
|
|
7
|
+
} from '@lifi/sdk'
|
|
8
|
+
import type { PublicClient } from './client/publicClient.js'
|
|
3
9
|
|
|
4
10
|
export interface BitcoinProviderOptions {
|
|
5
11
|
getWalletClient?: () => Promise<Client>
|
|
6
12
|
}
|
|
7
13
|
|
|
14
|
+
export interface BitcoinStepExecutorContext extends StepExecutorContext {
|
|
15
|
+
walletClient: Client
|
|
16
|
+
publicClient: PublicClient
|
|
17
|
+
checkClient: (step: LiFiStepExtended) => void
|
|
18
|
+
}
|
|
19
|
+
|
|
8
20
|
export interface BitcoinSDKProvider extends SDKProvider {
|
|
9
21
|
setOptions(options: BitcoinProviderOptions): void
|
|
10
22
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/sdk-provider-bitcoin'
|
|
2
|
-
export const version = '4.0.0-alpha.
|
|
2
|
+
export const version = '4.0.0-alpha.21'
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Client } from '@bigmi/core';
|
|
2
|
-
import { BaseStepExecutor, type LiFiStepExtended, type SDKClient, type StepExecutorOptions } from '@lifi/sdk';
|
|
3
|
-
interface BitcoinStepExecutorOptions extends StepExecutorOptions {
|
|
4
|
-
client: Client;
|
|
5
|
-
}
|
|
6
|
-
export declare class BitcoinStepExecutor extends BaseStepExecutor {
|
|
7
|
-
private client;
|
|
8
|
-
constructor(options: BitcoinStepExecutorOptions);
|
|
9
|
-
checkClient: (step: LiFiStepExtended) => void;
|
|
10
|
-
executeStep: (client: SDKClient, step: LiFiStepExtended) => Promise<LiFiStepExtended>;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BitcoinStepExecutor = void 0;
|
|
4
|
-
const core_1 = require("@bigmi/core");
|
|
5
|
-
const ecc = require("@bitcoinerlab/secp256k1");
|
|
6
|
-
const sdk_1 = require("@lifi/sdk");
|
|
7
|
-
const bitcoinjs_lib_1 = require("bitcoinjs-lib");
|
|
8
|
-
const publicClient_js_1 = require("./client/publicClient.js");
|
|
9
|
-
const parseBitcoinErrors_js_1 = require("./errors/parseBitcoinErrors.js");
|
|
10
|
-
const generateRedeemScript_js_1 = require("./utils/generateRedeemScript.js");
|
|
11
|
-
const isPsbtFinalized_js_1 = require("./utils/isPsbtFinalized.js");
|
|
12
|
-
const toXOnly_js_1 = require("./utils/toXOnly.js");
|
|
13
|
-
class BitcoinStepExecutor extends sdk_1.BaseStepExecutor {
|
|
14
|
-
client;
|
|
15
|
-
constructor(options) {
|
|
16
|
-
super(options);
|
|
17
|
-
this.client = options.client;
|
|
18
|
-
}
|
|
19
|
-
checkClient = (step) => {
|
|
20
|
-
if (this.client.account?.address !== step.action.fromAddress) {
|
|
21
|
-
throw new sdk_1.TransactionError(sdk_1.LiFiErrorCode.WalletChangedDuringExecution, 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.');
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
executeStep = async (client, step) => {
|
|
25
|
-
step.execution = this.statusManager.initExecutionObject(step);
|
|
26
|
-
const fromChain = await client.getChainById(step.action.fromChainId);
|
|
27
|
-
const toChain = await client.getChainById(step.action.toChainId);
|
|
28
|
-
const isBridgeExecution = fromChain.id !== toChain.id;
|
|
29
|
-
const currentProcessType = isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP';
|
|
30
|
-
let process = this.statusManager.findOrCreateProcess({
|
|
31
|
-
step,
|
|
32
|
-
type: currentProcessType,
|
|
33
|
-
chainId: fromChain.id,
|
|
34
|
-
});
|
|
35
|
-
const publicClient = await (0, publicClient_js_1.getBitcoinPublicClient)(client, sdk_1.ChainId.BTC);
|
|
36
|
-
if (process.status !== 'DONE') {
|
|
37
|
-
try {
|
|
38
|
-
let txHash;
|
|
39
|
-
let txHex;
|
|
40
|
-
if (process.txHash) {
|
|
41
|
-
this.checkClient(step);
|
|
42
|
-
txHash = process.txHash;
|
|
43
|
-
txHex = process.txHex;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
process = this.statusManager.updateProcess(step, process.type, 'STARTED');
|
|
47
|
-
await (0, sdk_1.checkBalance)(client, this.client.account.address, step);
|
|
48
|
-
if (!step.transactionRequest) {
|
|
49
|
-
const { execution, ...stepBase } = step;
|
|
50
|
-
const updatedStep = await (0, sdk_1.getStepTransaction)(client, stepBase);
|
|
51
|
-
const comparedStep = await (0, sdk_1.stepComparison)(this.statusManager, step, updatedStep, this.allowUserInteraction, this.executionOptions);
|
|
52
|
-
Object.assign(step, {
|
|
53
|
-
...comparedStep,
|
|
54
|
-
execution: step.execution,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
if (!step.transactionRequest?.data) {
|
|
58
|
-
throw new sdk_1.TransactionError(sdk_1.LiFiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
|
|
59
|
-
}
|
|
60
|
-
process = this.statusManager.updateProcess(step, process.type, 'ACTION_REQUIRED');
|
|
61
|
-
if (!this.allowUserInteraction) {
|
|
62
|
-
return step;
|
|
63
|
-
}
|
|
64
|
-
let transactionRequest = {
|
|
65
|
-
data: step.transactionRequest.data,
|
|
66
|
-
};
|
|
67
|
-
if (this.executionOptions?.updateTransactionRequestHook) {
|
|
68
|
-
const customizedTransactionRequest = await this.executionOptions.updateTransactionRequestHook({
|
|
69
|
-
requestType: 'transaction',
|
|
70
|
-
...transactionRequest,
|
|
71
|
-
});
|
|
72
|
-
transactionRequest = {
|
|
73
|
-
...transactionRequest,
|
|
74
|
-
...customizedTransactionRequest,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
if (!transactionRequest.data) {
|
|
78
|
-
throw new sdk_1.TransactionError(sdk_1.LiFiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
|
|
79
|
-
}
|
|
80
|
-
this.checkClient(step);
|
|
81
|
-
const psbtHex = transactionRequest.data;
|
|
82
|
-
(0, bitcoinjs_lib_1.initEccLib)(ecc);
|
|
83
|
-
const psbt = bitcoinjs_lib_1.Psbt.fromHex(psbtHex, { network: bitcoinjs_lib_1.networks.bitcoin });
|
|
84
|
-
psbt.data.inputs.forEach((input, index) => {
|
|
85
|
-
const accountAddress = input.witnessUtxo
|
|
86
|
-
? bitcoinjs_lib_1.address.fromOutputScript(input.witnessUtxo.script, bitcoinjs_lib_1.networks.bitcoin)
|
|
87
|
-
: this.client.account?.address;
|
|
88
|
-
const addressInfo = (0, core_1.getAddressInfo)(accountAddress);
|
|
89
|
-
if (addressInfo.type === core_1.AddressType.p2tr) {
|
|
90
|
-
if (!input.tapInternalKey) {
|
|
91
|
-
const pubKey = this.client.account?.publicKey;
|
|
92
|
-
if (pubKey) {
|
|
93
|
-
const tapInternalKey = (0, toXOnly_js_1.toXOnly)((0, core_1.hexToUnit8Array)(pubKey));
|
|
94
|
-
psbt.updateInput(index, {
|
|
95
|
-
tapInternalKey,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (!input.sighashType) {
|
|
100
|
-
psbt.updateInput(index, {
|
|
101
|
-
sighashType: 1,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (addressInfo.type === core_1.AddressType.p2sh) {
|
|
106
|
-
if (!input.redeemScript) {
|
|
107
|
-
const pubKey = this.client.account?.publicKey;
|
|
108
|
-
if (pubKey) {
|
|
109
|
-
psbt.updateInput(index, {
|
|
110
|
-
redeemScript: (0, generateRedeemScript_js_1.generateRedeemScript)((0, core_1.hexToUnit8Array)(pubKey)),
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
const inputsToSign = Array.from(psbt.data.inputs
|
|
117
|
-
.reduce((map, input, index) => {
|
|
118
|
-
const accountAddress = input.witnessUtxo
|
|
119
|
-
? bitcoinjs_lib_1.address.fromOutputScript(input.witnessUtxo.script, bitcoinjs_lib_1.networks.bitcoin)
|
|
120
|
-
: this.client.account?.address;
|
|
121
|
-
if (map.has(accountAddress)) {
|
|
122
|
-
map.get(accountAddress).signingIndexes.push(index);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
map.set(accountAddress, {
|
|
126
|
-
address: accountAddress,
|
|
127
|
-
sigHash: 1,
|
|
128
|
-
signingIndexes: [index],
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return map;
|
|
132
|
-
}, new Map())
|
|
133
|
-
.values());
|
|
134
|
-
const signedPsbtHex = await (0, core_1.withTimeout)(() => (0, core_1.signPsbt)(this.client, {
|
|
135
|
-
psbt: psbt.toHex(),
|
|
136
|
-
inputsToSign: inputsToSign,
|
|
137
|
-
finalize: false,
|
|
138
|
-
}), {
|
|
139
|
-
timeout: 600_000,
|
|
140
|
-
errorInstance: new sdk_1.TransactionError(sdk_1.LiFiErrorCode.TransactionExpired, 'Transaction has expired.'),
|
|
141
|
-
});
|
|
142
|
-
const signedPsbt = bitcoinjs_lib_1.Psbt.fromHex(signedPsbtHex);
|
|
143
|
-
if (!(0, isPsbtFinalized_js_1.isPsbtFinalized)(signedPsbt)) {
|
|
144
|
-
signedPsbt.finalizeAllInputs();
|
|
145
|
-
}
|
|
146
|
-
txHex = signedPsbt.extractTransaction().toHex();
|
|
147
|
-
txHash = await publicClient.sendUTXOTransaction({
|
|
148
|
-
hex: txHex,
|
|
149
|
-
});
|
|
150
|
-
process = this.statusManager.updateProcess(step, process.type, 'PENDING', {
|
|
151
|
-
txHash: txHash,
|
|
152
|
-
txLink: `${fromChain.metamask.blockExplorerUrls[0]}tx/${txHash}`,
|
|
153
|
-
txHex,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
let replacementReason;
|
|
157
|
-
const transaction = await (0, core_1.waitForTransaction)(publicClient, {
|
|
158
|
-
txId: txHash,
|
|
159
|
-
txHex,
|
|
160
|
-
senderAddress: this.client.account?.address,
|
|
161
|
-
onReplaced: (response) => {
|
|
162
|
-
replacementReason = response.reason;
|
|
163
|
-
process = this.statusManager.updateProcess(step, process.type, 'PENDING', {
|
|
164
|
-
txHash: response.transaction.txid,
|
|
165
|
-
txLink: `${fromChain.metamask.blockExplorerUrls[0]}tx/${response.transaction.txid}`,
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
if (replacementReason === 'cancelled') {
|
|
170
|
-
throw new sdk_1.TransactionError(sdk_1.LiFiErrorCode.TransactionCanceled, 'User canceled transaction.');
|
|
171
|
-
}
|
|
172
|
-
if (transaction.txid !== txHash) {
|
|
173
|
-
process = this.statusManager.updateProcess(step, process.type, 'PENDING', {
|
|
174
|
-
txHash: transaction.txid,
|
|
175
|
-
txLink: `${fromChain.metamask.blockExplorerUrls[0]}tx/${transaction.txid}`,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
if (isBridgeExecution) {
|
|
179
|
-
process = this.statusManager.updateProcess(step, process.type, 'DONE');
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
catch (e) {
|
|
183
|
-
const error = await (0, parseBitcoinErrors_js_1.parseBitcoinErrors)(e, step, process);
|
|
184
|
-
process = this.statusManager.updateProcess(step, process.type, 'FAILED', {
|
|
185
|
-
error: {
|
|
186
|
-
message: error.cause.message,
|
|
187
|
-
code: error.code,
|
|
188
|
-
},
|
|
189
|
-
});
|
|
190
|
-
this.statusManager.updateExecution(step, 'FAILED');
|
|
191
|
-
throw error;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
await (0, sdk_1.waitForDestinationChainTransaction)(client, step, process, fromChain, toChain, this.statusManager, 10_000);
|
|
195
|
-
return step;
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
exports.BitcoinStepExecutor = BitcoinStepExecutor;
|
|
199
|
-
//# sourceMappingURL=BitcoinStepExecutor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinStepExecutor.js","sourceRoot":"","sources":["../../src/BitcoinStepExecutor.ts"],"names":[],"mappings":";;;AACA,s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core';
|
|
2
|
-
import { BaseStepExecutor, type LiFiStepExtended, type SDKClient, type StepExecutorOptions } from '@lifi/sdk';
|
|
3
|
-
interface BitcoinStepExecutorOptions extends StepExecutorOptions {
|
|
4
|
-
client: Client;
|
|
5
|
-
}
|
|
6
|
-
export declare class BitcoinStepExecutor extends BaseStepExecutor {
|
|
7
|
-
private client;
|
|
8
|
-
constructor(options: BitcoinStepExecutorOptions);
|
|
9
|
-
checkClient: (step: LiFiStepExtended) => void;
|
|
10
|
-
executeStep: (client: SDKClient, step: LiFiStepExtended) => Promise<LiFiStepExtended>;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { AddressType, getAddressInfo, hexToUnit8Array, signPsbt, waitForTransaction, withTimeout, } from '@bigmi/core';
|
|
2
|
-
import * as ecc from '@bitcoinerlab/secp256k1';
|
|
3
|
-
import { BaseStepExecutor, ChainId, checkBalance, getStepTransaction, LiFiErrorCode, stepComparison, TransactionError, waitForDestinationChainTransaction, } from '@lifi/sdk';
|
|
4
|
-
import { address, initEccLib, networks, Psbt } from 'bitcoinjs-lib';
|
|
5
|
-
import { getBitcoinPublicClient } from './client/publicClient.js';
|
|
6
|
-
import { parseBitcoinErrors } from './errors/parseBitcoinErrors.js';
|
|
7
|
-
import { generateRedeemScript } from './utils/generateRedeemScript.js';
|
|
8
|
-
import { isPsbtFinalized } from './utils/isPsbtFinalized.js';
|
|
9
|
-
import { toXOnly } from './utils/toXOnly.js';
|
|
10
|
-
export class BitcoinStepExecutor extends BaseStepExecutor {
|
|
11
|
-
client;
|
|
12
|
-
constructor(options) {
|
|
13
|
-
super(options);
|
|
14
|
-
this.client = options.client;
|
|
15
|
-
}
|
|
16
|
-
checkClient = (step) => {
|
|
17
|
-
// TODO: check chain and possibly implement chain switch?
|
|
18
|
-
// Prevent execution of the quote by wallet different from the one which requested the quote
|
|
19
|
-
if (this.client.account?.address !== step.action.fromAddress) {
|
|
20
|
-
throw new TransactionError(LiFiErrorCode.WalletChangedDuringExecution, 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.');
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
executeStep = async (client, step) => {
|
|
24
|
-
step.execution = this.statusManager.initExecutionObject(step);
|
|
25
|
-
const fromChain = await client.getChainById(step.action.fromChainId);
|
|
26
|
-
const toChain = await client.getChainById(step.action.toChainId);
|
|
27
|
-
const isBridgeExecution = fromChain.id !== toChain.id;
|
|
28
|
-
const currentProcessType = isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP';
|
|
29
|
-
let process = this.statusManager.findOrCreateProcess({
|
|
30
|
-
step,
|
|
31
|
-
type: currentProcessType,
|
|
32
|
-
chainId: fromChain.id,
|
|
33
|
-
});
|
|
34
|
-
const publicClient = await getBitcoinPublicClient(client, ChainId.BTC);
|
|
35
|
-
if (process.status !== 'DONE') {
|
|
36
|
-
try {
|
|
37
|
-
let txHash;
|
|
38
|
-
let txHex;
|
|
39
|
-
if (process.txHash) {
|
|
40
|
-
// Make sure that the chain is still correct
|
|
41
|
-
this.checkClient(step);
|
|
42
|
-
// Wait for exiting transaction
|
|
43
|
-
txHash = process.txHash;
|
|
44
|
-
txHex = process.txHex;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
process = this.statusManager.updateProcess(step, process.type, 'STARTED');
|
|
48
|
-
// Check balance
|
|
49
|
-
await checkBalance(client, this.client.account.address, step);
|
|
50
|
-
// Create new transaction
|
|
51
|
-
if (!step.transactionRequest) {
|
|
52
|
-
// biome-ignore lint/correctness/noUnusedVariables: destructuring
|
|
53
|
-
const { execution, ...stepBase } = step;
|
|
54
|
-
const updatedStep = await getStepTransaction(client, stepBase);
|
|
55
|
-
const comparedStep = await stepComparison(this.statusManager, step, updatedStep, this.allowUserInteraction, this.executionOptions);
|
|
56
|
-
Object.assign(step, {
|
|
57
|
-
...comparedStep,
|
|
58
|
-
execution: step.execution,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (!step.transactionRequest?.data) {
|
|
62
|
-
throw new TransactionError(LiFiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
|
|
63
|
-
}
|
|
64
|
-
process = this.statusManager.updateProcess(step, process.type, 'ACTION_REQUIRED');
|
|
65
|
-
if (!this.allowUserInteraction) {
|
|
66
|
-
return step;
|
|
67
|
-
}
|
|
68
|
-
let transactionRequest = {
|
|
69
|
-
data: step.transactionRequest.data,
|
|
70
|
-
};
|
|
71
|
-
if (this.executionOptions?.updateTransactionRequestHook) {
|
|
72
|
-
const customizedTransactionRequest = await this.executionOptions.updateTransactionRequestHook({
|
|
73
|
-
requestType: 'transaction',
|
|
74
|
-
...transactionRequest,
|
|
75
|
-
});
|
|
76
|
-
transactionRequest = {
|
|
77
|
-
...transactionRequest,
|
|
78
|
-
...customizedTransactionRequest,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
if (!transactionRequest.data) {
|
|
82
|
-
throw new TransactionError(LiFiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
|
|
83
|
-
}
|
|
84
|
-
this.checkClient(step);
|
|
85
|
-
const psbtHex = transactionRequest.data;
|
|
86
|
-
// Initialize ECC library required for Taproot operations
|
|
87
|
-
// https://github.com/bitcoinjs/bitcoinjs-lib?tab=readme-ov-file#using-taproot
|
|
88
|
-
initEccLib(ecc);
|
|
89
|
-
const psbt = Psbt.fromHex(psbtHex, { network: networks.bitcoin });
|
|
90
|
-
psbt.data.inputs.forEach((input, index) => {
|
|
91
|
-
const accountAddress = input.witnessUtxo
|
|
92
|
-
? address.fromOutputScript(input.witnessUtxo.script, networks.bitcoin)
|
|
93
|
-
: this.client.account?.address;
|
|
94
|
-
const addressInfo = getAddressInfo(accountAddress);
|
|
95
|
-
if (addressInfo.type === AddressType.p2tr) {
|
|
96
|
-
// Taproot (P2TR) addresses require specific PSBT fields for proper signing
|
|
97
|
-
// tapInternalKey: Required for Taproot key-path spending
|
|
98
|
-
// Most wallets / libraries usually handle this already
|
|
99
|
-
if (!input.tapInternalKey) {
|
|
100
|
-
const pubKey = this.client.account?.publicKey;
|
|
101
|
-
if (pubKey) {
|
|
102
|
-
const tapInternalKey = toXOnly(hexToUnit8Array(pubKey));
|
|
103
|
-
psbt.updateInput(index, {
|
|
104
|
-
tapInternalKey,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// sighashType: Required by bitcoinjs-lib even though the bitcoin protocol allows defaults
|
|
109
|
-
// check if sighashType is default (0) or not set (undefined)
|
|
110
|
-
if (!input.sighashType) {
|
|
111
|
-
psbt.updateInput(index, {
|
|
112
|
-
sighashType: 1, // Default to Transaction.SIGHASH_ALL - 1
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
// redeemScript: Required by Pay-to-Script-Hash (P2SH) addresses for proper spending
|
|
117
|
-
if (addressInfo.type === AddressType.p2sh) {
|
|
118
|
-
if (!input.redeemScript) {
|
|
119
|
-
const pubKey = this.client.account?.publicKey;
|
|
120
|
-
if (pubKey) {
|
|
121
|
-
psbt.updateInput(index, {
|
|
122
|
-
redeemScript: generateRedeemScript(hexToUnit8Array(pubKey)),
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
const inputsToSign = Array.from(psbt.data.inputs
|
|
129
|
-
.reduce((map, input, index) => {
|
|
130
|
-
const accountAddress = input.witnessUtxo
|
|
131
|
-
? address.fromOutputScript(input.witnessUtxo.script, networks.bitcoin)
|
|
132
|
-
: this.client.account?.address;
|
|
133
|
-
if (map.has(accountAddress)) {
|
|
134
|
-
map.get(accountAddress).signingIndexes.push(index);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
map.set(accountAddress, {
|
|
138
|
-
address: accountAddress,
|
|
139
|
-
sigHash: 1, // Default to Transaction.SIGHASH_ALL - 1
|
|
140
|
-
signingIndexes: [index],
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return map;
|
|
144
|
-
}, new Map())
|
|
145
|
-
.values());
|
|
146
|
-
// We give users 10 minutes to sign the transaction or it should be considered expired
|
|
147
|
-
const signedPsbtHex = await withTimeout(() => signPsbt(this.client, {
|
|
148
|
-
psbt: psbt.toHex(),
|
|
149
|
-
inputsToSign: inputsToSign,
|
|
150
|
-
finalize: false,
|
|
151
|
-
}), {
|
|
152
|
-
timeout: 600_000,
|
|
153
|
-
errorInstance: new TransactionError(LiFiErrorCode.TransactionExpired, 'Transaction has expired.'),
|
|
154
|
-
});
|
|
155
|
-
const signedPsbt = Psbt.fromHex(signedPsbtHex);
|
|
156
|
-
if (!isPsbtFinalized(signedPsbt)) {
|
|
157
|
-
signedPsbt.finalizeAllInputs();
|
|
158
|
-
}
|
|
159
|
-
txHex = signedPsbt.extractTransaction().toHex();
|
|
160
|
-
txHash = await publicClient.sendUTXOTransaction({
|
|
161
|
-
hex: txHex,
|
|
162
|
-
});
|
|
163
|
-
process = this.statusManager.updateProcess(step, process.type, 'PENDING', {
|
|
164
|
-
txHash: txHash,
|
|
165
|
-
txLink: `${fromChain.metamask.blockExplorerUrls[0]}tx/${txHash}`,
|
|
166
|
-
txHex,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
let replacementReason;
|
|
170
|
-
const transaction = await waitForTransaction(publicClient, {
|
|
171
|
-
txId: txHash,
|
|
172
|
-
txHex,
|
|
173
|
-
senderAddress: this.client.account?.address,
|
|
174
|
-
onReplaced: (response) => {
|
|
175
|
-
replacementReason = response.reason;
|
|
176
|
-
process = this.statusManager.updateProcess(step, process.type, 'PENDING', {
|
|
177
|
-
txHash: response.transaction.txid,
|
|
178
|
-
txLink: `${fromChain.metamask.blockExplorerUrls[0]}tx/${response.transaction.txid}`,
|
|
179
|
-
});
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
if (replacementReason === 'cancelled') {
|
|
183
|
-
throw new TransactionError(LiFiErrorCode.TransactionCanceled, 'User canceled transaction.');
|
|
184
|
-
}
|
|
185
|
-
if (transaction.txid !== txHash) {
|
|
186
|
-
process = this.statusManager.updateProcess(step, process.type, 'PENDING', {
|
|
187
|
-
txHash: transaction.txid,
|
|
188
|
-
txLink: `${fromChain.metamask.blockExplorerUrls[0]}tx/${transaction.txid}`,
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
if (isBridgeExecution) {
|
|
192
|
-
process = this.statusManager.updateProcess(step, process.type, 'DONE');
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
catch (e) {
|
|
196
|
-
const error = await parseBitcoinErrors(e, step, process);
|
|
197
|
-
process = this.statusManager.updateProcess(step, process.type, 'FAILED', {
|
|
198
|
-
error: {
|
|
199
|
-
message: error.cause.message,
|
|
200
|
-
code: error.code,
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
this.statusManager.updateExecution(step, 'FAILED');
|
|
204
|
-
throw error;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
await waitForDestinationChainTransaction(client, step, process, fromChain, toChain, this.statusManager, 10_000);
|
|
208
|
-
// DONE
|
|
209
|
-
return step;
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
//# sourceMappingURL=BitcoinStepExecutor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinStepExecutor.js","sourceRoot":"","sources":["../../src/BitcoinStepExecutor.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,WAAW,GACZ,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAA;AAC9C,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,aAAa,EAIb,cAAc,EACd,gBAAgB,EAEhB,kCAAkC,GACnC,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAA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AAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;gBAClD,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;QAED,MAAM,kCAAkC,CACtC,MAAM,EACN,IAAI,EACJ,OAAO,EACP,SAAS,EACT,OAAO,EACP,IAAI,CAAC,aAAa,EAClB,MAAM,CACP,CAAA;QAED,OAAO;QACP,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;CACF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Client } from '@bigmi/core';
|
|
2
|
-
import { BaseStepExecutor, type LiFiStepExtended, type SDKClient, type StepExecutorOptions } from '@lifi/sdk';
|
|
3
|
-
interface BitcoinStepExecutorOptions extends StepExecutorOptions {
|
|
4
|
-
client: Client;
|
|
5
|
-
}
|
|
6
|
-
export declare class BitcoinStepExecutor extends BaseStepExecutor {
|
|
7
|
-
private client;
|
|
8
|
-
constructor(options: BitcoinStepExecutorOptions);
|
|
9
|
-
checkClient: (step: LiFiStepExtended) => void;
|
|
10
|
-
executeStep: (client: SDKClient, step: LiFiStepExtended) => Promise<LiFiStepExtended>;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=BitcoinStepExecutor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinStepExecutor.d.ts","sourceRoot":"","sources":["../../src/BitcoinStepExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AAU5D,OAAO,EACL,gBAAgB,EAKhB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,mBAAmB,EAKzB,MAAM,WAAW,CAAA;AAQlB,UAAU,0BAA2B,SAAQ,mBAAmB;IAC9D,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,OAAO,CAAC,MAAM,CAAQ;gBAEV,OAAO,EAAE,0BAA0B;IAK/C,WAAW,GAAI,MAAM,gBAAgB,UASpC;IAED,WAAW,GACT,QAAQ,SAAS,EACjB,MAAM,gBAAgB,KACrB,OAAO,CAAC,gBAAgB,CAAC,CA6R3B;CACF"}
|