cashscript 0.10.0-next.0 → 0.10.0-next.2
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/{src/LibauthTemplate.js → LibauthTemplate.js} +7 -7
- package/dist/{src/utils.js → utils.js} +2 -2
- package/package.json +4 -4
- /package/dist/{src/Argument.d.ts → Argument.d.ts} +0 -0
- /package/dist/{src/Argument.js → Argument.js} +0 -0
- /package/dist/{src/Contract.d.ts → Contract.d.ts} +0 -0
- /package/dist/{src/Contract.js → Contract.js} +0 -0
- /package/dist/{src/Errors.d.ts → Errors.d.ts} +0 -0
- /package/dist/{src/Errors.js → Errors.js} +0 -0
- /package/dist/{src/LibauthTemplate.d.ts → LibauthTemplate.d.ts} +0 -0
- /package/dist/{src/SignatureTemplate.d.ts → SignatureTemplate.d.ts} +0 -0
- /package/dist/{src/SignatureTemplate.js → SignatureTemplate.js} +0 -0
- /package/dist/{src/Transaction.d.ts → Transaction.d.ts} +0 -0
- /package/dist/{src/Transaction.js → Transaction.js} +0 -0
- /package/dist/{src/TransactionBuilder.d.ts → TransactionBuilder.d.ts} +0 -0
- /package/dist/{src/TransactionBuilder.js → TransactionBuilder.js} +0 -0
- /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{src/constants.js → constants.js} +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/interfaces.d.ts → interfaces.d.ts} +0 -0
- /package/dist/{src/interfaces.js → interfaces.js} +0 -0
- /package/dist/{src/network → network}/BitcoinRpcNetworkProvider.d.ts +0 -0
- /package/dist/{src/network → network}/BitcoinRpcNetworkProvider.js +0 -0
- /package/dist/{src/network → network}/ElectrumNetworkProvider.d.ts +0 -0
- /package/dist/{src/network → network}/ElectrumNetworkProvider.js +0 -0
- /package/dist/{src/network → network}/FullStackNetworkProvider.d.ts +0 -0
- /package/dist/{src/network → network}/FullStackNetworkProvider.js +0 -0
- /package/dist/{src/network → network}/MockNetworkProvider.d.ts +0 -0
- /package/dist/{src/network → network}/MockNetworkProvider.js +0 -0
- /package/dist/{src/network → network}/NetworkProvider.d.ts +0 -0
- /package/dist/{src/network → network}/NetworkProvider.js +0 -0
- /package/dist/{src/network → network}/index.d.ts +0 -0
- /package/dist/{src/network → network}/index.js +0 -0
- /package/dist/{src/utils.d.ts → utils.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Op, PrimitiveType, bytecodeToScript, decodeBool, decodeInt, decodeString,
|
|
1
|
+
import { Op, PrimitiveType, bytecodeToScript, decodeBool, decodeInt, decodeString, formatBitAuthScript, } from '@cashscript/utils';
|
|
2
2
|
import { hash160, hexToBin, decodeTransaction, binToHex, authenticationTemplateToCompilerConfiguration, createCompiler, createVirtualMachineBCHCHIPs, binToBase64, utf8ToBin, isHex, AuthenticationErrorCommon, } from '@bitauth/libauth';
|
|
3
3
|
import { deflate } from 'pako';
|
|
4
|
-
import { isUtxoP2PKH, } from '
|
|
4
|
+
import { isUtxoP2PKH, } from './interfaces.js';
|
|
5
5
|
import { encodeArgument as csEncodeArgument } from './Argument.js';
|
|
6
6
|
import { toRegExp } from './utils.js';
|
|
7
7
|
// all bitauth variables must be in snake case
|
|
@@ -150,7 +150,7 @@ const createScenarioSourceOutputs = (csTransaction) => {
|
|
|
150
150
|
if (csInput.token.nft) {
|
|
151
151
|
result.token.nft = {
|
|
152
152
|
capability: csInput.token.nft.capability,
|
|
153
|
-
commitment: csInput.token.nft.commitment
|
|
153
|
+
commitment: csInput.token.nft.commitment,
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -177,7 +177,7 @@ export const buildTemplate = async ({ transaction, transactionHex = undefined, /
|
|
|
177
177
|
const args = transaction.args.slice().reverse();
|
|
178
178
|
const hasSignatureTemplates = transaction.inputs.filter((input) => isUtxoP2PKH(input)).length;
|
|
179
179
|
const formattedBytecode = contract.artifact.debug
|
|
180
|
-
?
|
|
180
|
+
? formatBitAuthScript(bytecodeToScript(hexToBin(contract.artifact.debug.bytecode)), contract.artifact.debug.sourceMap, contract.artifact.source).split('\n')
|
|
181
181
|
: contract.artifact.bytecode.split(' ').map((asmElement) => {
|
|
182
182
|
if (isHex(asmElement)) {
|
|
183
183
|
return `<0x${asmElement}>`;
|
|
@@ -186,7 +186,7 @@ export const buildTemplate = async ({ transaction, transactionHex = undefined, /
|
|
|
186
186
|
});
|
|
187
187
|
const template = {
|
|
188
188
|
$schema: 'https://ide.bitauth.com/authentication-template-v0.schema.json',
|
|
189
|
-
description:
|
|
189
|
+
description: 'Imported from cashscript',
|
|
190
190
|
name: contract.artifact.contractName,
|
|
191
191
|
supported: ['BCH_SPEC'],
|
|
192
192
|
version: 0,
|
|
@@ -223,7 +223,7 @@ export const buildTemplate = async ({ transaction, transactionHex = undefined, /
|
|
|
223
223
|
},
|
|
224
224
|
})),
|
|
225
225
|
]),
|
|
226
|
-
}
|
|
226
|
+
},
|
|
227
227
|
};
|
|
228
228
|
// add extra variables for the p2pkh utxos spent together with our contract
|
|
229
229
|
if (hasSignatureTemplates) {
|
|
@@ -315,7 +315,7 @@ export const buildTemplate = async ({ transaction, transactionHex = undefined, /
|
|
|
315
315
|
unlocks: 'lock',
|
|
316
316
|
},
|
|
317
317
|
lock: {
|
|
318
|
-
lockingType:
|
|
318
|
+
lockingType: 'p2sh20',
|
|
319
319
|
name: 'lock',
|
|
320
320
|
// locking script contains the CashScript contract parameters followed by the contract opcodes
|
|
321
321
|
// we output these values as pushdata, comment will contain the type and the value of the variable
|
|
@@ -254,14 +254,14 @@ export const randomUtxo = (defaults) => ({
|
|
|
254
254
|
...{
|
|
255
255
|
txid: binToHex(sha256(bigIntToVmNumber(randomInt()))),
|
|
256
256
|
vout: Math.floor(Math.random() * 10),
|
|
257
|
-
satoshis:
|
|
257
|
+
satoshis: 100000n + randomInt(),
|
|
258
258
|
},
|
|
259
259
|
...defaults,
|
|
260
260
|
});
|
|
261
261
|
export const randomToken = (defaults) => ({
|
|
262
262
|
...{
|
|
263
263
|
category: binToHex(sha256(bigIntToVmNumber(randomInt()))),
|
|
264
|
-
amount:
|
|
264
|
+
amount: 100000n + randomInt(),
|
|
265
265
|
},
|
|
266
266
|
...defaults,
|
|
267
267
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cashscript",
|
|
3
|
-
"version": "0.10.0-next.
|
|
3
|
+
"version": "0.10.0-next.2",
|
|
4
4
|
"description": "Easily write and interact with Bitcoin Cash contracts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin cash",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"compile:test": "tsc -p tsconfig.test.json",
|
|
39
39
|
"lint": "eslint . --ext .ts --ignore-path ../../.eslintignore",
|
|
40
40
|
"prepare": "yarn build",
|
|
41
|
-
"prepublishOnly": "yarn test",
|
|
41
|
+
"prepublishOnly": "yarn test && yarn lint",
|
|
42
42
|
"pretest": "yarn build:test",
|
|
43
43
|
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@bitauth/libauth": "^2.0.0-alpha.8",
|
|
47
|
-
"@cashscript/utils": "^0.10.0-next.
|
|
47
|
+
"@cashscript/utils": "^0.10.0-next.2",
|
|
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": "^4.1.5"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "23f2f6fc78f6a911dfe559404be7741aa824e791"
|
|
65
65
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|