@lifi/sdk-provider-bitcoin 4.0.0-alpha.21 → 4.0.0-alpha.23
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.d.ts +7 -2
- package/dist/cjs/BitcoinProvider.js +31 -34
- package/dist/cjs/BitcoinProvider.js.map +1 -1
- package/dist/cjs/_virtual/_rolldown/runtime.js +23 -0
- package/dist/cjs/actions/getBitcoinBalance.d.ts +7 -2
- package/dist/cjs/actions/getBitcoinBalance.js +17 -24
- package/dist/cjs/actions/getBitcoinBalance.js.map +1 -1
- package/dist/cjs/actions/resolveBitcoinAddress.d.ts +5 -1
- package/dist/cjs/actions/resolveBitcoinAddress.js +6 -4
- package/dist/cjs/actions/resolveBitcoinAddress.js.map +1 -1
- package/dist/cjs/client/publicClient.d.ts +15 -4
- package/dist/cjs/client/publicClient.js +39 -42
- package/dist/cjs/client/publicClient.js.map +1 -1
- package/dist/cjs/core/BitcoinStepExecutor.d.ts +16 -12
- package/dist/cjs/core/BitcoinStepExecutor.js +46 -51
- package/dist/cjs/core/BitcoinStepExecutor.js.map +1 -1
- package/dist/cjs/core/tasks/BitcoinSignAndExecuteTask.d.ts +9 -4
- package/dist/cjs/core/tasks/BitcoinSignAndExecuteTask.js +73 -99
- package/dist/cjs/core/tasks/BitcoinSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/BitcoinWaitForTransactionTask.d.ts +9 -4
- package/dist/cjs/core/tasks/BitcoinWaitForTransactionTask.js +37 -43
- package/dist/cjs/core/tasks/BitcoinWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/errors/parseBitcoinErrors.d.ts +7 -2
- package/dist/cjs/errors/parseBitcoinErrors.js +18 -26
- package/dist/cjs/errors/parseBitcoinErrors.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +5 -8
- package/dist/cjs/types.d.ts +17 -12
- package/dist/cjs/types.js +8 -5
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/generateRedeemScript.d.ts +10 -1
- package/dist/cjs/utils/generateRedeemScript.js +12 -5
- package/dist/cjs/utils/generateRedeemScript.js.map +1 -1
- package/dist/cjs/utils/isPsbtFinalized.d.ts +7 -2
- package/dist/cjs/utils/isPsbtFinalized.js +11 -10
- package/dist/cjs/utils/isPsbtFinalized.js.map +1 -1
- package/dist/cjs/utils/toBigmiChainId.d.ts +8 -3
- package/dist/cjs/utils/toBigmiChainId.js +11 -11
- package/dist/cjs/utils/toBigmiChainId.js.map +1 -1
- package/dist/cjs/utils/toXOnly.d.ts +5 -1
- package/dist/cjs/utils/toXOnly.js +4 -3
- package/dist/cjs/utils/toXOnly.js.map +1 -1
- package/dist/cjs/version.d.ts +6 -2
- package/dist/cjs/version.js +8 -5
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/BitcoinProvider.d.ts +7 -2
- package/dist/esm/BitcoinProvider.d.ts.map +1 -0
- package/dist/esm/BitcoinProvider.js +30 -32
- package/dist/esm/BitcoinProvider.js.map +1 -1
- package/dist/esm/actions/getBitcoinBalance.d.ts +7 -2
- package/dist/esm/actions/getBitcoinBalance.d.ts.map +1 -0
- package/dist/esm/actions/getBitcoinBalance.js +17 -22
- package/dist/esm/actions/getBitcoinBalance.js.map +1 -1
- package/dist/esm/actions/resolveBitcoinAddress.d.ts +5 -1
- package/dist/esm/actions/resolveBitcoinAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveBitcoinAddress.js +6 -3
- package/dist/esm/actions/resolveBitcoinAddress.js.map +1 -1
- package/dist/esm/client/publicClient.d.ts +14 -9
- package/dist/esm/client/publicClient.d.ts.map +1 -0
- package/dist/esm/client/publicClient.js +38 -46
- package/dist/esm/client/publicClient.js.map +1 -1
- package/dist/esm/core/BitcoinStepExecutor.d.ts +16 -12
- package/dist/esm/core/BitcoinStepExecutor.d.ts.map +1 -0
- package/dist/esm/core/BitcoinStepExecutor.js +45 -50
- package/dist/esm/core/BitcoinStepExecutor.js.map +1 -1
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.d.ts +9 -4
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.js +71 -105
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.d.ts +9 -4
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.js +36 -40
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.js.map +1 -1
- package/dist/esm/errors/parseBitcoinErrors.d.ts +7 -2
- package/dist/esm/errors/parseBitcoinErrors.d.ts.map +1 -0
- package/dist/esm/errors/parseBitcoinErrors.js +17 -24
- package/dist/esm/errors/parseBitcoinErrors.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +3 -4
- package/dist/esm/package.json +1 -1
- package/dist/esm/types.d.ts +17 -12
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +7 -3
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/generateRedeemScript.d.ts +9 -5
- package/dist/esm/utils/generateRedeemScript.d.ts.map +1 -0
- package/dist/esm/utils/generateRedeemScript.js +10 -8
- package/dist/esm/utils/generateRedeemScript.js.map +1 -1
- package/dist/esm/utils/isPsbtFinalized.d.ts +7 -2
- package/dist/esm/utils/isPsbtFinalized.d.ts.map +1 -0
- package/dist/esm/utils/isPsbtFinalized.js +11 -8
- package/dist/esm/utils/isPsbtFinalized.js.map +1 -1
- package/dist/esm/utils/toBigmiChainId.d.ts +8 -3
- package/dist/esm/utils/toBigmiChainId.d.ts.map +1 -0
- package/dist/esm/utils/toBigmiChainId.js +11 -9
- package/dist/esm/utils/toBigmiChainId.js.map +1 -1
- package/dist/esm/utils/toXOnly.d.ts +5 -1
- package/dist/esm/utils/toXOnly.d.ts.map +1 -0
- package/dist/esm/utils/toXOnly.js +5 -2
- package/dist/esm/utils/toXOnly.js.map +1 -1
- package/dist/esm/version.d.ts +6 -2
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +6 -2
- package/dist/esm/version.js.map +1 -1
- package/package.json +6 -6
- package/src/core/BitcoinStepExecutor.ts +4 -2
- package/src/utils/generateRedeemScript.ts +3 -1
- package/src/utils/toXOnly.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/types/BitcoinProvider.d.ts +0 -3
- package/dist/types/BitcoinProvider.d.ts.map +0 -1
- package/dist/types/actions/getBitcoinBalance.d.ts +0 -3
- package/dist/types/actions/getBitcoinBalance.d.ts.map +0 -1
- package/dist/types/actions/resolveBitcoinAddress.d.ts +0 -2
- package/dist/types/actions/resolveBitcoinAddress.d.ts.map +0 -1
- package/dist/types/client/publicClient.d.ts +0 -11
- package/dist/types/client/publicClient.d.ts.map +0 -1
- package/dist/types/core/BitcoinStepExecutor.d.ts +0 -16
- package/dist/types/core/BitcoinStepExecutor.d.ts.map +0 -1
- package/dist/types/core/tasks/BitcoinSignAndExecuteTask.d.ts +0 -6
- package/dist/types/core/tasks/BitcoinSignAndExecuteTask.d.ts.map +0 -1
- package/dist/types/core/tasks/BitcoinWaitForTransactionTask.d.ts +0 -6
- package/dist/types/core/tasks/BitcoinWaitForTransactionTask.d.ts.map +0 -1
- package/dist/types/errors/parseBitcoinErrors.d.ts +0 -3
- package/dist/types/errors/parseBitcoinErrors.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -16
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/utils/generateRedeemScript.d.ts +0 -7
- package/dist/types/utils/generateRedeemScript.d.ts.map +0 -1
- package/dist/types/utils/isPsbtFinalized.d.ts +0 -3
- package/dist/types/utils/isPsbtFinalized.d.ts.map +0 -1
- package/dist/types/utils/toBigmiChainId.d.ts +0 -4
- package/dist/types/utils/toBigmiChainId.d.ts.map +0 -1
- package/dist/types/utils/toXOnly.d.ts +0 -2
- package/dist/types/utils/toXOnly.d.ts.map +0 -1
- package/dist/types/version.d.ts +0 -3
- package/dist/types/version.d.ts.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../_virtual/_rolldown/runtime.js");
|
|
3
|
+
let _bigmi_core = require("@bigmi/core");
|
|
4
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
5
|
+
//#region src/utils/toBigmiChainId.ts
|
|
6
6
|
const toBigmiChainId = (chainId) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
throw new Error(`Unsupported chainId mapping: ${chainId}`);
|
|
12
|
-
}
|
|
7
|
+
switch (chainId) {
|
|
8
|
+
case _lifi_sdk.ChainId.BTC: return _bigmi_core.ChainId.BITCOIN_MAINNET;
|
|
9
|
+
default: throw new Error(`Unsupported chainId mapping: ${chainId}`);
|
|
10
|
+
}
|
|
13
11
|
};
|
|
12
|
+
//#endregion
|
|
14
13
|
exports.toBigmiChainId = toBigmiChainId;
|
|
14
|
+
|
|
15
15
|
//# sourceMappingURL=toBigmiChainId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toBigmiChainId.js","
|
|
1
|
+
{"version":3,"file":"toBigmiChainId.js","names":["ChainId","BigmiChainId"],"sources":["../../../src/utils/toBigmiChainId.ts"],"sourcesContent":["import { ChainId as BigmiChainId } from '@bigmi/core'\nimport { ChainId } from '@lifi/sdk'\n\nexport const toBigmiChainId = (chainId: ChainId): BigmiChainId => {\n switch (chainId) {\n case ChainId.BTC:\n return BigmiChainId.BITCOIN_MAINNET\n default:\n throw new Error(`Unsupported chainId mapping: ${chainId}`)\n }\n}\n"],"mappings":";;;;;AAGA,MAAa,kBAAkB,YAAmC;AAChE,SAAQ,SAAR;EACE,KAAKA,UAAAA,QAAQ,IACX,QAAOC,YAAAA,QAAa;EACtB,QACE,OAAM,IAAI,MAAM,gCAAgC,UAAU"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.toXOnly = void 0;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/utils/toXOnly.ts
|
|
4
3
|
const toXOnly = (pubKey) => pubKey.length === 32 ? pubKey : pubKey.subarray(1, 33);
|
|
4
|
+
//#endregion
|
|
5
5
|
exports.toXOnly = toXOnly;
|
|
6
|
+
|
|
6
7
|
//# sourceMappingURL=toXOnly.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toXOnly.js","
|
|
1
|
+
{"version":3,"file":"toXOnly.js","names":[],"sources":["../../../src/utils/toXOnly.ts"],"sourcesContent":["// helper function to convert full public key (33 bytes) to x-only compressed format (32 bytes) required after taproot update\nexport const toXOnly = (pubKey: Uint8Array): Uint8Array =>\n pubKey.length === 32 ? pubKey : pubKey.subarray(1, 33)\n"],"mappings":";;AACA,MAAa,WAAW,WACtB,OAAO,WAAW,KAAK,SAAS,OAAO,SAAS,GAAG,GAAG"}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/version.d.ts
|
|
2
|
+
declare const name = "@lifi/sdk-provider-bitcoin";
|
|
3
|
+
declare const version = "4.0.0-alpha.23";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { name, version };
|
|
6
|
+
//# sourceMappingURL=version.d.ts.map
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/version.ts
|
|
3
|
+
const name = "@lifi/sdk-provider-bitcoin";
|
|
4
|
+
const version = "4.0.0-alpha.23";
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.name = name;
|
|
7
|
+
exports.version = version;
|
|
8
|
+
|
|
6
9
|
//# sourceMappingURL=version.js.map
|
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-bitcoin'\nexport const version = '4.0.0-alpha.23'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { BitcoinProviderOptions, BitcoinSDKProvider } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/BitcoinProvider.d.ts
|
|
4
|
+
declare function BitcoinProvider(options?: BitcoinProviderOptions): BitcoinSDKProvider;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { BitcoinProvider };
|
|
7
|
+
//# sourceMappingURL=BitcoinProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitcoinProvider.d.ts","names":[],"sources":["../../src/BitcoinProvider.ts"],"mappings":";;;iBAOgB,eAAA,CACd,OAAA,GAAU,sBAAA,GACT,kBAAA"}
|
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
setOptions(options) {
|
|
30
|
-
Object.assign(_options, options);
|
|
31
|
-
},
|
|
32
|
-
};
|
|
1
|
+
import { getBitcoinBalance } from "./actions/getBitcoinBalance.js";
|
|
2
|
+
import { resolveBitcoinAddress } from "./actions/resolveBitcoinAddress.js";
|
|
3
|
+
import { BitcoinStepExecutor } from "./core/BitcoinStepExecutor.js";
|
|
4
|
+
import { isUTXOAddress } from "@bigmi/core";
|
|
5
|
+
import { ChainType } from "@lifi/sdk";
|
|
6
|
+
//#region src/BitcoinProvider.ts
|
|
7
|
+
function BitcoinProvider(options) {
|
|
8
|
+
const _options = options ?? {};
|
|
9
|
+
return {
|
|
10
|
+
get type() {
|
|
11
|
+
return ChainType.UTXO;
|
|
12
|
+
},
|
|
13
|
+
isAddress: isUTXOAddress,
|
|
14
|
+
resolveAddress: resolveBitcoinAddress,
|
|
15
|
+
getBalance: getBitcoinBalance,
|
|
16
|
+
async getStepExecutor(options) {
|
|
17
|
+
if (!_options.getWalletClient) throw new Error("Client is not provided.");
|
|
18
|
+
return new BitcoinStepExecutor({
|
|
19
|
+
client: await _options.getWalletClient(),
|
|
20
|
+
routeId: options.routeId,
|
|
21
|
+
executionOptions: { ...options.executionOptions }
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
setOptions(options) {
|
|
25
|
+
Object.assign(_options, options);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
33
28
|
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { BitcoinProvider };
|
|
31
|
+
|
|
34
32
|
//# sourceMappingURL=BitcoinProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinProvider.js","
|
|
1
|
+
{"version":3,"file":"BitcoinProvider.js","names":[],"sources":["../../src/BitcoinProvider.ts"],"sourcesContent":["import { isUTXOAddress } from '@bigmi/core'\nimport { ChainType, type StepExecutorOptions } from '@lifi/sdk'\nimport { getBitcoinBalance } from './actions/getBitcoinBalance.js'\nimport { resolveBitcoinAddress } from './actions/resolveBitcoinAddress.js'\nimport { BitcoinStepExecutor } from './core/BitcoinStepExecutor.js'\nimport type { BitcoinProviderOptions, BitcoinSDKProvider } from './types.js'\n\nexport function BitcoinProvider(\n options?: BitcoinProviderOptions\n): BitcoinSDKProvider {\n const _options: BitcoinProviderOptions = options ?? {}\n return {\n get type() {\n return ChainType.UTXO\n },\n isAddress: isUTXOAddress,\n resolveAddress: resolveBitcoinAddress,\n getBalance: getBitcoinBalance,\n async getStepExecutor(\n options: StepExecutorOptions\n ): Promise<BitcoinStepExecutor> {\n if (!_options.getWalletClient) {\n throw new Error('Client is not provided.')\n }\n\n const walletClient = await _options.getWalletClient()\n\n const executor = new BitcoinStepExecutor({\n client: walletClient,\n routeId: options.routeId,\n executionOptions: {\n ...options.executionOptions,\n },\n })\n\n return executor\n },\n setOptions(options: BitcoinProviderOptions) {\n Object.assign(_options, options)\n },\n }\n}\n"],"mappings":";;;;;;AAOA,SAAgB,gBACd,SACoB;CACpB,MAAM,WAAmC,WAAW,EAAE;AACtD,QAAO;EACL,IAAI,OAAO;AACT,UAAO,UAAU;;EAEnB,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,MAAM,gBACJ,SAC8B;AAC9B,OAAI,CAAC,SAAS,gBACZ,OAAM,IAAI,MAAM,0BAA0B;AAa5C,UARiB,IAAI,oBAAoB;IACvC,QAHmB,MAAM,SAAS,iBAAiB;IAInD,SAAS,QAAQ;IACjB,kBAAkB,EAChB,GAAG,QAAQ,kBACZ;IACF,CAAC;;EAIJ,WAAW,SAAiC;AAC1C,UAAO,OAAO,UAAU,QAAQ;;EAEnC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { SDKClient, Token, TokenAmount } from "@lifi/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/actions/getBitcoinBalance.d.ts
|
|
4
|
+
declare const getBitcoinBalance: (client: SDKClient, walletAddress: string, tokens: Token[]) => Promise<TokenAmount[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getBitcoinBalance };
|
|
7
|
+
//# sourceMappingURL=getBitcoinBalance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBitcoinBalance.d.ts","names":[],"sources":["../../../src/actions/getBitcoinBalance.ts"],"mappings":";;;cAQa,iBAAA,GACX,MAAA,EAAQ,SAAA,EACR,aAAA,UACA,MAAA,EAAQ,KAAA,OACP,OAAA,CAAQ,WAAA"}
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
bigmiClient.getBalance({ address: walletAddress }),
|
|
16
|
-
bigmiClient.getBlockCount(),
|
|
17
|
-
]);
|
|
18
|
-
return tokens.map((token) => ({
|
|
19
|
-
...token,
|
|
20
|
-
amount: balance,
|
|
21
|
-
blockNumber: BigInt(blockCount),
|
|
22
|
-
}));
|
|
1
|
+
import { getBitcoinPublicClient } from "../client/publicClient.js";
|
|
2
|
+
import { ChainId } from "@lifi/sdk";
|
|
3
|
+
//#region src/actions/getBitcoinBalance.ts
|
|
4
|
+
const getBitcoinBalance = async (client, walletAddress, tokens) => {
|
|
5
|
+
if (tokens.length === 0) return [];
|
|
6
|
+
const { chainId } = tokens[0];
|
|
7
|
+
for (const token of tokens) if (token.chainId !== chainId) console.warn("Requested tokens have to be on the same chain.");
|
|
8
|
+
const bigmiClient = await getBitcoinPublicClient(client, ChainId.BTC);
|
|
9
|
+
const [balance, blockCount] = await Promise.all([bigmiClient.getBalance({ address: walletAddress }), bigmiClient.getBlockCount()]);
|
|
10
|
+
return tokens.map((token) => ({
|
|
11
|
+
...token,
|
|
12
|
+
amount: balance,
|
|
13
|
+
blockNumber: BigInt(blockCount)
|
|
14
|
+
}));
|
|
23
15
|
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { getBitcoinBalance };
|
|
18
|
+
|
|
24
19
|
//# sourceMappingURL=getBitcoinBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBitcoinBalance.js","
|
|
1
|
+
{"version":3,"file":"getBitcoinBalance.js","names":[],"sources":["../../../src/actions/getBitcoinBalance.ts"],"sourcesContent":["import {\n ChainId,\n type SDKClient,\n type Token,\n type TokenAmount,\n} from '@lifi/sdk'\nimport { getBitcoinPublicClient } from '../client/publicClient.js'\n\nexport const getBitcoinBalance = async (\n client: SDKClient,\n walletAddress: string,\n tokens: Token[]\n): Promise<TokenAmount[]> => {\n if (tokens.length === 0) {\n return []\n }\n const { chainId } = tokens[0]\n for (const token of tokens) {\n if (token.chainId !== chainId) {\n console.warn('Requested tokens have to be on the same chain.')\n }\n }\n const bigmiClient = await getBitcoinPublicClient(client, ChainId.BTC)\n const [balance, blockCount] = await Promise.all([\n bigmiClient.getBalance({ address: walletAddress }),\n bigmiClient.getBlockCount(),\n ])\n\n return tokens.map((token) => ({\n ...token,\n amount: balance,\n blockNumber: BigInt(blockCount),\n }))\n}\n"],"mappings":";;;AAQA,MAAa,oBAAoB,OAC/B,QACA,eACA,WAC2B;AAC3B,KAAI,OAAO,WAAW,EACpB,QAAO,EAAE;CAEX,MAAM,EAAE,YAAY,OAAO;AAC3B,MAAK,MAAM,SAAS,OAClB,KAAI,MAAM,YAAY,QACpB,SAAQ,KAAK,iDAAiD;CAGlE,MAAM,cAAc,MAAM,uBAAuB,QAAQ,QAAQ,IAAI;CACrE,MAAM,CAAC,SAAS,cAAc,MAAM,QAAQ,IAAI,CAC9C,YAAY,WAAW,EAAE,SAAS,eAAe,CAAC,EAClD,YAAY,eAAe,CAC5B,CAAC;AAEF,QAAO,OAAO,KAAK,WAAW;EAC5B,GAAG;EACH,QAAQ;EACR,aAAa,OAAO,WAAW;EAChC,EAAE"}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/actions/resolveBitcoinAddress.d.ts
|
|
2
|
+
declare function resolveBitcoinAddress(name: string): Promise<string | undefined>;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { resolveBitcoinAddress };
|
|
5
|
+
//# sourceMappingURL=resolveBitcoinAddress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBitcoinAddress.d.ts","names":[],"sources":["../../../src/actions/resolveBitcoinAddress.ts"],"mappings":";iBAAsB,qBAAA,CACpB,IAAA,WACC,OAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/actions/resolveBitcoinAddress.ts
|
|
2
|
+
async function resolveBitcoinAddress(name) {
|
|
3
|
+
return name;
|
|
4
4
|
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { resolveBitcoinAddress };
|
|
7
|
+
|
|
5
8
|
//# sourceMappingURL=resolveBitcoinAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveBitcoinAddress.js","
|
|
1
|
+
{"version":3,"file":"resolveBitcoinAddress.js","names":[],"sources":["../../../src/actions/resolveBitcoinAddress.ts"],"sourcesContent":["export async function resolveBitcoinAddress(\n name: string\n): Promise<string | undefined> {\n // Not supported on UTXO yet\n return name\n}\n"],"mappings":";AAAA,eAAsB,sBACpB,MAC6B;AAE7B,QAAO"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { Account, Chain, Client, FallbackTransport, HttpTransport, PublicActions, UTXOSchema, WalletActions } from "@bigmi/core";
|
|
2
|
+
import { SDKClient } from "@lifi/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/client/publicClient.d.ts
|
|
5
|
+
type PublicClient = Client<FallbackTransport<readonly HttpTransport[]>, Chain, Account | undefined, UTXOSchema, PublicActions & WalletActions>;
|
|
4
6
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
* Get an instance of a provider for a specific chain
|
|
8
|
+
* @param client - The SDK client
|
|
9
|
+
* @param chainId - Id of the chain the provider is for
|
|
10
|
+
* @returns The public client for the given chain
|
|
11
|
+
*/
|
|
12
|
+
declare const getBitcoinPublicClient: (client: SDKClient, chainId: number) => Promise<PublicClient>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { PublicClient, getBitcoinPublicClient };
|
|
15
|
+
//# sourceMappingURL=publicClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicClient.d.ts","names":[],"sources":["../../../src/client/publicClient.ts"],"mappings":";;;;KAsBY,YAAA,GAAe,MAAA,CACzB,iBAAA,UAA2B,aAAA,KAC3B,KAAA,EACA,OAAA,cACA,UAAA,EACA,aAAA,GAAgB,aAAA;;AALlB;;;;;cAiBa,sBAAA,GACX,MAAA,EAAQ,SAAA,EACR,OAAA,aACC,OAAA,CAAQ,YAAA"}
|
|
@@ -1,50 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { toBigmiChainId } from "../utils/toBigmiChainId.js";
|
|
2
|
+
import { blockchair, blockcypher, createClient, fallback, http, mempool, publicActions, rpcSchema, walletActions } from "@bigmi/core";
|
|
3
|
+
//#region src/client/publicClient.ts
|
|
4
4
|
const publicClients = {};
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
]),
|
|
39
|
-
pollingInterval: 10_000,
|
|
40
|
-
})
|
|
41
|
-
.extend(publicActions)
|
|
42
|
-
.extend(walletActions);
|
|
43
|
-
publicClients[chainId] = bigmiClient;
|
|
44
|
-
}
|
|
45
|
-
if (!publicClients[chainId]) {
|
|
46
|
-
throw new Error(`Unable to configure provider for chain ${chainId}`);
|
|
47
|
-
}
|
|
48
|
-
return publicClients[chainId];
|
|
6
|
+
* Get an instance of a provider for a specific chain
|
|
7
|
+
* @param client - The SDK client
|
|
8
|
+
* @param chainId - Id of the chain the provider is for
|
|
9
|
+
* @returns The public client for the given chain
|
|
10
|
+
*/
|
|
11
|
+
const getBitcoinPublicClient = async (client, chainId) => {
|
|
12
|
+
if (!publicClients[chainId]) {
|
|
13
|
+
const fallbackTransports = (await client.getRpcUrlsByChainId(chainId)).map((url) => http(url, { fetchOptions: { method: "POST" } }));
|
|
14
|
+
const _chain = await client.getChainById(chainId);
|
|
15
|
+
publicClients[chainId] = createClient({
|
|
16
|
+
chain: {
|
|
17
|
+
..._chain,
|
|
18
|
+
..._chain.metamask,
|
|
19
|
+
id: toBigmiChainId(_chain.id),
|
|
20
|
+
name: _chain.metamask.chainName,
|
|
21
|
+
rpcUrls: {
|
|
22
|
+
default: { http: _chain.metamask.rpcUrls },
|
|
23
|
+
public: { http: _chain.metamask.rpcUrls }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
rpcSchema: rpcSchema(),
|
|
27
|
+
transport: fallback([
|
|
28
|
+
blockchair(),
|
|
29
|
+
blockcypher(),
|
|
30
|
+
mempool(),
|
|
31
|
+
...fallbackTransports
|
|
32
|
+
]),
|
|
33
|
+
pollingInterval: 1e4
|
|
34
|
+
}).extend(publicActions).extend(walletActions);
|
|
35
|
+
}
|
|
36
|
+
if (!publicClients[chainId]) throw new Error(`Unable to configure provider for chain ${chainId}`);
|
|
37
|
+
return publicClients[chainId];
|
|
49
38
|
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { getBitcoinPublicClient };
|
|
41
|
+
|
|
50
42
|
//# sourceMappingURL=publicClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicClient.js","
|
|
1
|
+
{"version":3,"file":"publicClient.js","names":[],"sources":["../../../src/client/publicClient.ts"],"sourcesContent":["import {\n type Account,\n blockchair,\n blockcypher,\n type Chain,\n type Client,\n createClient,\n type FallbackTransport,\n fallback,\n type HttpTransport,\n http,\n mempool,\n type PublicActions,\n publicActions,\n rpcSchema,\n type UTXOSchema,\n type WalletActions,\n walletActions,\n} from '@bigmi/core'\nimport type { SDKClient } from '@lifi/sdk'\nimport { toBigmiChainId } from '../utils/toBigmiChainId.js'\n\nexport type PublicClient = Client<\n FallbackTransport<readonly HttpTransport[]>,\n Chain,\n Account | undefined,\n UTXOSchema,\n PublicActions & WalletActions\n>\n\n// cached providers\nconst publicClients: Record<number, PublicClient> = {}\n\n/**\n * Get an instance of a provider for a specific chain\n * @param client - The SDK client\n * @param chainId - Id of the chain the provider is for\n * @returns The public client for the given chain\n */\nexport const getBitcoinPublicClient = async (\n client: SDKClient,\n chainId: number\n): Promise<PublicClient> => {\n if (!publicClients[chainId]) {\n const urls = await client.getRpcUrlsByChainId(chainId)\n const fallbackTransports = urls.map((url) =>\n http(url, {\n fetchOptions: {\n method: 'POST',\n },\n })\n )\n const _chain = await client.getChainById(chainId)\n const chain: Chain = {\n ..._chain,\n ..._chain.metamask,\n id: toBigmiChainId(_chain.id),\n name: _chain.metamask.chainName,\n rpcUrls: {\n default: { http: _chain.metamask.rpcUrls },\n public: { http: _chain.metamask.rpcUrls },\n },\n }\n const bigmiClient = createClient({\n chain,\n rpcSchema: rpcSchema<UTXOSchema>(),\n transport: fallback([\n blockchair(),\n blockcypher(),\n mempool(),\n ...fallbackTransports,\n ]),\n pollingInterval: 10_000,\n })\n .extend(publicActions)\n .extend(walletActions)\n publicClients[chainId] = bigmiClient\n }\n\n if (!publicClients[chainId]) {\n throw new Error(`Unable to configure provider for chain ${chainId}`)\n }\n\n return publicClients[chainId]\n}\n"],"mappings":";;;AA+BA,MAAM,gBAA8C,EAAE;;;;;;;AAQtD,MAAa,yBAAyB,OACpC,QACA,YAC0B;AAC1B,KAAI,CAAC,cAAc,UAAU;EAE3B,MAAM,sBADO,MAAM,OAAO,oBAAoB,QAAQ,EACtB,KAAK,QACnC,KAAK,KAAK,EACR,cAAc,EACZ,QAAQ,QACT,EACF,CAAC,CACH;EACD,MAAM,SAAS,MAAM,OAAO,aAAa,QAAQ;AAwBjD,gBAAc,WAbM,aAAa;GAC/B,OAXmB;IACnB,GAAG;IACH,GAAG,OAAO;IACV,IAAI,eAAe,OAAO,GAAG;IAC7B,MAAM,OAAO,SAAS;IACtB,SAAS;KACP,SAAS,EAAE,MAAM,OAAO,SAAS,SAAS;KAC1C,QAAQ,EAAE,MAAM,OAAO,SAAS,SAAS;KAC1C;IACF;GAGC,WAAW,WAAuB;GAClC,WAAW,SAAS;IAClB,YAAY;IACZ,aAAa;IACb,SAAS;IACT,GAAG;IACJ,CAAC;GACF,iBAAiB;GAClB,CAAC,CACC,OAAO,cAAc,CACrB,OAAO,cAAc;;AAI1B,KAAI,CAAC,cAAc,SACjB,OAAM,IAAI,MAAM,0CAA0C,UAAU;AAGtE,QAAO,cAAc"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { BitcoinStepExecutorContext } from "../types.js";
|
|
2
|
+
import { Client } from "@bigmi/core";
|
|
3
|
+
import { BaseStepExecutor, ExecutionAction, LiFiStepExtended, SDKError, StepExecutorBaseContext, StepExecutorOptions, TaskPipeline } from "@lifi/sdk";
|
|
4
|
+
|
|
5
|
+
//#region src/core/BitcoinStepExecutor.d.ts
|
|
4
6
|
interface BitcoinStepExecutorOptions extends StepExecutorOptions {
|
|
5
|
-
|
|
7
|
+
client: Client;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
declare class BitcoinStepExecutor extends BaseStepExecutor {
|
|
10
|
+
private client;
|
|
11
|
+
constructor(options: BitcoinStepExecutorOptions);
|
|
12
|
+
checkClient: (step: LiFiStepExtended) => void;
|
|
13
|
+
override createPipeline: (context: BitcoinStepExecutorContext) => TaskPipeline;
|
|
14
|
+
override parseErrors: (error: Error, step?: LiFiStepExtended, action?: ExecutionAction) => Promise<SDKError>;
|
|
15
|
+
override createContext: (baseContext: StepExecutorBaseContext) => Promise<BitcoinStepExecutorContext>;
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
export { BitcoinStepExecutor };
|
|
19
|
+
//# sourceMappingURL=BitcoinStepExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitcoinStepExecutor.d.ts","names":[],"sources":["../../../src/core/BitcoinStepExecutor.ts"],"mappings":";;;;;UAqBU,0BAAA,SAAmC,mBAAA;EAC3C,MAAA,EAAQ,MAAA;AAAA;AAAA,cAGG,mBAAA,SAA4B,gBAAA;EAAA,QAC/B,MAAA;EAER,WAAA,CAAY,OAAA,EAAS,0BAAA;EAKrB,WAAA,GAAe,IAAA,EAAM,gBAAA;EAAA,SAWZ,cAAA,GACP,OAAA,EAAS,0BAAA,KACR,YAAA;EAAA,SAgCM,WAAA,GACP,KAAA,EAAO,KAAA,EACP,IAAA,GAAO,gBAAA,EACP,MAAA,GAAS,eAAA,KACR,OAAA,CAAQ,QAAA;EAAA,SAEF,aAAA,GACP,WAAA,EAAa,uBAAA,KACZ,OAAA,CAAQ,0BAAA;AAAA"}
|
|
@@ -1,51 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
walletClient: this.client,
|
|
47
|
-
publicClient,
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
}
|
|
1
|
+
import { getBitcoinPublicClient } from "../client/publicClient.js";
|
|
2
|
+
import { parseBitcoinErrors } from "../errors/parseBitcoinErrors.js";
|
|
3
|
+
import { BitcoinSignAndExecuteTask } from "./tasks/BitcoinSignAndExecuteTask.js";
|
|
4
|
+
import { BitcoinWaitForTransactionTask } from "./tasks/BitcoinWaitForTransactionTask.js";
|
|
5
|
+
import { BaseStepExecutor, CheckBalanceTask, LiFiErrorCode, PrepareTransactionTask, TaskPipeline, TransactionError, WaitForTransactionStatusTask } from "@lifi/sdk";
|
|
6
|
+
//#region src/core/BitcoinStepExecutor.ts
|
|
7
|
+
var BitcoinStepExecutor = class extends BaseStepExecutor {
|
|
8
|
+
client;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
super(options);
|
|
11
|
+
this.client = options.client;
|
|
12
|
+
}
|
|
13
|
+
checkClient = (step) => {
|
|
14
|
+
if (this.client.account?.address !== step.action.fromAddress) throw new TransactionError(LiFiErrorCode.WalletChangedDuringExecution, "The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.");
|
|
15
|
+
};
|
|
16
|
+
createPipeline = (context) => {
|
|
17
|
+
const { step, isBridgeExecution } = context;
|
|
18
|
+
const tasks = [
|
|
19
|
+
new CheckBalanceTask(),
|
|
20
|
+
new PrepareTransactionTask(),
|
|
21
|
+
new BitcoinSignAndExecuteTask(),
|
|
22
|
+
new BitcoinWaitForTransactionTask(),
|
|
23
|
+
new WaitForTransactionStatusTask(isBridgeExecution ? "RECEIVING_CHAIN" : "SWAP")
|
|
24
|
+
];
|
|
25
|
+
const swapOrBridgeAction = this.statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
26
|
+
const taskName = swapOrBridgeAction?.txHash ? swapOrBridgeAction?.status === "DONE" ? WaitForTransactionStatusTask.name : BitcoinWaitForTransactionTask.name : CheckBalanceTask.name;
|
|
27
|
+
const firstTaskIndex = tasks.findIndex((task) => task.constructor.name === taskName);
|
|
28
|
+
return new TaskPipeline(tasks.slice(firstTaskIndex));
|
|
29
|
+
};
|
|
30
|
+
parseErrors = (error, step, action) => parseBitcoinErrors(error, step, action);
|
|
31
|
+
createContext = async (baseContext) => {
|
|
32
|
+
const { client, fromChain } = baseContext;
|
|
33
|
+
const publicClient = await getBitcoinPublicClient(client, fromChain.id);
|
|
34
|
+
return {
|
|
35
|
+
...baseContext,
|
|
36
|
+
pollingIntervalMs: 1e4,
|
|
37
|
+
checkClient: this.checkClient,
|
|
38
|
+
walletClient: this.client,
|
|
39
|
+
publicClient
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { BitcoinStepExecutor };
|
|
45
|
+
|
|
51
46
|
//# sourceMappingURL=BitcoinStepExecutor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinStepExecutor.js","
|
|
1
|
+
{"version":3,"file":"BitcoinStepExecutor.js","names":[],"sources":["../../../src/core/BitcoinStepExecutor.ts"],"sourcesContent":["import type { Client } from '@bigmi/core'\nimport {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStepExtended,\n PrepareTransactionTask,\n type SDKError,\n type StepExecutorBaseContext,\n type StepExecutorOptions,\n TaskPipeline,\n TransactionError,\n WaitForTransactionStatusTask,\n} from '@lifi/sdk'\nimport { getBitcoinPublicClient } from '../client/publicClient.js'\nimport { parseBitcoinErrors } from '../errors/parseBitcoinErrors.js'\nimport type { BitcoinStepExecutorContext } from '../types.js'\nimport { BitcoinSignAndExecuteTask } from './tasks/BitcoinSignAndExecuteTask.js'\nimport { BitcoinWaitForTransactionTask } from './tasks/BitcoinWaitForTransactionTask.js'\n\ninterface BitcoinStepExecutorOptions extends StepExecutorOptions {\n client: Client\n}\n\nexport class BitcoinStepExecutor extends BaseStepExecutor {\n private client: Client\n\n constructor(options: BitcoinStepExecutorOptions) {\n super(options)\n this.client = options.client\n }\n\n checkClient = (step: LiFiStepExtended): void => {\n // TODO: check chain and possibly implement chain switch?\n // Prevent execution of the quote by wallet different from the one which requested the quote\n if (this.client.account?.address !== step.action.fromAddress) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n }\n\n override createPipeline = (\n context: BitcoinStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution } = context\n\n const tasks = [\n new CheckBalanceTask(),\n new PrepareTransactionTask(),\n new BitcoinSignAndExecuteTask(),\n new BitcoinWaitForTransactionTask(),\n new WaitForTransactionStatusTask(\n isBridgeExecution ? 'RECEIVING_CHAIN' : 'SWAP'\n ),\n ]\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n const taskName = swapOrBridgeAction?.txHash\n ? swapOrBridgeAction?.status === 'DONE'\n ? WaitForTransactionStatusTask.name\n : BitcoinWaitForTransactionTask.name\n : CheckBalanceTask.name\n\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor.name === taskName\n )\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction\n ): Promise<SDKError> => parseBitcoinErrors(error, step, action)\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<BitcoinStepExecutorContext> => {\n const { client, fromChain } = baseContext\n\n const publicClient = await getBitcoinPublicClient(client, fromChain.id)\n\n return {\n ...baseContext,\n pollingIntervalMs: 10_000,\n checkClient: this.checkClient,\n walletClient: this.client,\n publicClient,\n }\n }\n}\n"],"mappings":";;;;;;AAyBA,IAAa,sBAAb,cAAyC,iBAAiB;CACxD;CAEA,YAAY,SAAqC;AAC/C,QAAM,QAAQ;AACd,OAAK,SAAS,QAAQ;;CAGxB,eAAe,SAAiC;AAG9C,MAAI,KAAK,OAAO,SAAS,YAAY,KAAK,OAAO,YAC/C,OAAM,IAAI,iBACR,cAAc,8BACd,oHACD;;CAIL,kBACE,YACiB;EACjB,MAAM,EAAE,MAAM,sBAAsB;EAEpC,MAAM,QAAQ;GACZ,IAAI,kBAAkB;GACtB,IAAI,wBAAwB;GAC5B,IAAI,2BAA2B;GAC/B,IAAI,+BAA+B;GACnC,IAAI,6BACF,oBAAoB,oBAAoB,OACzC;GACF;EACD,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,OACrC;EAED,MAAM,WAAW,oBAAoB,SACjC,oBAAoB,WAAW,SAC7B,6BAA6B,OAC7B,8BAA8B,OAChC,iBAAiB;EAErB,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,YAAY,SAAS,SACrC;AAID,SAAO,IAAI,aAFQ,MAAM,MAAM,eAAe,CAEX;;CAGrC,eACE,OACA,MACA,WACsB,mBAAmB,OAAO,MAAM,OAAO;CAE/D,gBAAyB,OACvB,gBACwC;EACxC,MAAM,EAAE,QAAQ,cAAc;EAE9B,MAAM,eAAe,MAAM,uBAAuB,QAAQ,UAAU,GAAG;AAEvE,SAAO;GACL,GAAG;GACH,mBAAmB;GACnB,aAAa,KAAK;GAClB,cAAc,KAAK;GACnB;GACD"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { BitcoinStepExecutorContext } from "../../types.js";
|
|
2
|
+
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/core/tasks/BitcoinSignAndExecuteTask.d.ts
|
|
5
|
+
declare class BitcoinSignAndExecuteTask extends BaseStepExecutionTask {
|
|
6
|
+
run(context: BitcoinStepExecutorContext): Promise<TaskResult>;
|
|
5
7
|
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { BitcoinSignAndExecuteTask };
|
|
10
|
+
//# sourceMappingURL=BitcoinSignAndExecuteTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitcoinSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/BitcoinSignAndExecuteTask.ts"],"mappings":";;;;cAqBa,yBAAA,SAAkC,qBAAA;EAC7C,GAAA,CAAU,OAAA,EAAS,0BAAA,GAA6B,OAAA,CAAQ,UAAA;AAAA"}
|