cashscript 0.10.0 → 0.10.1
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.
package/dist/LibauthTemplate.js
CHANGED
|
@@ -38,7 +38,7 @@ export const buildTemplate = async ({ transaction, transactionHex = undefined, /
|
|
|
38
38
|
},
|
|
39
39
|
};
|
|
40
40
|
// add extra unlocking and locking script for P2PKH inputs spent alongside our contract
|
|
41
|
-
// this is needed for correct cross-
|
|
41
|
+
// this is needed for correct cross-references in the template
|
|
42
42
|
template.scripts[unlockScriptName] = {
|
|
43
43
|
name: unlockScriptName,
|
|
44
44
|
script: `<${signatureString}>\n<${placeholderKeyName}.public_key>`,
|
|
@@ -175,7 +175,7 @@ const generateTemplateScenarioTransaction = (contract, libauthTransaction, csTra
|
|
|
175
175
|
outpointIndex: input.outpointIndex,
|
|
176
176
|
outpointTransactionHash: binToHex(input.outpointTransactionHash),
|
|
177
177
|
sequenceNumber: input.sequenceNumber,
|
|
178
|
-
unlockingBytecode: generateTemplateScenarioBytecode(csInput, `p2pkh_placeholder_unlock_${index}`, index === slotIndex),
|
|
178
|
+
unlockingBytecode: generateTemplateScenarioBytecode(csInput, `p2pkh_placeholder_unlock_${index}`, `placeholder_key_${index}`, index === slotIndex),
|
|
179
179
|
};
|
|
180
180
|
});
|
|
181
181
|
const locktime = libauthTransaction.locktime;
|
|
@@ -201,21 +201,21 @@ const generateTemplateScenarioSourceOutputs = (csTransaction) => {
|
|
|
201
201
|
const slotIndex = csTransaction.inputs.findIndex((input) => !isUtxoP2PKH(input));
|
|
202
202
|
return csTransaction.inputs.map((input, index) => {
|
|
203
203
|
return {
|
|
204
|
-
lockingBytecode: generateTemplateScenarioBytecode(input, `p2pkh_placeholder_lock_${index}`, index === slotIndex),
|
|
204
|
+
lockingBytecode: generateTemplateScenarioBytecode(input, `p2pkh_placeholder_lock_${index}`, `placeholder_key_${index}`, index === slotIndex),
|
|
205
205
|
valueSatoshis: Number(input.satoshis),
|
|
206
206
|
token: serialiseTokenDetails(input.token),
|
|
207
207
|
};
|
|
208
208
|
});
|
|
209
209
|
};
|
|
210
210
|
// Used for generating the locking / unlocking bytecode for source outputs and inputs
|
|
211
|
-
const generateTemplateScenarioBytecode = (input, p2pkhScriptName, insertSlot) => {
|
|
211
|
+
const generateTemplateScenarioBytecode = (input, p2pkhScriptName, placeholderKeyName, insertSlot) => {
|
|
212
212
|
if (isUtxoP2PKH(input)) {
|
|
213
213
|
return {
|
|
214
214
|
script: p2pkhScriptName,
|
|
215
215
|
overrides: {
|
|
216
216
|
keys: {
|
|
217
217
|
privateKeys: {
|
|
218
|
-
|
|
218
|
+
[placeholderKeyName]: binToHex(input.template.privateKey),
|
|
219
219
|
},
|
|
220
220
|
},
|
|
221
221
|
},
|
package/dist/Transaction.js
CHANGED
|
@@ -191,7 +191,7 @@ export class Transaction {
|
|
|
191
191
|
// Compare nfts in- and outputs, check if inputs have nfts corresponding to outputs
|
|
192
192
|
// Keep list of nfts in inputs without matching output
|
|
193
193
|
// First check immutable nfts, then mutable & minting nfts together
|
|
194
|
-
// This is so an
|
|
194
|
+
// This is so an immutable input gets matched first and is removed from the list of unused nfts
|
|
195
195
|
let unusedNfts = listNftsInputs;
|
|
196
196
|
for (const nftInput of listNftsInputs) {
|
|
197
197
|
if (nftInput.capability === 'none') {
|
|
@@ -17,7 +17,7 @@ export class TransactionBuilder {
|
|
|
17
17
|
addInputs(utxos, unlocker, options) {
|
|
18
18
|
if ((!unlocker && utxos.some((utxo) => !isUnlockableUtxo(utxo)))
|
|
19
19
|
|| (unlocker && utxos.some((utxo) => isUnlockableUtxo(utxo)))) {
|
|
20
|
-
throw new Error('Either all UTXOs must have an individual unlocker
|
|
20
|
+
throw new Error('Either all UTXOs must have an individual unlocker specified, or no UTXOs must have an individual unlocker specified and a shared unlocker must be provided');
|
|
21
21
|
}
|
|
22
22
|
if (!unlocker) {
|
|
23
23
|
this.inputs = this.inputs.concat(utxos);
|
package/dist/interfaces.d.ts
CHANGED
package/dist/interfaces.js
CHANGED
|
@@ -10,7 +10,7 @@ export default class MockNetworkProvider {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
this.utxoMap = {};
|
|
12
12
|
this.transactionMap = {};
|
|
13
|
-
this.network = Network.
|
|
13
|
+
this.network = Network.MOCKNET;
|
|
14
14
|
for (let i = 0; i < 3; i += 1) {
|
|
15
15
|
this.addUtxo(aliceAddress, randomUtxo());
|
|
16
16
|
this.addUtxo(bobAddress, randomUtxo());
|
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cashscript",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Easily write and interact with Bitcoin Cash contracts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin cash",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@bitauth/libauth": "^3.0.0",
|
|
47
|
-
"@cashscript/utils": "^0.10.
|
|
47
|
+
"@cashscript/utils": "^0.10.1",
|
|
48
48
|
"bip68": "^1.0.4",
|
|
49
49
|
"bitcoin-rpc-promise-retry": "^1.3.0",
|
|
50
50
|
"delay": "^5.0.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"jest": "^29.4.1",
|
|
62
62
|
"typescript": "^5.5.4"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "0dd95d5b05a438ac1884bdb2252aec6a4c77e5b2"
|
|
65
65
|
}
|