You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can see that the CashScript `ContractInfo` needs to be provided as part of the `sourceOutputs`. Important to note from the spec is how the wallet knows which inputs to sign:
31
-
32
-
>To signal that the wallet needs to sign an input, the app sets the corresponding input's `unlockingBytecode` to empty Uint8Array.
23
+
```ts
24
+
interfaceWcTransactionObject {
25
+
transaction:TransactionCommon|string;
26
+
sourceOutputs:WcSourceOutput[];
27
+
broadcast?:boolean;
28
+
userPrompt?:string;
29
+
}
33
30
34
-
Also important for smart contract usage is how the wallet adds the public-key or a signature to contract inputs:
31
+
typeWcSourceOutput=Input&Output&WcContractInfo;
35
32
36
-
> We signal the use of pubkeys by using a 33-byte long zero-filled arrays and schnorr (the currently supported type) signatures by using a 65-byte long zero-filled arrays. Wallet detects these patterns and replaces them accordingly.
33
+
interfaceWcContractInfo {
34
+
contract?: {
35
+
abiFunction:AbiFunction;
36
+
redeemScript:Uint8Array;
37
+
artifact:Partial<Artifact>;
38
+
}
39
+
}
37
40
38
-
## Create wcTransactionObj
41
+
interfaceSignedTxObject {
42
+
signedTransaction:string;
43
+
signedTransactionHash:string;
44
+
}
45
+
```
39
46
40
-
To use the BCH WalletConnect `signTransaction` API, we need to pass an `options` object which we'll call `wcTransactionObj`.
47
+
To use the BCH WalletConnect `signTransaction` API, we need to pass a `wcTransactionObj`.
48
+
CashScript `TransactionBuilder` has a `generateWcTransactionObject` method for creating this object.
41
49
42
-
Below we'll give 2 example, the first example using spending a user-input and in the second example spending from a user-contract with the `userPubKey` and the`userSig`
50
+
Below we show 2 examples, the first example using spending a user-input and in the second example spending from a user-contract with placeholders for `userPubKey` and `userSig`
43
51
44
52
### Spending a user-input
45
53
46
54
Below is example code from the `CreateContract` code of the 'Hodl Vault' dapp repository, [link to source code](https://github.com/mr-zwets/bch-hodl-dapp/blob/main/src/views/CreateContract.vue#L14).
@@ -96,41 +87,28 @@ async function proposeWcTransaction(){
96
87
Below is example code from the `unlockHodlVault` code of the 'Hodl Vault' dapp repository, [link to source code](https://github.com/mr-zwets/bch-hodl-dapp/blob/main/src/views/UserContracts.vue#L66).
Copy file name to clipboardExpand all lines: website/docs/releases/release-notes.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,12 @@
2
2
title: Release Notes
3
3
---
4
4
5
+
## v0.11.1
6
+
7
+
#### CashScript SDK
8
+
-:sparkles: Add `generateWcTransactionObject()` method to `TransactionBuilder` to generate a `WcTransactionObject` that can be used to sign a transaction with a WalletConnect client.
9
+
-:sparkles: Add `placeholderSignature()`, `placeholderPublicKey()` and `placeholderP2PKHUnlocker()` helper functions to the SDK for WalletConnect usage.
10
+
5
11
## v0.11.0
6
12
7
13
This update adds CashScript support for the new BCH 2025 network upgrade. To read more about the upgrade, see [this blog post](https://blog.bitjson.com/2025-chips/).
0 commit comments