@lifi/sdk-provider-bitcoin 4.0.2 → 4.0.3
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 +6 -0
- package/dist/cjs/BitcoinProvider.d.ts +0 -1
- package/dist/cjs/actions/getBitcoinBalance.d.ts +0 -1
- package/dist/cjs/client/publicClient.d.ts +5 -6
- package/dist/cjs/client/publicClient.js +2 -1
- package/dist/cjs/client/publicClient.js.map +1 -1
- package/dist/cjs/core/BitcoinStepExecutor.d.ts +0 -1
- package/dist/cjs/core/tasks/BitcoinSignAndExecuteTask.d.ts +0 -1
- package/dist/cjs/core/tasks/BitcoinWaitForTransactionTask.d.ts +0 -1
- package/dist/cjs/errors/parseBitcoinErrors.d.ts +0 -1
- package/dist/cjs/types.d.ts +0 -1
- package/dist/cjs/utils/generateRedeemScript.d.ts +4 -4
- package/dist/cjs/utils/isPsbtFinalized.d.ts +0 -1
- package/dist/cjs/utils/toBigmiChainId.d.ts +0 -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.d.ts +0 -1
- package/dist/esm/BitcoinProvider.d.ts.map +1 -1
- package/dist/esm/actions/getBitcoinBalance.d.ts +0 -1
- package/dist/esm/actions/getBitcoinBalance.d.ts.map +1 -1
- package/dist/esm/actions/resolveBitcoinAddress.d.ts.map +1 -1
- package/dist/esm/client/publicClient.d.ts +5 -6
- package/dist/esm/client/publicClient.d.ts.map +1 -1
- package/dist/esm/client/publicClient.js +2 -1
- package/dist/esm/client/publicClient.js.map +1 -1
- package/dist/esm/core/BitcoinStepExecutor.d.ts +0 -1
- package/dist/esm/core/BitcoinStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.d.ts +0 -1
- package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.d.ts +0 -1
- package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/errors/parseBitcoinErrors.d.ts +0 -1
- package/dist/esm/errors/parseBitcoinErrors.d.ts.map +1 -1
- package/dist/esm/types.d.ts +0 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils/generateRedeemScript.d.ts +4 -4
- package/dist/esm/utils/generateRedeemScript.d.ts.map +1 -1
- package/dist/esm/utils/isPsbtFinalized.d.ts +0 -1
- package/dist/esm/utils/isPsbtFinalized.d.ts.map +1 -1
- package/dist/esm/utils/toBigmiChainId.d.ts +0 -1
- package/dist/esm/utils/toBigmiChainId.d.ts.map +1 -1
- package/dist/esm/utils/toXOnly.d.ts.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +2 -2
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lifi/sdk-provider-bitcoin
|
|
2
2
|
|
|
3
|
+
## 4.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#429](https://github.com/lifinance/sdk/pull/429) [`1de76f9`](https://github.com/lifinance/sdk/commit/1de76f93fcbdddc9df269581822036e4eecd3e78) Thanks [@chybisov](https://github.com/chybisov)! - Bump runtime dependencies: viem to 2.55.1 (ethereum), @bigmi/core to 0.9.0 (bitcoin), and @mysten/sui to 2.20.3 (sui).
|
|
8
|
+
|
|
3
9
|
## 4.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Account, Chain, Client, FallbackTransport, HttpTransport, PublicActions, UTXOSchema, WalletActions } from "@bigmi/core";
|
|
2
2
|
import { SDKClient } from "@lifi/sdk";
|
|
3
|
-
|
|
4
3
|
//#region src/client/publicClient.d.ts
|
|
5
4
|
type PublicClient = Client<FallbackTransport<readonly HttpTransport[]>, Chain, Account | undefined, UTXOSchema, PublicActions & WalletActions>;
|
|
6
5
|
/**
|
|
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
|
-
*/
|
|
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
|
+
*/
|
|
12
11
|
declare const getBitcoinPublicClient: (client: SDKClient, chainId: number) => Promise<PublicClient>;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { PublicClient, getBitcoinPublicClient };
|
|
@@ -13,7 +13,7 @@ const getBitcoinPublicClient = async (client, chainId) => {
|
|
|
13
13
|
if (!publicClients[chainId]) {
|
|
14
14
|
const fallbackTransports = (await client.getRpcUrlsByChainId(chainId)).map((url) => (0, _bigmi_core.http)(url, { fetchOptions: { method: "POST" } }));
|
|
15
15
|
const _chain = await client.getChainById(chainId);
|
|
16
|
-
|
|
16
|
+
const bigmiClient = (0, _bigmi_core.createClient)({
|
|
17
17
|
chain: {
|
|
18
18
|
..._chain,
|
|
19
19
|
..._chain.metamask,
|
|
@@ -33,6 +33,7 @@ const getBitcoinPublicClient = async (client, chainId) => {
|
|
|
33
33
|
]),
|
|
34
34
|
pollingInterval: 1e4
|
|
35
35
|
}).extend(_bigmi_core.publicActions).extend(_bigmi_core.walletActions);
|
|
36
|
+
publicClients[chainId] = bigmiClient;
|
|
36
37
|
}
|
|
37
38
|
if (!publicClients[chainId]) throw new Error(`Unable to configure provider for chain ${chainId}`);
|
|
38
39
|
return publicClients[chainId];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicClient.js","names":["toBigmiChainId","publicActions","walletActions"],"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,CAAC;;;;;;;AAQrD,MAAa,yBAAyB,OACpC,QACA,YAC0B;CAC1B,IAAI,CAAC,cAAc,UAAU;EAE3B,MAAM,sBAAqB,MADR,OAAO,oBAAoB,OAAO,EAAA,CACrB,KAAK,SAAA,GAAA,YAAA,KAAA,CAC9B,KAAK,EACR,cAAc,EACZ,QAAQ,OACV,EACF,CAAC,CACH;EACA,MAAM,SAAS,MAAM,OAAO,aAAa,OAAO;
|
|
1
|
+
{"version":3,"file":"publicClient.js","names":["toBigmiChainId","publicActions","walletActions"],"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,CAAC;;;;;;;AAQrD,MAAa,yBAAyB,OACpC,QACA,YAC0B;CAC1B,IAAI,CAAC,cAAc,UAAU;EAE3B,MAAM,sBAAqB,MADR,OAAO,oBAAoB,OAAO,EAAA,CACrB,KAAK,SAAA,GAAA,YAAA,KAAA,CAC9B,KAAK,EACR,cAAc,EACZ,QAAQ,OACV,EACF,CAAC,CACH;EACA,MAAM,SAAS,MAAM,OAAO,aAAa,OAAO;EAWhD,MAAM,eAAA,GAAA,YAAA,aAAA,CAA2B;GAC/B,OAAA;IAVA,GAAG;IACH,GAAG,OAAO;IACV,IAAIA,6BAAAA,eAAe,OAAO,EAAE;IAC5B,MAAM,OAAO,SAAS;IACtB,SAAS;KACP,SAAS,EAAE,MAAM,OAAO,SAAS,QAAQ;KACzC,QAAQ,EAAE,MAAM,OAAO,SAAS,QAAQ;IAC1C;GAGI;GACJ,YAAA,GAAA,YAAA,UAAA,CAAiC;GACjC,YAAA,GAAA,YAAA,SAAA,CAAoB;gCACP;iCACC;6BACJ;IACR,GAAG;GACL,CAAC;GACD,iBAAiB;EACnB,CAAC,CAAC,CACC,OAAOC,YAAAA,aAAa,CAAC,CACrB,OAAOC,YAAAA,aAAa;EACvB,cAAc,WAAW;CAC3B;CAEA,IAAI,CAAC,cAAc,UACjB,MAAM,IAAI,MAAM,0CAA0C,SAAS;CAGrE,OAAO,cAAc;AACvB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BitcoinStepExecutorContext } from "../types.js";
|
|
2
2
|
import { Client } from "@bigmi/core";
|
|
3
3
|
import { BaseStepExecutor, ExecutionAction, LiFiStepExtended, SDKError, StepExecutorBaseContext, StepExecutorOptions, TaskPipeline } from "@lifi/sdk";
|
|
4
|
-
|
|
5
4
|
//#region src/core/BitcoinStepExecutor.d.ts
|
|
6
5
|
interface BitcoinStepExecutorOptions extends StepExecutorOptions {
|
|
7
6
|
client: Client;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BitcoinStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
|
|
4
3
|
//#region src/core/tasks/BitcoinSignAndExecuteTask.d.ts
|
|
5
4
|
declare class BitcoinSignAndExecuteTask extends BaseStepExecutionTask {
|
|
6
5
|
run(context: BitcoinStepExecutorContext): Promise<TaskResult>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BitcoinStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
|
|
4
3
|
//#region src/core/tasks/BitcoinWaitForTransactionTask.d.ts
|
|
5
4
|
declare class BitcoinWaitForTransactionTask extends BaseStepExecutionTask {
|
|
6
5
|
run(context: BitcoinStepExecutorContext): Promise<TaskResult>;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PublicClient } from "./client/publicClient.js";
|
|
2
2
|
import { Client } from "@bigmi/core";
|
|
3
3
|
import { LiFiStepExtended, SDKProvider, StepExecutorContext } from "@lifi/sdk";
|
|
4
|
-
|
|
5
4
|
//#region src/types.d.ts
|
|
6
5
|
interface BitcoinProviderOptions {
|
|
7
6
|
getWalletClient?: () => Promise<Client>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/utils/generateRedeemScript.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Generate redeem script for P2SH addresses
|
|
4
|
-
* @param publicKey
|
|
5
|
-
* @returns redeem script
|
|
6
|
-
*/
|
|
3
|
+
* Generate redeem script for P2SH addresses
|
|
4
|
+
* @param publicKey
|
|
5
|
+
* @returns redeem script
|
|
6
|
+
*/
|
|
7
7
|
declare const generateRedeemScript: (publicKey: Uint8Array) => Uint8Array | undefined;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { generateRedeemScript };
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-bitcoin'\nexport const version = '4.0.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-bitcoin'\nexport const version = '4.0.3'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinProvider.d.ts","names":[],"sources":["../../src/BitcoinProvider.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitcoinProvider.d.ts","names":[],"sources":["../../src/BitcoinProvider.ts"],"mappings":";;iBAOgB,gBACd,UAAU,yBACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBitcoinBalance.d.ts","names":[],"sources":["../../../src/actions/getBitcoinBalance.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBitcoinBalance.d.ts","names":[],"sources":["../../../src/actions/getBitcoinBalance.ts"],"mappings":";;cAQa,oBACX,QAAQ,WACR,uBACA,QAAQ,YACP,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveBitcoinAddress.d.ts","names":[],"sources":["../../../src/actions/resolveBitcoinAddress.ts"],"mappings":";iBAAsB,
|
|
1
|
+
{"version":3,"file":"resolveBitcoinAddress.d.ts","names":[],"sources":["../../../src/actions/resolveBitcoinAddress.ts"],"mappings":";iBAAsB,sBACpB,eACC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Account, Chain, Client, FallbackTransport, HttpTransport, PublicActions, UTXOSchema, WalletActions } from "@bigmi/core";
|
|
2
2
|
import { SDKClient } from "@lifi/sdk";
|
|
3
|
-
|
|
4
3
|
//#region src/client/publicClient.d.ts
|
|
5
4
|
type PublicClient = Client<FallbackTransport<readonly HttpTransport[]>, Chain, Account | undefined, UTXOSchema, PublicActions & WalletActions>;
|
|
6
5
|
/**
|
|
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
|
-
*/
|
|
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
|
+
*/
|
|
12
11
|
declare const getBitcoinPublicClient: (client: SDKClient, chainId: number) => Promise<PublicClient>;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { PublicClient, getBitcoinPublicClient };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicClient.d.ts","names":[],"sources":["../../../src/client/publicClient.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"publicClient.d.ts","names":[],"sources":["../../../src/client/publicClient.ts"],"mappings":";;;KAsBY,eAAe,OACzB,2BAA2B,kBAC3B,OACA,qBACA,YACA,gBAAgB;;;;;;;cAYL,yBACX,QAAQ,WACR,oBACC,QAAQ"}
|
|
@@ -12,7 +12,7 @@ const getBitcoinPublicClient = async (client, chainId) => {
|
|
|
12
12
|
if (!publicClients[chainId]) {
|
|
13
13
|
const fallbackTransports = (await client.getRpcUrlsByChainId(chainId)).map((url) => http(url, { fetchOptions: { method: "POST" } }));
|
|
14
14
|
const _chain = await client.getChainById(chainId);
|
|
15
|
-
|
|
15
|
+
const bigmiClient = createClient({
|
|
16
16
|
chain: {
|
|
17
17
|
..._chain,
|
|
18
18
|
..._chain.metamask,
|
|
@@ -32,6 +32,7 @@ const getBitcoinPublicClient = async (client, chainId) => {
|
|
|
32
32
|
]),
|
|
33
33
|
pollingInterval: 1e4
|
|
34
34
|
}).extend(publicActions).extend(walletActions);
|
|
35
|
+
publicClients[chainId] = bigmiClient;
|
|
35
36
|
}
|
|
36
37
|
if (!publicClients[chainId]) throw new Error(`Unable to configure provider for chain ${chainId}`);
|
|
37
38
|
return publicClients[chainId];
|
|
@@ -1 +1 @@
|
|
|
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,CAAC;;;;;;;AAQrD,MAAa,yBAAyB,OACpC,QACA,YAC0B;CAC1B,IAAI,CAAC,cAAc,UAAU;EAE3B,MAAM,sBAAqB,MADR,OAAO,oBAAoB,OAAO,EAAA,CACrB,KAAK,QACnC,KAAK,KAAK,EACR,cAAc,EACZ,QAAQ,OACV,EACF,CAAC,CACH;EACA,MAAM,SAAS,MAAM,OAAO,aAAa,OAAO;
|
|
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,CAAC;;;;;;;AAQrD,MAAa,yBAAyB,OACpC,QACA,YAC0B;CAC1B,IAAI,CAAC,cAAc,UAAU;EAE3B,MAAM,sBAAqB,MADR,OAAO,oBAAoB,OAAO,EAAA,CACrB,KAAK,QACnC,KAAK,KAAK,EACR,cAAc,EACZ,QAAQ,OACV,EACF,CAAC,CACH;EACA,MAAM,SAAS,MAAM,OAAO,aAAa,OAAO;EAWhD,MAAM,cAAc,aAAa;GAC/B,OAAA;IAVA,GAAG;IACH,GAAG,OAAO;IACV,IAAI,eAAe,OAAO,EAAE;IAC5B,MAAM,OAAO,SAAS;IACtB,SAAS;KACP,SAAS,EAAE,MAAM,OAAO,SAAS,QAAQ;KACzC,QAAQ,EAAE,MAAM,OAAO,SAAS,QAAQ;IAC1C;GAGI;GACJ,WAAW,UAAsB;GACjC,WAAW,SAAS;IAClB,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,GAAG;GACL,CAAC;GACD,iBAAiB;EACnB,CAAC,CAAC,CACC,OAAO,aAAa,CAAC,CACrB,OAAO,aAAa;EACvB,cAAc,WAAW;CAC3B;CAEA,IAAI,CAAC,cAAc,UACjB,MAAM,IAAI,MAAM,0CAA0C,SAAS;CAGrE,OAAO,cAAc;AACvB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BitcoinStepExecutorContext } from "../types.js";
|
|
2
2
|
import { Client } from "@bigmi/core";
|
|
3
3
|
import { BaseStepExecutor, ExecutionAction, LiFiStepExtended, SDKError, StepExecutorBaseContext, StepExecutorOptions, TaskPipeline } from "@lifi/sdk";
|
|
4
|
-
|
|
5
4
|
//#region src/core/BitcoinStepExecutor.d.ts
|
|
6
5
|
interface BitcoinStepExecutorOptions extends StepExecutorOptions {
|
|
7
6
|
client: Client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinStepExecutor.d.ts","names":[],"sources":["../../../src/core/BitcoinStepExecutor.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitcoinStepExecutor.d.ts","names":[],"sources":["../../../src/core/BitcoinStepExecutor.ts"],"mappings":";;;;UAqBU,mCAAmC;EAC3C,QAAQ;;cAGG,4BAA4B;UAC/B;EAER,YAAY,SAAS;EAKrB,cAAe,MAAM;WAWZ,iBACP,SAAS,+BACR;WAgCM,cACP,OAAO,OACP,OAAO,kBACP,SAAS,oBACR,QAAQ;WAEF,gBACP,aAAa,4BACZ,QAAQ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BitcoinStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
|
|
4
3
|
//#region src/core/tasks/BitcoinSignAndExecuteTask.d.ts
|
|
5
4
|
declare class BitcoinSignAndExecuteTask extends BaseStepExecutionTask {
|
|
6
5
|
run(context: BitcoinStepExecutorContext): Promise<TaskResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/BitcoinSignAndExecuteTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitcoinSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/BitcoinSignAndExecuteTask.ts"],"mappings":";;;cAqBa,kCAAkC;EAC7C,IAAU,SAAS,6BAA6B,QAAQ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BitcoinStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
|
|
4
3
|
//#region src/core/tasks/BitcoinWaitForTransactionTask.d.ts
|
|
5
4
|
declare class BitcoinWaitForTransactionTask extends BaseStepExecutionTask {
|
|
6
5
|
run(context: BitcoinStepExecutorContext): Promise<TaskResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/BitcoinWaitForTransactionTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitcoinWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/BitcoinWaitForTransactionTask.ts"],"mappings":";;;cAUa,sCAAsC;EACjD,IAAU,SAAS,6BAA6B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBitcoinErrors.d.ts","names":[],"sources":["../../../src/errors/parseBitcoinErrors.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseBitcoinErrors.d.ts","names":[],"sources":["../../../src/errors/parseBitcoinErrors.ts"],"mappings":";;cAWa,qBACX,GAAG,OACH,OAAO,UACP,SAAS,oBACR,QAAQ"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PublicClient } from "./client/publicClient.js";
|
|
2
2
|
import { Client } from "@bigmi/core";
|
|
3
3
|
import { LiFiStepExtended, SDKProvider, StepExecutorContext } from "@lifi/sdk";
|
|
4
|
-
|
|
5
4
|
//#region src/types.d.ts
|
|
6
5
|
interface BitcoinProviderOptions {
|
|
7
6
|
getWalletClient?: () => Promise<Client>;
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;UASiB;EACf,wBAAwB,QAAQ;;UAGjB,mCAAmC;EAClD,cAAc;EACd,cAAc;EACd,cAAc,MAAM;;UAGL,2BAA2B;EAC1C,WAAW,SAAS;;iBAGN,kBACd,UAAU,cACT,YAAY"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/utils/generateRedeemScript.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Generate redeem script for P2SH addresses
|
|
4
|
-
* @param publicKey
|
|
5
|
-
* @returns redeem script
|
|
6
|
-
*/
|
|
3
|
+
* Generate redeem script for P2SH addresses
|
|
4
|
+
* @param publicKey
|
|
5
|
+
* @returns redeem script
|
|
6
|
+
*/
|
|
7
7
|
declare const generateRedeemScript: (publicKey: Uint8Array) => Uint8Array | undefined;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { generateRedeemScript };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRedeemScript.d.ts","names":[],"sources":["../../../src/utils/generateRedeemScript.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateRedeemScript.d.ts","names":[],"sources":["../../../src/utils/generateRedeemScript.ts"],"mappings":";;;;;;cAOa,uBACX,WAAW,eACV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPsbtFinalized.d.ts","names":[],"sources":["../../../src/utils/isPsbtFinalized.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isPsbtFinalized.d.ts","names":[],"sources":["../../../src/utils/isPsbtFinalized.ts"],"mappings":";;iBAEgB,gBAAgB,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toBigmiChainId.d.ts","names":[],"sources":["../../../src/utils/toBigmiChainId.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toBigmiChainId.d.ts","names":[],"sources":["../../../src/utils/toBigmiChainId.ts"],"mappings":";;;cAGa,iBAAkB,SAAS,cAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toXOnly.d.ts","names":[],"sources":["../../../src/utils/toXOnly.ts"],"mappings":";cACa,
|
|
1
|
+
{"version":3,"file":"toXOnly.d.ts","names":[],"sources":["../../../src/utils/toXOnly.ts"],"mappings":";cACa,UAAW,QAAQ,eAAa"}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":";cAAa
|
|
1
|
+
{"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":";cAAa;cACA"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-bitcoin'\nexport const version = '4.0.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-bitcoin'\nexport const version = '4.0.3'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/sdk-provider-bitcoin",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "LI.FI Bitcoin SDK Provider for Any-to-Any Cross-Chain-Swap",
|
|
5
5
|
"homepage": "https://github.com/lifinance/sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@bigmi/core": "^0.
|
|
31
|
+
"@bigmi/core": "^0.9.0",
|
|
32
32
|
"@bitcoinerlab/secp256k1": "^1.2.0",
|
|
33
33
|
"bech32": "^2.0.0",
|
|
34
34
|
"bitcoinjs-lib": "^7.0.1",
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/sdk-provider-bitcoin'
|
|
2
|
-
export const version = '4.0.
|
|
2
|
+
export const version = '4.0.3'
|