@babylonlabs-io/ts-sdk 0.17.1 → 0.19.0

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 (83) hide show
  1. package/dist/errors-DVNYib5y.cjs +2 -0
  2. package/dist/errors-DVNYib5y.cjs.map +1 -0
  3. package/dist/errors-aMocmFr-.js +1225 -0
  4. package/dist/errors-aMocmFr-.js.map +1 -0
  5. package/dist/index-BX-V3C9t.js +995 -0
  6. package/dist/index-BX-V3C9t.js.map +1 -0
  7. package/dist/index-BgnxXV5G.cjs +2 -0
  8. package/dist/index-BgnxXV5G.cjs.map +1 -0
  9. package/dist/index-BvFLf3vm.js +1513 -0
  10. package/dist/index-BvFLf3vm.js.map +1 -0
  11. package/dist/index-DpKhuCta.cjs +2 -0
  12. package/dist/index-DpKhuCta.cjs.map +1 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +84 -74
  15. package/dist/tbv/core/clients/eth/__tests__/protocol-params-reader.test.d.ts +2 -0
  16. package/dist/tbv/core/clients/eth/__tests__/protocol-params-reader.test.d.ts.map +1 -0
  17. package/dist/tbv/core/clients/eth/__tests__/signer-set-reader.test.d.ts +2 -0
  18. package/dist/tbv/core/clients/eth/__tests__/signer-set-reader.test.d.ts.map +1 -0
  19. package/dist/tbv/core/clients/eth/contract-address-resolver.d.ts +18 -0
  20. package/dist/tbv/core/clients/eth/contract-address-resolver.d.ts.map +1 -0
  21. package/dist/tbv/core/clients/eth/index.d.ts +4 -1
  22. package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
  23. package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts +27 -0
  24. package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts.map +1 -0
  25. package/dist/tbv/core/clients/eth/signer-set-reader.d.ts +37 -0
  26. package/dist/tbv/core/clients/eth/signer-set-reader.d.ts.map +1 -0
  27. package/dist/tbv/core/clients/eth/types.d.ts +80 -0
  28. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  29. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  30. package/dist/tbv/core/clients/index.cjs +1 -1
  31. package/dist/tbv/core/clients/index.js +25 -21
  32. package/dist/tbv/core/contracts/abis/ApplicationRegistry.abi.d.ts +74 -0
  33. package/dist/tbv/core/contracts/abis/ApplicationRegistry.abi.d.ts.map +1 -0
  34. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +74 -0
  35. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
  36. package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +233 -0
  37. package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts.map +1 -0
  38. package/dist/tbv/core/contracts/index.d.ts +2 -0
  39. package/dist/tbv/core/contracts/index.d.ts.map +1 -1
  40. package/dist/tbv/core/index.cjs +1 -1
  41. package/dist/tbv/core/index.js +86 -76
  42. package/dist/tbv/core/services/htlc/__tests__/htlc.test.d.ts +2 -0
  43. package/dist/tbv/core/services/htlc/__tests__/htlc.test.d.ts.map +1 -0
  44. package/dist/tbv/core/services/htlc/index.d.ts +25 -0
  45. package/dist/tbv/core/services/htlc/index.d.ts.map +1 -0
  46. package/dist/tbv/core/services/index.cjs +1 -1
  47. package/dist/tbv/core/services/index.d.ts +1 -0
  48. package/dist/tbv/core/services/index.d.ts.map +1 -1
  49. package/dist/tbv/core/services/index.js +6 -4
  50. package/dist/tbv/core/wots/__tests__/blockDerivation.test.d.ts +2 -0
  51. package/dist/tbv/core/wots/__tests__/blockDerivation.test.d.ts.map +1 -0
  52. package/dist/tbv/core/wots/blockDerivation.d.ts +36 -0
  53. package/dist/tbv/core/wots/blockDerivation.d.ts.map +1 -0
  54. package/dist/tbv/core/wots/index.d.ts +1 -0
  55. package/dist/tbv/core/wots/index.d.ts.map +1 -1
  56. package/dist/tbv/index.cjs +1 -1
  57. package/dist/tbv/index.js +86 -76
  58. package/dist/tbv/integrations/aave/clients/abis/AaveSpoke.abi.json.d.ts +140 -0
  59. package/dist/tbv/integrations/aave/clients/index.d.ts +1 -1
  60. package/dist/tbv/integrations/aave/clients/index.d.ts.map +1 -1
  61. package/dist/tbv/integrations/aave/clients/query.d.ts +12 -1
  62. package/dist/tbv/integrations/aave/clients/query.d.ts.map +1 -1
  63. package/dist/tbv/integrations/aave/index.cjs +1 -1
  64. package/dist/tbv/integrations/aave/index.cjs.map +1 -1
  65. package/dist/tbv/integrations/aave/index.d.ts +2 -2
  66. package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
  67. package/dist/tbv/integrations/aave/index.js +141 -129
  68. package/dist/tbv/integrations/aave/index.js.map +1 -1
  69. package/dist/tbv/integrations/aave/types.d.ts +10 -0
  70. package/dist/tbv/integrations/aave/types.d.ts.map +1 -1
  71. package/package.json +1 -1
  72. package/dist/errors-DKLboMnq.cjs +0 -2
  73. package/dist/errors-DKLboMnq.cjs.map +0 -1
  74. package/dist/errors-KY63mgWT.js +0 -1510
  75. package/dist/errors-KY63mgWT.js.map +0 -1
  76. package/dist/index-D3z3SZAj.cjs +0 -2
  77. package/dist/index-D3z3SZAj.cjs.map +0 -1
  78. package/dist/index-Dw7FAwne.js +0 -913
  79. package/dist/index-Dw7FAwne.js.map +0 -1
  80. package/dist/signAndSubmitPayouts-CAOEAQp9.js +0 -490
  81. package/dist/signAndSubmitPayouts-CAOEAQp9.js.map +0 -1
  82. package/dist/signAndSubmitPayouts-CSJmcPQN.cjs +0 -2
  83. package/dist/signAndSubmitPayouts-CSJmcPQN.cjs.map +0 -1
