Skip to content

Commit acd9a05

Browse files
authored
chore: update lock docs in readme and remove unused deps (#26)
* chore: update lock docs in readme * chore: remove unused deps
1 parent 9a0c7ef commit acd9a05

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

deps/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

deps/auth

-147 KB
Binary file not shown.

packages/sdk/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,27 @@ const nostrPublicKey = '0x45c41f21e1cf715fa6d9ca20b8e002a574db7bb49e96ee89834c66
1515
const nostrLockScript = sdk.lock.buildScript(nostrPublicKey);
1616
const ckbAddress = sdk.lock.encodeToCKBAddress(nostrPublicKey);
1717

18-
// signed a nostr-lock input transaction
18+
//**** Signed a nostr-lock input transaction ****//
19+
20+
// construct a nostr signer first
1921
const signer = async (event: EventToSign) => {
2022
//...nostr signing event code
2123
const signedEvent: SignedEvent = //...
2224
return signedEvent;
2325
};
26+
// sdk.lock.signTx will overwrite the witness lock with dummyLock and then generate sigHashAll,
27+
// sign it and return signed transaction. It is a easy way to do nostr lock signing if
28+
// transaction fee estimation is not a problem to you. After calling this function, witness
29+
// is auto-filled with signedEvent.
2430
txSkeleton = await sdk.lock.signTx(txSkeleton, signer);
25-
// witness is auto-filled with signedEvent
31+
32+
// or prepare your transaction first
33+
import { createTransactionFromSkeleton } from "@ckb-lumos/lumos/helpers";
34+
let tx = createTransactionFromSkeleton(txSkeleton);
35+
// fill-in the witness of nostr-lock with corresponding dummyLock
36+
tx = await sdk.lock.prepareTx(transaction: Transaction);
37+
// sdk.lock.signPreparedTx will checks if the transaction is placed with correct Nostr-lock dummyLock
38+
// and then directly generate sigHashAll from the giving transaction, sign it and return
39+
// signed transaction. You need to call prepareTx before this function.
40+
const signedTx = await sdk.lock.signPreparedTx(tx, signer);
2641
```

0 commit comments

Comments
 (0)