@ckb-lumos/experiment-tx-assembler
Advanced tools
Comparing version 0.20.0 to 0.21.0-next.0
@@ -9,21 +9,16 @@ "use strict"; | ||
exports.createScriptRegistry = createScriptRegistry; | ||
var _bi = require("@ckb-lumos/bi"); | ||
var _helpers = require("@ckb-lumos/helpers"); | ||
function createScriptRegistry(payload) { | ||
const map = new Map(); | ||
Object.keys(payload).forEach(k => map.set(k, payload[k])); | ||
const extend = newPayload => { | ||
return createScriptRegistry({ ...payload, | ||
return createScriptRegistry({ | ||
...payload, | ||
...newPayload | ||
}); | ||
}; | ||
const newScript = (key, args) => { | ||
const config = map.get(key); | ||
if (config === undefined) throw new Error(`${String(key)} doesn't exist in ScriptRegistry`); | ||
if (typeof args === "string") { | ||
@@ -43,3 +38,2 @@ return { | ||
}; | ||
const isScriptOf = (key, script) => { | ||
@@ -50,3 +44,2 @@ const config = map.get(key); | ||
}; | ||
const newCellDep = key => { | ||
@@ -63,3 +56,2 @@ const config = map.get(key); | ||
}; | ||
const nameOfScript = script => { | ||
@@ -74,3 +66,2 @@ let name = undefined; | ||
}; | ||
return { | ||
@@ -84,3 +75,2 @@ extend: extend, | ||
} | ||
function createCell(payload, options) { | ||
@@ -92,3 +82,2 @@ const data = payload.data || "0x"; | ||
}; | ||
if (payload.type) { | ||
@@ -99,3 +88,2 @@ cellOutput = Object.assign(cellOutput, { | ||
} | ||
let cell = { | ||
@@ -105,3 +93,2 @@ cellOutput: cellOutput, | ||
}; | ||
if (payload.outPoint) { | ||
@@ -112,3 +99,2 @@ cell = Object.assign(cell, { | ||
} | ||
if (payload.blockHash) { | ||
@@ -119,3 +105,2 @@ cell = Object.assign(cell, { | ||
} | ||
if (payload.blockNumber) { | ||
@@ -126,6 +111,4 @@ cell = Object.assign(cell, { | ||
} | ||
if ((options === null || options === void 0 ? void 0 : options.skipCheckCapacityIsEnough) !== false) { | ||
const min = (0, _helpers.minimalCellCapacity)(cell); | ||
if (_bi.BI.from(payload.capacity).lt(min)) { | ||
@@ -135,6 +118,4 @@ throw new Error("provided capacity is not enough"); | ||
} | ||
return cell; | ||
} | ||
function createCellWithMinimalCapacity(payload) { | ||
@@ -146,3 +127,2 @@ const data = payload.data || "0x"; | ||
}; | ||
if (payload.type) { | ||
@@ -153,3 +133,2 @@ cellOutput = Object.assign(cellOutput, { | ||
} | ||
const cell = { | ||
@@ -156,0 +135,0 @@ cellOutput: cellOutput, |
{ | ||
"name": "@ckb-lumos/experiment-tx-assembler", | ||
"version": "0.20.0", | ||
"version": "0.21.0-next.0", | ||
"description": "", | ||
@@ -24,6 +24,7 @@ "homepage": "https://github.com/ckb-js/lumos#readme", | ||
"dependencies": { | ||
"@ckb-lumos/base": "0.20.0", | ||
"@ckb-lumos/config-manager": "0.20.0", | ||
"@ckb-lumos/helpers": "0.20.0", | ||
"@ckb-lumos/toolkit": "0.20.0" | ||
"@ckb-lumos/base": "0.21.0-next.0", | ||
"@ckb-lumos/bi": "0.21.0-next.0", | ||
"@ckb-lumos/config-manager": "0.21.0-next.0", | ||
"@ckb-lumos/helpers": "0.21.0-next.0", | ||
"@ckb-lumos/toolkit": "0.21.0-next.0" | ||
}, | ||
@@ -34,13 +35,2 @@ "repository": { | ||
}, | ||
"scripts": { | ||
"fmt": "prettier --write \"{src,tests,examples}/**/*.ts\" package.json", | ||
"lint": "eslint -c ../../.eslintrc.js \"{src,tests,examples}/**/*.ts\"", | ||
"test": "ava **/*.test.ts --timeout=2m", | ||
"build": "npm run build:types && npm run build:js", | ||
"build:types": "tsc --declaration --emitDeclarationOnly", | ||
"build:js": "babel --root-mode upward src --out-dir lib --extensions .ts -s", | ||
"clean": "rm -rf lib", | ||
"prepublishOnly": "yarn run clean && yarn run build", | ||
"release": "npm publish" | ||
}, | ||
"bugs": { | ||
@@ -57,3 +47,11 @@ "url": "https://github.com/ckb-js/lumos/issues" | ||
}, | ||
"gitHead": "28756be37c312eca132cac0c00b40510803030e0" | ||
} | ||
"scripts": { | ||
"fmt": "prettier --write \"{src,tests,examples}/**/*.ts\" package.json", | ||
"lint": "eslint -c ../../.eslintrc.js \"{src,tests,examples}/**/*.ts\"", | ||
"test": "ava **/*.test.ts --timeout=2m", | ||
"build": "pnpm run build:types && pnpm run build:js", | ||
"build:types": "tsc --declaration --emitDeclarationOnly", | ||
"build:js": "babel --root-mode upward src --out-dir lib --extensions .ts -s", | ||
"clean": "rm -rf lib" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
303
23285
5
+ Added@ckb-lumos/bi@0.21.0-next.0
+ Added@ckb-lumos/base@0.21.0-next.0(transitive)
+ Added@ckb-lumos/bi@0.21.0-next.0(transitive)
+ Added@ckb-lumos/codec@0.21.0-next.0(transitive)
+ Added@ckb-lumos/config-manager@0.21.0-next.0(transitive)
+ Added@ckb-lumos/helpers@0.21.0-next.0(transitive)
+ Added@ckb-lumos/toolkit@0.21.0-next.0(transitive)
- Removed@ckb-lumos/base@0.20.0(transitive)
- Removed@ckb-lumos/bi@0.20.0(transitive)
- Removed@ckb-lumos/codec@0.20.0(transitive)
- Removed@ckb-lumos/config-manager@0.20.0(transitive)
- Removed@ckb-lumos/helpers@0.20.0(transitive)
- Removed@ckb-lumos/toolkit@0.20.0(transitive)