@@ -0,0 +1,36 @@
1
+ import { WotsBlockPublicKey } from '../clients/vault-provider/types';
2
+ import { Hex } from 'viem';
3
+ /**
4
+ * Derive deterministic WOTS block public keys for a specific vault.
5
+ *
6
+ * Produces an array of {@link WotsBlockPublicKey} (one per assert block),
7
+ * matching the Rust `Vec<babe::wots::PublicKey>` format expected by the
8
+ * vault provider's `submitDepositorWotsKey` RPC.
9
+ *
10
+ * The VP expects exactly 2 blocks and validates that keccak256 of the
11
+ * concatenated chain tips matches the on-chain `depositorWotsPkHash`.
12
+ *
13
+ * @param seed - 64-byte seed (e.g. from `mnemonicToWotsSeed`). Zeroed after use.
14
+ * @param vaultId - Vault identifier / pegin tx hash (hex, with or without 0x prefix).
15
+ * @param depositorPk - Depositor's BTC public key (hex, with or without 0x prefix).
16
+ * @param appContractAddress - Application contract address.
17
+ * @returns Array of 2 WOTS block public keys.
18
+ * @throws If seed is not exactly 64 bytes.
19
+ */
20
+ export declare function deriveWotsBlockPublicKeys(seed: Uint8Array, vaultId: string, depositorPk: string, appContractAddress: string): Promise<WotsBlockPublicKey[]>;
21
+ /**
22
+ * Compute the keccak256 hash of WOTS block public keys.
23
+ *
24
+ * Matches Rust `btc_vault::wots_public_keys_keccak256`: for each block,
25
+ * chain tips are concatenated in canonical order
26
+ * `[checksum_minor, checksum_major, message_terminals...]`, then all
27
+ * blocks are concatenated and hashed.
28
+ *
29
+ * The result is committed on-chain as `depositorWotsPkHash` so the vault
30
+ * provider can verify submitted WOTS public keys.
31
+ *
32
+ * @param publicKeys - Array of WOTS block public keys (must not be empty).
33
+ * @returns 0x-prefixed keccak256 hex string.
34
+ */
35
+ export declare function computeWotsBlockPublicKeysHash(publicKeys: WotsBlockPublicKey[]): Hex;
36
+ //# sourceMappingURL=blockDerivation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockDerivation.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/wots/blockDerivation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAmMhC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuF/B;AAuBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,kBAAkB,EAAE,GAC/B,GAAG,CAsCL"}
@@ -1,5 +1,6 @@
1
1
  export type { WotsKeypair, WotsPublicKey, WotsKeyProvider } from './types';
2
2
  export { mnemonicToWotsSeed, deriveWotsKeypair, keypairToPublicKey, computeWotsPkHash, } from './derivation';
