@ckb-lumos/helpers
Advanced tools
Comparing version 0.0.0-canary-c37d5b8-20240429081316 to 0.0.0-canary-c41f602-20240522044632
@@ -26,3 +26,3 @@ "use strict"; | ||
*/ | ||
const ADDRESS_FORMAT_FULL = 0x00; | ||
const ADDRESS_FORMAT_FULL = exports.ADDRESS_FORMAT_FULL = 0x00; | ||
/** | ||
@@ -32,4 +32,3 @@ * @deprecated | ||
*/ | ||
exports.ADDRESS_FORMAT_FULL = ADDRESS_FORMAT_FULL; | ||
const ADDRESS_FORMAT_SHORT = 0x01; | ||
const ADDRESS_FORMAT_SHORT = exports.ADDRESS_FORMAT_SHORT = 0x01; | ||
@@ -40,4 +39,3 @@ /** | ||
*/ | ||
exports.ADDRESS_FORMAT_SHORT = ADDRESS_FORMAT_SHORT; | ||
const ADDRESS_FORMAT_FULLDATA = 0x02; | ||
const ADDRESS_FORMAT_FULLDATA = exports.ADDRESS_FORMAT_FULLDATA = 0x02; | ||
@@ -48,5 +46,3 @@ /** | ||
*/ | ||
exports.ADDRESS_FORMAT_FULLDATA = ADDRESS_FORMAT_FULLDATA; | ||
const ADDRESS_FORMAT_FULLTYPE = 0x04; | ||
exports.ADDRESS_FORMAT_FULLTYPE = ADDRESS_FORMAT_FULLTYPE; | ||
const ADDRESS_FORMAT_FULLTYPE = exports.ADDRESS_FORMAT_FULLTYPE = 0x04; | ||
function parseFullFormatAddress(address, { | ||
@@ -53,0 +49,0 @@ config |
@@ -123,3 +123,3 @@ import { Address, Cell, CellDep, CellProvider, Hash, HexString, PackedSince, Script, Transaction, OutPoint } from "@ckb-lumos/base"; | ||
export declare function objectToTransactionSkeleton(obj: TransactionSkeletonObject): TransactionSkeletonType; | ||
export {}; | ||
export { refreshTypeIdCellDeps } from "./refresh"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -21,2 +21,8 @@ "use strict"; | ||
exports.parseAddress = parseAddress; | ||
Object.defineProperty(exports, "refreshTypeIdCellDeps", { | ||
enumerable: true, | ||
get: function () { | ||
return _refresh.refreshTypeIdCellDeps; | ||
} | ||
}); | ||
exports.scriptToAddress = void 0; | ||
@@ -35,2 +41,3 @@ exports.sealTransaction = sealTransaction; | ||
var _blockchain = require("@ckb-lumos/base/lib/blockchain"); | ||
var _refresh = require("./refresh"); | ||
const { | ||
@@ -49,2 +56,3 @@ bytify, | ||
} | ||
const ONE_CKB = 100_000_000; | ||
function minimalScriptCapacityCompatible(script, { | ||
@@ -61,3 +69,3 @@ validate = true | ||
bytes += 1; | ||
return _bi.BI.from(bytes).mul(100000000); | ||
return _bi.BI.from(bytes).mul(ONE_CKB); | ||
} | ||
@@ -92,3 +100,3 @@ function minimalCellCapacity(fullCell, { | ||
} | ||
return _bi.BI.from(bytes).mul(100000000); | ||
return _bi.BI.from(bytes).mul(ONE_CKB); | ||
} | ||
@@ -113,2 +121,12 @@ function locateCellDep(script, { | ||
// |format type|description | | ||
// |-----------|----------------------------------------------------------| | ||
// |0x00 |full version identifies the hash_type | | ||
// |0x01 |short version for locks with popular code_hash, deprecated| | ||
// |0x02 |full version with hash_type = "Data", deprecated | | ||
// |0x04 |full version with hash_type = "Type", deprecated | | ||
const CKB2019_ADDRESS_FORMAT_TYPE_DATA = 0x02; | ||
const CKB2019_ADDRESS_FORMAT_TYPE_TYPE = 0x04; | ||
/** | ||
@@ -135,3 +153,9 @@ * @deprecated please migrate to {@link encodeToAddress}, the short format address will be removed in the future | ||
} else { | ||
if (script.hashType === "type") data.push(0x04);else if (script.hashType === "data") data.push(0x02);else throw new Error(`Invalid hashType ${script.hashType}`); | ||
if (script.hashType === "type") { | ||
data.push(CKB2019_ADDRESS_FORMAT_TYPE_TYPE); | ||
} else if (script.hashType === "data") { | ||
data.push(CKB2019_ADDRESS_FORMAT_TYPE_DATA); | ||
} else { | ||
throw new Error(`Invalid hashType ${script.hashType}`); | ||
} | ||
data.push(...(0, _utils.hexToByteArray)(script.codeHash)); | ||
@@ -146,3 +170,3 @@ data.push(...(0, _utils.hexToByteArray)(script.args)); | ||
* @deprecated please migrate to {@link encodeToAddress}, the short format address will be removed in the future */ | ||
const scriptToAddress = generateAddress; | ||
const scriptToAddress = exports.scriptToAddress = generateAddress; | ||
@@ -156,3 +180,2 @@ /** | ||
*/ | ||
exports.scriptToAddress = scriptToAddress; | ||
function generatePredefinedAddress(args, scriptType, { | ||
@@ -217,3 +240,3 @@ config = undefined | ||
} | ||
const addressToScript = parseAddress; | ||
const addressToScript = exports.addressToScript = parseAddress; | ||
@@ -225,3 +248,2 @@ /** | ||
*/ | ||
exports.addressToScript = addressToScript; | ||
function encodeToAddress(script, { | ||
@@ -275,3 +297,3 @@ config = undefined | ||
} | ||
const TransactionSkeleton = (0, _immutable.Record)({ | ||
const TransactionSkeleton = exports.TransactionSkeleton = (0, _immutable.Record)({ | ||
cellProvider: null, | ||
@@ -287,3 +309,2 @@ cellDeps: (0, _immutable.List)(), | ||
}); | ||
exports.TransactionSkeleton = TransactionSkeleton; | ||
function createTransactionFromSkeleton(txSkeleton, { | ||
@@ -290,0 +311,0 @@ validate = true |
{ | ||
"name": "@ckb-lumos/helpers", | ||
"version": "0.0.0-canary-c37d5b8-20240429081316", | ||
"version": "0.0.0-canary-c41f602-20240522044632", | ||
"description": "Helper functions for working with CKB", | ||
@@ -29,7 +29,7 @@ "author": "Xuejie Xiao <xxuejie@gmail.com>", | ||
"dependencies": { | ||
"@ckb-lumos/base": "0.0.0-canary-c37d5b8-20240429081316", | ||
"@ckb-lumos/bi": "0.0.0-canary-c37d5b8-20240429081316", | ||
"@ckb-lumos/codec": "0.0.0-canary-c37d5b8-20240429081316", | ||
"@ckb-lumos/config-manager": "0.0.0-canary-c37d5b8-20240429081316", | ||
"@ckb-lumos/toolkit": "0.0.0-canary-c37d5b8-20240429081316", | ||
"@ckb-lumos/base": "0.0.0-canary-c41f602-20240522044632", | ||
"@ckb-lumos/bi": "0.0.0-canary-c41f602-20240522044632", | ||
"@ckb-lumos/codec": "0.0.0-canary-c41f602-20240522044632", | ||
"@ckb-lumos/config-manager": "0.0.0-canary-c41f602-20240522044632", | ||
"@ckb-lumos/toolkit": "0.0.0-canary-c41f602-20240522044632", | ||
"bech32": "^2.0.0", | ||
@@ -36,0 +36,0 @@ "immutable": "^4.3.0" |
@@ -43,2 +43,4 @@ import { bytes } from "@ckb-lumos/codec"; | ||
const ONE_CKB = 100_000_000; | ||
export function minimalScriptCapacityCompatible( | ||
@@ -58,3 +60,3 @@ script: Script, | ||
return BI.from(bytes).mul(100000000); | ||
return BI.from(bytes).mul(ONE_CKB); | ||
} | ||
@@ -91,3 +93,3 @@ | ||
} | ||
return BI.from(bytes).mul(100000000); | ||
return BI.from(bytes).mul(ONE_CKB); | ||
} | ||
@@ -119,2 +121,12 @@ | ||
// |format type|description | | ||
// |-----------|----------------------------------------------------------| | ||
// |0x00 |full version identifies the hash_type | | ||
// |0x01 |short version for locks with popular code_hash, deprecated| | ||
// |0x02 |full version with hash_type = "Data", deprecated | | ||
// |0x04 |full version with hash_type = "Type", deprecated | | ||
const CKB2019_ADDRESS_FORMAT_TYPE_DATA = 0x02; | ||
const CKB2019_ADDRESS_FORMAT_TYPE_TYPE = 0x04; | ||
/** | ||
@@ -148,5 +160,9 @@ * @deprecated please migrate to {@link encodeToAddress}, the short format address will be removed in the future | ||
} else { | ||
if (script.hashType === "type") data.push(0x04); | ||
else if (script.hashType === "data") data.push(0x02); | ||
else throw new Error(`Invalid hashType ${script.hashType}`); | ||
if (script.hashType === "type") { | ||
data.push(CKB2019_ADDRESS_FORMAT_TYPE_TYPE); | ||
} else if (script.hashType === "data") { | ||
data.push(CKB2019_ADDRESS_FORMAT_TYPE_DATA); | ||
} else { | ||
throw new Error(`Invalid hashType ${script.hashType}`); | ||
} | ||
@@ -522,1 +538,3 @@ data.push(...hexToByteArray(script.codeHash)); | ||
} | ||
export { refreshTypeIdCellDeps } from "./refresh"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
96694
23
1371
+ Added@ckb-lumos/base@0.0.0-canary-c41f602-20240522044632(transitive)
+ Added@ckb-lumos/bi@0.0.0-canary-c41f602-20240522044632(transitive)
+ Added@ckb-lumos/codec@0.0.0-canary-c41f602-20240522044632(transitive)
+ Added@ckb-lumos/config-manager@0.0.0-canary-c41f602-20240522044632(transitive)
+ Added@ckb-lumos/rpc@0.0.0-canary-c41f602-20240522044632(transitive)
+ Added@ckb-lumos/toolkit@0.0.0-canary-c41f602-20240522044632(transitive)
- Removed@ckb-lumos/base@0.0.0-canary-c37d5b8-20240429081316(transitive)
- Removed@ckb-lumos/bi@0.0.0-canary-c37d5b8-20240429081316(transitive)
- Removed@ckb-lumos/codec@0.0.0-canary-c37d5b8-20240429081316(transitive)
- Removed@ckb-lumos/config-manager@0.0.0-canary-c37d5b8-20240429081316(transitive)
- Removed@ckb-lumos/rpc@0.0.0-canary-c37d5b8-20240429081316(transitive)
- Removed@ckb-lumos/toolkit@0.0.0-canary-c37d5b8-20240429081316(transitive)
Updated@ckb-lumos/config-manager@0.0.0-canary-c41f602-20240522044632
Updated@ckb-lumos/toolkit@0.0.0-canary-c41f602-20240522044632