@lifi/sdk-provider-bitcoin 4.0.2 → 4.0.4

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/BitcoinProvider.d.ts +0 -1
  3. package/dist/cjs/actions/getBitcoinBalance.d.ts +0 -1
  4. package/dist/cjs/client/publicClient.d.ts +5 -6
  5. package/dist/cjs/client/publicClient.js +2 -1
  6. package/dist/cjs/client/publicClient.js.map +1 -1
  7. package/dist/cjs/core/BitcoinStepExecutor.d.ts +0 -1
  8. package/dist/cjs/core/tasks/BitcoinSignAndExecuteTask.d.ts +0 -1
  9. package/dist/cjs/core/tasks/BitcoinWaitForTransactionTask.d.ts +0 -1
  10. package/dist/cjs/errors/parseBitcoinErrors.d.ts +0 -1
  11. package/dist/cjs/types.d.ts +0 -1
  12. package/dist/cjs/utils/generateRedeemScript.d.ts +4 -4
  13. package/dist/cjs/utils/isPsbtFinalized.d.ts +0 -1
  14. package/dist/cjs/utils/toBigmiChainId.d.ts +0 -1
  15. package/dist/cjs/version.d.ts +1 -1
  16. package/dist/cjs/version.js +1 -1
  17. package/dist/cjs/version.js.map +1 -1
  18. package/dist/esm/BitcoinProvider.d.ts +0 -1
  19. package/dist/esm/BitcoinProvider.d.ts.map +1 -1
  20. package/dist/esm/actions/getBitcoinBalance.d.ts +0 -1
  21. package/dist/esm/actions/getBitcoinBalance.d.ts.map +1 -1
  22. package/dist/esm/actions/resolveBitcoinAddress.d.ts.map +1 -1
  23. package/dist/esm/client/publicClient.d.ts +5 -6
  24. package/dist/esm/client/publicClient.d.ts.map +1 -1
  25. package/dist/esm/client/publicClient.js +2 -1
  26. package/dist/esm/client/publicClient.js.map +1 -1
  27. package/dist/esm/core/BitcoinStepExecutor.d.ts +0 -1
  28. package/dist/esm/core/BitcoinStepExecutor.d.ts.map +1 -1
  29. package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.d.ts +0 -1
  30. package/dist/esm/core/tasks/BitcoinSignAndExecuteTask.d.ts.map +1 -1
  31. package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.d.ts +0 -1
  32. package/dist/esm/core/tasks/BitcoinWaitForTransactionTask.d.ts.map +1 -1
  33. package/dist/esm/errors/parseBitcoinErrors.d.ts +0 -1
  34. package/dist/esm/errors/parseBitcoinErrors.d.ts.map +1 -1
  35. package/dist/esm/types.d.ts +0 -1
  36. package/dist/esm/types.d.ts.map +1 -1
  37. package/dist/esm/utils/generateRedeemScript.d.ts +4 -4
  38. package/dist/esm/utils/generateRedeemScript.d.ts.map +1 -1
  39. package/dist/esm/utils/isPsbtFinalized.d.ts +0 -1
  40. package/dist/esm/utils/isPsbtFinalized.d.ts.map +1 -1
  41. package/dist/esm/utils/toBigmiChainId.d.ts +0 -1
  42. package/dist/esm/utils/toBigmiChainId.d.ts.map +1 -1
  43. package/dist/esm/utils/toXOnly.d.ts.map +1 -1
  44. package/dist/esm/version.d.ts +1 -1
  45. package/dist/esm/version.d.ts.map +1 -1
  46. package/dist/esm/version.js +1 -1
  47. package/dist/esm/version.js.map +1 -1
  48. package/package.json +3 -3
  49. package/src/version.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @lifi/sdk-provider-bitcoin
2
2
 