3
+ export { deriveWotsBlockPublicKeys, computeWotsBlockPublicKeysHash, } from './blockDerivation';
3
4
  export { deriveWotsPkHash } from './deriveWotsPkHash';
4
5
  export { isWotsMismatchError } from './errors';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/wots/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/wots/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../challengeAssert-D_k_ADgP.cjs"),u=require("@babylonlabs-io/babylon-tbv-rust-wasm"),a=require("../payout-CfsDnjKI.cjs"),e=require("../constants-EiyZkXce.cjs"),s=require("../psbtInputFields-C0nKn_GD.cjs"),T=require("../fundPeginTransaction-EbrZzlrh.cjs"),P=require("../signing-Deg5lCoC.cjs"),r=require("../errors-DKLboMnq.cjs"),n=require("../signAndSubmitPayouts-CSJmcPQN.cjs"),t=require("../index-D3z3SZAj.cjs"),o=require("../types-DEWiqXYp.cjs");exports.buildChallengeAssertPsbt=i.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=i.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=i.buildNoPayoutPsbt;exports.buildPeginInputPsbt=i.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=i.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=i.buildPrePeginPsbt;exports.buildRefundPsbt=i.buildRefundPsbt;exports.computeNumLocalChallengers=i.computeNumLocalChallengers;exports.extractPeginInputSignature=i.extractPeginInputSignature;exports.finalizePeginInputPsbt=i.finalizePeginInputPsbt;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>u.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>u.deriveVaultId});exports.buildPayoutPsbt=a.buildPayoutPsbt;exports.createPayoutScript=a.createPayoutScript;exports.extractPayoutSignature=a.extractPayoutSignature;exports.BTC_DUST_SAT=e.BTC_DUST_SAT;exports.DUST_THRESHOLD=e.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=e.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=e.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=e.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=e.P2TR_INPUT_SIZE;exports.PEGIN_FIXED_OUTPUTS=e.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=e.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=e.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=e.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.getNetwork=e.getNetwork;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.peginOutputCount=e.peginOutputCount;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.rateBasedTxBufferFee=e.rateBasedTxBufferFee;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;exports.BitcoinScriptType=s.BitcoinScriptType;exports.calculateBtcTxHash=s.calculateBtcTxHash;exports.getDustThreshold=s.getDustThreshold;exports.getPsbtInputFields=s.getPsbtInputFields;exports.getScriptType=s.getScriptType;exports.selectUtxosForPegin=s.selectUtxosForPegin;exports.shouldAddChangeOutput=s.shouldAddChangeOutput;exports.fundPeginTransaction=T.fundPeginTransaction;exports.parseUnfundedWasmTransaction=T.parseUnfundedWasmTransaction;exports.createTaprootScriptPathSignOptions=P.createTaprootScriptPathSignOptions;exports.CONTRACT_ERRORS=r.CONTRACT_ERRORS;exports.PeginManager=r.PeginManager;exports.computeWotsPkHash=r.computeWotsPkHash;exports.deriveWotsKeypair=r.deriveWotsKeypair;exports.deriveWotsPkHash=r.deriveWotsPkHash;exports.extractErrorData=r.extractErrorData;exports.getContractErrorMessage=r.getContractErrorMessage;exports.handleContractError=r.handleContractError;exports.isKnownContractError=r.isKnownContractError;exports.isWotsMismatchError=r.isWotsMismatchError;exports.keypairToPublicKey=r.keypairToPublicKey;exports.mnemonicToWotsSeed=r.mnemonicToWotsSeed;exports.PayoutManager=n.PayoutManager;exports.pollAndSignPayouts=n.pollAndSignPayouts;exports.signDepositorGraph=n.signDepositorGraph;exports.submitWotsPublicKey=n.submitWotsPublicKey;exports.waitForPeginStatus=n.waitForPeginStatus;exports.BTCVaultRegistryABI=t.BTCVaultRegistryABI;exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.pushTx=t.pushTx;exports.DaemonStatus=o.DaemonStatus;exports.JSON_RPC_ERROR_CODES=o.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=o.JsonRpcClient;exports.JsonRpcError=o.JsonRpcError;exports.POST_WOTS_STATUSES=o.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=o.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=o.RpcErrorCode;exports.VP_TERMINAL_STATUSES=o.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=o.VP_TRANSIENT_STATUSES;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../challengeAssert-D_k_ADgP.cjs"),u=require("@babylonlabs-io/babylon-tbv-rust-wasm"),n=require("../payout-CfsDnjKI.cjs"),e=require("../constants-EiyZkXce.cjs"),s=require("../psbtInputFields-C0nKn_GD.cjs"),l=require("../fundPeginTransaction-EbrZzlrh.cjs"),P=require("../signing-Deg5lCoC.cjs"),r=require("../errors-DVNYib5y.cjs"),a=require("../index-BgnxXV5G.cjs"),t=require("../index-DpKhuCta.cjs"),i=require("../types-DEWiqXYp.cjs");exports.buildChallengeAssertPsbt=o.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=o.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=o.buildNoPayoutPsbt;exports.buildPeginInputPsbt=o.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=o.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=o.buildPrePeginPsbt;exports.buildRefundPsbt=o.buildRefundPsbt;exports.computeNumLocalChallengers=o.computeNumLocalChallengers;exports.extractPeginInputSignature=o.extractPeginInputSignature;exports.finalizePeginInputPsbt=o.finalizePeginInputPsbt;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>u.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>u.deriveVaultId});exports.buildPayoutPsbt=n.buildPayoutPsbt;exports.createPayoutScript=n.createPayoutScript;exports.extractPayoutSignature=n.extractPayoutSignature;exports.BTC_DUST_SAT=e.BTC_DUST_SAT;exports.DUST_THRESHOLD=e.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=e.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=e.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=e.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=e.P2TR_INPUT_SIZE;exports.PEGIN_FIXED_OUTPUTS=e.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=e.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=e.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=e.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.getNetwork=e.getNetwork;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.peginOutputCount=e.peginOutputCount;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.rateBasedTxBufferFee=e.rateBasedTxBufferFee;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;exports.BitcoinScriptType=s.BitcoinScriptType;exports.calculateBtcTxHash=s.calculateBtcTxHash;exports.getDustThreshold=s.getDustThreshold;exports.getPsbtInputFields=s.getPsbtInputFields;exports.getScriptType=s.getScriptType;exports.selectUtxosForPegin=s.selectUtxosForPegin;exports.shouldAddChangeOutput=s.shouldAddChangeOutput;exports.fundPeginTransaction=l.fundPeginTransaction;exports.parseUnfundedWasmTransaction=l.parseUnfundedWasmTransaction;exports.createTaprootScriptPathSignOptions=P.createTaprootScriptPathSignOptions;exports.CONTRACT_ERRORS=r.CONTRACT_ERRORS;exports.PeginManager=r.PeginManager;exports.computeWotsBlockPublicKeysHash=r.computeWotsBlockPublicKeysHash;exports.computeWotsPkHash=r.computeWotsPkHash;exports.deriveWotsBlockPublicKeys=r.deriveWotsBlockPublicKeys;exports.deriveWotsKeypair=r.deriveWotsKeypair;exports.deriveWotsPkHash=r.deriveWotsPkHash;exports.extractErrorData=r.extractErrorData;exports.getContractErrorMessage=r.getContractErrorMessage;exports.handleContractError=r.handleContractError;exports.isKnownContractError=r.isKnownContractError;exports.isWotsMismatchError=r.isWotsMismatchError;exports.keypairToPublicKey=r.keypairToPublicKey;exports.mnemonicToWotsSeed=r.mnemonicToWotsSeed;exports.PayoutManager=a.PayoutManager;exports.computeHashlock=a.computeHashlock;exports.pollAndSignPayouts=a.pollAndSignPayouts;exports.signDepositorGraph=a.signDepositorGraph;exports.submitWotsPublicKey=a.submitWotsPublicKey;exports.validateSecretAgainstHashlock=a.validateSecretAgainstHashlock;exports.waitForPeginStatus=a.waitForPeginStatus;exports.ApplicationRegistryABI=t.ApplicationRegistryABI;exports.BTCVaultRegistryABI=t.BTCVaultRegistryABI;exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.ProtocolParamsABI=t.ProtocolParamsABI;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.pushTx=t.pushTx;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.DaemonStatus=i.DaemonStatus;exports.JSON_RPC_ERROR_CODES=i.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=i.JsonRpcClient;exports.JsonRpcError=i.JsonRpcError;exports.POST_WOTS_STATUSES=i.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=i.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=i.RpcErrorCode;exports.VP_TERMINAL_STATUSES=i.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=i.VP_TRANSIENT_STATUSES;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/tbv/index.js CHANGED
