@dynamic-labs-wallet/btc-utils 0.0.353 → 0.1.0-request-signing

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 (72) hide show
  1. package/index.cjs +681 -136
  2. package/index.esm.js +672 -138
  3. package/internal/core/ed_bls12_377.cjs +1 -1
  4. package/internal/core/ed_bls12_377.d.ts +1 -0
  5. package/internal/core/ed_bls12_377.js +1 -1
  6. package/internal/core/native.d.ts +1 -0
  7. package/package.json +5 -4
  8. package/src/assertSighashAllowed/assertSighashAllowed.d.ts +21 -0
  9. package/src/assertSighashAllowed/assertSighashAllowed.d.ts.map +1 -0
  10. package/src/assertSighashAllowed/index.d.ts +2 -0
  11. package/src/assertSighashAllowed/index.d.ts.map +1 -0
  12. package/src/buildToSpendTx/buildToSpendTx.d.ts +12 -0
  13. package/src/buildToSpendTx/buildToSpendTx.d.ts.map +1 -0
  14. package/src/buildToSpendTx/index.d.ts +2 -0
  15. package/src/buildToSpendTx/index.d.ts.map +1 -0
  16. package/src/bytesEqual/bytesEqual.d.ts +10 -0
  17. package/src/bytesEqual/bytesEqual.d.ts.map +1 -0
  18. package/src/bytesEqual/index.d.ts +2 -0
  19. package/src/bytesEqual/index.d.ts.map +1 -0
  20. package/src/calculateBip322Hash/calculateBip322Hash.d.ts.map +1 -1
  21. package/src/computeBip322HashHex/computeBip322HashHex.d.ts +2 -4
  22. package/src/computeBip322HashHex/computeBip322HashHex.d.ts.map +1 -1
  23. package/src/convertSignatureToDER/convertSignatureToDER.d.ts +4 -1
  24. package/src/convertSignatureToDER/convertSignatureToDER.d.ts.map +1 -1
  25. package/src/convertSignatureToTaprootBuffer/convertSignatureToTaprootBuffer.d.ts +5 -2
  26. package/src/convertSignatureToTaprootBuffer/convertSignatureToTaprootBuffer.d.ts.map +1 -1
  27. package/src/doesInputBelongToAddress/doesInputBelongToAddress.d.ts +15 -4
  28. package/src/doesInputBelongToAddress/doesInputBelongToAddress.d.ts.map +1 -1
  29. package/src/extractPsbtIntentOperation/extractPsbtIntentOperation.d.ts +36 -0
  30. package/src/extractPsbtIntentOperation/extractPsbtIntentOperation.d.ts.map +1 -0
  31. package/src/extractPsbtIntentOperation/index.d.ts +3 -0
  32. package/src/extractPsbtIntentOperation/index.d.ts.map +1 -0
  33. package/src/extractPsbtSighashes/extractPsbtSighashes.d.ts +6 -2
  34. package/src/extractPsbtSighashes/extractPsbtSighashes.d.ts.map +1 -1
  35. package/src/filterInputsBySigningIndexes/filterInputsBySigningIndexes.d.ts +12 -0
  36. package/src/filterInputsBySigningIndexes/filterInputsBySigningIndexes.d.ts.map +1 -0
  37. package/src/filterInputsBySigningIndexes/index.d.ts +2 -0
  38. package/src/filterInputsBySigningIndexes/index.d.ts.map +1 -0
  39. package/src/getBtcChainId/getBtcChainId.d.ts +13 -0
  40. package/src/getBtcChainId/getBtcChainId.d.ts.map +1 -0
  41. package/src/getBtcChainId/index.d.ts +2 -0
  42. package/src/getBtcChainId/index.d.ts.map +1 -0
  43. package/src/getFeeRates/getFeeRates.d.ts +12 -8
  44. package/src/getFeeRates/getFeeRates.d.ts.map +1 -1
  45. package/src/getSegwitV0ScriptCode/getSegwitV0ScriptCode.d.ts +20 -0
  46. package/src/getSegwitV0ScriptCode/getSegwitV0ScriptCode.d.ts.map +1 -0
  47. package/src/getSegwitV0ScriptCode/index.d.ts +2 -0
  48. package/src/getSegwitV0ScriptCode/index.d.ts.map +1 -0
  49. package/src/getSigHashType/getSigHashType.d.ts +21 -0
  50. package/src/getSigHashType/getSigHashType.d.ts.map +1 -0
  51. package/src/getSigHashType/index.d.ts +2 -0
  52. package/src/getSigHashType/index.d.ts.map +1 -0
  53. package/src/getUTXOs/getUTXOs.d.ts +2 -2
  54. package/src/getUTXOs/getUTXOs.d.ts.map +1 -1
  55. package/src/index.d.ts +11 -0
  56. package/src/index.d.ts.map +1 -1
  57. package/src/isP2wshOutputScript/index.d.ts +2 -0
  58. package/src/isP2wshOutputScript/index.d.ts.map +1 -0
  59. package/src/isP2wshOutputScript/isP2wshOutputScript.d.ts +10 -0
  60. package/src/isP2wshOutputScript/isP2wshOutputScript.d.ts.map +1 -0
  61. package/src/resolveBitcoinAddressType/index.d.ts +2 -0
  62. package/src/resolveBitcoinAddressType/index.d.ts.map +1 -0
  63. package/src/resolveBitcoinAddressType/resolveBitcoinAddressType.d.ts +34 -0
  64. package/src/resolveBitcoinAddressType/resolveBitcoinAddressType.d.ts.map +1 -0
  65. package/src/resolveRpcUrl/index.d.ts +2 -0
  66. package/src/resolveRpcUrl/index.d.ts.map +1 -0
  67. package/src/resolveRpcUrl/resolveRpcUrl.d.ts +14 -0
  68. package/src/resolveRpcUrl/resolveRpcUrl.d.ts.map +1 -0
  69. package/src/rpcFetch/index.d.ts +2 -0
  70. package/src/rpcFetch/index.d.ts.map +1 -0
  71. package/src/rpcFetch/rpcFetch.d.ts +9 -0
  72. package/src/rpcFetch/rpcFetch.d.ts.map +1 -0
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.EdBls12377=void 0;const utils_1=require("@noble/hashes/utils"),types_1=require("./types.cjs"),common_1=require("./common.cjs");class EdBls12377{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new types_1.EdBls12377InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){return(await this.NATIVE).edBls12377GetExportID(getSecretShare(keygenResult))}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async keygen(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).edBls12377Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(keygenResult.compute_key,keygenResult.address,keygenResult.secret_share)}async signRequest(roomUuid,keygenResult,requestPayload){const requestPayloadJson=serializeRequestPayload(requestPayload),signedRequestJson=await(await this.NATIVE).edBls12377signRequest(roomUuid,this.URL,getSecretShare(keygenResult),requestPayloadJson);return deserializeSignedRequest(signedRequestJson)}async refresh(roomUuid,keygenResult){const refreshedKeygenResult=await(await this.NATIVE).edBls12377Refresh(roomUuid,this.URL,getSecretShare(keygenResult));return new types_1.EdBls12377KeygenResult(refreshedKeygenResult.compute_key,refreshedKeygenResult.address,refreshedKeygenResult.secret_share)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareRemainingParty(roomUuid,this.URL,newThreshold,getSecretShare(keygenResult),keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportFullPrivateKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async exportViewKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportViewKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async offlineExportFullPrivateKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportFullPrivateKey(serializeKeygenResults(keygenResults))}async offlineExportViewKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportViewKey(serializeKeygenResults(keygenResults))}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds,isPrivateKeyRaw=!1){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,isPrivateKeyRaw);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}}function getSecretShare(keygenResult){return"string"==typeof keygenResult?keygenResult:keygenResult.secretShare}function serializeKeygenResults(keygenResults){return keygenResults.map(result=>"string"==typeof result?result:result.secretShare)}function serializeRequestPayload(requestPayload){const serializedPayload={function_id:(0,utils_1.bytesToHex)(requestPayload.function_id),is_root:requestPayload.is_root,program_checksum:requestPayload.program_checksum?(0,utils_1.bytesToHex)(requestPayload.program_checksum):null,inputs:requestPayload.inputs.map(input=>"record"===input.type?{type:"record",h:(0,utils_1.bytesToHex)(input.h),tag:(0,utils_1.bytesToHex)(input.tag)}:{type:input.type,index:(0,utils_1.bytesToHex)(input.index),fields:input.fields.map(utils_1.bytesToHex)})};return JSON.stringify(serializedPayload)}function deserializeSignedRequest(signedRequestJson){let parsed;try{parsed=JSON.parse(signedRequestJson)}catch(_a){throw new Error("Invalid signed request JSON returned from native bindings.")}if(!parsed||"object"!=typeof parsed||Array.isArray(parsed))throw new Error("Invalid signed request JSON returned from native bindings.");const signedRequest=parsed;return{signer:deserializeBytes(signedRequest.signer,"signer"),signature:deserializeBytes(signedRequest.signature,"signature"),tvk:deserializeBytes(signedRequest.tvk,"tvk"),gammas:deserializeBytesArray(signedRequest.gammas,"gammas")}}function deserializeBytes(value,fieldName){if("string"!=typeof value)throw new TypeError(fieldName+" must be a hex string in the native response.");return(0,utils_1.hexToBytes)(value)}function deserializeBytesArray(value,fieldName){if(Array.isArray(value))return value.map((item,index)=>deserializeBytes(item,fieldName+`[${index}]`));throw new TypeError(fieldName+" must be an array in the native response.")}exports.EdBls12377=EdBls12377;
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.EdBls12377=void 0;const utils_1=require("@noble/hashes/utils"),types_1=require("./types.cjs"),common_1=require("./common.cjs");class EdBls12377{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new types_1.EdBls12377InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){return(await this.NATIVE).edBls12377GetExportID(getSecretShare(keygenResult))}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async keygen(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).edBls12377Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(keygenResult.compute_key,keygenResult.address,keygenResult.secret_share)}async signRequest(roomUuid,keygenResult,requestPayload){const requestPayloadJson=serializeRequestPayload(requestPayload),signedRequestJson=await(await this.NATIVE).edBls12377signRequest(roomUuid,this.URL,getSecretShare(keygenResult),requestPayloadJson);return deserializeSignedRequest(signedRequestJson)}async signBytes(roomUuid,keygenResult,message){const messageHex=(0,utils_1.bytesToHex)(message);return(await this.NATIVE).edBls12377SignMessageBytes(roomUuid,this.URL,getSecretShare(keygenResult),messageHex)}async refresh(roomUuid,keygenResult){const refreshedKeygenResult=await(await this.NATIVE).edBls12377Refresh(roomUuid,this.URL,getSecretShare(keygenResult));return new types_1.EdBls12377KeygenResult(refreshedKeygenResult.compute_key,refreshedKeygenResult.address,refreshedKeygenResult.secret_share)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareRemainingParty(roomUuid,this.URL,newThreshold,getSecretShare(keygenResult),keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportFullPrivateKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async exportViewKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportViewKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async offlineExportFullPrivateKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportFullPrivateKey(serializeKeygenResults(keygenResults))}async offlineExportViewKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportViewKey(serializeKeygenResults(keygenResults))}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds,isPrivateKeyRaw=!1){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,isPrivateKeyRaw);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}}function getSecretShare(keygenResult){return"string"==typeof keygenResult?keygenResult:keygenResult.secretShare}function serializeKeygenResults(keygenResults){return keygenResults.map(result=>"string"==typeof result?result:result.secretShare)}function serializeRequestPayload(requestPayload){const serializedPayload={function_id:(0,utils_1.bytesToHex)(requestPayload.function_id),is_root:requestPayload.is_root,program_checksum:requestPayload.program_checksum?(0,utils_1.bytesToHex)(requestPayload.program_checksum):null,inputs:requestPayload.inputs.map(input=>"record"===input.type?{type:"record",h:(0,utils_1.bytesToHex)(input.h),tag:(0,utils_1.bytesToHex)(input.tag)}:{type:input.type,index:(0,utils_1.bytesToHex)(input.index),fields:input.fields.map(utils_1.bytesToHex)})};return JSON.stringify(serializedPayload)}function deserializeSignedRequest(signedRequestJson){let parsed;try{parsed=JSON.parse(signedRequestJson)}catch(_a){throw new Error("Invalid signed request JSON returned from native bindings.")}if(!parsed||"object"!=typeof parsed||Array.isArray(parsed))throw new Error("Invalid signed request JSON returned from native bindings.");const signedRequest=parsed;return{signer:deserializeBytes(signedRequest.signer,"signer"),signature:deserializeBytes(signedRequest.signature,"signature"),tvk:deserializeBytes(signedRequest.tvk,"tvk"),gammas:deserializeBytesArray(signedRequest.gammas,"gammas")}}function deserializeBytes(value,fieldName){if("string"!=typeof value)throw new TypeError(fieldName+" must be a hex string in the native response.");return(0,utils_1.hexToBytes)(value)}function deserializeBytesArray(value,fieldName){if(Array.isArray(value))return value.map((item,index)=>deserializeBytes(item,fieldName+`[${index}]`));throw new TypeError(fieldName+" must be an array in the native response.")}exports.EdBls12377=EdBls12377;
@@ -9,6 +9,7 @@ export declare class EdBls12377 {
9
9
  createRoom(numParties: number, apiKey: string): Promise<string>;
10
10
  keygen(roomUuid: string, numParties: number, threshold: number, keygenInit: EdBls12377InitKeygenResult, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
11
11
  signRequest(roomUuid: string, keygenResult: EdBls12377KeygenResult | string, requestPayload: EdBls12377RequestSignPayload): Promise<EdBls12377SignedRequest>;
12
+ signBytes(roomUuid: string, keygenResult: EdBls12377KeygenResult | string, message: Uint8Array): Promise<string>;
12
13
  refresh(roomUuid: string, keygenResult: EdBls12377KeygenResult | string): Promise<EdBls12377KeygenResult>;
13
14
  reshareNewParty(roomUuid: string, oldThreshold: number, newThreshold: number, keygenInit: EdBls12377InitKeygenResult, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
14
15
  reshareRemainingParty(roomUuid: string, newThreshold: number, keygenResult: EdBls12377KeygenResult | string, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
@@ -1 +1 @@
1
- import*as types_1 from"./types.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";class EdBls12377{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new types_1.EdBls12377InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){return(await this.NATIVE).edBls12377GetExportID(getSecretShare(keygenResult))}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async keygen(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).edBls12377Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(keygenResult.compute_key,keygenResult.address,keygenResult.secret_share)}async signRequest(roomUuid,keygenResult,requestPayload){const requestPayloadJson=serializeRequestPayload(requestPayload),signedRequestJson=await(await this.NATIVE).edBls12377signRequest(roomUuid,this.URL,getSecretShare(keygenResult),requestPayloadJson);return deserializeSignedRequest(signedRequestJson)}async refresh(roomUuid,keygenResult){const refreshedKeygenResult=await(await this.NATIVE).edBls12377Refresh(roomUuid,this.URL,getSecretShare(keygenResult));return new types_1.EdBls12377KeygenResult(refreshedKeygenResult.compute_key,refreshedKeygenResult.address,refreshedKeygenResult.secret_share)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareRemainingParty(roomUuid,this.URL,newThreshold,getSecretShare(keygenResult),keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportFullPrivateKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async exportViewKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportViewKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async offlineExportFullPrivateKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportFullPrivateKey(serializeKeygenResults(keygenResults))}async offlineExportViewKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportViewKey(serializeKeygenResults(keygenResults))}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds,isPrivateKeyRaw=!1){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,isPrivateKeyRaw);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}}function getSecretShare(keygenResult){return"string"==typeof keygenResult?keygenResult:keygenResult.secretShare}function serializeKeygenResults(keygenResults){return keygenResults.map(result=>"string"==typeof result?result:result.secretShare)}function serializeRequestPayload(requestPayload){const serializedPayload={function_id:(0,utils_1.bytesToHex)(requestPayload.function_id),is_root:requestPayload.is_root,program_checksum:requestPayload.program_checksum?(0,utils_1.bytesToHex)(requestPayload.program_checksum):null,inputs:requestPayload.inputs.map(input=>"record"===input.type?{type:"record",h:(0,utils_1.bytesToHex)(input.h),tag:(0,utils_1.bytesToHex)(input.tag)}:{type:input.type,index:(0,utils_1.bytesToHex)(input.index),fields:input.fields.map(utils_1.bytesToHex)})};return JSON.stringify(serializedPayload)}function deserializeSignedRequest(signedRequestJson){let parsed;try{parsed=JSON.parse(signedRequestJson)}catch(_a){throw new Error("Invalid signed request JSON returned from native bindings.")}if(!parsed||"object"!=typeof parsed||Array.isArray(parsed))throw new Error("Invalid signed request JSON returned from native bindings.");const signedRequest=parsed;return{signer:deserializeBytes(signedRequest.signer,"signer"),signature:deserializeBytes(signedRequest.signature,"signature"),tvk:deserializeBytes(signedRequest.tvk,"tvk"),gammas:deserializeBytesArray(signedRequest.gammas,"gammas")}}function deserializeBytes(value,fieldName){if("string"!=typeof value)throw new TypeError(fieldName+" must be a hex string in the native response.");return(0,utils_1.hexToBytes)(value)}function deserializeBytesArray(value,fieldName){if(Array.isArray(value))return value.map((item,index)=>deserializeBytes(item,fieldName+`[${index}]`));throw new TypeError(fieldName+" must be an array in the native response.")}export{EdBls12377};
1
+ import*as types_1 from"./types.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";class EdBls12377{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new types_1.EdBls12377InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){return(await this.NATIVE).edBls12377GetExportID(getSecretShare(keygenResult))}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async keygen(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).edBls12377Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(keygenResult.compute_key,keygenResult.address,keygenResult.secret_share)}async signRequest(roomUuid,keygenResult,requestPayload){const requestPayloadJson=serializeRequestPayload(requestPayload),signedRequestJson=await(await this.NATIVE).edBls12377signRequest(roomUuid,this.URL,getSecretShare(keygenResult),requestPayloadJson);return deserializeSignedRequest(signedRequestJson)}async signBytes(roomUuid,keygenResult,message){const messageHex=(0,utils_1.bytesToHex)(message);return(await this.NATIVE).edBls12377SignMessageBytes(roomUuid,this.URL,getSecretShare(keygenResult),messageHex)}async refresh(roomUuid,keygenResult){const refreshedKeygenResult=await(await this.NATIVE).edBls12377Refresh(roomUuid,this.URL,getSecretShare(keygenResult));return new types_1.EdBls12377KeygenResult(refreshedKeygenResult.compute_key,refreshedKeygenResult.address,refreshedKeygenResult.secret_share)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareRemainingParty(roomUuid,this.URL,newThreshold,getSecretShare(keygenResult),keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportFullPrivateKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async exportViewKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportViewKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async offlineExportFullPrivateKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportFullPrivateKey(serializeKeygenResults(keygenResults))}async offlineExportViewKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportViewKey(serializeKeygenResults(keygenResults))}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds,isPrivateKeyRaw=!1){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,isPrivateKeyRaw);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}}function getSecretShare(keygenResult){return"string"==typeof keygenResult?keygenResult:keygenResult.secretShare}function serializeKeygenResults(keygenResults){return keygenResults.map(result=>"string"==typeof result?result:result.secretShare)}function serializeRequestPayload(requestPayload){const serializedPayload={function_id:(0,utils_1.bytesToHex)(requestPayload.function_id),is_root:requestPayload.is_root,program_checksum:requestPayload.program_checksum?(0,utils_1.bytesToHex)(requestPayload.program_checksum):null,inputs:requestPayload.inputs.map(input=>"record"===input.type?{type:"record",h:(0,utils_1.bytesToHex)(input.h),tag:(0,utils_1.bytesToHex)(input.tag)}:{type:input.type,index:(0,utils_1.bytesToHex)(input.index),fields:input.fields.map(utils_1.bytesToHex)})};return JSON.stringify(serializedPayload)}function deserializeSignedRequest(signedRequestJson){let parsed;try{parsed=JSON.parse(signedRequestJson)}catch(_a){throw new Error("Invalid signed request JSON returned from native bindings.")}if(!parsed||"object"!=typeof parsed||Array.isArray(parsed))throw new Error("Invalid signed request JSON returned from native bindings.");const signedRequest=parsed;return{signer:deserializeBytes(signedRequest.signer,"signer"),signature:deserializeBytes(signedRequest.signature,"signature"),tvk:deserializeBytes(signedRequest.tvk,"tvk"),gammas:deserializeBytesArray(signedRequest.gammas,"gammas")}}function deserializeBytes(value,fieldName){if("string"!=typeof value)throw new TypeError(fieldName+" must be a hex string in the native response.");return(0,utils_1.hexToBytes)(value)}function deserializeBytesArray(value,fieldName){if(Array.isArray(value))return value.map((item,index)=>deserializeBytes(item,fieldName+`[${index}]`));throw new TypeError(fieldName+" must be an array in the native response.")}export{EdBls12377};
@@ -141,6 +141,7 @@ export interface DynamicNativeSdkInterface {
141
141
  edBls12377GetExportID(secretShare: string): Promise<string>;
142
142
  edBls12377Keygen(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
143
143
  edBls12377signRequest(roomUUID: string, hostUrl: string, secretShare: string, requestPayload: string): Promise<string>;
144
+ edBls12377SignMessageBytes(roomUUID: string, hostUrl: string, secretShare: string, messageHex: string): Promise<string>;
144
145
  edBls12377Refresh(roomUUID: string, hostUrl: string, secretShare: string): Promise<EdBls12377NativeKeygenResult>;
145
146
  edBls12377ReshareNewParty(roomUUID: string, hostUrl: string, oldThreshold: number, newThreshold: number, keygenSecret: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
146
147
  edBls12377ReshareRemainingParty(roomUUID: string, hostUrl: string, newThreshold: number, secretShare: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/btc-utils",
3
- "version": "0.0.353",
3
+ "version": "0.1.0-request-signing",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "dependencies": {
8
- "@dynamic-labs-wallet/core": "0.0.353",
9
- "bitcoinjs-lib": "^7.0.0",
10
- "bip322-js": "^3.0.0",
8
+ "@dynamic-labs-wallet/core": "0.1.0-request-signing",
9
+ "bitcoinjs-lib": "^7.0.2",
10
+ "bip322-js": "4.0.0",
11
11
  "@noble/hashes": "1.7.1",
12
12
  "bs58": "^6.0.0"
13
13
  },
@@ -34,6 +34,7 @@
34
34
  }
35
35
  },
36
36
  "devDependencies": {
37
+ "@bitcoinerlab/secp256k1": "^1.2.0",
37
38
  "typescript": "^5.0.0",
38
39
  "@types/node": "^20.0.0"
39
40
  }
@@ -0,0 +1,21 @@
1
+ import type * as bitcoin from 'bitcoinjs-lib';
2
+ /**
3
+ * Throws unless every input's PSBT-declared sighash type is in the allow-list.
4
+ *
5
+ * Call this before any signing begins — inputs are signed in parallel, so
6
+ * throwing partway through would leave a partially signed PSBT behind.
7
+ *
8
+ * An empty array permits nothing rather than everything: a caller whose
9
+ * allow-list computes to empty must not silently get the guard disabled. Omit
10
+ * the parameter entirely to permit any declared type.
11
+ *
12
+ * @param inputsToSign - The wallet-owned inputs about to be signed, with their PSBT indexes
13
+ * @param isTaproot - Whether signing takes the Taproot branch, so the fallback
14
+ * sighash type matches the hash function actually used
15
+ * @param allowedSighash - Optional allow-list of permitted sighash types
16
+ */
17
+ export declare const assertSighashAllowed: (inputsToSign: {
18
+ input: bitcoin.Psbt["data"]["inputs"][number];
19
+ index: number;
20
+ }[], isTaproot: boolean, allowedSighash?: number[]) => void;
21
+ //# sourceMappingURL=assertSighashAllowed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertSighashAllowed.d.ts","sourceRoot":"","sources":["../../src/assertSighashAllowed/assertSighashAllowed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAC;AAG9C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,iBACjB;IAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,aACrE,OAAO,mBACD,MAAM,EAAE,KACxB,IAgBF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { assertSighashAllowed } from './assertSighashAllowed.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assertSighashAllowed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as bitcoin from 'bitcoinjs-lib';
2
+ /**
3
+ * Builds the BIP-322 `to_spend` transaction as a plain Transaction.
4
+ *
5
+ * `BIP322.buildToSpendTx` goes through `Psbt.extractTransaction()`, which bitcoinjs-lib >= 7.0.4 rejects
6
+ * because the virtual input has no UTXO ("Need a Utxo input item for input #0"). A Transaction has no such check.
7
+ *
8
+ * @param message - The message to sign
9
+ * @param scriptPubKey - The message challenge (the signer's script public key)
10
+ */
11
+ export declare const buildToSpendTx: (message: string, scriptPubKey: Uint8Array) => bitcoin.Transaction;
12
+ //# sourceMappingURL=buildToSpendTx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildToSpendTx.d.ts","sourceRoot":"","sources":["../../src/buildToSpendTx/buildToSpendTx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAMzC;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,YAAa,MAAM,gBAAgB,UAAU,KAAG,OAAO,CAAC,WAalF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { buildToSpendTx } from './buildToSpendTx.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/buildToSpendTx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Constant-shape byte equality without Buffer — the iframe build compiles
3
+ * this package with browser typings where Buffer is not assignable to
4
+ * Uint8Array.
5
+ * @param a - First byte array
6
+ * @param b - Second byte array
7
+ * @returns True if both arrays have identical length and contents
8
+ */
9
+ export declare const bytesEqual: (a: Uint8Array, b: Uint8Array) => boolean;
10
+ //# sourceMappingURL=bytesEqual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bytesEqual.d.ts","sourceRoot":"","sources":["../../src/bytesEqual/bytesEqual.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,MAAO,UAAU,KAAK,UAAU,KAAG,OACY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { bytesEqual } from './bytesEqual.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bytesEqual/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"calculateBip322Hash.d.ts","sourceRoot":"","sources":["../../src/calculateBip322Hash/calculateBip322Hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI/E;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,YACrB,MAAM,UACP,GAAG,eACE,kBAAkB,WACtB,cAAc,QACjB,GAAG,KACR;IAAE,gBAAgB,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,GAAG,CAAA;CAiDjD,CAAC"}
1
+ {"version":3,"file":"calculateBip322Hash.d.ts","sourceRoot":"","sources":["../../src/calculateBip322Hash/calculateBip322Hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAK/E;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,YACrB,MAAM,UACP,GAAG,eACE,kBAAkB,WACtB,cAAc,QACjB,GAAG,KACR;IAAE,gBAAgB,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,GAAG,CAAA;CAiDjD,CAAC"}
@@ -1,11 +1,9 @@
1
- import { BitcoinAddressType, BitcoinNetwork } from '@dynamic-labs-wallet/core';
1
+ import type { BitcoinAddressType } from '@dynamic-labs-wallet/core';
2
+ import { BitcoinNetwork } from '@dynamic-labs-wallet/core';
2
3
  /**
3
4
  * Computes the BIP-322 message hash for a given message and public key,
4
5
  * returning the result as a hex string.
5
6
  *
6
- * This function implements the BIP-322 hash computation for
7
- * native_segwit and taproot address types.
8
- *
9
7
  * @param message - The raw message to be signed
10
8
  * @param publicKey - The public key (hex string, Buffer, or Uint8Array)
11
9
  * @param addressType - The address type (BitcoinAddressType enum or 'native_segwit', 'taproot')
@@ -1 +1 @@
1
- {"version":3,"file":"computeBip322HashHex.d.ts","sourceRoot":"","sources":["../../src/computeBip322HashHex/computeBip322HashHex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ/E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,YACtB,MAAM,aACJ,MAAM,GAAG,MAAM,GAAG,UAAU,eAC1B,kBAAkB,GAAG,eAAe,GAAG,SAAS,YACpD,cAAc,GAAG,SAAS,GAAG,SAAS,QACzC,GAAG,KACR,MAyEF,CAAC"}
1
+ {"version":3,"file":"computeBip322HashHex.d.ts","sourceRoot":"","sources":["../../src/computeBip322HashHex/computeBip322HashHex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAK3D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,YACtB,MAAM,aACJ,MAAM,GAAG,MAAM,GAAG,UAAU,eAC1B,kBAAkB,GAAG,eAAe,GAAG,SAAS,YACpD,cAAc,GAAG,SAAS,GAAG,SAAS,QACzC,GAAG,KACR,MASF,CAAC"}
@@ -3,7 +3,10 @@ import type { EcdsaSignature } from '#internal/core';
3
3
  * Converts an ECDSA signature to DER format
4
4
  *
5
5
  * @param signature - The ECDSA signature
6
+ * @param sighashType - The sighash type to append as the DER trailing byte.
7
+ * Must match the type the signing hash was built with, or the signature will
8
+ * fail verification at finalize/broadcast. Defaults to SIGHASH_ALL.
6
9
  * @returns The DER encoded signature
7
10
  */
8
- export declare const convertSignatureToDER: (signature: EcdsaSignature) => Uint8Array;
11
+ export declare const convertSignatureToDER: (signature: EcdsaSignature, sighashType?: number) => Uint8Array;
9
12
  //# sourceMappingURL=convertSignatureToDER.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertSignatureToDER.d.ts","sourceRoot":"","sources":["../../src/convertSignatureToDER/convertSignatureToDER.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,cAAe,cAAc,eAmB9D,CAAC"}
1
+ {"version":3,"file":"convertSignatureToDER.d.ts","sourceRoot":"","sources":["../../src/convertSignatureToDER/convertSignatureToDER.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,cACrB,cAAc,gBACZ,MAAM,eAoBpB,CAAC"}
@@ -3,7 +3,10 @@ import type { EcdsaSignature } from '#internal/core';
3
3
  * Converts a signature to a Buffer format suitable for Taproot (BIP340/Schnorr)
4
4
  *
5
5
  * @param signature - The signature from MPC (can be Uint8Array, Buffer, or EcdsaSignature object)
6
- * @returns A Buffer containing the 64-byte Schnorr signature
6
+ * @param sighashType - The sighash type the signing hash was built with. Per
7
+ * BIP-341 the signature stays 64 bytes for SIGHASH_DEFAULT and gains the
8
+ * sighash type as a 65th byte for any other type. Defaults to SIGHASH_DEFAULT.
9
+ * @returns A Buffer containing the 64-byte (or 65-byte) Schnorr signature
7
10
  */
8
- export declare const convertSignatureToTaprootBuffer: (signature: EcdsaSignature | Uint8Array | Buffer) => Buffer;
11
+ export declare const convertSignatureToTaprootBuffer: (signature: EcdsaSignature | Uint8Array | Buffer, sighashType?: number) => Buffer;
9
12
  //# sourceMappingURL=convertSignatureToTaprootBuffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertSignatureToTaprootBuffer.d.ts","sourceRoot":"","sources":["../../src/convertSignatureToTaprootBuffer/convertSignatureToTaprootBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,cAAe,cAAc,GAAG,UAAU,GAAG,MAAM,KAAG,MAWjG,CAAC"}
1
+ {"version":3,"file":"convertSignatureToTaprootBuffer.d.ts","sourceRoot":"","sources":["../../src/convertSignatureToTaprootBuffer/convertSignatureToTaprootBuffer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,cAC/B,cAAc,GAAG,UAAU,GAAG,MAAM,gBAClC,MAAM,KAClB,MAmBF,CAAC"}
@@ -1,11 +1,22 @@
1
1
  import type { Psbt } from 'bitcoinjs-lib';
2
- import type { BitcoinNetwork } from '@dynamic-labs-wallet/core';
2
+ import { BitcoinNetwork } from '@dynamic-labs-wallet/core';
3
3
  /**
4
- * Checks if a PSBT input belongs to a specific address
4
+ * Checks if a PSBT input belongs to a specific address.
5
+ *
6
+ * For P2WSH inputs address equality cannot work (the address commits to the
7
+ * script, not our key), so ownership is opt-in and means ALL of: the caller
8
+ * explicitly allowlisted the witnessScript, it hashes to the scriptPubKey
9
+ * commitment, and it is a canonical m-of-n CHECKMULTISIG script with
10
+ * `publicKey` in a signing position. Any other script shape is rejected even
11
+ * if the key appears in it, so a hostile PSBT cannot obtain a signature over
12
+ * an arbitrary script that merely name-drops the wallet key, and the wallet
13
+ * never co-signs a multisig arrangement the caller did not name.
5
14
  * @param input - The PSBT input (from psbt.data.inputs)
6
15
  * @param address - The address to check against
7
16
  * @param network - The Bitcoin network
8
- * @returns True if the input belongs to the address, false otherwise
17
+ * @param publicKey - The wallet's compressed ECDSA public key; required to match P2WSH inputs
18
+ * @param allowedWitnessScripts - Hex-encoded witnessScripts the caller consents to co-sign; required to match P2WSH inputs
19
+ * @returns True if the input belongs to the address (or public key, for P2WSH), false otherwise
9
20
  */
10
- export declare const doesInputBelongToAddress: (input: Psbt["data"]["inputs"][number], address: string, network: BitcoinNetwork) => boolean;
21
+ export declare const doesInputBelongToAddress: (input: Psbt["data"]["inputs"][number], address: string, network: BitcoinNetwork, publicKey?: ArrayLike<number>, allowedWitnessScripts?: string[]) => boolean;
11
22
  //# sourceMappingURL=doesInputBelongToAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doesInputBelongToAddress.d.ts","sourceRoot":"","sources":["../../src/doesInputBelongToAddress/doesInputBelongToAddress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,UAC5B,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAC5B,MAAM,WACN,cAAc,KACtB,OAwCF,CAAC"}
1
+ {"version":3,"file":"doesInputBelongToAddress.d.ts","sourceRoot":"","sources":["../../src/doesInputBelongToAddress/doesInputBelongToAddress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAmD3D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,UAC5B,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAC5B,MAAM,WACN,cAAc,cACX,SAAS,CAAC,MAAM,CAAC,0BACL,MAAM,EAAE,KAC/B,OAuDF,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { BitcoinNetwork } from '@dynamic-labs-wallet/core';
2
+ /** The transaction fields a signing intent commits to, as the intent encodes them. */
3
+ export type PsbtIntentOperation = {
4
+ /** The fee in satoshis: the sum of the inputs minus the sum of the outputs, as a decimal string. */
5
+ feeSats: string;
6
+ /** Every output of the transaction, in transaction order. */
7
+ outputs: {
8
+ script: string;
9
+ valueSats: string;
10
+ }[];
11
+ /** The signature hashes of the requested inputs, in ascending input order, as lowercase hex. */
12
+ sighashes: string[];
13
+ /** The transaction id, as lowercase hex. */
14
+ txid: string;
15
+ };
16
+ /**
17
+ * Describes a PSBT the way a BTC signing intent does: its txid, fee, outputs
18
+ * and the sighashes of the inputs a wallet is about to sign.
19
+ *
20
+ * Every input must carry a `witnessUtxo`: the fee needs the value of every
21
+ * input, and the txid of a segwit transaction does not change once its inputs
22
+ * are signed. An input with only a `nonWitnessUtxo` is rejected.
23
+ *
24
+ * @param psbtBase64 - The PSBT in base64 format
25
+ * @param network - The Bitcoin network the PSBT is for
26
+ * @param inputIndexes - The PSBT input indexes the wallet signs
27
+ * @returns The txid, fee, outputs and the sighashes of `inputIndexes`
28
+ * @throws Error if an input lacks a `witnessUtxo`, the outputs exceed the inputs,
29
+ * `inputIndexes` is empty or out of range, or a requested input has no derivable sighash
30
+ */
31
+ export declare const extractPsbtIntentOperation: ({ inputIndexes, network, psbtBase64, }: {
32
+ inputIndexes: number[];
33
+ network: BitcoinNetwork | "mainnet" | "testnet";
34
+ psbtBase64: string;
35
+ }) => PsbtIntentOperation;
36
+ //# sourceMappingURL=extractPsbtIntentOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractPsbtIntentOperation.d.ts","sourceRoot":"","sources":["../../src/extractPsbtIntentOperation/extractPsbtIntentOperation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,sFAAsF;AACtF,MAAM,MAAM,mBAAmB,GAAG;IAChC,oGAAoG;IACpG,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjD,gGAAgG;IAChG,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,2CAIpC;IACD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC;IAChD,UAAU,EAAE,MAAM,CAAC;CACpB,KAAG,mBA+CH,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { extractPsbtIntentOperation } from './extractPsbtIntentOperation.js';
2
+ export type { PsbtIntentOperation } from './extractPsbtIntentOperation.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extractPsbtIntentOperation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -3,9 +3,13 @@ import type { BitcoinNetwork } from '@dynamic-labs-wallet/core';
3
3
  * Extracts sighashes from a PSBT for validation.
4
4
  * This is used to verify that the message being signed matches the PSBT context.
5
5
  *
6
+ * P2WSH inputs whose witnessScript is absent yield `null` instead of a hash:
7
+ * finalization strips witnessScript from completed inputs, so a co-signer's
8
+ * already-finalized input must not block validation of the remaining inputs.
9
+ *
6
10
  * @param psbtBase64 - PSBT in base64 format
7
11
  * @param network - 'mainnet' or 'testnet' or BitcoinNetwork enum (defaults to 'mainnet')
8
- * @returns Array of sighash hex strings for each input
12
+ * @returns Array of sighash hex strings, aligned by input index; `null` for inputs whose sighash cannot be derived
9
13
  */
10
- export declare const extractPsbtSighashes: (psbtBase64: string, network?: BitcoinNetwork | "mainnet" | "testnet") => string[];
14
+ export declare const extractPsbtSighashes: (psbtBase64: string, network?: BitcoinNetwork | "mainnet" | "testnet") => (string | null)[];
11
15
  //# sourceMappingURL=extractPsbtSighashes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extractPsbtSighashes.d.ts","sourceRoot":"","sources":["../../src/extractPsbtSighashes/extractPsbtSighashes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,eACnB,MAAM,YACT,cAAc,GAAG,SAAS,GAAG,SAAS,KAC9C,MAAM,EA4CR,CAAC"}
1
+ {"version":3,"file":"extractPsbtSighashes.d.ts","sourceRoot":"","sources":["../../src/extractPsbtSighashes/extractPsbtSighashes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQhE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,eACnB,MAAM,YACT,cAAc,GAAG,SAAS,GAAG,SAAS,KAC9C,CAAC,MAAM,GAAG,IAAI,CAAC,EA2CjB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Restricts wallet-owned PSBT inputs to an explicitly requested subset.
3
+ *
4
+ * @param inputsToSign - Wallet-owned inputs, each carrying its PSBT index
5
+ * @param signingIndexes - Optional subset of input indexes the caller wants signed
6
+ * @returns The requested subset, or all inputs when signingIndexes is omitted/empty
7
+ * @throws Error if signingIndexes references an input the wallet does not own
8
+ */
9
+ export declare const filterInputsBySigningIndexes: <T extends {
10
+ index: number;
11
+ }>(inputsToSign: T[], signingIndexes?: number[]) => T[];
12
+ //# sourceMappingURL=filterInputsBySigningIndexes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterInputsBySigningIndexes.d.ts","sourceRoot":"","sources":["../../src/filterInputsBySigningIndexes/filterInputsBySigningIndexes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GAAI,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,gBACxD,CAAC,EAAE,mBACA,MAAM,EAAE,KACxB,CAAC,EAeH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { filterInputsBySigningIndexes } from './filterInputsBySigningIndexes.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filterInputsBySigningIndexes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { BitcoinNetwork } from '@dynamic-labs-wallet/core';
2
+ /**
3
+ * The `chainId` label that identifies a Bitcoin network to the policy layer
4
+ * and in a signing intent: `'2'` for an explicit testnet, `'1'` otherwise.
5
+ *
6
+ * An omitted network is labelled mainnet, which matches the mainnet default
7
+ * the signing clients already use for the PSBT itself.
8
+ *
9
+ * @param network - The Bitcoin network, if known
10
+ * @returns `'2'` for testnet, `'1'` for mainnet or when no network is given
11
+ */
12
+ export declare const getBtcChainId: (network?: BitcoinNetwork | "mainnet" | "testnet") => "1" | "2";
13
+ //# sourceMappingURL=getBtcChainId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBtcChainId.d.ts","sourceRoot":"","sources":["../../src/getBtcChainId/getBtcChainId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,aAAc,cAAc,GAAG,SAAS,GAAG,SAAS,KAAG,GAAG,GAAG,GACpD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { getBtcChainId } from './getBtcChainId.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/getBtcChainId/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,18 +1,22 @@
1
1
  import { BitcoinNetwork } from '@dynamic-labs-wallet/core';
2
+ type FeeRates = {
3
+ fast: number;
4
+ medium: number;
5
+ slow: number;
6
+ };
2
7
  /**
3
- * Fetches current fee rates from mempool.space
4
- * Returns fees in sat/vByte
8
+ * Fetches current fee rates in sat/vByte.
9
+ * Uses the mempool.space `/v1/fees/recommended` endpoint. For a custom Esplora-compatible
10
+ * `rpcUrl` that does not serve it, falls back to the standard `/fee-estimates` endpoint
11
+ * on the same backend. Never falls back to a different host.
5
12
  *
6
13
  * @param network - The Bitcoin network (default: MAINNET)
7
- * @param rpcUrl - Optional custom RPC URL
14
+ * @param rpcUrl - Optional custom Esplora-compatible RPC URL
8
15
  * @returns The fee rates for fast, medium, and slow transactions
9
16
  */
10
17
  export declare const getFeeRates: ({ network, rpcUrl, }: {
11
18
  network?: BitcoinNetwork;
12
19
  rpcUrl?: string;
13
- }) => Promise<{
14
- fast: number;
15
- medium: number;
16
- slow: number;
17
- }>;
20
+ }) => Promise<FeeRates>;
21
+ export {};
18
22
  //# sourceMappingURL=getFeeRates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFeeRates.d.ts","sourceRoot":"","sources":["../../src/getFeeRates/getFeeRates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,yBAGrB;IACD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAkBzD,CAAC"}
1
+ {"version":3,"file":"getFeeRates.d.ts","sourceRoot":"","sources":["../../src/getFeeRates/getFeeRates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3D,KAAK,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AA2B/D;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,yBAGrB;IACD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,QAAQ,CAyCnB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import * as bitcoin from 'bitcoinjs-lib';
2
+ import type { Psbt } from 'bitcoinjs-lib';
3
+ /**
4
+ * Resolves the BIP-143 scriptCode for a segwit v0 input. Shared by the signer
5
+ * and the sighash-verification helper so both derive the identical digest.
6
+ *
7
+ * P2WSH inputs sign over the full witnessScript, verified against the
8
+ * scriptPubKey commitment so a PSBT cannot substitute a script the UTXO does
9
+ * not commit to. P2WPKH inputs sign over the implied P2PKH script.
10
+ *
11
+ * @param input - The PSBT input (from psbt.data.inputs)
12
+ * @param script - The input's witnessUtxo scriptPubKey
13
+ * @param index - The input index (for error messages)
14
+ * @param bitcoinNetwork - The bitcoinjs-lib network for P2PKH reconstruction
15
+ * @returns The scriptCode to feed hashForWitnessV0
16
+ * @throws Error if a P2WSH input is missing its witnessScript, the witnessScript
17
+ * does not hash to the scriptPubKey commitment, or scriptCode generation fails
18
+ */
19
+ export declare const getSegwitV0ScriptCode: (input: Psbt["data"]["inputs"][number], script: ArrayLike<number>, index: number, bitcoinNetwork: bitcoin.networks.Network) => Uint8Array;
20
+ //# sourceMappingURL=getSegwitV0ScriptCode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSegwitV0ScriptCode.d.ts","sourceRoot":"","sources":["../../src/getSegwitV0ScriptCode/getSegwitV0ScriptCode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAK1C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,UACzB,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAC7B,SAAS,CAAC,MAAM,CAAC,SAClB,MAAM,kBACG,OAAO,CAAC,QAAQ,CAAC,OAAO,KACvC,UAyBF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { getSegwitV0ScriptCode } from './getSegwitV0ScriptCode.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/getSegwitV0ScriptCode/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,21 @@
1
+ import * as bitcoin from 'bitcoinjs-lib';
2
+ /**
3
+ * Resolves the sighash type for a PSBT input.
4
+ *
5
+ * The type is read from the PSBT itself (BIP-174 `PSBT_IN_SIGHASH_TYPE`), never
6
+ * supplied by the caller — the signing hash and the policy layer's verification
7
+ * hash must be derived from the same bytes, or every non-default signature
8
+ * would be rejected as tampered.
9
+ *
10
+ * When the input declares nothing, falls back to the historical default:
11
+ * SIGHASH_DEFAULT (0x00) for Taproot, SIGHASH_ALL (0x01) otherwise.
12
+ *
13
+ * @param input - The PSBT input to resolve the sighash type for
14
+ * @param isTaproot - Whether the input is spent as Taproot. Defaults to
15
+ * detecting `tapInternalKey`; pass explicitly when the caller already knows
16
+ * which signing branch it is on, so the fallback matches the hash function
17
+ * actually used.
18
+ * @returns The sighash type to build and encode the signature with
19
+ */
20
+ export declare const getSigHashType: (input: bitcoin.Psbt["data"]["inputs"][number], isTaproot?: boolean) => number;
21
+ //# sourceMappingURL=getSigHashType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSigHashType.d.ts","sourceRoot":"","sources":["../../src/getSigHashType/getSigHashType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,UAClB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,0BAE5C,MAAkH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { getSigHashType } from './getSigHashType.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/getSigHashType/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { BitcoinNetwork } from '@dynamic-labs-wallet/core';
2
2
  import type { UTXO } from '../types.js';
3
3
  /**
4
- * Fetches UTXOs for a given address using mempool.space API
4
+ * Fetches UTXOs for a given address using an Esplora-compatible API (mempool.space by default)
5
5
  *
6
6
  * @param address - The address to fetch UTXOs for
7
7
  * @param network - The Bitcoin network (default: MAINNET)
8
- * @param rpcUrl - Optional custom RPC URL
8
+ * @param rpcUrl - Optional custom Esplora-compatible RPC URL
9
9
  * @returns The list of UTXOs
10
10
  */
11
11
  export declare const getUTXOs: ({ address, network, rpcUrl, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"getUTXOs.d.ts","sourceRoot":"","sources":["../../src/getUTXOs/getUTXOs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,kCAIlB;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,IAAI,EAAE,CAmBjB,CAAC"}
1
+ {"version":3,"file":"getUTXOs.d.ts","sourceRoot":"","sources":["../../src/getUTXOs/getUTXOs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAIxC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,kCAIlB;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,IAAI,EAAE,CAmBjB,CAAC"}
package/src/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { publicKeyToBitcoinAddress } from './publicKeyToBitcoinAddress/index.js';
2
2
  export { normalizePublicKey } from './normalizePublicKey/index.js';
3
3
  export { getAddressTypeFromDerivationPath } from './getAddressTypeFromDerivationPath/index.js';
4
+ export { getAddressTypeFromAddress, resolveBitcoinAddressType } from './resolveBitcoinAddressType/index.js';
4
5
  export { calculateBip322Hash } from './calculateBip322Hash/index.js';
5
6
  export { encodeBip322Signature } from './encodeBip322Signature/index.js';
6
7
  export { privateKeyToWIF } from './privateKeyToWIF/index.js';
@@ -11,11 +12,18 @@ export { getUTXOs } from './getUTXOs/index.js';
11
12
  export { selectUTXOs } from './selectUTXOs/index.js';
12
13
  export { getFeeRates } from './getFeeRates/index.js';
13
14
  export { getDefaultRpcUrl } from './getDefaultRpcUrl/index.js';
15
+ export { resolveRpcUrl } from './resolveRpcUrl/index.js';
16
+ export { rpcFetch } from './rpcFetch/index.js';
14
17
  export { calculateTaprootTweak } from './calculateTaprootTweak/index.js';
15
18
  export { convertSignatureToTaprootBuffer } from './convertSignatureToTaprootBuffer/index.js';
16
19
  export { collectPSBTInputData } from './collectPSBTInputData/index.js';
17
20
  export { doesInputBelongToAddress } from './doesInputBelongToAddress/index.js';
21
+ export { isP2wshOutputScript } from './isP2wshOutputScript/index.js';
22
+ export { getSegwitV0ScriptCode } from './getSegwitV0ScriptCode/index.js';
23
+ export { filterInputsBySigningIndexes } from './filterInputsBySigningIndexes/index.js';
18
24
  export { getBitcoinNetwork } from './getBitcoinNetwork/index.js';
25
+ export { getSigHashType } from './getSigHashType/index.js';
26
+ export { assertSighashAllowed } from './assertSighashAllowed/index.js';
19
27
  export { initEccLib } from './initEccLib/index.js';
20
28
  export { extractPublicKeyHex } from './extractPublicKeyHex/index.js';
21
29
  export type { UTXO } from './types.js';
@@ -28,5 +36,8 @@ export { normalizeForCompressed } from './normalizeForCompressed/index.js';
28
36
  export { normalizeForTaproot } from './normalizeForTaproot/index.js';
29
37
  export { toBitcoinNetwork } from './toBitcoinNetwork/index.js';
30
38
  export { extractPsbtSighashes } from './extractPsbtSighashes/index.js';
39
+ export { extractPsbtIntentOperation } from './extractPsbtIntentOperation/index.js';
40
+ export type { PsbtIntentOperation } from './extractPsbtIntentOperation/index.js';
41
+ export { getBtcChainId } from './getBtcChainId/index.js';
31
42
  export { computeBip322HashHex } from './computeBip322HashHex/index.js';
32
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAC5G,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,YAAY,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { isP2wshOutputScript } from './isP2wshOutputScript.js';
2
+ //# sourceMappingURL=index.d.ts.map