@secondlayer/stacks 5.1.3 → 6.1.0
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/README.md +1 -8
- package/dist/shared/{stacks-qt8ehebn.js → stacks-esm-0rdxcta7.js} +2 -2
- package/dist/shared/{stacks-qt8ehebn.js.map → stacks-esm-0rdxcta7.js.map} +1 -1
- package/dist/shared/{stacks-4hs8r4q2.js → stacks-esm-1jae0a3r.js} +2 -2
- package/dist/shared/{stacks-xjkn3en1.cjs.map → stacks-esm-1jae0a3r.js.map} +1 -1
- package/dist/shared/{stacks-4d7c3x27.js → stacks-esm-2mc7ebrm.js} +3 -3
- package/dist/shared/{stacks-4d7c3x27.js.map → stacks-esm-2mc7ebrm.js.map} +1 -1
- package/dist/shared/{stacks-8brgfvqx.js → stacks-esm-3g33bqsm.js} +4 -4
- package/dist/shared/{stacks-8brgfvqx.js.map → stacks-esm-3g33bqsm.js.map} +1 -1
- package/dist/shared/{stacks-gjz26k6b.js → stacks-esm-3pv5avgr.js} +59 -15
- package/dist/shared/stacks-esm-3pv5avgr.js.map +12 -0
- package/dist/shared/{stacks-qex691bh.js → stacks-esm-743jfh10.js} +6 -6
- package/dist/shared/{stacks-qex691bh.js.map → stacks-esm-743jfh10.js.map} +1 -1
- package/dist/shared/{stacks-wxfd6r4b.js → stacks-esm-7fpqgtyx.js} +3 -3
- package/dist/shared/{stacks-wxfd6r4b.js.map → stacks-esm-7fpqgtyx.js.map} +1 -1
- package/dist/shared/{stacks-71k0vmct.js → stacks-esm-9rnx0zxr.js} +5 -5
- package/dist/shared/{stacks-71k0vmct.js.map → stacks-esm-9rnx0zxr.js.map} +1 -1
- package/dist/shared/{stacks-fd4rx56e.js → stacks-esm-aw2mj3sj.js} +7 -7
- package/dist/shared/{stacks-fd4rx56e.js.map → stacks-esm-aw2mj3sj.js.map} +1 -1
- package/dist/shared/{stacks-qs5fzts5.js → stacks-esm-cvhazvhd.js} +2 -2
- package/dist/shared/{stacks-qs5fzts5.js.map → stacks-esm-cvhazvhd.js.map} +1 -1
- package/dist/shared/{stacks-69nq48jp.js → stacks-esm-fcfdn2zx.js} +5 -5
- package/dist/shared/{stacks-69nq48jp.js.map → stacks-esm-fcfdn2zx.js.map} +1 -1
- package/dist/shared/{stacks-x0qqwrev.js → stacks-esm-hr7fpxtj.js} +4 -4
- package/dist/shared/{stacks-x0qqwrev.js.map → stacks-esm-hr7fpxtj.js.map} +1 -1
- package/dist/shared/{stacks-mbt36bzt.js → stacks-esm-kds4n82p.js} +11 -11
- package/dist/shared/{stacks-mbt36bzt.js.map → stacks-esm-kds4n82p.js.map} +1 -1
- package/dist/shared/{stacks-kg1npstf.js → stacks-esm-n53kvwmt.js} +2 -2
- package/dist/shared/{stacks-kg1npstf.js.map → stacks-esm-n53kvwmt.js.map} +1 -1
- package/dist/shared/{stacks-v2rfr46a.js → stacks-esm-pxhfqfff.js} +4 -4
- package/dist/shared/{stacks-v2rfr46a.js.map → stacks-esm-pxhfqfff.js.map} +1 -1
- package/dist/shared/{stacks-yajyej2y.js → stacks-esm-q19a17fd.js} +3 -3
- package/dist/shared/{stacks-yajyej2y.js.map → stacks-esm-q19a17fd.js.map} +1 -1
- package/dist/shared/{stacks-v03zef3g.js → stacks-esm-qk0p9fr6.js} +9 -9
- package/dist/shared/{stacks-v03zef3g.js.map → stacks-esm-qk0p9fr6.js.map} +1 -1
- package/dist/shared/{stacks-qcae5852.js → stacks-esm-qkj67g80.js} +2 -2
- package/dist/shared/{stacks-qcae5852.js.map → stacks-esm-qkj67g80.js.map} +1 -1
- package/dist/shared/{stacks-mftyrc60.js → stacks-esm-r6dejrgr.js} +4 -4
- package/dist/shared/{stacks-mftyrc60.js.map → stacks-esm-r6dejrgr.js.map} +1 -1
- package/dist/shared/{stacks-9c1yam8b.js → stacks-esm-r9q4wnyw.js} +5 -5
- package/dist/shared/{stacks-9c1yam8b.js.map → stacks-esm-r9q4wnyw.js.map} +1 -1
- package/dist/shared/{stacks-51ybf135.js → stacks-esm-skmcf5n2.js} +5 -5
- package/dist/shared/{stacks-51ybf135.js.map → stacks-esm-skmcf5n2.js.map} +1 -1
- package/dist/shared/{stacks-yvb7rvwk.js → stacks-esm-v45990hx.js} +2 -2
- package/dist/shared/{stacks-8vzxax5e.cjs.map → stacks-esm-v45990hx.js.map} +1 -1
- package/dist/shared/{stacks-z90xdr1x.js → stacks-esm-wv67m4g6.js} +3 -3
- package/dist/shared/{stacks-z90xdr1x.js.map → stacks-esm-wv67m4g6.js.map} +1 -1
- package/dist/shared/{stacks-1m3m1agc.js → stacks-esm-x1r01353.js} +5 -5
- package/dist/shared/{stacks-1m3m1agc.js.map → stacks-esm-x1r01353.js.map} +1 -1
- package/dist/src/accounts/index.cjs +558 -4
- package/dist/src/accounts/index.cjs.map +10 -4
- package/dist/src/accounts/index.js +3 -3
- package/dist/src/actions/index.cjs +3815 -1
- package/dist/src/actions/index.cjs.map +65 -3
- package/dist/src/actions/index.js +14 -14
- package/dist/src/bitcoin/index.cjs +2477 -1
- package/dist/src/bitcoin/index.cjs.map +31 -3
- package/dist/src/bitcoin/index.js +11 -11
- package/dist/src/bns/index.cjs +4439 -17
- package/dist/src/bns/index.cjs.map +50 -3
- package/dist/src/bns/index.js +14 -14
- package/dist/src/chains/index.cjs +135 -1
- package/dist/src/chains/index.cjs.map +5 -3
- package/dist/src/chains/index.js +1 -1
- package/dist/src/clarity/index.cjs +2019 -1
- package/dist/src/clarity/index.cjs.map +24 -3
- package/dist/src/clarity/index.js +8 -8
- package/dist/src/filters/index.cjs +725 -1
- package/dist/src/filters/index.cjs.map +11 -3
- package/dist/src/filters/index.d.cts +76 -13
- package/dist/src/filters/index.d.ts +76 -13
- package/dist/src/filters/index.js +8 -4
- package/dist/src/filters/index.js.map +1 -1
- package/dist/src/index.cjs +3935 -62
- package/dist/src/index.cjs.map +69 -4
- package/dist/src/index.d.cts +62 -11
- package/dist/src/index.d.ts +62 -11
- package/dist/src/index.js +16 -16
- package/dist/src/postconditions/index.cjs +1726 -1
- package/dist/src/postconditions/index.cjs.map +20 -3
- package/dist/src/postconditions/index.js +6 -6
- package/dist/src/pox/index.cjs +3855 -1
- package/dist/src/pox/index.cjs.map +48 -3
- package/dist/src/pox/index.js +13 -13
- package/dist/src/pox5/index.cjs +4054 -29
- package/dist/src/pox5/index.cjs.map +54 -3
- package/dist/src/pox5/index.js +15 -15
- package/dist/src/sbtc/index.cjs +3705 -4
- package/dist/src/sbtc/index.cjs.map +47 -3
- package/dist/src/sbtc/index.js +12 -12
- package/dist/src/stackingdao/index.cjs +3751 -8
- package/dist/src/stackingdao/index.cjs.map +45 -3
- package/dist/src/stackingdao/index.js +12 -12
- package/dist/src/subscriptions/index.cjs +153 -1
- package/dist/src/subscriptions/index.cjs.map +6 -3
- package/dist/src/subscriptions/index.js +2 -2
- package/dist/src/transactions/index.cjs +2139 -1
- package/dist/src/transactions/index.cjs.map +23 -3
- package/dist/src/transactions/index.js +6 -6
- package/dist/src/utils/index.cjs +435 -3
- package/dist/src/utils/index.cjs.map +9 -3
- package/dist/src/utils/index.js +3 -3
- package/package.json +3 -23
- package/dist/shared/stacks-02actsrx.cjs +0 -17
- package/dist/shared/stacks-02actsrx.cjs.map +0 -10
- package/dist/shared/stacks-03vfm21t.cjs +0 -222
- package/dist/shared/stacks-03vfm21t.cjs.map +0 -12
- package/dist/shared/stacks-24h5k94q.cjs +0 -74
- package/dist/shared/stacks-24h5k94q.cjs.map +0 -11
- package/dist/shared/stacks-37kz5t9f.cjs +0 -764
- package/dist/shared/stacks-37kz5t9f.cjs.map +0 -23
- package/dist/shared/stacks-3mt2q2na.cjs +0 -65
- package/dist/shared/stacks-3mt2q2na.cjs.map +0 -9
- package/dist/shared/stacks-4hs8r4q2.js.map +0 -10
- package/dist/shared/stacks-8vzxax5e.cjs +0 -45
- package/dist/shared/stacks-agk106zs.cjs +0 -267
- package/dist/shared/stacks-agk106zs.cjs.map +0 -12
- package/dist/shared/stacks-bdgh9n83.cjs +0 -212
- package/dist/shared/stacks-bdgh9n83.cjs.map +0 -11
- package/dist/shared/stacks-dpxnxhqb.cjs +0 -51
- package/dist/shared/stacks-dpxnxhqb.cjs.map +0 -11
- package/dist/shared/stacks-ee53k9j2.cjs +0 -651
- package/dist/shared/stacks-ee53k9j2.cjs.map +0 -13
- package/dist/shared/stacks-enpj9krt.cjs +0 -38
- package/dist/shared/stacks-enpj9krt.cjs.map +0 -10
- package/dist/shared/stacks-f35mnrmg.cjs +0 -164
- package/dist/shared/stacks-f35mnrmg.cjs.map +0 -10
- package/dist/shared/stacks-fhzwsn5d.cjs +0 -261
- package/dist/shared/stacks-fhzwsn5d.cjs.map +0 -12
- package/dist/shared/stacks-gjz26k6b.js.map +0 -12
- package/dist/shared/stacks-gza2n1zs.cjs +0 -73
- package/dist/shared/stacks-gza2n1zs.cjs.map +0 -11
- package/dist/shared/stacks-kem68d80.cjs +0 -156
- package/dist/shared/stacks-kem68d80.cjs.map +0 -10
- package/dist/shared/stacks-n98w7g57.cjs +0 -234
- package/dist/shared/stacks-n98w7g57.cjs.map +0 -10
- package/dist/shared/stacks-p337hp6m.cjs +0 -336
- package/dist/shared/stacks-p337hp6m.cjs.map +0 -25
- package/dist/shared/stacks-q34k4vnc.cjs +0 -286
- package/dist/shared/stacks-q34k4vnc.cjs.map +0 -12
- package/dist/shared/stacks-rryme9bv.cjs +0 -569
- package/dist/shared/stacks-rryme9bv.cjs.map +0 -13
- package/dist/shared/stacks-s5vej5z6.cjs +0 -410
- package/dist/shared/stacks-s5vej5z6.cjs.map +0 -15
- package/dist/shared/stacks-sdqkapct.cjs +0 -67
- package/dist/shared/stacks-sdqkapct.cjs.map +0 -12
- package/dist/shared/stacks-vea7nde7.cjs +0 -731
- package/dist/shared/stacks-vea7nde7.cjs.map +0 -13
- package/dist/shared/stacks-wk8yp13j.cjs +0 -33
- package/dist/shared/stacks-wk8yp13j.cjs.map +0 -11
- package/dist/shared/stacks-xjkn3en1.cjs +0 -42
- package/dist/shared/stacks-xnrywjf1.cjs +0 -131
- package/dist/shared/stacks-xnrywjf1.cjs.map +0 -11
- package/dist/shared/stacks-yvb7rvwk.js.map +0 -10
- package/dist/src/tools/btc/index.cjs +0 -131
- package/dist/src/tools/btc/index.cjs.map +0 -10
- package/dist/src/tools/btc/index.d.cts +0 -10
- package/dist/src/tools/btc/index.d.ts +0 -10
- package/dist/src/tools/btc/index.js +0 -90
- package/dist/src/tools/btc/index.js.map +0 -10
- package/dist/src/tools/index.cjs +0 -3865
- package/dist/src/tools/index.cjs.map +0 -80
- package/dist/src/tools/index.d.cts +0 -206
- package/dist/src/tools/index.d.ts +0 -206
- package/dist/src/tools/index.js +0 -3827
- package/dist/src/tools/index.js.map +0 -80
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/clarity/abi/guards.ts", "../src/clarity/abi/utils.ts", "../src/clarity/bridge.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { parsePrincipal } from \"../../utils/address.ts\";\nimport type { ResponseErr, ResponseOk } from \"./mappings.ts\";\nimport { MAX_I128, MAX_U128, MIN_I128 } from \"./types.ts\";\nimport type {\n\tAbiBuffer,\n\tAbiListType,\n\tAbiOptionalType,\n\tAbiResponseType,\n\tAbiStringAscii,\n\tAbiStringUtf8,\n\tAbiTraitReference,\n\tAbiTupleType,\n\tAbiType,\n} from \"./types.ts\";\n\n// Value guards\n\nexport function isUint128(value: unknown): value is bigint {\n\treturn typeof value === \"bigint\" && value >= 0n && value <= MAX_U128;\n}\n\nexport function isInt128(value: unknown): value is bigint {\n\treturn typeof value === \"bigint\" && value >= MIN_I128 && value <= MAX_I128;\n}\n\nexport function isBool(value: unknown): value is boolean {\n\treturn typeof value === \"boolean\";\n}\n\nexport function isPrincipal(value: unknown): value is string {\n\treturn typeof value === \"string\" && parsePrincipal(value) !== null;\n}\n\nexport function isStandardPrincipal(value: unknown): value is string {\n\tif (typeof value !== \"string\") return false;\n\tconst parsed = parsePrincipal(value);\n\t// Explicit null check: `null?.contractName === undefined` is also true.\n\treturn parsed !== null && parsed.contractName === undefined;\n}\n\nexport function isContractPrincipal(value: unknown): value is string {\n\tif (typeof value !== \"string\") return false;\n\tconst parsed = parsePrincipal(value);\n\treturn parsed !== null && parsed.contractName !== undefined;\n}\n\nexport function isTraitReference(value: unknown): value is string {\n\treturn isContractPrincipal(value);\n}\n\nexport function isString(value: unknown): value is string {\n\treturn typeof value === \"string\";\n}\n\nexport function isUint8Array(value: unknown): value is Uint8Array {\n\treturn value instanceof Uint8Array;\n}\n\nexport function isArray<T>(\n\tvalue: unknown,\n\titemGuard: (item: unknown) => item is T,\n): value is T[] {\n\treturn Array.isArray(value) && value.every(itemGuard);\n}\n\nexport function isOptional<T>(\n\tvalue: unknown,\n\tguard: (val: unknown) => val is T,\n): value is T | null {\n\treturn value === null || guard(value);\n}\n\nexport function isOkResponse<T>(\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tresponse: { ok: T } | { err: any },\n): response is ResponseOk<T> {\n\treturn \"ok\" in response && !(\"err\" in response);\n}\n\nexport function isErrResponse<E>(\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tresponse: { ok: any } | { err: E },\n): response is ResponseErr<E> {\n\treturn \"err\" in response && !(\"ok\" in response);\n}\n\nexport function isResponse<T, E>(\n\tvalue: unknown,\n\tokGuard: (val: unknown) => val is T,\n\terrGuard: (val: unknown) => val is E,\n): value is ResponseOk<T> | ResponseErr<E> {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst obj = value as Record<string, unknown>;\n\tif (\"ok\" in value && !(\"err\" in value)) return okGuard(obj.ok);\n\tif (\"err\" in value && !(\"ok\" in value)) return errGuard(obj.err);\n\treturn false;\n}\n\n// ABI type definition guards\n\nexport function isAbiList(type: AbiType): type is AbiListType {\n\treturn typeof type === \"object\" && type !== null && \"list\" in type;\n}\n\nexport function isAbiTuple(type: AbiType): type is AbiTupleType {\n\treturn typeof type === \"object\" && type !== null && \"tuple\" in type;\n}\n\nexport function isAbiOptional(type: AbiType): type is AbiOptionalType {\n\treturn typeof type === \"object\" && type !== null && \"optional\" in type;\n}\n\nexport function isAbiResponse(type: AbiType): type is AbiResponseType {\n\treturn typeof type === \"object\" && type !== null && \"response\" in type;\n}\n\nexport function isAbiBuffer(type: AbiType): type is AbiBuffer {\n\treturn typeof type === \"object\" && type !== null && \"buff\" in type;\n}\n\nexport function isAbiStringAscii(type: AbiType): type is AbiStringAscii {\n\treturn typeof type === \"object\" && type !== null && \"string-ascii\" in type;\n}\n\nexport function isAbiStringUtf8(type: AbiType): type is AbiStringUtf8 {\n\treturn typeof type === \"object\" && type !== null && \"string-utf8\" in type;\n}\n\nexport function isAbiTraitReference(type: AbiType): type is AbiTraitReference {\n\treturn type === \"trait_reference\";\n}\n",
|
|
6
|
-
"type CamelCaseInner<S extends string> =\n\tS extends `${infer P1}-${infer P2}${infer P3}`\n\t\t? `${P1}${Capitalize<CamelCaseInner<`${P2}${P3}`>>}`\n\t\t: S;\n\nexport type ToCamelCase<S extends string> =\n\tCamelCaseInner<S> extends `${number}${string}`\n\t\t? `_${CamelCaseInner<S>}`\n\t\t: CamelCaseInner<S>;\n\nexport function toCamelCase(str: string): string {\n\treturn str\n\t\t.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())\n\t\t.replace(/-([A-Z])/g, (_, letter) => letter)\n\t\t.replace(/-(\\d)/g, (_, digit) => digit)\n\t\t.replace(/-/g, \"\")\n\t\t.replace(/^\\d/, \"_$&\");\n}\n",
|
|
7
|
-
"import {\n\tisAbiBuffer,\n\tisAbiList,\n\tisAbiOptional,\n\tisAbiResponse,\n\tisAbiStringAscii,\n\tisAbiStringUtf8,\n\tisAbiTuple,\n} from \"./abi/guards.ts\";\nimport type { AbiToTS } from \"./abi/mappings.ts\";\nimport type { AbiType } from \"./abi/types.ts\";\nimport { toCamelCase } from \"./abi/utils.ts\";\nimport type { ClarityValue } from \"./types.ts\";\nimport {\n\tboolCV,\n\tbufferCV,\n\tintCV,\n\tlistCV,\n\tnoneCV,\n\tresponseErrorCV,\n\tresponseOkCV,\n\tsomeCV,\n\tstringAsciiCV,\n\tstringUtf8CV,\n\ttupleCV,\n\tuintCV,\n} from \"./values.ts\";\nimport { Cl } from \"./values.ts\";\n\n/** CV type tags — mirrors the discriminants of `ClarityValue`. */\nconst CV_TYPE_TAGS = new Set([\n\t\"int\",\n\t\"uint\",\n\t\"true\",\n\t\"false\",\n\t\"address\",\n\t\"contract\",\n\t\"ascii\",\n\t\"utf8\",\n\t\"buffer\",\n\t\"list\",\n\t\"tuple\",\n\t\"none\",\n\t\"some\",\n\t\"ok\",\n\t\"err\",\n]);\n\n/**\n * Duck-type check: is `value` already a built ClarityValue? Tag-only CVs\n * (`true`/`false`/`none`) have no payload; every other tag carries `value`.\n */\nexport function isClarityValue(value: unknown): value is ClarityValue {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst type = (value as { type?: unknown }).type;\n\tif (typeof type !== \"string\" || !CV_TYPE_TAGS.has(type)) return false;\n\tif (type === \"true\" || type === \"false\" || type === \"none\") return true;\n\treturn \"value\" in value;\n}\n\nconst HEX_PAIRS_REGEX = /^(?:[0-9a-fA-F]{2})+$/;\n\n/**\n * Coerce a flexible buffer input to a BufferCV. Accepts `Uint8Array`, a\n * pre-built `BufferCV`, a tagged `{ type: 'ascii' | 'utf8' | 'hex', value }`\n * object, or a bare string (even-length hex — optionally 0x-prefixed — is\n * decoded as hex; anything else is UTF-8 encoded).\n */\nfunction coerceBuffer(value: unknown): ClarityValue {\n\tif (value instanceof Uint8Array) return bufferCV(value);\n\tif (typeof value === \"object\" && value !== null && \"type\" in value) {\n\t\tconst tagged = value as { type: string; value?: unknown };\n\t\tif (tagged.type === \"buffer\" && isClarityValue(value)) return value;\n\t\tif (typeof tagged.value === \"string\") {\n\t\t\tif (tagged.type === \"ascii\") return Cl.bufferFromAscii(tagged.value);\n\t\t\tif (tagged.type === \"utf8\") return Cl.bufferFromUtf8(tagged.value);\n\t\t\tif (tagged.type === \"hex\") return Cl.bufferFromHex(tagged.value);\n\t\t}\n\t\tthrow new Error(`Unsupported buffer input: ${JSON.stringify(value)}`);\n\t}\n\tif (typeof value === \"string\") {\n\t\tconst hex = value.startsWith(\"0x\") ? value.slice(2) : value;\n\t\tif (HEX_PAIRS_REGEX.test(hex)) return Cl.bufferFromHex(hex);\n\t\treturn Cl.bufferFromUtf8(value);\n\t}\n\tthrow new Error(\n\t\t\"buffer arg expects Uint8Array, hex string, { type, value }, or BufferCV\",\n\t);\n}\n\n/**\n * Convert a JS value to a ClarityValue using ABI type information.\n *\n * Pre-built ClarityValues pass through unchanged (escape hatch for callers\n * that already hold a CV). Buffer args additionally accept hex strings and\n * tagged `{ type, value }` objects — matching the generated-client input\n * contract.\n */\nexport function jsToClarityValue(\n\tabiType: AbiType,\n\tvalue: unknown,\n): ClarityValue {\n\t// Buffers first: the tagged `{ type: 'ascii', value }` input form is\n\t// shape-identical to StringAsciiCV, so buffer coercion wins for buff args.\n\tif (isAbiBuffer(abiType)) return coerceBuffer(value);\n\n\tif (isClarityValue(value)) return value;\n\n\tif (abiType === \"uint128\") return uintCV(value as bigint | number);\n\tif (abiType === \"int128\") return intCV(value as bigint | number);\n\tif (abiType === \"bool\") return boolCV(value as boolean);\n\tif (abiType === \"principal\" || abiType === \"trait_reference\")\n\t\treturn Cl.principal(value as string);\n\n\tif (isAbiStringAscii(abiType)) return stringAsciiCV(value as string);\n\tif (isAbiStringUtf8(abiType)) return stringUtf8CV(value as string);\n\n\tif (isAbiList(abiType)) {\n\t\tconst arr = value as unknown[];\n\t\treturn listCV(arr.map((item) => jsToClarityValue(abiType.list.type, item)));\n\t}\n\n\tif (isAbiTuple(abiType)) {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tconst data: Record<string, ClarityValue> = {};\n\t\tfor (const field of abiType.tuple) {\n\t\t\tconst camelKey = toCamelCase(field.name);\n\t\t\tconst hasOriginal = field.name in obj;\n\t\t\tconst hasCamel = camelKey in obj;\n\t\t\tconst fieldValue = hasOriginal\n\t\t\t\t? obj[field.name]\n\t\t\t\t: hasCamel\n\t\t\t\t\t? obj[camelKey]\n\t\t\t\t\t: undefined;\n\t\t\tif (fieldValue === undefined && !isAbiOptional(field.type)) {\n\t\t\t\tthrow new Error(`Missing tuple field: ${field.name}`);\n\t\t\t}\n\t\t\tdata[field.name] = jsToClarityValue(field.type, fieldValue);\n\t\t}\n\t\treturn tupleCV(data);\n\t}\n\n\tif (isAbiOptional(abiType)) {\n\t\tif (value === null || value === undefined) return noneCV();\n\t\treturn someCV(jsToClarityValue(abiType.optional, value));\n\t}\n\n\tif (isAbiResponse(abiType)) {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tif (\"ok\" in obj && !(\"err\" in obj))\n\t\t\treturn responseOkCV(jsToClarityValue(abiType.response.ok, obj.ok));\n\t\tif (\"err\" in obj && !(\"ok\" in obj))\n\t\t\treturn responseErrorCV(jsToClarityValue(abiType.response.error, obj.err));\n\t\tthrow new Error(\"Response must have exactly 'ok' or 'err' property\");\n\t}\n\n\tthrow new Error(`Unknown ABI type: ${JSON.stringify(abiType)}`);\n}\n\n/**\n * Convert a ClarityValue back to a typed JS value using ABI type information.\n */\nexport function clarityValueToJS<T extends AbiType>(\n\tabiType: T,\n\tcv: ClarityValue,\n): AbiToTS<T> {\n\treturn clarityValueToJSInner(abiType, cv) as AbiToTS<T>;\n}\n\n/** Non-generic version for internal use — avoids deep type instantiation. */\nexport function clarityValueToJSUntyped(\n\tabiType: AbiType,\n\tcv: ClarityValue,\n): unknown {\n\treturn clarityValueToJSInner(abiType, cv);\n}\n\nfunction clarityValueToJSInner(abiType: AbiType, cv: ClarityValue): unknown {\n\tif (abiType === \"uint128\" || abiType === \"int128\") {\n\t\tif (cv.type !== \"int\" && cv.type !== \"uint\")\n\t\t\tthrow new Error(`Expected int/uint CV, got ${cv.type}`);\n\t\treturn cv.value;\n\t}\n\n\tif (abiType === \"bool\") {\n\t\tif (cv.type === \"true\") return true;\n\t\tif (cv.type === \"false\") return false;\n\t\tthrow new Error(`Expected bool CV, got ${cv.type}`);\n\t}\n\n\tif (abiType === \"principal\" || abiType === \"trait_reference\") {\n\t\tif (cv.type !== \"address\" && cv.type !== \"contract\")\n\t\t\tthrow new Error(`Expected principal CV, got ${cv.type}`);\n\t\treturn cv.value;\n\t}\n\n\tif (isAbiStringAscii(abiType) || isAbiStringUtf8(abiType)) {\n\t\tif (cv.type !== \"ascii\" && cv.type !== \"utf8\")\n\t\t\tthrow new Error(`Expected string CV, got ${cv.type}`);\n\t\treturn cv.value;\n\t}\n\n\tif (isAbiBuffer(abiType)) {\n\t\tif (cv.type !== \"buffer\")\n\t\t\tthrow new Error(`Expected buffer CV, got ${cv.type}`);\n\t\t// BufferCV stores hex string; convert back to Uint8Array\n\t\tconst hex = cv.value;\n\t\tconst bytes = new Uint8Array(hex.length / 2);\n\t\tfor (let i = 0; i < bytes.length; i++) {\n\t\t\tbytes[i] = Number.parseInt(hex.substring(i * 2, i * 2 + 2), 16);\n\t\t}\n\t\treturn bytes;\n\t}\n\n\tif (isAbiList(abiType)) {\n\t\tif (cv.type !== \"list\") throw new Error(`Expected list CV, got ${cv.type}`);\n\t\treturn cv.value.map((item) =>\n\t\t\tclarityValueToJSInner(abiType.list.type, item),\n\t\t);\n\t}\n\n\tif (isAbiTuple(abiType)) {\n\t\tif (cv.type !== \"tuple\")\n\t\t\tthrow new Error(`Expected tuple CV, got ${cv.type}`);\n\t\tconst result: Record<string, unknown> = {};\n\t\tfor (const field of abiType.tuple) {\n\t\t\tconst fieldCV = cv.value[field.name];\n\t\t\tif (!fieldCV) throw new Error(`Missing tuple field in CV: ${field.name}`);\n\t\t\tconst camelKey = toCamelCase(field.name);\n\t\t\tresult[camelKey] = clarityValueToJSInner(field.type, fieldCV);\n\t\t}\n\t\treturn result;\n\t}\n\n\tif (isAbiOptional(abiType)) {\n\t\tif (cv.type === \"none\") return null;\n\t\tif (cv.type === \"some\")\n\t\t\treturn clarityValueToJSInner(abiType.optional, cv.value);\n\t\tthrow new Error(`Expected optional CV, got ${cv.type}`);\n\t}\n\n\tif (isAbiResponse(abiType)) {\n\t\tif (cv.type === \"ok\")\n\t\t\treturn { ok: clarityValueToJSInner(abiType.response.ok, cv.value) };\n\t\tif (cv.type === \"err\")\n\t\t\treturn { err: clarityValueToJSInner(abiType.response.error, cv.value) };\n\t\tthrow new Error(`Expected response CV, got ${cv.type}`);\n\t}\n\n\tthrow new Error(`Unknown ABI type: ${JSON.stringify(abiType)}`);\n}\n"
|
|
8
|
-
],
|
|
9
|
-
"mappings": ";AAiBO,SAAS,SAAS,CAAC,OAAiC;AAAA,EAC1D,OAAO,OAAO,UAAU,YAAY,SAAS,MAAM,SAAS;AAAA;AAGtD,SAAS,QAAQ,CAAC,OAAiC;AAAA,EACzD,OAAO,OAAO,UAAU,YAAY,SAAS,YAAY,SAAS;AAAA;AAG5D,SAAS,MAAM,CAAC,OAAkC;AAAA,EACxD,OAAO,OAAO,UAAU;AAAA;AAGlB,SAAS,WAAW,CAAC,OAAiC;AAAA,EAC5D,OAAO,OAAO,UAAU,YAAY,eAAe,KAAK,MAAM;AAAA;AAGxD,SAAS,mBAAmB,CAAC,OAAiC;AAAA,EACpE,IAAI,OAAO,UAAU;AAAA,IAAU,OAAO;AAAA,EACtC,MAAM,SAAS,eAAe,KAAK;AAAA,EAEnC,OAAO,WAAW,QAAQ,OAAO,iBAAiB;AAAA;AAG5C,SAAS,mBAAmB,CAAC,OAAiC;AAAA,EACpE,IAAI,OAAO,UAAU;AAAA,IAAU,OAAO;AAAA,EACtC,MAAM,SAAS,eAAe,KAAK;AAAA,EACnC,OAAO,WAAW,QAAQ,OAAO,iBAAiB;AAAA;AAG5C,SAAS,gBAAgB,CAAC,OAAiC;AAAA,EACjE,OAAO,oBAAoB,KAAK;AAAA;AAG1B,SAAS,Q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AAK,sBAAsB,QAAQ,SAAS,OAAO,GAAG,KAAK,EAAE;AAAA,IACvE,MAAM,IAAI,MAAM,6BAA6B,GAAG,MAAM;AAAA,EACvD;AAAA,EAEA,MAAM,IAAI,MAAM,qBAAqB,KAAK,UAAU,OAAO,GAAG;AAAA;",
|
|
10
|
-
"debugId": "C0E0912050C4217A64756E2164756E21",
|
|
11
|
-
"names": []
|
|
12
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
// src/bitcoin/serialize.ts
|
|
2
|
-
function doubleSha256(bytes) {
|
|
3
|
-
return import_sha2.sha256(import_sha2.sha256(bytes));
|
|
4
|
-
}
|
|
5
|
-
function reverseBytes(bytes) {
|
|
6
|
-
const out = new Uint8Array(bytes.length);
|
|
7
|
-
for (let i = 0;i < bytes.length; i++) {
|
|
8
|
-
out[i] = bytes[bytes.length - 1 - i];
|
|
9
|
-
}
|
|
10
|
-
return out;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
class BtcReader {
|
|
14
|
-
data;
|
|
15
|
-
view;
|
|
16
|
-
offset = 0;
|
|
17
|
-
constructor(data) {
|
|
18
|
-
this.data = data;
|
|
19
|
-
this.view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
20
|
-
}
|
|
21
|
-
get length() {
|
|
22
|
-
return this.data.length;
|
|
23
|
-
}
|
|
24
|
-
readUInt8() {
|
|
25
|
-
const v = this.view.getUint8(this.offset);
|
|
26
|
-
this.offset += 1;
|
|
27
|
-
return v;
|
|
28
|
-
}
|
|
29
|
-
peekUInt8() {
|
|
30
|
-
return this.view.getUint8(this.offset);
|
|
31
|
-
}
|
|
32
|
-
readUInt32LE() {
|
|
33
|
-
const v = this.view.getUint32(this.offset, true);
|
|
34
|
-
this.offset += 4;
|
|
35
|
-
return v;
|
|
36
|
-
}
|
|
37
|
-
readUInt64LE() {
|
|
38
|
-
const v = this.view.getBigUint64(this.offset, true);
|
|
39
|
-
this.offset += 8;
|
|
40
|
-
return v;
|
|
41
|
-
}
|
|
42
|
-
readBytes(n) {
|
|
43
|
-
if (this.offset + n > this.data.length) {
|
|
44
|
-
throw new Error(`Bitcoin tx underflow: need ${n} bytes at offset ${this.offset}, have ${this.data.length}`);
|
|
45
|
-
}
|
|
46
|
-
const slice = this.data.slice(this.offset, this.offset + n);
|
|
47
|
-
this.offset += n;
|
|
48
|
-
return slice;
|
|
49
|
-
}
|
|
50
|
-
readVarInt() {
|
|
51
|
-
const first = this.readUInt8();
|
|
52
|
-
if (first < 253)
|
|
53
|
-
return first;
|
|
54
|
-
if (first === 253) {
|
|
55
|
-
const v = this.view.getUint16(this.offset, true);
|
|
56
|
-
this.offset += 2;
|
|
57
|
-
return v;
|
|
58
|
-
}
|
|
59
|
-
if (first === 254) {
|
|
60
|
-
return this.readUInt32LE();
|
|
61
|
-
}
|
|
62
|
-
const big = this.readUInt64LE();
|
|
63
|
-
if (big > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
64
|
-
throw new Error("Bitcoin varint exceeds safe integer range");
|
|
65
|
-
}
|
|
66
|
-
return Number(big);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function scanTx(rawTx) {
|
|
70
|
-
const r = new BtcReader(rawTx);
|
|
71
|
-
const version = r.readUInt32LE();
|
|
72
|
-
let hasWitness = false;
|
|
73
|
-
if (r.peekUInt8() === 0) {
|
|
74
|
-
r.readUInt8();
|
|
75
|
-
const flag = r.readUInt8();
|
|
76
|
-
if (flag !== 1) {
|
|
77
|
-
throw new Error(`Unexpected SegWit flag 0x${flag.toString(16)}`);
|
|
78
|
-
}
|
|
79
|
-
hasWitness = true;
|
|
80
|
-
}
|
|
81
|
-
const bodyStart = r.offset;
|
|
82
|
-
const inputCount = r.readVarInt();
|
|
83
|
-
const inputs = [];
|
|
84
|
-
for (let i = 0;i < inputCount; i++) {
|
|
85
|
-
const prevTxid = r.readBytes(32);
|
|
86
|
-
const vout = r.readUInt32LE();
|
|
87
|
-
const scriptSig = r.readBytes(r.readVarInt());
|
|
88
|
-
const sequence = r.readUInt32LE();
|
|
89
|
-
inputs.push({ prevTxid, vout, scriptSig, sequence });
|
|
90
|
-
}
|
|
91
|
-
const outputCount = r.readVarInt();
|
|
92
|
-
const outputs = [];
|
|
93
|
-
for (let i = 0;i < outputCount; i++) {
|
|
94
|
-
const value = r.readUInt64LE();
|
|
95
|
-
const scriptPubKey = r.readBytes(r.readVarInt());
|
|
96
|
-
outputs.push({ value, scriptPubKey });
|
|
97
|
-
}
|
|
98
|
-
const bodyEnd = r.offset;
|
|
99
|
-
if (hasWitness) {
|
|
100
|
-
for (let i = 0;i < inputCount; i++) {
|
|
101
|
-
const itemCount = r.readVarInt();
|
|
102
|
-
for (let j = 0;j < itemCount; j++) {
|
|
103
|
-
r.readBytes(r.readVarInt());
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const locktime = r.readUInt32LE();
|
|
108
|
-
const legacy = concatBytes(rawTx.slice(0, 4), rawTx.slice(bodyStart, bodyEnd), rawTx.slice(r.offset - 4, r.offset));
|
|
109
|
-
return { version, hasWitness, inputs, outputs, locktime, legacy };
|
|
110
|
-
}
|
|
111
|
-
function parseBitcoinTx(rawTx) {
|
|
112
|
-
const s = scanTx(rawTx);
|
|
113
|
-
return {
|
|
114
|
-
version: s.version,
|
|
115
|
-
hasWitness: s.hasWitness,
|
|
116
|
-
inputs: s.inputs,
|
|
117
|
-
outputs: s.outputs,
|
|
118
|
-
locktime: s.locktime,
|
|
119
|
-
txidInternal: doubleSha256(s.legacy)
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function stripWitness(rawTx) {
|
|
123
|
-
return scanTx(rawTx).legacy;
|
|
124
|
-
}
|
|
125
|
-
function bitcoinTxid(rawTx, { display = false } = {}) {
|
|
126
|
-
const txid = doubleSha256(scanTx(rawTx).legacy);
|
|
127
|
-
return display ? reverseBytes(txid) : txid;
|
|
128
|
-
}
|
|
129
|
-
function parseBlockHeader(header) {
|
|
130
|
-
if (header.length !== 80) {
|
|
131
|
-
throw new Error(`Bitcoin block header must be 80 bytes, got ${header.length}`);
|
|
132
|
-
}
|
|
133
|
-
const r = new BtcReader(header);
|
|
134
|
-
const version = r.readUInt32LE();
|
|
135
|
-
const prevBlock = r.readBytes(32);
|
|
136
|
-
const merkleRoot = r.readBytes(32);
|
|
137
|
-
const timestamp = r.readUInt32LE();
|
|
138
|
-
const bits = r.readUInt32LE();
|
|
139
|
-
const nonce = r.readUInt32LE();
|
|
140
|
-
return { version, prevBlock, merkleRoot, timestamp, bits, nonce };
|
|
141
|
-
}
|
|
142
|
-
function blockHash(header, { display = false } = {}) {
|
|
143
|
-
const hash = doubleSha256(header);
|
|
144
|
-
return display ? reverseBytes(hash) : hash;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// src/bitcoin/address.ts
|
|
148
|
-
var import_secp256k1 = require("@noble/curves/secp256k1.js");
|
|
149
|
-
var import_base = require("@scure/base");
|
|
150
|
-
var BITCOIN_NETWORK_PARAMS = {
|
|
151
|
-
mainnet: { p2pkh: 0, p2sh: 5, hrp: "bc" },
|
|
152
|
-
testnet: { p2pkh: 111, p2sh: 196, hrp: "tb" },
|
|
153
|
-
regtest: { p2pkh: 111, p2sh: 196, hrp: "bcrt" }
|
|
154
|
-
};
|
|
155
|
-
var NETWORK_PARAMS = BITCOIN_NETWORK_PARAMS;
|
|
156
|
-
function base58CheckEncode(version, payload) {
|
|
157
|
-
const data = concatBytes(Uint8Array.of(version), payload);
|
|
158
|
-
const checksum = doubleSha256(data).slice(0, 4);
|
|
159
|
-
return import_base.base58.encode(concatBytes(data, checksum));
|
|
160
|
-
}
|
|
161
|
-
function formatBitcoinAddress(parsed, network = "mainnet") {
|
|
162
|
-
const params = NETWORK_PARAMS[network];
|
|
163
|
-
const hash = parsed.hash;
|
|
164
|
-
if (!hash)
|
|
165
|
-
return;
|
|
166
|
-
switch (parsed.type) {
|
|
167
|
-
case "p2pkh":
|
|
168
|
-
return base58CheckEncode(params.p2pkh, hash);
|
|
169
|
-
case "p2sh":
|
|
170
|
-
return base58CheckEncode(params.p2sh, hash);
|
|
171
|
-
case "p2wpkh":
|
|
172
|
-
case "p2wsh":
|
|
173
|
-
return import_base.bech32.encode(params.hrp, [0, ...import_base.bech32.toWords(hash)]);
|
|
174
|
-
case "p2tr":
|
|
175
|
-
return import_base.bech32m.encode(params.hrp, [1, ...import_base.bech32m.toWords(hash)]);
|
|
176
|
-
default:
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function toPubkeyBytes(publicKey) {
|
|
181
|
-
return typeof publicKey === "string" ? hexToBytes(publicKey) : publicKey;
|
|
182
|
-
}
|
|
183
|
-
function taprootTweakPubkey(xonly) {
|
|
184
|
-
if (xonly.length !== 32)
|
|
185
|
-
throw new Error(`Expected 32-byte x-only pubkey, got ${xonly.length}`);
|
|
186
|
-
const tweak = import_secp256k1.schnorr.utils.taggedHash("TapTweak", xonly);
|
|
187
|
-
const t = BigInt(`0x${Array.from(tweak, (b) => b.toString(16).padStart(2, "0")).join("")}`);
|
|
188
|
-
if (t >= import_secp256k1.secp256k1.Point.Fn.ORDER)
|
|
189
|
-
throw new Error("Invalid tap tweak (exceeds curve order)");
|
|
190
|
-
const internal = import_secp256k1.secp256k1.Point.fromBytes(concatBytes(Uint8Array.of(2), xonly));
|
|
191
|
-
const output = internal.add(import_secp256k1.secp256k1.Point.BASE.multiply(t));
|
|
192
|
-
return output.toBytes(true).slice(1);
|
|
193
|
-
}
|
|
194
|
-
function publicKeyToP2wpkhAddress(publicKey, network = "mainnet") {
|
|
195
|
-
const pubkey = toPubkeyBytes(publicKey);
|
|
196
|
-
if (pubkey.length !== 33)
|
|
197
|
-
throw new Error(`Expected 33-byte compressed pubkey, got ${pubkey.length}`);
|
|
198
|
-
const params = NETWORK_PARAMS[network];
|
|
199
|
-
return import_base.bech32.encode(params.hrp, [0, ...import_base.bech32.toWords(hash160(pubkey))]);
|
|
200
|
-
}
|
|
201
|
-
function publicKeyToP2trAddress(publicKey, network = "mainnet") {
|
|
202
|
-
const pubkey = toPubkeyBytes(publicKey);
|
|
203
|
-
const xonly = pubkey.length === 33 ? pubkey.slice(1) : pubkey.length === 32 ? pubkey : undefined;
|
|
204
|
-
if (!xonly)
|
|
205
|
-
throw new Error(`Expected 33-byte compressed or 32-byte x-only pubkey, got ${pubkey.length}`);
|
|
206
|
-
const params = NETWORK_PARAMS[network];
|
|
207
|
-
const outputKey = taprootTweakPubkey(xonly);
|
|
208
|
-
return import_base.bech32m.encode(params.hrp, [1, ...import_base.bech32m.toWords(outputKey)]);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
//# debugId=1DF872A8095B935464756E2164756E21
|
|
212
|
-
//# sourceMappingURL=stacks-bdgh9n83.cjs.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/bitcoin/serialize.ts", "../src/bitcoin/address.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { concatBytes } from \"../utils/encoding.ts\";\nimport { sha256 } from \"../utils/hash.ts\";\n\n/**\n * Bitcoin double-SHA256: `sha256(sha256(bytes))`. This is the hash Bitcoin uses\n * for txids, block headers, and merkle nodes — NOT the same as the Stacks\n * `txidFromBytes` (which uses sha512_256), so it lives here, not in `utils/hash`.\n */\nexport function doubleSha256(bytes: Uint8Array): Uint8Array {\n\treturn sha256(sha256(bytes));\n}\n\n/**\n * Reverse a byte array. Bitcoin hashes are computed and stored in *internal*\n * (little-endian) order but *displayed* big-endian, so the two differ by a\n * reversal. The SIP-044 built-ins consume internal order; only reverse for\n * display / when matching an explorer value.\n */\nexport function reverseBytes(bytes: Uint8Array): Uint8Array {\n\tconst out = new Uint8Array(bytes.length);\n\tfor (let i = 0; i < bytes.length; i++) {\n\t\tout[i] = bytes[bytes.length - 1 - i] as number;\n\t}\n\treturn out;\n}\n\n/**\n * A little-endian, varint-aware byte reader for Bitcoin serialization. The\n * shared `utils/BytesReader` is big-endian only; Bitcoin tx fields are\n * little-endian with compact-size (varint) length prefixes.\n */\nexport class BtcReader {\n\tprivate readonly data: Uint8Array;\n\tprivate readonly view: DataView;\n\tpublic offset = 0;\n\n\tconstructor(data: Uint8Array) {\n\t\tthis.data = data;\n\t\tthis.view = new DataView(data.buffer, data.byteOffset, data.byteLength);\n\t}\n\n\tget length(): number {\n\t\treturn this.data.length;\n\t}\n\n\treadUInt8(): number {\n\t\tconst v = this.view.getUint8(this.offset);\n\t\tthis.offset += 1;\n\t\treturn v;\n\t}\n\n\t/** Read the next byte without advancing. */\n\tpeekUInt8(): number {\n\t\treturn this.view.getUint8(this.offset);\n\t}\n\n\treadUInt32LE(): number {\n\t\tconst v = this.view.getUint32(this.offset, true);\n\t\tthis.offset += 4;\n\t\treturn v;\n\t}\n\n\treadUInt64LE(): bigint {\n\t\tconst v = this.view.getBigUint64(this.offset, true);\n\t\tthis.offset += 8;\n\t\treturn v;\n\t}\n\n\treadBytes(n: number): Uint8Array {\n\t\tif (this.offset + n > this.data.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Bitcoin tx underflow: need ${n} bytes at offset ${this.offset}, have ${this.data.length}`,\n\t\t\t);\n\t\t}\n\t\tconst slice = this.data.slice(this.offset, this.offset + n);\n\t\tthis.offset += n;\n\t\treturn slice;\n\t}\n\n\t/** Read a Bitcoin compact-size unsigned integer (varint). */\n\treadVarInt(): number {\n\t\tconst first = this.readUInt8();\n\t\tif (first < 0xfd) return first;\n\t\tif (first === 0xfd) {\n\t\t\tconst v = this.view.getUint16(this.offset, true);\n\t\t\tthis.offset += 2;\n\t\t\treturn v;\n\t\t}\n\t\tif (first === 0xfe) {\n\t\t\treturn this.readUInt32LE();\n\t\t}\n\t\tconst big = this.readUInt64LE();\n\t\tif (big > BigInt(Number.MAX_SAFE_INTEGER)) {\n\t\t\tthrow new Error(\"Bitcoin varint exceeds safe integer range\");\n\t\t}\n\t\treturn Number(big);\n\t}\n}\n\nexport interface BitcoinTxInput {\n\t/** Previous output txid, in serialized (internal) byte order. */\n\tprevTxid: Uint8Array;\n\tvout: number;\n\tscriptSig: Uint8Array;\n\tsequence: number;\n}\n\nexport interface BitcoinTxOutput {\n\t/** Output value in satoshis. */\n\tvalue: bigint;\n\tscriptPubKey: Uint8Array;\n}\n\nexport interface ParsedBitcoinTx {\n\tversion: number;\n\thasWitness: boolean;\n\tinputs: BitcoinTxInput[];\n\toutputs: BitcoinTxOutput[];\n\tlocktime: number;\n\t/**\n\t * The legacy txid as the raw double-SHA256 in *internal* byte order — ready\n\t * to pass as the leaf to `verify-merkle-proof`. Witness data is excluded\n\t * (the txid is computed over the legacy serialization), so this is stable for\n\t * both legacy and SegWit txs. Use `reverseBytes` for the displayed form.\n\t */\n\ttxidInternal: Uint8Array;\n}\n\ninterface ScanResult {\n\tversion: number;\n\thasWitness: boolean;\n\tinputs: BitcoinTxInput[];\n\toutputs: BitcoinTxOutput[];\n\tlocktime: number;\n\t/** The legacy (witness-stripped) serialization — what the txid is hashed over. */\n\tlegacy: Uint8Array;\n}\n\n/**\n * Single-pass scan of a raw Bitcoin tx. Captures the inputs/outputs slice and\n * reassembles the legacy serialization so both `parseBitcoinTx` and\n * `stripWitness` share one parser (and one set of foot-guns).\n */\nfunction scanTx(rawTx: Uint8Array): ScanResult {\n\tconst r = new BtcReader(rawTx);\n\tconst version = r.readUInt32LE();\n\n\t// SegWit marker (0x00) + flag (0x01) sit immediately after the version. A\n\t// legacy tx can never have a zero input count, so 0x00 here is unambiguous.\n\tlet hasWitness = false;\n\tif (r.peekUInt8() === 0x00) {\n\t\tr.readUInt8(); // marker\n\t\tconst flag = r.readUInt8();\n\t\tif (flag !== 0x01) {\n\t\t\tthrow new Error(`Unexpected SegWit flag 0x${flag.toString(16)}`);\n\t\t}\n\t\thasWitness = true;\n\t}\n\n\tconst bodyStart = r.offset;\n\tconst inputCount = r.readVarInt();\n\tconst inputs: BitcoinTxInput[] = [];\n\tfor (let i = 0; i < inputCount; i++) {\n\t\tconst prevTxid = r.readBytes(32);\n\t\tconst vout = r.readUInt32LE();\n\t\tconst scriptSig = r.readBytes(r.readVarInt());\n\t\tconst sequence = r.readUInt32LE();\n\t\tinputs.push({ prevTxid, vout, scriptSig, sequence });\n\t}\n\n\tconst outputCount = r.readVarInt();\n\tconst outputs: BitcoinTxOutput[] = [];\n\tfor (let i = 0; i < outputCount; i++) {\n\t\tconst value = r.readUInt64LE();\n\t\tconst scriptPubKey = r.readBytes(r.readVarInt());\n\t\toutputs.push({ value, scriptPubKey });\n\t}\n\tconst bodyEnd = r.offset;\n\n\tif (hasWitness) {\n\t\tfor (let i = 0; i < inputCount; i++) {\n\t\t\tconst itemCount = r.readVarInt();\n\t\t\tfor (let j = 0; j < itemCount; j++) {\n\t\t\t\tr.readBytes(r.readVarInt());\n\t\t\t}\n\t\t}\n\t}\n\n\tconst locktime = r.readUInt32LE();\n\n\tconst legacy = concatBytes(\n\t\trawTx.slice(0, 4),\n\t\trawTx.slice(bodyStart, bodyEnd),\n\t\trawTx.slice(r.offset - 4, r.offset),\n\t);\n\n\treturn { version, hasWitness, inputs, outputs, locktime, legacy };\n}\n\n/** Parse a serialized Bitcoin tx (legacy or SegWit) into its fields + txid. */\nexport function parseBitcoinTx(rawTx: Uint8Array): ParsedBitcoinTx {\n\tconst s = scanTx(rawTx);\n\treturn {\n\t\tversion: s.version,\n\t\thasWitness: s.hasWitness,\n\t\tinputs: s.inputs,\n\t\toutputs: s.outputs,\n\t\tlocktime: s.locktime,\n\t\ttxidInternal: doubleSha256(s.legacy),\n\t};\n}\n\n/**\n * Return the legacy (witness-stripped) serialization of a tx. For a legacy tx\n * this is the input unchanged; for a SegWit tx the marker, flag, and witness\n * stack are removed. This is the byte string the txid is hashed over.\n */\nexport function stripWitness(rawTx: Uint8Array): Uint8Array {\n\treturn scanTx(rawTx).legacy;\n}\n\n/**\n * Compute a tx's id from its raw serialization. Internal byte order by default\n * (the merkle leaf / built-in input); pass `{ display: true }` for the\n * explorer-style big-endian form.\n */\nexport function bitcoinTxid(\n\trawTx: Uint8Array,\n\t{ display = false }: { display?: boolean } = {},\n): Uint8Array {\n\tconst txid = doubleSha256(scanTx(rawTx).legacy);\n\treturn display ? reverseBytes(txid) : txid;\n}\n\nexport interface BlockHeader {\n\tversion: number;\n\t/** Previous block hash, internal byte order. */\n\tprevBlock: Uint8Array;\n\t/** Merkle root, internal byte order — pairs with `verify-merkle-proof`. */\n\tmerkleRoot: Uint8Array;\n\ttimestamp: number;\n\tbits: number;\n\tnonce: number;\n}\n\n/** Parse an 80-byte Bitcoin block header into its fields (hashes internal order). */\nexport function parseBlockHeader(header: Uint8Array): BlockHeader {\n\tif (header.length !== 80) {\n\t\tthrow new Error(\n\t\t\t`Bitcoin block header must be 80 bytes, got ${header.length}`,\n\t\t);\n\t}\n\tconst r = new BtcReader(header);\n\tconst version = r.readUInt32LE();\n\tconst prevBlock = r.readBytes(32);\n\tconst merkleRoot = r.readBytes(32);\n\tconst timestamp = r.readUInt32LE();\n\tconst bits = r.readUInt32LE();\n\tconst nonce = r.readUInt32LE();\n\treturn { version, prevBlock, merkleRoot, timestamp, bits, nonce };\n}\n\n/**\n * Hash an 80-byte block header (double-SHA256). Internal byte order by default;\n * `{ display: true }` for the explorer-style block hash.\n */\nexport function blockHash(\n\theader: Uint8Array,\n\t{ display = false }: { display?: boolean } = {},\n): Uint8Array {\n\tconst hash = doubleSha256(header);\n\treturn display ? reverseBytes(hash) : hash;\n}\n",
|
|
6
|
-
"import { schnorr, secp256k1 } from \"@noble/curves/secp256k1.js\";\nimport { base58, bech32, bech32m } from \"@scure/base\";\nimport { concatBytes, hexToBytes } from \"../utils/encoding.ts\";\nimport { hash160 } from \"../utils/hash.ts\";\nimport type { ParsedOutputScript } from \"./codec.ts\";\nimport type { BitcoinNetwork } from \"./constants.ts\";\nimport { doubleSha256 } from \"./serialize.ts\";\n\n/** Address-encoding parameters (base58 version bytes + bech32 hrp) per network. */\nexport const BITCOIN_NETWORK_PARAMS = {\n\tmainnet: { p2pkh: 0x00, p2sh: 0x05, hrp: \"bc\" },\n\ttestnet: { p2pkh: 0x6f, p2sh: 0xc4, hrp: \"tb\" },\n\tregtest: { p2pkh: 0x6f, p2sh: 0xc4, hrp: \"bcrt\" },\n} as const;\n\nconst NETWORK_PARAMS = BITCOIN_NETWORK_PARAMS;\n\n/** Base58Check-encode a versioned 20-byte payload (legacy P2PKH / P2SH).\n * The one encoder for the package; pox5 and sbtc address code import it. */\nexport function base58CheckEncode(\n\tversion: number,\n\tpayload: Uint8Array,\n): string {\n\tconst data = concatBytes(Uint8Array.of(version), payload);\n\tconst checksum = doubleSha256(data).slice(0, 4);\n\treturn base58.encode(concatBytes(data, checksum));\n}\n\n/**\n * Render a parsed output script as a Bitcoin address for the given network.\n * Returns `undefined` for scripts without a standard address (OP_RETURN, P2PK,\n * unknown). Address encoding is network-dependent, which is why this is separate\n * from the pure `parseOutputScript` decoder.\n */\nexport function formatBitcoinAddress(\n\tparsed: ParsedOutputScript,\n\tnetwork: BitcoinNetwork = \"mainnet\",\n): string | undefined {\n\tconst params = NETWORK_PARAMS[network];\n\tconst hash = parsed.hash;\n\tif (!hash) return undefined;\n\tswitch (parsed.type) {\n\t\tcase \"p2pkh\":\n\t\t\treturn base58CheckEncode(params.p2pkh, hash);\n\t\tcase \"p2sh\":\n\t\t\treturn base58CheckEncode(params.p2sh, hash);\n\t\tcase \"p2wpkh\":\n\t\tcase \"p2wsh\":\n\t\t\treturn bech32.encode(params.hrp, [0, ...bech32.toWords(hash)]);\n\t\tcase \"p2tr\":\n\t\t\treturn bech32m.encode(params.hrp, [1, ...bech32m.toWords(hash)]);\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nfunction toPubkeyBytes(publicKey: Uint8Array | string): Uint8Array {\n\treturn typeof publicKey === \"string\" ? hexToBytes(publicKey) : publicKey;\n}\n\n/**\n * BIP341 key-path tweak: lift the x-only internal key to a point, add\n * `tapTweakHash(P)·G` (no script tree), and return the x-only output key.\n */\nexport function taprootTweakPubkey(xonly: Uint8Array): Uint8Array {\n\tif (xonly.length !== 32)\n\t\tthrow new Error(`Expected 32-byte x-only pubkey, got ${xonly.length}`);\n\tconst tweak = schnorr.utils.taggedHash(\"TapTweak\", xonly);\n\tconst t = BigInt(\n\t\t`0x${Array.from(tweak, (b) => b.toString(16).padStart(2, \"0\")).join(\"\")}`,\n\t);\n\tif (t >= secp256k1.Point.Fn.ORDER)\n\t\tthrow new Error(\"Invalid tap tweak (exceeds curve order)\");\n\tconst internal = secp256k1.Point.fromBytes(\n\t\tconcatBytes(Uint8Array.of(0x02), xonly),\n\t);\n\tconst output = internal.add(secp256k1.Point.BASE.multiply(t));\n\treturn output.toBytes(true).slice(1);\n}\n\n/**\n * Derive the native-segwit (P2WPKH, bech32 v0) address for a compressed\n * public key.\n */\nexport function publicKeyToP2wpkhAddress(\n\tpublicKey: Uint8Array | string,\n\tnetwork: BitcoinNetwork = \"mainnet\",\n): string {\n\tconst pubkey = toPubkeyBytes(publicKey);\n\tif (pubkey.length !== 33)\n\t\tthrow new Error(`Expected 33-byte compressed pubkey, got ${pubkey.length}`);\n\tconst params = NETWORK_PARAMS[network];\n\treturn bech32.encode(params.hrp, [0, ...bech32.toWords(hash160(pubkey))]);\n}\n\n/**\n * Derive the taproot (P2TR, bech32m v1) address for a public key — BIP341\n * key-path spend, no script tree. Accepts a 33-byte compressed key (the\n * parity byte is dropped) or a 32-byte x-only key.\n */\nexport function publicKeyToP2trAddress(\n\tpublicKey: Uint8Array | string,\n\tnetwork: BitcoinNetwork = \"mainnet\",\n): string {\n\tconst pubkey = toPubkeyBytes(publicKey);\n\tconst xonly =\n\t\tpubkey.length === 33\n\t\t\t? pubkey.slice(1)\n\t\t\t: pubkey.length === 32\n\t\t\t\t? pubkey\n\t\t\t\t: undefined;\n\tif (!xonly)\n\t\tthrow new Error(\n\t\t\t`Expected 33-byte compressed or 32-byte x-only pubkey, got ${pubkey.length}`,\n\t\t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AAM,UAChC,YAAY,WAAW,GAAG,CAAI,GAAG,KAAK,CACvC;AAAA,EACA,MAAM,SAAS,SAAS,IAAI,2BAAU,MAAM,KAAK,SAAS,CAAC,CAAC;AAAA,EAC5D,OAAO,OAAO,QAAQ,IAAI,EAAE,MAAM,CAAC;AAAA;AAO7B,SAAS,wBAAwB,CACvC,WACA,UAA0B,WACjB;AAAA,EACT,MAAM,SAAS,cAAc,SAAS;AAAA,EACtC,IAAI,OAAO,WAAW;AAAA,IACrB,MAAM,IAAI,MAAM,2CAA2C,OAAO,QAAQ;AAAA,EAC3E,MAAM,SAAS,eAAe;AAAA,EAC9B,OAAO,mBAAO,OAAO,OAAO,KAAK,CAAC,GAAG,GAAG,mBAAO,QAAQ,QAAQ,MAAM,CAAC,CAAC,CAAC;AAAA;AAQlE,SAAS,sBAAsB,CACrC,WACA,UAA0B,WACjB;AAAA,EACT,MAAM,SAAS,cAAc,SAAS;AAAA,EACtC,MAAM,QACL,OAAO,WAAW,KACf,OAAO,MAAM,CAAC,IACd,OAAO,WAAW,KACjB,SACA;AAAA,EACL,IAAI,CAAC;AAAA,IACJ,MAAM,IAAI,MACT,6DAA6D,OAAO,QACrE;AAAA,EACD,MAAM,SAAS,eAAe;AAAA,EAC9B,MAAM,YAAY,mBAAmB,KAAK;AAAA,EAC1C,OAAO,oBAAQ,OAAO,OAAO,KAAK,CAAC,GAAG,GAAG,oBAAQ,QAAQ,SAAS,CAAC,CAAC;AAAA;",
|
|
9
|
-
"debugId": "1DF872A8095B935464756E2164756E21",
|
|
10
|
-
"names": []
|
|
11
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// src/errors/websocket.ts
|
|
2
|
-
class WebSocketError extends BaseError {
|
|
3
|
-
name = "WebSocketError";
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// src/subscriptions/actions.ts
|
|
7
|
-
function getWsTransport(client) {
|
|
8
|
-
if (client.transport.type !== "webSocket") {
|
|
9
|
-
throw new WebSocketError("Watch actions require a webSocket transport. Use `webSocket()` when creating your client.");
|
|
10
|
-
}
|
|
11
|
-
return client.transport;
|
|
12
|
-
}
|
|
13
|
-
async function watchBlocks(client, params) {
|
|
14
|
-
const transport = getWsTransport(client);
|
|
15
|
-
return transport.subscribe({ event: "block" }, params.onBlock);
|
|
16
|
-
}
|
|
17
|
-
async function watchMempool(client, params) {
|
|
18
|
-
const transport = getWsTransport(client);
|
|
19
|
-
return transport.subscribe({ event: "mempool" }, params.onTransaction);
|
|
20
|
-
}
|
|
21
|
-
async function watchTransaction(client, params) {
|
|
22
|
-
const transport = getWsTransport(client);
|
|
23
|
-
return transport.subscribe({ event: "tx_update", tx_id: params.txId }, params.onUpdate);
|
|
24
|
-
}
|
|
25
|
-
async function watchAddress(client, params) {
|
|
26
|
-
const transport = getWsTransport(client);
|
|
27
|
-
return transport.subscribe({ event: "address_tx_update", address: params.address }, params.onTransaction);
|
|
28
|
-
}
|
|
29
|
-
async function watchAddressBalance(client, params) {
|
|
30
|
-
const transport = getWsTransport(client);
|
|
31
|
-
return transport.subscribe({ event: "address_balance_update", address: params.address }, params.onBalance);
|
|
32
|
-
}
|
|
33
|
-
async function watchNftEvent(client, params) {
|
|
34
|
-
const transport = getWsTransport(client);
|
|
35
|
-
let event;
|
|
36
|
-
if (params.assetIdentifier && params.value) {
|
|
37
|
-
event = "nft_event";
|
|
38
|
-
} else if (params.assetIdentifier) {
|
|
39
|
-
event = "nft_collection_event";
|
|
40
|
-
} else {
|
|
41
|
-
event = "nft_event";
|
|
42
|
-
}
|
|
43
|
-
return transport.subscribe({
|
|
44
|
-
event,
|
|
45
|
-
asset_identifier: params.assetIdentifier,
|
|
46
|
-
value: params.value
|
|
47
|
-
}, params.onEvent);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//# debugId=5512A15F010E3B8E64756E2164756E21
|
|
51
|
-
//# sourceMappingURL=stacks-dpxnxhqb.cjs.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/errors/websocket.ts", "../src/subscriptions/actions.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { BaseError } from \"./base.ts\";\n\nexport class WebSocketError extends BaseError {\n\toverride name = \"WebSocketError\";\n}\n",
|
|
6
|
-
"import type { Client } from \"../clients/types.ts\";\nimport { WebSocketError } from \"../errors/websocket.ts\";\nimport type { WebSocketTransport } from \"../transports/webSocket.ts\";\nimport type {\n\tAddressBalanceNotification,\n\tAddressTxNotification,\n\tBlockNotification,\n\tMempoolNotification,\n\tNftEventNotification,\n\tSubscription,\n\tTxUpdateNotification,\n} from \"./types.ts\";\n\nfunction getWsTransport(client: Client): WebSocketTransport {\n\tif (client.transport.type !== \"webSocket\") {\n\t\tthrow new WebSocketError(\n\t\t\t\"Watch actions require a webSocket transport. Use `webSocket()` when creating your client.\",\n\t\t);\n\t}\n\treturn client.transport as WebSocketTransport;\n}\n\nexport type WatchBlocksParams = {\n\tonBlock: (block: BlockNotification) => void;\n};\n\nexport async function watchBlocks(\n\tclient: Client,\n\tparams: WatchBlocksParams,\n): Promise<Subscription> {\n\tconst transport = getWsTransport(client);\n\treturn transport.subscribe({ event: \"block\" }, params.onBlock);\n}\n\nexport type WatchMempoolParams = {\n\tonTransaction: (tx: MempoolNotification) => void;\n};\n\nexport async function watchMempool(\n\tclient: Client,\n\tparams: WatchMempoolParams,\n): Promise<Subscription> {\n\tconst transport = getWsTransport(client);\n\treturn transport.subscribe({ event: \"mempool\" }, params.onTransaction);\n}\n\nexport type WatchTransactionParams = {\n\ttxId: string;\n\tonUpdate: (update: TxUpdateNotification) => void;\n};\n\nexport async function watchTransaction(\n\tclient: Client,\n\tparams: WatchTransactionParams,\n): Promise<Subscription> {\n\tconst transport = getWsTransport(client);\n\treturn transport.subscribe(\n\t\t{ event: \"tx_update\", tx_id: params.txId },\n\t\tparams.onUpdate,\n\t);\n}\n\nexport type WatchAddressParams = {\n\taddress: string;\n\tonTransaction: (tx: AddressTxNotification) => void;\n};\n\nexport async function watchAddress(\n\tclient: Client,\n\tparams: WatchAddressParams,\n): Promise<Subscription> {\n\tconst transport = getWsTransport(client);\n\treturn transport.subscribe(\n\t\t{ event: \"address_tx_update\", address: params.address },\n\t\tparams.onTransaction,\n\t);\n}\n\nexport type WatchAddressBalanceParams = {\n\taddress: string;\n\tonBalance: (balance: AddressBalanceNotification) => void;\n};\n\nexport async function watchAddressBalance(\n\tclient: Client,\n\tparams: WatchAddressBalanceParams,\n): Promise<Subscription> {\n\tconst transport = getWsTransport(client);\n\treturn transport.subscribe(\n\t\t{ event: \"address_balance_update\", address: params.address },\n\t\tparams.onBalance,\n\t);\n}\n\nexport type WatchNftEventParams = {\n\tonEvent: (event: NftEventNotification) => void;\n\tassetIdentifier?: string;\n\tvalue?: string;\n};\n\nexport async function watchNftEvent(\n\tclient: Client,\n\tparams: WatchNftEventParams,\n): Promise<Subscription> {\n\tconst transport = getWsTransport(client);\n\n\tlet event: \"nft_event\" | \"nft_asset_event\" | \"nft_collection_event\";\n\tif (params.assetIdentifier && params.value) {\n\t\tevent = \"nft_event\";\n\t} else if (params.assetIdentifier) {\n\t\tevent = \"nft_collection_event\";\n\t} else {\n\t\tevent = \"nft_event\";\n\t}\n\n\treturn transport.subscribe(\n\t\t{\n\t\t\tevent,\n\t\t\tasset_identifier: params.assetIdentifier,\n\t\t\tvalue: params.value,\n\t\t},\n\t\tparams.onEvent,\n\t);\n}\n"
|
|
7
|
-
],
|
|
8
|
-
"mappings": ";AAEO,MAAM,uBAAuB,UAAU;AAAA,EACpC,OAAO;AACjB;;;ACSA,SAAS,cAAc,CAAC,QAAoC;AAAA,EAC3D,IAAI,OAAO,UAAU,SAAS,aAAa;AAAA,IAC1C,MAAM,IAAI,eACT,2FACD;AAAA,EACD;AAAA,EACA,OAAO,OAAO;AAAA;AAOf,eAAsB,WAAW,CAChC,QACA,QACwB;AAAA,EACxB,MAAM,YAAY,eAAe,MAAM;AAAA,EACv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