@@ -1,102 +1,112 @@
1
- import { j as e, h as t, i as r, d as o, a as i, b as n, g as T, c as P, e as u, f as p } from "../challengeAssert-k5_LWUtO.js";
2
- import { computeMinClaimValue as E, deriveVaultId as S } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
- import { b as _, c, e as g } from "../payout-Ce9vSs9e.js";
4
- import { B as A, D as x, F as b, L as m, M as f, P as I, c as O, S as y, T as C, W as U, d as h, a as F, e as N, g as D, h as L, i as M, b as V, f as H, p as B, r as W, s as v, t as k, u as w, v as K } from "../constants-Q7v2O7Ps.js";
5
- import { B as G, c as Y, g as J, d as Z, b as j, s as z, a as q } from "../psbtInputFields-DO0ELwiv.js";
1
+ import { j as e, h as t, i as r, d as o, a as i, b as n, g as P, c as l, e as T, f as u } from "../challengeAssert-k5_LWUtO.js";
2
+ import { computeMinClaimValue as p, deriveVaultId as c } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
+ import { b as E, c as g, e as _ } from "../payout-Ce9vSs9e.js";
4
+ import { B as R, D as m, F as b, L as x, M as I, P as f, c as y, S as O, T as h, W as C, d as U, a as F, e as V, g as N, h as B, i as H, b as D, f as L, p as M, r as v, s as W, t as k, u as K, v as w } from "../constants-Q7v2O7Ps.js";
5
+ import { B as G, c as Y, g as J, d as j, b as Z, s as z, a as q } from "../psbtInputFields-DO0ELwiv.js";
6
6
  import { f as $, p as aa } from "../fundPeginTransaction-DpwnDslW.js";