3
+ ## 4.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`0990a5d`](https://github.com/lifinance/sdk/commit/0990a5d2dcb148c113e41aeeab38eb1bcc5c684e)]:
8
+ - @lifi/sdk@4.2.0
9
+
10
+ ## 4.0.3
11
+
12
+ ### Patch Changes
13
+
14
+ - [#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).
15
+
3
16
  ## 4.0.2
4
17
 
5
18
  ### Patch Changes
@@ -1,5 +1,4 @@
1
1
  import { BitcoinProviderOptions, BitcoinSDKProvider } from "./types.js";
2
-
3
2
  //#region src/BitcoinProvider.d.ts
4
3
  declare function BitcoinProvider(options?: BitcoinProviderOptions): BitcoinSDKProvider;
5
4
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import { SDKClient, Token, TokenAmount } from "@lifi/sdk";
2
-
3
2
  //#region src/actions/getBitcoinBalance.d.ts
4
3
  declare const getBitcoinBalance: (client: SDKClient, walletAddress: string, tokens: Token[]) => Promise<TokenAmount[]>;
5
4
  //#endregion
@@ -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
- publicClients[chainId] = (0, _bigmi_core.createClient)({
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;EAwBhD,cAAc,YAAA,GAAA,YAAA,aAAA,CAbmB;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,aACyB;CACrC;CAEA,IAAI,CAAC,cAAc,UACjB,MAAM,IAAI,MAAM,0CAA0C,SAAS;CAGrE,OAAO,cAAc;AACvB"}
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>;
@@ -1,5 +1,4 @@
1
1
  import { ExecutionAction, LiFiStep, SDKError } from "@lifi/sdk";
2
-
3
2
  //#region src/errors/parseBitcoinErrors.d.ts
4
3
  declare const parseBitcoinErrors: (e: Error, step?: LiFiStep, action?: ExecutionAction) => Promise<SDKError>;
5
4
  //#endregion
@@ -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 };
@@ -1,5 +1,4 @@
1
1
  import { Psbt } from "bitcoinjs-lib";
2
-
3
2
  //#region src/utils/isPsbtFinalized.d.ts
4
3
  declare function isPsbtFinalized(psbt: Psbt): boolean;
5
4
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { ChainId } from "@bigmi/core";
2
2
  import { ChainId as ChainId$1 } from "@lifi/sdk";
3
-
4
3
  //#region src/utils/toBigmiChainId.d.ts
5
4
  declare const toBigmiChainId: (chainId: ChainId$1) => ChainId;
6
5
  //#endregion
@@ -1,6 +1,6 @@
1
1
  //#region src/version.d.ts
2
2
  declare const name = "@lifi/sdk-provider-bitcoin";
3
- declare const version = "4.0.2";
3
+ declare const version = "4.0.4";
4
4
  //#endregion
5
5
  export { name, version };
6
6
  //# sourceMappingURL=version.d.ts.map
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/version.ts
3
3
  const name = "@lifi/sdk-provider-bitcoin";
4
- const version = "4.0.2";
4
+ const version = "4.0.4";
5
5
  //#endregion
6
6
  exports.name = name;
7
7
  exports.version = version;
@@ -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.2'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-bitcoin'\nexport const version = '4.0.4'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
@@ -1,5 +1,4 @@
1
1
  import { BitcoinProviderOptions, BitcoinSDKProvider } from "./types.js";
2
-
3
2
  //#region src/BitcoinProvider.d.ts
4
3
  declare function BitcoinProvider(options?: BitcoinProviderOptions): BitcoinSDKProvider;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"BitcoinProvider.d.ts","names":[],"sources":["../../src/BitcoinProvider.ts"],"mappings":";;;iBAOgB,eAAA,CACd,OAAA,GAAU,sBAAA,GACT,kBAAA"}
1
+ {"version":3,"file":"BitcoinProvider.d.ts","names":[],"sources":["../../src/BitcoinProvider.ts"],"mappings":";;iBAOgB,gBACd,UAAU,yBACT"}
@@ -1,5 +1,4 @@
1
1
  import { SDKClient, Token, TokenAmount } from "@lifi/sdk";
2
-
3
2
  //#region src/actions/getBitcoinBalance.d.ts
4
3
  declare const getBitcoinBalance: (client: SDKClient, walletAddress: string, tokens: Token[]) => Promise<TokenAmount[]>;
5
4
  //#endregion
@@ -1 +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
+ {"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,qBAAA,CACpB,IAAA,WACC,OAAA"}
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":";;;;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
+ {"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
- publicClients[chainId] = createClient({
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;EAwBhD,cAAc,WAbM,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,aACyB;CACrC;CAEA,IAAI,CAAC,cAAc,UACjB,MAAM,IAAI,MAAM,0CAA0C,SAAS;CAGrE,OAAO,cAAc;AACvB"}
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":";;;;;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
+ {"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":";;;;cAqBa,yBAAA,SAAkC,qBAAA;EAC7C,GAAA,CAAU,OAAA,EAAS,0BAAA,GAA6B,OAAA,CAAQ,UAAA;AAAA"}
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":";;;;cAUa,6BAAA,SAAsC,qBAAA;EACjD,GAAA,CAAU,OAAA,EAAS,0BAAA,GAA6B,OAAA,CAAQ,UAAA;AAAA"}
1
+ {"version":3,"file":"BitcoinWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/BitcoinWaitForTransactionTask.ts"],"mappings":";;;cAUa,sCAAsC;EACjD,IAAU,SAAS,6BAA6B,QAAQ"}
@@ -1,5 +1,4 @@
1
1
  import { ExecutionAction, LiFiStep, SDKError } from "@lifi/sdk";
2
-
3
2
  //#region src/errors/parseBitcoinErrors.d.ts
4
3
  declare const parseBitcoinErrors: (e: Error, step?: LiFiStep, action?: ExecutionAction) => Promise<SDKError>;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"parseBitcoinErrors.d.ts","names":[],"sources":["../../../src/errors/parseBitcoinErrors.ts"],"mappings":";;;cAWa,kBAAA,GACX,CAAA,EAAG,KAAA,EACH,IAAA,GAAO,QAAA,EACP,MAAA,GAAS,eAAA,KACR,OAAA,CAAQ,QAAA"}
1
+ {"version":3,"file":"parseBitcoinErrors.d.ts","names":[],"sources":["../../../src/errors/parseBitcoinErrors.ts"],"mappings":";;cAWa,qBACX,GAAG,OACH,OAAO,UACP,SAAS,oBACR,QAAQ"}
@@ -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 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;UASiB,sBAAA;EACf,eAAA,SAAwB,OAAA,CAAQ,MAAA;AAAA;AAAA,UAGjB,0BAAA,SAAmC,mBAAA;EAClD,YAAA,EAAc,MAAA;EACd,YAAA,EAAc,YAAA;EACd,WAAA,GAAc,IAAA,EAAM,gBAAA;AAAA;AAAA,UAGL,kBAAA,SAA2B,WAAA;EAC1C,UAAA,CAAW,OAAA,EAAS,sBAAA;AAAA;AAAA,iBAGN,iBAAA,CACd,QAAA,EAAU,WAAA,GACT,QAAA,IAAY,kBAAA"}
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":";;AAOA;;;;cAAa,oBAAA,GACX,SAAA,EAAW,UAAA,KACV,UAAA"}
1
+ {"version":3,"file":"generateRedeemScript.d.ts","names":[],"sources":["../../../src/utils/generateRedeemScript.ts"],"mappings":";;;;;;cAOa,uBACX,WAAW,eACV"}
@@ -1,5 +1,4 @@
1
1
  import { Psbt } from "bitcoinjs-lib";
2
-
3
2
  //#region src/utils/isPsbtFinalized.d.ts
4
3
  declare function isPsbtFinalized(psbt: Psbt): boolean;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"isPsbtFinalized.d.ts","names":[],"sources":["../../../src/utils/isPsbtFinalized.ts"],"mappings":";;;iBAEgB,eAAA,CAAgB,IAAM,EAAA,IAAA"}
1
+ {"version":3,"file":"isPsbtFinalized.d.ts","names":[],"sources":["../../../src/utils/isPsbtFinalized.ts"],"mappings":";;iBAEgB,gBAAgB,MAAM"}
@@ -1,6 +1,5 @@
1
1
  import { ChainId } from "@bigmi/core";
2
2
  import { ChainId as ChainId$1 } from "@lifi/sdk";
3
-
4
3
  //#region src/utils/toBigmiChainId.d.ts
5
4
  declare const toBigmiChainId: (chainId: ChainId$1) => ChainId;
6
5
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"toBigmiChainId.d.ts","names":[],"sources":["../../../src/utils/toBigmiChainId.ts"],"mappings":";;;;cAGa,cAAA,GAAkB,OAAA,EAAS,SAAA,KAAU,OAAA"}
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,OAAA,GAAW,MAAA,EAAQ,UAAA,KAAa,UAAA"}
1
+ {"version":3,"file":"toXOnly.d.ts","names":[],"sources":["../../../src/utils/toXOnly.ts"],"mappings":";cACa,UAAW,QAAQ,eAAa"}
@@ -1,6 +1,6 @@
1
1
  //#region src/version.d.ts
2
2
  declare const name = "@lifi/sdk-provider-bitcoin";
3
- declare const version = "4.0.2";
3
+ declare const version = "4.0.4";
4
4
  //#endregion
5
5
  export { name, version };
6
6
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":";cAAa,IAAA;AAAA,cACA,OAAA"}
1
+ {"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":";cAAa;cACA"}
@@ -1,6 +1,6 @@
1
1
  //#region src/version.ts
2
2
  const name = "@lifi/sdk-provider-bitcoin";
3
- const version = "4.0.2";
3
+ const version = "4.0.4";
4
4
  //#endregion
5
5
  export { name, version };
6
6
 
@@ -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.2'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-bitcoin'\nexport const version = '4.0.4'\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.2",
3
+ "version": "4.0.4",
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,11 +28,11 @@
28
28
  "./package.json": "./package.json"
29
29
  },
30
30
  "dependencies": {
31
- "@bigmi/core": "^0.8.1",
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",
35
- "@lifi/sdk": "4.1.0"
35
+ "@lifi/sdk": "4.2.0"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
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'
2
+ export const version = '4.0.4'