diff --git a/docs/user-wallets/pkps/bitcoin/1of1-multi-sig.md b/docs/user-wallets/pkps/bitcoin/1of1-multi-sig.md index 3bb26225..e673dd06 100644 --- a/docs/user-wallets/pkps/bitcoin/1of1-multi-sig.md +++ b/docs/user-wallets/pkps/bitcoin/1of1-multi-sig.md @@ -35,7 +35,7 @@ import { LitNodeClient } from "@lit-protocol/lit-node-client"; bitcoin.initEccLib(ecc); -async function oneOfOneMultiSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPublicKey1: string, pkpPublicKey2: string, destinationAddress: string) { +export async function oneOfOneMultiSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPublicKey1: string, pkpPublicKey2: string, destinationAddress: string) { const network = bitcoin.networks.bitcoin; const pubKeyBuffer_1 = Buffer.from(pkpPublicKey1, "hex"); const pubKeyBuffer_2 = Buffer.from(pkpPublicKey2, "hex"); @@ -104,7 +104,7 @@ async function oneOfOneMultiSig(litNodeClient: LitNodeClient, sessionSigs: any, }, }); - const signatureWithHashType = convertSignature( + const signatureWithHashType = await convertSignature( litActionResponse.signatures.btcSignature ); diff --git a/docs/user-wallets/pkps/bitcoin/collaborative.md b/docs/user-wallets/pkps/bitcoin/collaborative.md index 5c4594cb..cc4feb23 100644 --- a/docs/user-wallets/pkps/bitcoin/collaborative.md +++ b/docs/user-wallets/pkps/bitcoin/collaborative.md @@ -36,7 +36,7 @@ import { LitNodeClient } from "@lit-protocol/lit-node-client"; bitcoin.initEccLib(ecc); -async function collaborativeMultiSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPublicKey1: string, pkpPublicKey2: string, destinationAddress: string) { +export async function collaborativeMultiSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPublicKey1: string, pkpPublicKey2: string, destinationAddress: string) { const network = bitcoin.networks.bitcoin; const pubKeyBuffer_1 = Buffer.from(pkpPublicKey1, "hex"); const pubKeyBuffer_2 = Buffer.from(pkpPublicKey2, "hex"); @@ -155,11 +155,11 @@ async function collaborativeMultiSig(litNodeClient: LitNodeClient, sessionSigs: }, }); - const signatureWithHashType1 = convertSignature( + const signatureWithHashType1 = await convertSignature( litActionResponse1.signatures.btcSignature ); - const signatureWithHashType2 = convertSignature( + const signatureWithHashType2 = await convertSignature( litActionResponse2.signatures.btcSignature ); diff --git a/docs/user-wallets/pkps/bitcoin/multi-sig.md b/docs/user-wallets/pkps/bitcoin/multi-sig.md index a40b2329..e33b7d91 100644 --- a/docs/user-wallets/pkps/bitcoin/multi-sig.md +++ b/docs/user-wallets/pkps/bitcoin/multi-sig.md @@ -35,7 +35,7 @@ import { LitNodeClient } from "@lit-protocol/lit-node-client"; bitcoin.initEccLib(ecc); -async function multiSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPublicKey1: string, pkpPublicKey2: string, destinationAddress: string) { +export async function multiSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPublicKey1: string, pkpPublicKey2: string, destinationAddress: string) { const network = bitcoin.networks.bitcoin; const pubKeyBuffer_1 = Buffer.from(pkpPublicKey1, "hex"); const pubKeyBuffer_2 = Buffer.from(pkpPublicKey2, "hex"); @@ -113,11 +113,11 @@ async function multiSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPubli }, }); - const signatureWithHashType1 = convertSignature( + const signatureWithHashType1 = await convertSignature( litActionResponse1.signatures.btcSignature ); - const signatureWithHashType2 = convertSignature( + const signatureWithHashType2 = await convertSignature( litActionResponse2.signatures.btcSignature ); diff --git a/docs/user-wallets/pkps/bitcoin/overview.md b/docs/user-wallets/pkps/bitcoin/overview.md index 97465821..0dbd2321 100644 --- a/docs/user-wallets/pkps/bitcoin/overview.md +++ b/docs/user-wallets/pkps/bitcoin/overview.md @@ -110,7 +110,7 @@ import * as bip66 from "bip66"; import * as bitcoin from "bitcoinjs-lib"; import BN from "bn.js"; -function convertSignature(litSignature: any) { +export const convertSignature = async (litSignature: any) => { const EC = elliptic.ec; let r = Buffer.from(litSignature.r, "hex"); let s = Buffer.from(litSignature.s, "hex"); @@ -177,7 +177,7 @@ Once the transaction is fully signed and formatted, it needs to be broadcasted t ```tsx import fetch from "node-fetch"; -const broadcastTransaction = async (txHex: string) => { +export const broadcastTransaction = async (txHex: string) => { try { const response = await fetch("https://mempool.space/api/tx", { method: "POST", diff --git a/docs/user-wallets/pkps/bitcoin/single-sig.md b/docs/user-wallets/pkps/bitcoin/single-sig.md index 4ed3f5e2..b7bd12ee 100644 --- a/docs/user-wallets/pkps/bitcoin/single-sig.md +++ b/docs/user-wallets/pkps/bitcoin/single-sig.md @@ -33,7 +33,7 @@ import { LitNodeClient } from "@lit-protocol/lit-node-client"; bitcoin.initEccLib(ecc); -async function singleSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPublicKey: string, destinationAddress: string) { +export async function singleSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPublicKey: string, destinationAddress: string) { const network = bitcoin.networks.bitcoin; const pubKeyBuffer = Buffer.from(pkpPublicKey, "hex"); @@ -98,7 +98,7 @@ async function singleSig(litNodeClient: LitNodeClient, sessionSigs: any, pkpPubl }, }); - const signatureWithHashType = convertSignature( + const signatureWithHashType = await convertSignature( litActionResponse.signatures.btcSignature );