7
7
  import { c as ea } from "../signing-Drwr3bXB.js";
8
- import { C as ra, P as oa, c as ia, d as na, a as Ta, e as Pa, g as ua, h as pa, i as da, b as Ea, k as Sa, m as la } from "../errors-KY63mgWT.js";
9
- import { P as ca, p as ga, a as Ra, s as Aa, w as xa } from "../signAndSubmitPayouts-CAOEAQp9.js";
10
- import { B as ma, M as fa, V as Ia, i as Oa, h as ya, g as Ca, a as Ua, b as ha, c as Fa, d as Na, e as Da, f as La, p as Ma } from "../index-Dw7FAwne.js";
11
- import { D as Ha, b as Ba, J as Wa, a as va, d as ka, P as wa, R as Ka, c as Xa, V as Ga } from "../types-D1rYwwCu.js";
8
+ import { C as ra, P as oa, b as ia, c as na, a as Pa, d as la, f as Ta, e as ua, g as da, h as pa, i as ca, j as Sa, k as Ea, m as ga } from "../errors-aMocmFr-.js";
9
+ import { P as Aa, c as Ra, p as ma, a as ba, s as xa, v as Ia, w as fa } from "../index-BX-V3C9t.js";
10
+ import { A as Oa, B as ha, M as Ca, P as Ua, V as Fa, i as Va, j as Na, k as Ba, l as Ha, h as Da, g as La, a as Ma, b as va, c as Wa, d as ka, e as Ka, f as wa, p as Xa, r as Ga } from "../index-BvFLf3vm.js";
11
+ import { D as Ja, b as ja, J as Za, a as za, d as qa, P as Qa, R as $a, c as as, V as ss } from "../types-D1rYwwCu.js";
12
12
  export {
13
- ma as BTCVaultRegistryABI,
14
- A as BTC_DUST_SAT,
13
+ Oa as ApplicationRegistryABI,
14
+ ha as BTCVaultRegistryABI,
15
+ R as BTC_DUST_SAT,
15
16
  G as BitcoinScriptType,
16
17
  ra as CONTRACT_ERRORS,
17
- x as DUST_THRESHOLD,
18
- Ha as DaemonStatus,
18
+ m as DUST_THRESHOLD,
19
+ Ja as DaemonStatus,
19
20
  b as FEE_SAFETY_MARGIN,
20
- Ba as JSON_RPC_ERROR_CODES,
21
- Wa as JsonRpcClient,
22
- va as JsonRpcError,
23
- m as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
24
- f as MAX_NON_LEGACY_OUTPUT_SIZE,
25
- fa as MEMPOOL_API_URLS,
26
- I as P2TR_INPUT_SIZE,
27
- O as PEGIN_FIXED_OUTPUTS,
28
- ka as POST_WOTS_STATUSES,
29
- wa as PRE_DEPOSITOR_SIGNATURES_STATES,
30
- ca as PayoutManager,
21
+ ja as JSON_RPC_ERROR_CODES,
22
+ Za as JsonRpcClient,
23
+ za as JsonRpcError,
24
+ x as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
25
+ I as MAX_NON_LEGACY_OUTPUT_SIZE,
26
+ Ca as MEMPOOL_API_URLS,
27
+ f as P2TR_INPUT_SIZE,
28
+ y as PEGIN_FIXED_OUTPUTS,
29
+ qa as POST_WOTS_STATUSES,
30
+ Qa as PRE_DEPOSITOR_SIGNATURES_STATES,
31
+ Aa as PayoutManager,
31
32
  oa as PeginManager,
32
- Ka as RpcErrorCode,
33
- y as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
34
- C as TX_BUFFER_SIZE_OVERHEAD,
35
- Xa as VP_TERMINAL_STATUSES,
36
- Ga as VP_TRANSIENT_STATUSES,
37
- Ia as VaultProviderRpcClient,
38
- Oa as ViemVaultRegistryReader,
39
- ya as VpResponseValidationError,
40
- U as WALLET_RELAY_FEE_RATE_THRESHOLD,
33
+ Ua as ProtocolParamsABI,
34
+ $a as RpcErrorCode,
35
+ O as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
36
+ h as TX_BUFFER_SIZE_OVERHEAD,
37
+ as as VP_TERMINAL_STATUSES,
38
+ ss as VP_TRANSIENT_STATUSES,
39
+ Fa as VaultProviderRpcClient,
40
+ Va as ViemProtocolParamsReader,
41
+ Na as ViemUniversalChallengerReader,
42
+ Ba as ViemVaultKeeperReader,
43
+ Ha as ViemVaultRegistryReader,
44
+ Da as VpResponseValidationError,
45
+ C as WALLET_RELAY_FEE_RATE_THRESHOLD,
41
46
  e as buildChallengeAssertPsbt,
42
47
  t as buildDepositorPayoutPsbt,
43
48
  r as buildNoPayoutPsbt,
44
- _ as buildPayoutPsbt,
49
+ E as buildPayoutPsbt,
45
50
  o as buildPeginInputPsbt,
46
51
  i as buildPeginTxFromFundedPrePegin,
47
52
  n as buildPrePeginPsbt,
48
- T as buildRefundPsbt,
53
+ P as buildRefundPsbt,
49
54
  Y as calculateBtcTxHash,
50
- E as computeMinClaimValue,
51
- P as computeNumLocalChallengers,
52
- ia as computeWotsPkHash,
53
- c as createPayoutScript,
55
+ Ra as computeHashlock,
56
+ p as computeMinClaimValue,
57
+ l as computeNumLocalChallengers,
58
+ ia as computeWotsBlockPublicKeysHash,
59
+ na as computeWotsPkHash,
60
+ g as createPayoutScript,
54
61
  ea as createTaprootScriptPathSignOptions,
55
- h as deriveNativeSegwitAddress,
62
+ U as deriveNativeSegwitAddress,
56
63
  F as deriveTaprootAddress,
57
- S as deriveVaultId,
58
- na as deriveWotsKeypair,
64
+ c as deriveVaultId,
65
+ Pa as deriveWotsBlockPublicKeys,
66
+ la as deriveWotsKeypair,
59
67
  Ta as deriveWotsPkHash,
60
- N as ensureHexPrefix,
61
- Pa as extractErrorData,
62
- g as extractPayoutSignature,
63
- u as extractPeginInputSignature,
64
- p as finalizePeginInputPsbt,
68
+ V as ensureHexPrefix,
69
+ ua as extractErrorData,
70
+ _ as extractPayoutSignature,
71
+ T as extractPeginInputSignature,
72
+ u as finalizePeginInputPsbt,
65
73
  $ as fundPeginTransaction,
66
- Ca as getAddressTxs,
67
- Ua as getAddressUtxos,
68
- ua as getContractErrorMessage,
74
+ La as getAddressTxs,
75
+ Ma as getAddressUtxos,
76
+ da as getContractErrorMessage,
69
77
  J as getDustThreshold,
70
- ha as getMempoolApiUrl,
71
- D as getNetwork,
72
- Fa as getNetworkFees,
73
- Z as getPsbtInputFields,
74
- j as getScriptType,
75
- Na as getTxHex,
76
- Da as getTxInfo,
77
- La as getUtxoInfo,
78
+ va as getMempoolApiUrl,
79
+ N as getNetwork,
80
+ Wa as getNetworkFees,
81
+ j as getPsbtInputFields,
82
+ Z as getScriptType,
83
+ ka as getTxHex,
84
+ Ka as getTxInfo,
85
+ wa as getUtxoInfo,
78
86
  pa as handleContractError,
79
- L as hexToUint8Array,
80
- M as isAddressFromPublicKey,
81
- da as isKnownContractError,
82
- V as isValidHex,
83
- Ea as isWotsMismatchError,
84
- Sa as keypairToPublicKey,
85
- la as mnemonicToWotsSeed,
87
+ B as hexToUint8Array,
88
+ H as isAddressFromPublicKey,
89
+ ca as isKnownContractError,
90
+ D as isValidHex,
91
+ Sa as isWotsMismatchError,
92
+ Ea as keypairToPublicKey,
93
+ ga as mnemonicToWotsSeed,
86
94
  aa as parseUnfundedWasmTransaction,
87
- H as peginOutputCount,
88
- ga as pollAndSignPayouts,
89
- B as processPublicKeyToXOnly,
90
- Ma as pushTx,
91
- W as rateBasedTxBufferFee,
95
+ L as peginOutputCount,
96
+ ma as pollAndSignPayouts,
97
+ M as processPublicKeyToXOnly,
98
+ Xa as pushTx,
99
+ v as rateBasedTxBufferFee,
100
+ Ga as resolveProtocolAddresses,
92
101
  z as selectUtxosForPegin,
93
102
  q as shouldAddChangeOutput,
94
- Ra as signDepositorGraph,
95
- v as stripHexPrefix,
96
- Aa as submitWotsPublicKey,
103
+ ba as signDepositorGraph,
104
+ W as stripHexPrefix,
105
+ xa as submitWotsPublicKey,
97
106
  k as toXOnly,
98
- w as uint8ArrayToHex,
99
- K as validateWalletPubkey,
100
- xa as waitForPeginStatus
107
+ K as uint8ArrayToHex,
108
+ Ia as validateSecretAgainstHashlock,
109
+ w as validateWalletPubkey,
110
+ fa as waitForPeginStatus
101
111
  };
