Skip to content

Commit 5ec9fb3

Browse files
authored
Merge pull request #5 from blooo-io/feat/publish-npm
docs: update readme
2 parents ebafaba + 5a4d210 commit 5ec9fb3

File tree

1 file changed

+65
-23
lines changed

1 file changed

+65
-23
lines changed

README.md

+65-23
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,27 @@ For a smooth and quick integration:
5555
* [Parameters](#parameters-8)
5656
* [getTrustedInputBIP143](#gettrustedinputbip143)
5757
* [Parameters](#parameters-9)
58+
* [signWithdrawal](#signwithdrawal)
59+
* [Parameters](#parameters-10)
5860
* [AcreBtcNew](#acrebtcnew)
5961
* [getWalletXpub](#getwalletxpub-1)
60-
* [Parameters](#parameters-10)
61-
* [getWalletPublicKey](#getwalletpublickey-1)
6262
* [Parameters](#parameters-11)
63-
* [createPaymentTransaction](#createpaymenttransaction-1)
63+
* [getWalletPublicKey](#getwalletpublickey-1)
6464
* [Parameters](#parameters-12)
65-
* [signMessage](#signmessage-1)
65+
* [createPaymentTransaction](#createpaymenttransaction-1)
6666
* [Parameters](#parameters-13)
67-
* [signWithdrawal](#signwithdrawal-1)
67+
* [signMessage](#signmessage-1)
6868
* [Parameters](#parameters-14)
69+
* [signWithdrawal](#signwithdrawal-1)
70+
* [Parameters](#parameters-15)
6971
* [descrTemplFrom](#descrtemplfrom)
70-
* [Parameters](#parameters-15)
72+
* [Parameters](#parameters-16)
7173
* [AcreBtcOld](#acrebtcold)
7274
* [getWalletPublicKey](#getwalletpublickey-2)
73-
* [Parameters](#parameters-16)
75+
* [Parameters](#parameters-17)
7476
* [Examples](#examples-7)
7577
* [createPaymentTransaction](#createpaymenttransaction-2)
76-
* [Parameters](#parameters-17)
78+
* [Parameters](#parameters-18)
7779
* [Examples](#examples-8)
7880
* [CreateTransactionArg](#createtransactionarg)
7981
* [Properties](#properties)
@@ -82,38 +84,38 @@ For a smooth and quick integration:
8284
* [Properties](#properties-1)
8385
* [AccountType](#accounttype)
8486
* [spendingCondition](#spendingcondition)
85-
* [Parameters](#parameters-18)
86-
* [setInput](#setinput)
8787
* [Parameters](#parameters-19)
88-
* [setOwnOutput](#setownoutput)
88+
* [setInput](#setinput)
8989
* [Parameters](#parameters-20)
90+
* [setOwnOutput](#setownoutput)
91+
* [Parameters](#parameters-21)
9092
* [getDescriptorTemplate](#getdescriptortemplate)
9193
* [SingleKeyAccount](#singlekeyaccount)
9294
* [getTaprootOutputKey](#gettaprootoutputkey)
93-
* [Parameters](#parameters-21)
94-
* [AppClient](#appclient)
9595
* [Parameters](#parameters-22)
96-
* [ClientCommandInterpreter](#clientcommandinterpreter)
96+
* [AppClient](#appclient)
9797
* [Parameters](#parameters-23)
98-
* [MerkelizedPsbt](#merkelizedpsbt)
98+
* [ClientCommandInterpreter](#clientcommandinterpreter)
9999
* [Parameters](#parameters-24)
100-
* [Merkle](#merkle)
100+
* [MerkelizedPsbt](#merkelizedpsbt)
101101
* [Parameters](#parameters-25)
102-
* [MerkleMap](#merklemap)
102+
* [Merkle](#merkle)
103103
* [Parameters](#parameters-26)
104-
* [WalletPolicy](#walletpolicy)
104+
* [MerkleMap](#merklemap)
105105
* [Parameters](#parameters-27)
106-
* [extract](#extract)
106+
* [WalletPolicy](#walletpolicy)
107107
* [Parameters](#parameters-28)
108-
* [finalize](#finalize)
108+
* [extract](#extract)
109109
* [Parameters](#parameters-29)
110-
* [clearFinalizedInput](#clearfinalizedinput)
110+
* [finalize](#finalize)
111111
* [Parameters](#parameters-30)
112-
* [writePush](#writepush)
112+
* [clearFinalizedInput](#clearfinalizedinput)
113113
* [Parameters](#parameters-31)
114+
* [writePush](#writepush)
115+
* [Parameters](#parameters-32)
114116
* [PsbtV2](#psbtv2)
115117
* [serializeTransactionOutputs](#serializetransactionoutputs-1)
116-
* [Parameters](#parameters-32)
118+
* [Parameters](#parameters-33)
117119
* [Examples](#examples-9)
118120
* [SignP2SHTransactionArg](#signp2shtransactionarg)
119121
* [Properties](#properties-2)
@@ -338,6 +340,46 @@ Trusted input is the hash of a UTXO that needs to be signed. BIP143 is used for
338340

339341
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
340342

343+
#### signWithdrawal
344+
345+
Signs an Acre Withdrawal message with the private key at
346+
the provided derivation path according to the Bitcoin Signature format
347+
and returns v, r, s.
348+
349+
##### Parameters
350+
351+
* `$0` **{path: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), withdrawalData: [AcreWithdrawalData](#acrewithdrawaldata)}**
352+
353+
* `$0.path`  
354+
* `$0.withdrawalData`  
355+
356+
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
357+
358+
##### Examples
359+
360+
```javascript
361+
var withdrawalData = {
362+
to: "0xc14972DC5a4443E4f5e89E3655BE48Ee95A795aB",
363+
value: "0x0",
364+
data: "0xcae9ca510000000000000000000000000e781e9d538895ee99bd6e9bf28664942beff32f00000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001000000000000000000000000006083Bde64CCBF08470a1a0dAa9a0281B4951be7C4b5e4623765ec95cfa6e261406d5c446012eff9300000000000000000000000008dcc842b8ed75efe1f222ebdc22d1b06ef35efff6469f708057266816f0595200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000587f579c500000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000001a1976a914c8e9edf5e915c0482b1b236fc917011a4b943e6e88ac000000000000",
365+
operation: "0",
366+
safeTxGas: "0x0",
367+
baseGas: "0x0",
368+
gasPrice: "0x0",
369+
gasToken: "0x0000000000000000000000000000000000000000",
370+
refundReceiver: "0x0000000000000000000000000000000000000000",
371+
nonce: "0xC",
372+
};
373+
acre.signWithdrawal({"m/44'/0'/0'/0/0", withdrawalData}).then(function(result) {
374+
var v = result['v'] + 27 + 4;
375+
var signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');
376+
console.log("Signature : " + signature);
377+
}).catch(function(ex) {console.log(ex);});
378+
```
379+
380+
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
381+
382+
341383
### AcreBtcNew
342384

343385
This class implements the same interface as AcreBtcOld (formerly

0 commit comments

Comments
 (0)