102
112
  //# sourceMappingURL=index.js.map
@@ -1255,6 +1255,146 @@ declare const _default: [
1255
1255
  }
1256
1256
  ],
1257
1257
  "stateMutability": "nonpayable"
1258
+ },
1259
+ {
1260
+ "type": "error",
1261
+ "name": "AssetNotListed",
1262
+ "inputs": []
1263
+ },
1264
+ {
1265
+ "type": "error",
1266
+ "name": "ReserveExists",
1267
+ "inputs": []
1268
+ },
1269
+ {
1270
+ "type": "error",
1271
+ "name": "InvalidAssetId",
1272
+ "inputs": []
1273
+ },
1274
+ {
1275
+ "type": "error",
1276
+ "name": "ReserveNotListed",
1277
+ "inputs": []
1278
+ },
1279
+ {
1280
+ "type": "error",
1281
+ "name": "ReserveNotBorrowable",
1282
+ "inputs": []
1283
+ },
1284
+ {
1285
+ "type": "error",
1286
+ "name": "ReservePaused",
1287
+ "inputs": []
1288
+ },
1289
+ {
1290
+ "type": "error",
1291
+ "name": "ReserveFrozen",
1292
+ "inputs": []
1293
+ },
1294
+ {
1295
+ "type": "error",
1296
+ "name": "HealthFactorBelowThreshold",
1297
+ "inputs": []
1298
+ },
1299
+ {
1300
+ "type": "error",
1301
+ "name": "CollateralCannotBeLiquidated",
1302
+ "inputs": []
1303
+ },
1304
+ {
1305
+ "type": "error",
1306
+ "name": "ReserveNotSupplied",
1307
+ "inputs": []
1308
+ },
1309
+ {
1310
+ "type": "error",
1311
+ "name": "ReserveNotBorrowed",
1312
+ "inputs": []
1313
+ },
1314
+ {
1315
+ "type": "error",
1316
+ "name": "Unauthorized",
1317
+ "inputs": []
1318
+ },
1319
+ {
1320
+ "type": "error",
1321
+ "name": "ConfigKeyUninitialized",
1322
+ "inputs": []
1323
+ },
1324
+ {
1325
+ "type": "error",
1326
+ "name": "InactivePositionManager",
1327
+ "inputs": []
1328
+ },
1329
+ {
1330
+ "type": "error",
1331
+ "name": "InvalidSignature",
1332
+ "inputs": []
1333
+ },
1334
+ {
1335
+ "type": "error",
1336
+ "name": "InvalidAddress",
1337
+ "inputs": []
1338
+ },
1339
+ {
1340
+ "type": "error",
1341
+ "name": "InvalidOracleDecimals",
1342
+ "inputs": []
1343
+ },
1344
+ {
1345
+ "type": "error",
1346
+ "name": "InvalidCollateralRisk",
1347
+ "inputs": []
1348
+ },
1349
+ {
1350
+ "type": "error",
1351
+ "name": "InvalidLiquidationConfig",
1352
+ "inputs": []
1353
+ },
1354
+ {
1355
+ "type": "error",
1356
+ "name": "InvalidLiquidationFee",
1357
+ "inputs": []
1358
+ },
1359
+ {
1360
+ "type": "error",
1361
+ "name": "InvalidCollateralFactorAndMaxLiquidationBonus",
1362
+ "inputs": []
1363
+ },
1364
+ {
1365
+ "type": "error",
1366
+ "name": "InvalidCollateralFactor",
1367
+ "inputs": []
1368
+ },
1369
+ {
1370
+ "type": "error",
1371
+ "name": "SelfLiquidation",
1372
+ "inputs": []
1373
+ },
1374
+ {
1375
+ "type": "error",
1376
+ "name": "HealthFactorNotBelowThreshold",
1377
+ "inputs": []
1378
+ },
1379
+ {
1380
+ "type": "error",
1381
+ "name": "MustNotLeaveDust",
1382
+ "inputs": []
1383
+ },
1384
+ {
1385
+ "type": "error",
1386
+ "name": "InvalidDebtToCover",
1387
+ "inputs": []
1388
+ },
1389
+ {
1390
+ "type": "error",
1391
+ "name": "CannotReceiveShares",
1392
+ "inputs": []
1393
+ },
1394
+ {
1395
+ "type": "error",
1396
+ "name": "MaximumDynamicConfigKeyReached",
1397
+ "inputs": []
1258
1398
  }
1259
1399
  ]
1260
1400
  ;
@@ -1,4 +1,4 @@
1
- export { getPosition, getPositionCollateral } from './query.js';
1
+ export { getPosition, getPositionCollateral, getPositionSizeParams, } from './query.js';
2
2
  export { getDynamicReserveConfig, getReserve, getTargetHealthFactor, getUserAccountData, getUserPosition, getUserTotalDebt, hasCollateral, hasDebt, } from './spoke.js';
3
3
  export { buildBorrowTx, buildReorderVaultsTx, buildRepayTx, buildWithdrawCollateralsTx, } from './transaction.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/integrations/aave/clients/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,OAAO,GACR,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/integrations/aave/clients/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,OAAO,GACR,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Address, PublicClient } from 'viem';
2
- import { AaveMarketPosition } from '../types.js';
2
+ import { AaveMarketPosition, PositionSizeParams } from '../types.js';
3
3
  /**
4
4
  * Get a position by user address.
5
5
  *
@@ -24,4 +24,15 @@ export declare function getPosition(publicClient: PublicClient, contractAddress:
24
24
  * @returns Total collateral amount in satoshis
25
25
  */
26
26
  export declare function getPositionCollateral(publicClient: PublicClient, contractAddress: Address, user: Address): Promise<bigint>;
27
+ /**
28
+ * Get position size parameters from the adapter contract.
29
+ *
30
+ * Returns the maximum BTC position size and maximum vaults per position
31
+ * as configured on-chain.
32
+ *
33
+ * @param publicClient - Viem public client for reading contracts
34
+ * @param contractAddress - AaveIntegrationAdapter contract address
35
+ * @returns Position size parameters (maxPositionBTC, maxVaultsPerPosition)
36
+ */
37
+ export declare function getPositionSizeParams(publicClient: PublicClient, contractAddress: Address): Promise<PositionSizeParams>;
27
38
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/integrations/aave/clients/query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAY,KAAK,YAAY,EAAe,MAAM,MAAM,CAAC;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAC/B,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO,EACxB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAwBpC;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO,EACxB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,MAAM,CAAC,CASjB"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/integrations/aave/clients/query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAY,KAAK,YAAY,EAAe,MAAM,MAAM,CAAC;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAG1E;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAC/B,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO,EACxB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAwBpC;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO,EACxB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,MAAM,CAAC,CASjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO,GACvB,OAAO,CAAC,kBAAkB,CAAC,CAa7B"}