@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
package/dist/src/utils/index.cjs
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
+
var import_node_module = require("node:module");
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toCommonJS = (from) => {
|
|
34
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
35
|
+
if (entry)
|
|
36
|
+
return entry;
|
|
37
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (var key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(entry, key))
|
|
41
|
+
__defProp(entry, key, {
|
|
42
|
+
get: __accessProp.bind(from, key),
|
|
43
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
__moduleCache.set(from, entry);
|
|
47
|
+
return entry;
|
|
48
|
+
};
|
|
49
|
+
var __moduleCache;
|
|
50
|
+
var __returnValue = (v) => v;
|
|
51
|
+
function __exportSetter(name, newValue) {
|
|
52
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
53
|
+
}
|
|
54
|
+
var __export = (target, all) => {
|
|
55
|
+
for (var name in all)
|
|
56
|
+
__defProp(target, name, {
|
|
57
|
+
get: all[name],
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
set: __exportSetter.bind(all, name)
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
1
64
|
// src/utils/index.ts
|
|
2
65
|
var exports_utils = {};
|
|
3
66
|
__export(exports_utils, {
|
|
@@ -66,8 +129,377 @@ __export(exports_utils, {
|
|
|
66
129
|
});
|
|
67
130
|
module.exports = __toCommonJS(exports_utils);
|
|
68
131
|
|
|
69
|
-
// src/utils/
|
|
132
|
+
// src/utils/encoding.ts
|
|
133
|
+
var hexes = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
134
|
+
function bytesToHex(bytes) {
|
|
135
|
+
let hex = "";
|
|
136
|
+
for (const b of bytes) {
|
|
137
|
+
hex += hexes[b];
|
|
138
|
+
}
|
|
139
|
+
return hex;
|
|
140
|
+
}
|
|
141
|
+
function hexToBytes(hex) {
|
|
142
|
+
let h = without0x(hex);
|
|
143
|
+
if (h.length % 2)
|
|
144
|
+
h = `0${h}`;
|
|
145
|
+
const array = new Uint8Array(h.length / 2);
|
|
146
|
+
for (let i = 0;i < array.length; i++) {
|
|
147
|
+
const j = i * 2;
|
|
148
|
+
const byte = Number.parseInt(h.slice(j, j + 2), 16);
|
|
149
|
+
if (Number.isNaN(byte) || byte < 0)
|
|
150
|
+
throw new Error("Invalid byte sequence");
|
|
151
|
+
array[i] = byte;
|
|
152
|
+
}
|
|
153
|
+
return array;
|
|
154
|
+
}
|
|
155
|
+
function with0x(value) {
|
|
156
|
+
return /^0x/i.test(value) ? value : `0x${value}`;
|
|
157
|
+
}
|
|
158
|
+
function without0x(value) {
|
|
159
|
+
return /^0x/i.test(value) ? value.slice(2) : value;
|
|
160
|
+
}
|
|
161
|
+
function utf8ToBytes(str) {
|
|
162
|
+
return new TextEncoder().encode(str);
|
|
163
|
+
}
|
|
164
|
+
function bytesToUtf8(bytes) {
|
|
165
|
+
return new TextDecoder().decode(bytes);
|
|
166
|
+
}
|
|
167
|
+
function asciiToBytes(str) {
|
|
168
|
+
const bytes = new Uint8Array(str.length);
|
|
169
|
+
for (let i = 0;i < str.length; i++) {
|
|
170
|
+
bytes[i] = str.charCodeAt(i) & 255;
|
|
171
|
+
}
|
|
172
|
+
return bytes;
|
|
173
|
+
}
|
|
174
|
+
function bytesToAscii(bytes) {
|
|
175
|
+
return String.fromCharCode(...bytes);
|
|
176
|
+
}
|
|
177
|
+
function concatBytes(...arrays) {
|
|
178
|
+
if (arrays.length === 1)
|
|
179
|
+
return arrays[0];
|
|
180
|
+
const length = arrays.reduce((a, arr) => a + arr.length, 0);
|
|
181
|
+
const result = new Uint8Array(length);
|
|
182
|
+
let pad = 0;
|
|
183
|
+
for (const arr of arrays) {
|
|
184
|
+
result.set(arr, pad);
|
|
185
|
+
pad += arr.length;
|
|
186
|
+
}
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
function intToBigInt(value) {
|
|
190
|
+
if (typeof value === "bigint")
|
|
191
|
+
return value;
|
|
192
|
+
if (typeof value === "string")
|
|
193
|
+
return BigInt(value);
|
|
194
|
+
if (typeof value === "number") {
|
|
195
|
+
if (!Number.isInteger(value))
|
|
196
|
+
throw new RangeError("Values of type 'number' must be an integer.");
|
|
197
|
+
if (value > Number.MAX_SAFE_INTEGER)
|
|
198
|
+
throw new RangeError(`Values of type 'number' must be <= ${Number.MAX_SAFE_INTEGER}. Use BigInt instead.`);
|
|
199
|
+
return BigInt(value);
|
|
200
|
+
}
|
|
201
|
+
if (value instanceof Uint8Array)
|
|
202
|
+
return BigInt(`0x${bytesToHex(value)}`);
|
|
203
|
+
throw new TypeError("Must be a number, bigint, string, or Uint8Array.");
|
|
204
|
+
}
|
|
205
|
+
function intToBytes(value, byteLength) {
|
|
206
|
+
return bigIntToBytes(intToBigInt(value), byteLength);
|
|
207
|
+
}
|
|
208
|
+
function bigIntToBytes(value, length = 16) {
|
|
209
|
+
const hex = value.toString(16).padStart(length * 2, "0");
|
|
210
|
+
return hexToBytes(hex);
|
|
211
|
+
}
|
|
212
|
+
function intToHex(integer, byteLength = 8) {
|
|
213
|
+
const value = typeof integer === "bigint" ? integer : intToBigInt(integer);
|
|
214
|
+
return value.toString(16).padStart(byteLength * 2, "0");
|
|
215
|
+
}
|
|
216
|
+
function toTwos(value, width) {
|
|
217
|
+
const limit = BigInt(1) << width - BigInt(1);
|
|
218
|
+
if (value < -limit || value > limit - BigInt(1)) {
|
|
219
|
+
throw new Error(`Unable to represent integer in width: ${width}`);
|
|
220
|
+
}
|
|
221
|
+
if (value >= BigInt(0))
|
|
222
|
+
return value;
|
|
223
|
+
return value + (BigInt(1) << width);
|
|
224
|
+
}
|
|
225
|
+
function fromTwos(value, width) {
|
|
226
|
+
if (value & BigInt(1) << width - BigInt(1)) {
|
|
227
|
+
return value - (BigInt(1) << width);
|
|
228
|
+
}
|
|
229
|
+
return value;
|
|
230
|
+
}
|
|
231
|
+
function bytesToTwosBigInt(bytes) {
|
|
232
|
+
if (bytes.length === 0)
|
|
233
|
+
return 0n;
|
|
234
|
+
const hex = bytesToHex(bytes);
|
|
235
|
+
if (hex.length === 0)
|
|
236
|
+
return 0n;
|
|
237
|
+
return fromTwos(BigInt(`0x${hex}`), BigInt(bytes.byteLength * 8));
|
|
238
|
+
}
|
|
239
|
+
function writeUInt32BE(value) {
|
|
240
|
+
const buf = new Uint8Array(4);
|
|
241
|
+
buf[0] = value >>> 24 & 255;
|
|
242
|
+
buf[1] = value >>> 16 & 255;
|
|
243
|
+
buf[2] = value >>> 8 & 255;
|
|
244
|
+
buf[3] = value & 255;
|
|
245
|
+
return buf;
|
|
246
|
+
}
|
|
247
|
+
function readUInt32BE(bytes, offset = 0) {
|
|
248
|
+
return (bytes[offset] << 24 | bytes[offset + 1] << 16 | bytes[offset + 2] << 8 | bytes[offset + 3]) >>> 0;
|
|
249
|
+
}
|
|
250
|
+
function writeUInt16BE(value) {
|
|
251
|
+
const buf = new Uint8Array(2);
|
|
252
|
+
buf[0] = value >>> 8 & 255;
|
|
253
|
+
buf[1] = value & 255;
|
|
254
|
+
return buf;
|
|
255
|
+
}
|
|
256
|
+
function readUInt16BE(bytes, offset = 0) {
|
|
257
|
+
return (bytes[offset] << 8 | bytes[offset + 1]) >>> 0;
|
|
258
|
+
}
|
|
259
|
+
function writeUInt8(value) {
|
|
260
|
+
return new Uint8Array([value & 255]);
|
|
261
|
+
}
|
|
262
|
+
// src/utils/hash.ts
|
|
263
|
+
var import_legacy = require("@noble/hashes/legacy.js");
|
|
264
|
+
var import_sha2 = require("@noble/hashes/sha2.js");
|
|
265
|
+
var import_sha22 = require("@noble/hashes/sha2.js");
|
|
266
|
+
function hash160(input) {
|
|
267
|
+
return import_legacy.ripemd160(import_sha2.sha256(input));
|
|
268
|
+
}
|
|
269
|
+
function txidFromBytes(data) {
|
|
270
|
+
return bytesToHex(import_sha22.sha512_256(data));
|
|
271
|
+
}
|
|
272
|
+
function hashP2PKH(input) {
|
|
273
|
+
return bytesToHex(hash160(input));
|
|
274
|
+
}
|
|
275
|
+
// src/utils/c32.ts
|
|
70
276
|
var import_sha23 = require("@noble/hashes/sha2.js");
|
|
277
|
+
var C32 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
278
|
+
var HEX = "0123456789abcdef";
|
|
279
|
+
function c32normalize(input) {
|
|
280
|
+
return input.toUpperCase().replace(/O/g, "0").replace(/L|I/g, "1");
|
|
281
|
+
}
|
|
282
|
+
function c32encode(inputHex) {
|
|
283
|
+
let hex = inputHex;
|
|
284
|
+
if (hex.length % 2 !== 0)
|
|
285
|
+
hex = `0${hex}`;
|
|
286
|
+
hex = hex.toLowerCase();
|
|
287
|
+
const res = [];
|
|
288
|
+
let carry = 0;
|
|
289
|
+
for (let i = hex.length - 1;i >= 0; i--) {
|
|
290
|
+
if (carry < 4) {
|
|
291
|
+
const currentCode = HEX.indexOf(hex[i]) >> carry;
|
|
292
|
+
const nextCode = i !== 0 ? HEX.indexOf(hex[i - 1]) : 0;
|
|
293
|
+
const nextBits = 1 + carry;
|
|
294
|
+
const nextLowBits = nextCode % (1 << nextBits) << 5 - nextBits;
|
|
295
|
+
res.unshift(C32[currentCode + nextLowBits]);
|
|
296
|
+
carry = nextBits;
|
|
297
|
+
} else {
|
|
298
|
+
carry = 0;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
let leadingZeros = 0;
|
|
302
|
+
while (leadingZeros < res.length && res[leadingZeros] === "0")
|
|
303
|
+
leadingZeros++;
|
|
304
|
+
const stripped = res.slice(leadingZeros);
|
|
305
|
+
const bytes = hexToBytes(hex);
|
|
306
|
+
let zeroBytesCount = 0;
|
|
307
|
+
while (zeroBytesCount < bytes.length && bytes[zeroBytesCount] === 0)
|
|
308
|
+
zeroBytesCount++;
|
|
309
|
+
const prefix = Array(zeroBytesCount).fill(C32[0]);
|
|
310
|
+
return [...prefix, ...stripped].join("");
|
|
311
|
+
}
|
|
312
|
+
function c32decode(c32input) {
|
|
313
|
+
const input = c32normalize(c32input);
|
|
314
|
+
if (!input.match(`^[${C32}]*$`))
|
|
315
|
+
throw new Error("Not a c32-encoded string");
|
|
316
|
+
const zeroPrefix = input.match(`^${C32[0]}*`);
|
|
317
|
+
const numLeadingZeroBytes = zeroPrefix ? zeroPrefix[0]?.length : 0;
|
|
318
|
+
const res = [];
|
|
319
|
+
let carry = 0;
|
|
320
|
+
let carryBits = 0;
|
|
321
|
+
for (let i = input.length - 1;i >= 0; i--) {
|
|
322
|
+
if (carryBits === 4) {
|
|
323
|
+
res.unshift(HEX[carry]);
|
|
324
|
+
carryBits = 0;
|
|
325
|
+
carry = 0;
|
|
326
|
+
}
|
|
327
|
+
const currentValue = (C32.indexOf(input[i]) << carryBits) + carry;
|
|
328
|
+
res.unshift(HEX[currentValue % 16]);
|
|
329
|
+
carryBits += 1;
|
|
330
|
+
carry = currentValue >> 4;
|
|
331
|
+
if (carry > 1 << carryBits)
|
|
332
|
+
throw new Error("Panic error in c32 decoding");
|
|
333
|
+
}
|
|
334
|
+
res.unshift(HEX[carry]);
|
|
335
|
+
if (res.length % 2 === 1)
|
|
336
|
+
res.unshift("0");
|
|
337
|
+
let hexLeadingZeros = 0;
|
|
338
|
+
while (hexLeadingZeros < res.length && res[hexLeadingZeros] === "0")
|
|
339
|
+
hexLeadingZeros++;
|
|
340
|
+
let hexStr = res.slice(hexLeadingZeros - hexLeadingZeros % 2).join("");
|
|
341
|
+
for (let i = 0;i < numLeadingZeroBytes; i++)
|
|
342
|
+
hexStr = `00${hexStr}`;
|
|
343
|
+
return hexStr;
|
|
344
|
+
}
|
|
345
|
+
function c32checksum(dataHex) {
|
|
346
|
+
return bytesToHex(import_sha23.sha256(import_sha23.sha256(hexToBytes(dataHex))).slice(0, 4));
|
|
347
|
+
}
|
|
348
|
+
function c32checkEncode(version, data) {
|
|
349
|
+
if (version < 0 || version >= 32)
|
|
350
|
+
throw new Error("Invalid version (must be between 0 and 31)");
|
|
351
|
+
if (!data.match(/^[0-9a-fA-F]*$/))
|
|
352
|
+
throw new Error("Invalid data (not a hex string)");
|
|
353
|
+
let d = data.toLowerCase();
|
|
354
|
+
if (d.length % 2 !== 0)
|
|
355
|
+
d = `0${d}`;
|
|
356
|
+
let versionHex = version.toString(16);
|
|
357
|
+
if (versionHex.length === 1)
|
|
358
|
+
versionHex = `0${versionHex}`;
|
|
359
|
+
const checksumHex = c32checksum(`${versionHex}${d}`);
|
|
360
|
+
return `${C32[version]}${c32encode(`${d}${checksumHex}`)}`;
|
|
361
|
+
}
|
|
362
|
+
function c32checkDecode(c32data) {
|
|
363
|
+
const normalized = c32normalize(c32data);
|
|
364
|
+
const dataHex = c32decode(normalized.slice(1));
|
|
365
|
+
const version = C32.indexOf(normalized[0]);
|
|
366
|
+
const checksum = dataHex.slice(-8);
|
|
367
|
+
let versionHex = version.toString(16);
|
|
368
|
+
if (versionHex.length === 1)
|
|
369
|
+
versionHex = `0${versionHex}`;
|
|
370
|
+
if (c32checksum(`${versionHex}${dataHex.substring(0, dataHex.length - 8)}`) !== checksum) {
|
|
371
|
+
throw new Error("Invalid c32check string: checksum mismatch");
|
|
372
|
+
}
|
|
373
|
+
return [version, dataHex.substring(0, dataHex.length - 8)];
|
|
374
|
+
}
|
|
375
|
+
function c32address(version, hash160hex) {
|
|
376
|
+
if (!hash160hex.match(/^[0-9a-fA-F]{40}$/)) {
|
|
377
|
+
throw new Error("Invalid argument: not a hash160 hex string");
|
|
378
|
+
}
|
|
379
|
+
return `S${c32checkEncode(version, hash160hex)}`;
|
|
380
|
+
}
|
|
381
|
+
function c32addressDecode(c32addr) {
|
|
382
|
+
if (c32addr.length <= 5)
|
|
383
|
+
throw new Error("Invalid c32 address: invalid length");
|
|
384
|
+
if (c32addr[0] !== "S")
|
|
385
|
+
throw new Error('Invalid c32 address: must start with "S"');
|
|
386
|
+
return c32checkDecode(c32addr.slice(1));
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// src/utils/constants.ts
|
|
390
|
+
var MAX_U128 = (1n << 128n) - 1n;
|
|
391
|
+
var MAX_I128 = (1n << 127n) - 1n;
|
|
392
|
+
var MIN_I128 = -(1n << 127n);
|
|
393
|
+
var AddressVersion = {
|
|
394
|
+
MainnetSingleSig: 22,
|
|
395
|
+
MainnetMultiSig: 20,
|
|
396
|
+
TestnetSingleSig: 26,
|
|
397
|
+
TestnetMultiSig: 21
|
|
398
|
+
};
|
|
399
|
+
var ZERO_ADDRESS = "SP000000000000000000002Q6VF78";
|
|
400
|
+
var TESTNET_ZERO_ADDRESS = "ST000000000000000000002AMW42H";
|
|
401
|
+
var MICROSTX_PER_STX = 1000000n;
|
|
402
|
+
|
|
403
|
+
// src/utils/address.ts
|
|
404
|
+
function publicKeyToAddress(publicKey, network = "mainnet") {
|
|
405
|
+
const bytes = typeof publicKey === "string" ? hexToBytes(without0x(publicKey)) : publicKey;
|
|
406
|
+
const version = network === "mainnet" ? AddressVersion.MainnetSingleSig : AddressVersion.TestnetSingleSig;
|
|
407
|
+
return c32address(version, bytesToHex(hash160(bytes)));
|
|
408
|
+
}
|
|
409
|
+
var CONTRACT_NAME_REGEX = /^[a-zA-Z][a-zA-Z0-9_-]{0,127}$/;
|
|
410
|
+
function validateStacksAddress(address) {
|
|
411
|
+
try {
|
|
412
|
+
c32addressDecode(address);
|
|
413
|
+
return true;
|
|
414
|
+
} catch {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
var isValidAddress = validateStacksAddress;
|
|
419
|
+
function parsePrincipal(value) {
|
|
420
|
+
const parts = value.split(".");
|
|
421
|
+
if (parts.length > 2)
|
|
422
|
+
return null;
|
|
423
|
+
const [address, contractName] = parts;
|
|
424
|
+
if (!validateStacksAddress(address))
|
|
425
|
+
return null;
|
|
426
|
+
if (contractName === undefined)
|
|
427
|
+
return { address };
|
|
428
|
+
if (!CONTRACT_NAME_REGEX.test(contractName))
|
|
429
|
+
return null;
|
|
430
|
+
return { address, contractName };
|
|
431
|
+
}
|
|
432
|
+
function parseContractId(contractId) {
|
|
433
|
+
const parsed = parsePrincipal(contractId);
|
|
434
|
+
if (!parsed?.contractName)
|
|
435
|
+
throw new Error(`Invalid contract identifier: ${contractId}`);
|
|
436
|
+
return [parsed.address, parsed.contractName];
|
|
437
|
+
}
|
|
438
|
+
function isClarityName(name) {
|
|
439
|
+
const regex = /^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$/;
|
|
440
|
+
return regex.test(name) && name.length < 128;
|
|
441
|
+
}
|
|
442
|
+
function isAddressEqual(a, b) {
|
|
443
|
+
const [versionA, hashA] = c32addressDecode(a);
|
|
444
|
+
const [versionB, hashB] = c32addressDecode(b);
|
|
445
|
+
return versionA === versionB && hashA.toLowerCase() === hashB.toLowerCase();
|
|
446
|
+
}
|
|
447
|
+
function addressToVersion(address) {
|
|
448
|
+
return c32addressDecode(address)[0];
|
|
449
|
+
}
|
|
450
|
+
function getContractAddress(deployer, contractName) {
|
|
451
|
+
if (!validateStacksAddress(deployer)) {
|
|
452
|
+
throw new Error(`Invalid deployer address: ${deployer}`);
|
|
453
|
+
}
|
|
454
|
+
if (!isClarityName(contractName)) {
|
|
455
|
+
throw new Error(`Invalid contract name: ${contractName}`);
|
|
456
|
+
}
|
|
457
|
+
return `${deployer}.${contractName}`;
|
|
458
|
+
}
|
|
459
|
+
// src/utils/units.ts
|
|
460
|
+
function formatUnits(value, decimals) {
|
|
461
|
+
let v = BigInt(value);
|
|
462
|
+
const negative = v < 0n;
|
|
463
|
+
if (negative)
|
|
464
|
+
v = -v;
|
|
465
|
+
const divisor = 10n ** BigInt(decimals);
|
|
466
|
+
const integer = (v / divisor).toString();
|
|
467
|
+
let fraction = (v % divisor).toString().padStart(decimals, "0");
|
|
468
|
+
fraction = fraction.replace(/0+$/, "") || "0";
|
|
469
|
+
const result = `${integer}.${fraction}`;
|
|
470
|
+
return negative ? `-${result}` : result;
|
|
471
|
+
}
|
|
472
|
+
var DECIMAL_STRING = /^-?\d+(\.\d+)?$/;
|
|
473
|
+
function parseUnits(value, decimals) {
|
|
474
|
+
if (typeof value === "number" && !Number.isFinite(value)) {
|
|
475
|
+
throw new RangeError(`Cannot parse ${value} as a decimal amount`);
|
|
476
|
+
}
|
|
477
|
+
let str = typeof value === "number" ? value.toFixed(decimals) : value.trim();
|
|
478
|
+
if (!DECIMAL_STRING.test(str)) {
|
|
479
|
+
throw new RangeError(`Cannot parse "${value}" as a decimal amount: expected digits with an optional fraction, like "1.5"`);
|
|
480
|
+
}
|
|
481
|
+
if (typeof value === "number" && Number(str) !== value) {
|
|
482
|
+
throw new RangeError(`Cannot parse ${value} with ${decimals} decimals: pass the amount as a string to keep every digit`);
|
|
483
|
+
}
|
|
484
|
+
const negative = str.startsWith("-");
|
|
485
|
+
if (negative)
|
|
486
|
+
str = str.slice(1);
|
|
487
|
+
const [integer = "", fraction = ""] = str.split(".");
|
|
488
|
+
if (fraction.length > decimals) {
|
|
489
|
+
throw new Error(`Too many decimal places: "${value}" has ${fraction.length} decimals, max is ${decimals}`);
|
|
490
|
+
}
|
|
491
|
+
const padded = fraction.padEnd(decimals, "0");
|
|
492
|
+
const result = BigInt(integer + padded);
|
|
493
|
+
return negative ? -result : result;
|
|
494
|
+
}
|
|
495
|
+
function formatStx(microStx) {
|
|
496
|
+
return formatUnits(microStx, 6);
|
|
497
|
+
}
|
|
498
|
+
function parseStx(stx) {
|
|
499
|
+
return parseUnits(stx, 6);
|
|
500
|
+
}
|
|
501
|
+
// src/utils/signature.ts
|
|
502
|
+
var import_sha24 = require("@noble/hashes/sha2.js");
|
|
71
503
|
var import_secp256k1 = require("@noble/secp256k1");
|
|
72
504
|
function parseSignature(hex) {
|
|
73
505
|
const clean = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
@@ -134,7 +566,7 @@ function hashMessage(message, prefix) {
|
|
|
134
566
|
const messageBytes = typeof message === "string" ? utf8ToBytes(message) : message;
|
|
135
567
|
const prefixBytes = utf8ToBytes(prefix);
|
|
136
568
|
const lengthBytes = encodeVarint(messageBytes.length);
|
|
137
|
-
return
|
|
569
|
+
return import_sha24.sha256(concatBytes(prefixBytes, lengthBytes, messageBytes));
|
|
138
570
|
}
|
|
139
571
|
function verifyMessageSignature(message, signature, publicKey) {
|
|
140
572
|
const parsed = parseSignature(signature);
|
|
@@ -167,5 +599,5 @@ function randomBytes(length) {
|
|
|
167
599
|
return import_secp256k12.etc.randomBytes(length ?? 32);
|
|
168
600
|
}
|
|
169
601
|
|
|
170
|
-
//# debugId=
|
|
602
|
+
//# debugId=4144E71FC68A472964756E2164756E21
|
|
171
603
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/utils/signature.ts", "../src/utils/keys.ts"],
|
|
3
|
+
"sources": ["../src/utils/encoding.ts", "../src/utils/hash.ts", "../src/utils/c32.ts", "../src/utils/constants.ts", "../src/utils/address.ts", "../src/utils/units.ts", "../src/utils/signature.ts", "../src/utils/keys.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
+
"const hexes = Array.from({ length: 256 }, (_, i) =>\n\ti.toString(16).padStart(2, \"0\"),\n);\n\nexport function bytesToHex(bytes: Uint8Array): string {\n\tlet hex = \"\";\n\tfor (const b of bytes) {\n\t\thex += hexes[b];\n\t}\n\treturn hex;\n}\n\nexport function hexToBytes(hex: string): Uint8Array {\n\tlet h = without0x(hex);\n\tif (h.length % 2) h = `0${h}`;\n\n\tconst array = new Uint8Array(h.length / 2);\n\tfor (let i = 0; i < array.length; i++) {\n\t\tconst j = i * 2;\n\t\tconst byte = Number.parseInt(h.slice(j, j + 2), 16);\n\t\tif (Number.isNaN(byte) || byte < 0)\n\t\t\tthrow new Error(\"Invalid byte sequence\");\n\t\tarray[i] = byte;\n\t}\n\treturn array;\n}\n\nexport function with0x(value: string): string {\n\treturn /^0x/i.test(value) ? value : `0x${value}`;\n}\n\nexport function without0x(value: string): string {\n\treturn /^0x/i.test(value) ? value.slice(2) : value;\n}\n\nexport function utf8ToBytes(str: string): Uint8Array {\n\treturn new TextEncoder().encode(str);\n}\n\nexport function bytesToUtf8(bytes: Uint8Array): string {\n\treturn new TextDecoder().decode(bytes);\n}\n\nexport function asciiToBytes(str: string): Uint8Array {\n\tconst bytes = new Uint8Array(str.length);\n\tfor (let i = 0; i < str.length; i++) {\n\t\tbytes[i] = str.charCodeAt(i) & 0xff;\n\t}\n\treturn bytes;\n}\n\nexport function bytesToAscii(bytes: Uint8Array): string {\n\treturn String.fromCharCode(...bytes);\n}\n\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\tif (arrays.length === 1) return arrays[0]!;\n\tconst length = arrays.reduce((a, arr) => a + arr.length, 0);\n\tconst result = new Uint8Array(length);\n\tlet pad = 0;\n\tfor (const arr of arrays) {\n\t\tresult.set(arr, pad);\n\t\tpad += arr.length;\n\t}\n\treturn result;\n}\n\nexport type IntegerType = number | string | bigint | Uint8Array;\n\nexport function intToBigInt(value: IntegerType): bigint {\n\tif (typeof value === \"bigint\") return value;\n\tif (typeof value === \"string\") return BigInt(value);\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isInteger(value))\n\t\t\tthrow new RangeError(\"Values of type 'number' must be an integer.\");\n\t\tif (value > Number.MAX_SAFE_INTEGER)\n\t\t\tthrow new RangeError(\n\t\t\t\t`Values of type 'number' must be <= ${Number.MAX_SAFE_INTEGER}. Use BigInt instead.`,\n\t\t\t);\n\t\treturn BigInt(value);\n\t}\n\tif (value instanceof Uint8Array) return BigInt(`0x${bytesToHex(value)}`);\n\tthrow new TypeError(\"Must be a number, bigint, string, or Uint8Array.\");\n}\n\nexport function intToBytes(value: IntegerType, byteLength: number): Uint8Array {\n\treturn bigIntToBytes(intToBigInt(value), byteLength);\n}\n\nexport function bigIntToBytes(value: bigint, length = 16): Uint8Array {\n\tconst hex = value.toString(16).padStart(length * 2, \"0\");\n\treturn hexToBytes(hex);\n}\n\nexport function intToHex(integer: IntegerType, byteLength = 8): string {\n\tconst value = typeof integer === \"bigint\" ? integer : intToBigInt(integer);\n\treturn value.toString(16).padStart(byteLength * 2, \"0\");\n}\n\nexport function toTwos(value: bigint, width: bigint): bigint {\n\tconst limit = BigInt(1) << (width - BigInt(1));\n\tif (value < -limit || value > limit - BigInt(1)) {\n\t\tthrow new Error(`Unable to represent integer in width: ${width}`);\n\t}\n\tif (value >= BigInt(0)) return value;\n\treturn value + (BigInt(1) << width);\n}\n\nexport function fromTwos(value: bigint, width: bigint): bigint {\n\tif (value & (BigInt(1) << (width - BigInt(1)))) {\n\t\treturn value - (BigInt(1) << width);\n\t}\n\treturn value;\n}\n\nexport function bytesToTwosBigInt(bytes: Uint8Array): bigint {\n\tif (bytes.length === 0) return 0n;\n\tconst hex = bytesToHex(bytes);\n\tif (hex.length === 0) return 0n;\n\treturn fromTwos(BigInt(`0x${hex}`), BigInt(bytes.byteLength * 8));\n}\n\nexport function writeUInt32BE(value: number): Uint8Array {\n\tconst buf = new Uint8Array(4);\n\tbuf[0] = (value >>> 24) & 0xff;\n\tbuf[1] = (value >>> 16) & 0xff;\n\tbuf[2] = (value >>> 8) & 0xff;\n\tbuf[3] = value & 0xff;\n\treturn buf;\n}\n\nexport function readUInt32BE(bytes: Uint8Array, offset = 0): number {\n\treturn (\n\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\t((bytes[offset]! << 24) |\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\t\t(bytes[offset + 1]! << 16) |\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\t\t(bytes[offset + 2]! << 8) |\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\t\tbytes[offset + 3]!) >>>\n\t\t0\n\t);\n}\n\nexport function writeUInt16BE(value: number): Uint8Array {\n\tconst buf = new Uint8Array(2);\n\tbuf[0] = (value >>> 8) & 0xff;\n\tbuf[1] = value & 0xff;\n\treturn buf;\n}\n\nexport function readUInt16BE(bytes: Uint8Array, offset = 0): number {\n\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\treturn ((bytes[offset]! << 8) | bytes[offset + 1]!) >>> 0;\n}\n\nexport function writeUInt8(value: number): Uint8Array {\n\treturn new Uint8Array([value & 0xff]);\n}\n",
|
|
6
|
+
"import { ripemd160 } from \"@noble/hashes/legacy.js\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport { sha512_256 } from \"@noble/hashes/sha2.js\";\nimport { bytesToHex } from \"./encoding.ts\";\n\nexport { sha256, sha512_256, ripemd160 };\n\n/** RIPEMD160(SHA256(input)) — standard Bitcoin/Stacks address hash */\nexport function hash160(input: Uint8Array): Uint8Array {\n\treturn ripemd160(sha256(input));\n}\n\n/** Hash used for transaction IDs */\nexport function txidFromBytes(data: Uint8Array): string {\n\treturn bytesToHex(sha512_256(data));\n}\n\n/** hash160 as hex — used for P2PKH address derivation */\nexport function hashP2PKH(input: Uint8Array): string {\n\treturn bytesToHex(hash160(input));\n}\n",
|
|
7
|
+
"import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { bytesToHex, hexToBytes } from \"./encoding.ts\";\n\nconst C32 = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\nconst HEX = \"0123456789abcdef\";\n\nfunction c32normalize(input: string): string {\n\treturn input.toUpperCase().replace(/O/g, \"0\").replace(/L|I/g, \"1\");\n}\n\nfunction c32encode(inputHex: string): string {\n\tlet hex = inputHex;\n\tif (hex.length % 2 !== 0) hex = `0${hex}`;\n\thex = hex.toLowerCase();\n\n\tconst res: string[] = [];\n\tlet carry = 0;\n\tfor (let i = hex.length - 1; i >= 0; i--) {\n\t\tif (carry < 4) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\t\tconst currentCode = HEX.indexOf(hex[i]!) >> carry;\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\t\tconst nextCode = i !== 0 ? HEX.indexOf(hex[i - 1]!) : 0;\n\t\t\tconst nextBits = 1 + carry;\n\t\t\tconst nextLowBits = (nextCode % (1 << nextBits)) << (5 - nextBits);\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\t\tres.unshift(C32[currentCode + nextLowBits]!);\n\t\t\tcarry = nextBits;\n\t\t} else {\n\t\t\tcarry = 0;\n\t\t}\n\t}\n\n\t// Strip leading c32 zeros\n\tlet leadingZeros = 0;\n\twhile (leadingZeros < res.length && res[leadingZeros] === \"0\") leadingZeros++;\n\tconst stripped = res.slice(leadingZeros);\n\n\t// Preserve leading zero bytes from hex\n\tconst bytes = hexToBytes(hex);\n\tlet zeroBytesCount = 0;\n\twhile (zeroBytesCount < bytes.length && bytes[zeroBytesCount] === 0)\n\t\tzeroBytesCount++;\n\tconst prefix = Array(zeroBytesCount).fill(C32[0]) as string[];\n\n\treturn [...prefix, ...stripped].join(\"\");\n}\n\nfunction c32decode(c32input: string): string {\n\tconst input = c32normalize(c32input);\n\tif (!input.match(`^[${C32}]*$`)) throw new Error(\"Not a c32-encoded string\");\n\n\tconst zeroPrefix = input.match(`^${C32[0]}*`);\n\tconst numLeadingZeroBytes = zeroPrefix ? zeroPrefix[0]?.length : 0;\n\n\tconst res: string[] = [];\n\tlet carry = 0;\n\tlet carryBits = 0;\n\tfor (let i = input.length - 1; i >= 0; i--) {\n\t\tif (carryBits === 4) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\t\tres.unshift(HEX[carry]!);\n\t\t\tcarryBits = 0;\n\t\t\tcarry = 0;\n\t\t}\n\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\tconst currentValue = (C32.indexOf(input[i]!) << carryBits) + carry;\n\t\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\t\tres.unshift(HEX[currentValue % 16]!);\n\t\tcarryBits += 1;\n\t\tcarry = currentValue >> 4;\n\t\tif (carry > 1 << carryBits) throw new Error(\"Panic error in c32 decoding\");\n\t}\n\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\tres.unshift(HEX[carry]!);\n\n\tif (res.length % 2 === 1) res.unshift(\"0\");\n\n\t// Strip leading hex zeros\n\tlet hexLeadingZeros = 0;\n\twhile (hexLeadingZeros < res.length && res[hexLeadingZeros] === \"0\")\n\t\thexLeadingZeros++;\n\tlet hexStr = res.slice(hexLeadingZeros - (hexLeadingZeros % 2)).join(\"\");\n\n\tfor (let i = 0; i < numLeadingZeroBytes; i++) hexStr = `00${hexStr}`;\n\n\treturn hexStr;\n}\n\nfunction c32checksum(dataHex: string): string {\n\treturn bytesToHex(sha256(sha256(hexToBytes(dataHex))).slice(0, 4));\n}\n\nfunction c32checkEncode(version: number, data: string): string {\n\tif (version < 0 || version >= 32)\n\t\tthrow new Error(\"Invalid version (must be between 0 and 31)\");\n\tif (!data.match(/^[0-9a-fA-F]*$/))\n\t\tthrow new Error(\"Invalid data (not a hex string)\");\n\n\tlet d = data.toLowerCase();\n\tif (d.length % 2 !== 0) d = `0${d}`;\n\n\tlet versionHex = version.toString(16);\n\tif (versionHex.length === 1) versionHex = `0${versionHex}`;\n\n\tconst checksumHex = c32checksum(`${versionHex}${d}`);\n\treturn `${C32[version]}${c32encode(`${d}${checksumHex}`)}`;\n}\n\nfunction c32checkDecode(c32data: string): [number, string] {\n\tconst normalized = c32normalize(c32data);\n\tconst dataHex = c32decode(normalized.slice(1));\n\t// biome-ignore lint/style/noNonNullAssertion: bit-encoding routine where index is provably bounded by surrounding loop/length checks\n\tconst version = C32.indexOf(normalized[0]!);\n\tconst checksum = dataHex.slice(-8);\n\n\tlet versionHex = version.toString(16);\n\tif (versionHex.length === 1) versionHex = `0${versionHex}`;\n\n\tif (\n\t\tc32checksum(`${versionHex}${dataHex.substring(0, dataHex.length - 8)}`) !==\n\t\tchecksum\n\t) {\n\t\tthrow new Error(\"Invalid c32check string: checksum mismatch\");\n\t}\n\n\treturn [version, dataHex.substring(0, dataHex.length - 8)];\n}\n\nexport function c32address(version: number, hash160hex: string): string {\n\tif (!hash160hex.match(/^[0-9a-fA-F]{40}$/)) {\n\t\tthrow new Error(\"Invalid argument: not a hash160 hex string\");\n\t}\n\treturn `S${c32checkEncode(version, hash160hex)}`;\n}\n\nexport function c32addressDecode(c32addr: string): [number, string] {\n\tif (c32addr.length <= 5)\n\t\tthrow new Error(\"Invalid c32 address: invalid length\");\n\tif (c32addr[0] !== \"S\")\n\t\tthrow new Error('Invalid c32 address: must start with \"S\"');\n\treturn c32checkDecode(c32addr.slice(1));\n}\n",
|
|
8
|
+
"// Clarity integer bounds\nexport const MAX_U128: bigint = (1n << 128n) - 1n;\nexport const MAX_I128: bigint = (1n << 127n) - 1n;\nexport const MIN_I128: bigint = -(1n << 127n);\n\n/** C32-encoded address version bytes for single-sig and multi-sig on each network. */\nexport const AddressVersion = {\n\tMainnetSingleSig: 22,\n\tMainnetMultiSig: 20,\n\tTestnetSingleSig: 26,\n\tTestnetMultiSig: 21,\n} as const;\nexport type AddressVersion =\n\t(typeof AddressVersion)[keyof typeof AddressVersion];\n\n/** Mainnet burn address (all-zero hash160). */\nexport const ZERO_ADDRESS = \"SP000000000000000000002Q6VF78\";\n/** Testnet burn address (all-zero hash160). */\nexport const TESTNET_ZERO_ADDRESS = \"ST000000000000000000002AMW42H\";\n\n/** Number of microSTX per 1 STX (10^6). */\nexport const MICROSTX_PER_STX = 1_000_000n;\n",
|
|
9
|
+
"import { c32address, c32addressDecode } from \"./c32.ts\";\nimport { AddressVersion } from \"./constants.ts\";\nimport { bytesToHex, hexToBytes, without0x } from \"./encoding.ts\";\nimport { hash160 } from \"./hash.ts\";\n\nexport { c32address, c32addressDecode };\n\n/**\n * Derive the single-sig Stacks address for a compressed public key.\n */\nexport function publicKeyToAddress(\n\tpublicKey: string | Uint8Array,\n\tnetwork: \"mainnet\" | \"testnet\" = \"mainnet\",\n): string {\n\tconst bytes =\n\t\ttypeof publicKey === \"string\"\n\t\t\t? hexToBytes(without0x(publicKey))\n\t\t\t: publicKey;\n\tconst version =\n\t\tnetwork === \"mainnet\"\n\t\t\t? AddressVersion.MainnetSingleSig\n\t\t\t: AddressVersion.TestnetSingleSig;\n\treturn c32address(version, bytesToHex(hash160(bytes)));\n}\n\n/** Clarity contract-name grammar: leading letter, then letters/digits/`-`/`_`.\n * Underscore is legal (SIP-002) and deployed contracts use it — matches the\n * pattern the Index API already accepts for contract ids. */\nexport const CONTRACT_NAME_REGEX: RegExp = /^[a-zA-Z][a-zA-Z0-9_-]{0,127}$/;\n\nexport function validateStacksAddress(address: string): boolean {\n\ttry {\n\t\tc32addressDecode(address);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Alias for validateStacksAddress — matches future.md naming. */\nexport const isValidAddress: (address: string) => boolean =\n\tvalidateStacksAddress;\n\n/** Parse a principal into its parts, or null when malformed. The single\n * definition of \"valid principal\" for this package: exactly one optional\n * `.name` segment (never two), a c32-decodable address, and a contract name\n * matching the Clarity grammar. */\nexport function parsePrincipal(\n\tvalue: string,\n): { address: string; contractName?: string } | null {\n\tconst parts = value.split(\".\");\n\tif (parts.length > 2) return null;\n\tconst [address, contractName] = parts as [string, string | undefined];\n\tif (!validateStacksAddress(address)) return null;\n\tif (contractName === undefined) return { address };\n\tif (!CONTRACT_NAME_REGEX.test(contractName)) return null;\n\treturn { address, contractName };\n}\n\n/** Split `address.name` into its parts. Throws on anything `parsePrincipal`\n * rejects, and on a bare address with no contract name. */\nexport function parseContractId(contractId: string): [string, string] {\n\tconst parsed = parsePrincipal(contractId);\n\tif (!parsed?.contractName)\n\t\tthrow new Error(`Invalid contract identifier: ${contractId}`);\n\treturn [parsed.address, parsed.contractName];\n}\n\nexport function isClarityName(name: string): boolean {\n\tconst regex = /^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$/;\n\treturn regex.test(name) && name.length < 128;\n}\n\n/**\n * Compare two Stacks addresses for equality (case-insensitive, version-aware).\n * Throws if either address is invalid.\n */\nexport function isAddressEqual(a: string, b: string): boolean {\n\tconst [versionA, hashA] = c32addressDecode(a);\n\tconst [versionB, hashB] = c32addressDecode(b);\n\treturn versionA === versionB && hashA.toLowerCase() === hashB.toLowerCase();\n}\n\n/** Extract the version byte from a Stacks address (22, 20, 26, or 21). */\nexport function addressToVersion(address: string): number {\n\treturn c32addressDecode(address)[0];\n}\n\n/**\n * Build a contract address from deployer + contract name.\n * Validates both parts; returns `deployer.contractName`.\n */\nexport function getContractAddress(\n\tdeployer: string,\n\tcontractName: string,\n): string {\n\tif (!validateStacksAddress(deployer)) {\n\t\tthrow new Error(`Invalid deployer address: ${deployer}`);\n\t}\n\tif (!isClarityName(contractName)) {\n\t\tthrow new Error(`Invalid contract name: ${contractName}`);\n\t}\n\treturn `${deployer}.${contractName}`;\n}\n",
|
|
10
|
+
"/**\n * Format a bigint value with decimal places.\n * @example formatUnits(1000000n, 6) → \"1.0\"\n * @example formatUnits(1500000n, 6) → \"1.5\"\n */\nexport function formatUnits(\n\tvalue: bigint | number | string,\n\tdecimals: number,\n): string {\n\tlet v = BigInt(value);\n\n\tconst negative = v < 0n;\n\tif (negative) v = -v;\n\n\tconst divisor = 10n ** BigInt(decimals);\n\tconst integer = (v / divisor).toString();\n\tlet fraction = (v % divisor).toString().padStart(decimals, \"0\");\n\n\t// Trim trailing zeros, but keep at least one decimal\n\tfraction = fraction.replace(/0+$/, \"\") || \"0\";\n\n\tconst result = `${integer}.${fraction}`;\n\treturn negative ? `-${result}` : result;\n}\n\n/**\n * Parse a decimal string into a bigint with the given number of decimals.\n * @example parseUnits(\"1.5\", 6) → 1500000n\n * @example parseUnits(\"1\", 6) → 1000000n\n */\nconst DECIMAL_STRING = /^-?\\d+(\\.\\d+)?$/;\n\nexport function parseUnits(value: string | number, decimals: number): bigint {\n\tif (typeof value === \"number\" && !Number.isFinite(value)) {\n\t\tthrow new RangeError(`Cannot parse ${value} as a decimal amount`);\n\t}\n\t// Numbers small or large enough to print in exponent form (1e-7, 1e21)\n\t// go through toFixed so the digits survive. A number the fixed form\n\t// cannot hold exactly (too many decimals, or too small for one unit) is\n\t// refused rather than rounded, so amounts never shrink silently.\n\tlet str = typeof value === \"number\" ? value.toFixed(decimals) : value.trim();\n\tif (!DECIMAL_STRING.test(str)) {\n\t\tthrow new RangeError(\n\t\t\t`Cannot parse \"${value}\" as a decimal amount: expected digits with an optional fraction, like \"1.5\"`,\n\t\t);\n\t}\n\tif (typeof value === \"number\" && Number(str) !== value) {\n\t\tthrow new RangeError(\n\t\t\t`Cannot parse ${value} with ${decimals} decimals: pass the amount as a string to keep every digit`,\n\t\t);\n\t}\n\n\tconst negative = str.startsWith(\"-\");\n\tif (negative) str = str.slice(1);\n\n\tconst [integer = \"\", fraction = \"\"] = str.split(\".\");\n\n\tif (fraction.length > decimals) {\n\t\tthrow new Error(\n\t\t\t`Too many decimal places: \"${value}\" has ${fraction.length} decimals, max is ${decimals}`,\n\t\t);\n\t}\n\n\tconst padded = fraction.padEnd(decimals, \"0\");\n\tconst result = BigInt(integer + padded);\n\treturn negative ? -result : result;\n}\n\n/**\n * Format microSTX to STX string (6 decimals).\n * @example formatStx(1000000n) → \"1.0\"\n */\nexport function formatStx(microStx: bigint | number | string): string {\n\treturn formatUnits(microStx, 6);\n}\n\n/**\n * Parse STX string to microSTX bigint (6 decimals).\n * @example parseStx(\"1.5\") → 1500000n\n */\nexport function parseStx(stx: string | number): bigint {\n\treturn parseUnits(stx, 6);\n}\n",
|
|
5
11
|
"import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { Signature as NobleSignature, verify } from \"@noble/secp256k1\";\nimport { c32address } from \"./address.ts\";\nimport { AddressVersion } from \"./constants.ts\";\nimport { concatBytes, hexToBytes, utf8ToBytes } from \"./encoding.ts\";\nimport { hashP2PKH } from \"./hash.ts\";\n\nexport interface RecoverableSignature {\n\t/** Recovery id (0–3) */\n\trecovery: number;\n\t/** 32-byte r value as hex */\n\tr: string;\n\t/** 32-byte s value as hex */\n\ts: string;\n}\n\n// --- Format conversion ---\n\n/**\n * Parse a 65-byte VRS hex signature into components.\n * VRS format: recovery (1 byte) + r (32 bytes) + s (32 bytes)\n */\nexport function parseSignature(hex: string): RecoverableSignature {\n\tconst clean = hex.startsWith(\"0x\") ? hex.slice(2) : hex;\n\tif (clean.length !== 130) {\n\t\tthrow new Error(\n\t\t\t`Invalid signature length: expected 130 hex chars, got ${clean.length}`,\n\t\t);\n\t}\n\treturn {\n\t\trecovery: Number.parseInt(clean.slice(0, 2), 16),\n\t\tr: clean.slice(2, 66),\n\t\ts: clean.slice(66, 130),\n\t};\n}\n\n/**\n * Serialize a recoverable signature to 65-byte VRS hex (130 chars).\n */\nexport function serializeSignature(sig: RecoverableSignature): string {\n\tconst v = sig.recovery.toString(16).padStart(2, \"0\");\n\treturn v + sig.r + sig.s;\n}\n\n/** Convert VRS hex to RSV hex: r+s (128 chars) + recovery (2 chars). */\nexport function signatureVrsToRsv(vrs: string): string {\n\tconst clean = vrs.startsWith(\"0x\") ? vrs.slice(2) : vrs;\n\treturn clean.slice(2) + clean.slice(0, 2);\n}\n\n/** Convert RSV hex to VRS hex: recovery (2 chars) + r+s (128 chars). */\nexport function signatureRsvToVrs(rsv: string): string {\n\tconst clean = rsv.startsWith(\"0x\") ? rsv.slice(2) : rsv;\n\treturn clean.slice(-2) + clean.slice(0, -2);\n}\n\n// --- Recovery ---\n\n/**\n * Recover a public key from a message hash and VRS signature.\n * @returns hex-encoded public key (33 bytes compressed, or 65 bytes uncompressed)\n */\nexport function recoverPublicKey(\n\thash: Uint8Array | string,\n\tsignature: string,\n\tcompressed = true,\n): string {\n\tconst parsed = parseSignature(signature);\n\tconst rs = parsed.r + parsed.s;\n\tconst sig = NobleSignature.fromCompact(rs).addRecoveryBit(parsed.recovery);\n\tconst msgHash = typeof hash === \"string\" ? hexToBytes(hash) : hash;\n\tconst point = sig.recoverPublicKey(msgHash);\n\treturn point.toHex(compressed);\n}\n\n/**\n * Recover a Stacks address from a message hash and VRS signature.\n * @param addressVersion defaults to MainnetSingleSig (22)\n */\nexport function recoverAddress(\n\thash: Uint8Array | string,\n\tsignature: string,\n\taddressVersion: number = AddressVersion.MainnetSingleSig,\n): string {\n\tconst pubkey = recoverPublicKey(hash, signature, true);\n\tconst pubkeyHash = hashP2PKH(hexToBytes(pubkey));\n\treturn c32address(addressVersion, pubkeyHash);\n}\n\n// --- Verification ---\n\n/**\n * Verify an ECDSA signature against a message hash and public key.\n * Accepts compact (64-byte) signature as hex or Uint8Array.\n */\nexport function verifySignature(\n\thash: Uint8Array | string,\n\tsignature: string | Uint8Array,\n\tpublicKey: string | Uint8Array,\n): boolean {\n\treturn verify(signature, hash, publicKey, { lowS: false });\n}\n\n/** Bitcoin-style varint encoding for message length prefix. */\nfunction encodeVarint(n: number): Uint8Array {\n\tif (n < 0xfd) return new Uint8Array([n]);\n\tif (n <= 0xffff) {\n\t\tconst buf = new Uint8Array(3);\n\t\tbuf[0] = 0xfd;\n\t\tbuf[1] = n & 0xff;\n\t\tbuf[2] = (n >> 8) & 0xff;\n\t\treturn buf;\n\t}\n\tconst buf = new Uint8Array(5);\n\tbuf[0] = 0xfe;\n\tbuf[1] = n & 0xff;\n\tbuf[2] = (n >> 8) & 0xff;\n\tbuf[3] = (n >> 16) & 0xff;\n\tbuf[4] = (n >> 24) & 0xff;\n\treturn buf;\n}\n\nconst STACKS_MESSAGE_PREFIX = \"\\x17Stacks Signed Message:\\n\";\nconst LEGACY_MESSAGE_PREFIX = \"\\x18Stacks Message Signing:\\n\";\n\n/** Hash a message with the Stacks structured message prefix. */\nfunction hashMessage(message: string | Uint8Array, prefix: string): Uint8Array {\n\tconst messageBytes =\n\t\ttypeof message === \"string\" ? utf8ToBytes(message) : message;\n\tconst prefixBytes = utf8ToBytes(prefix);\n\tconst lengthBytes = encodeVarint(messageBytes.length);\n\treturn sha256(concatBytes(prefixBytes, lengthBytes, messageBytes));\n}\n\n/**\n * Verify a signed Stacks message.\n * Parses a VRS signature, extracts r+s for verification.\n * Falls back to legacy prefix if standard prefix fails.\n */\nexport function verifyMessageSignature(\n\tmessage: string | Uint8Array,\n\tsignature: string,\n\tpublicKey: string,\n): boolean {\n\tconst parsed = parseSignature(signature);\n\tconst compactSig = parsed.r + parsed.s;\n\n\tconst msgHash = hashMessage(message, STACKS_MESSAGE_PREFIX);\n\tif (verify(compactSig, msgHash, publicKey, { lowS: false })) return true;\n\n\t// Fallback to legacy prefix\n\tif (typeof message === \"string\") {\n\t\tconst legacyHash = hashMessage(message, LEGACY_MESSAGE_PREFIX);\n\t\tif (verify(compactSig, legacyHash, publicKey, { lowS: false })) return true;\n\t}\n\n\treturn false;\n}\n",
|
|
6
12
|
"import { Point, etc } from \"@noble/secp256k1\";\nimport { bytesToHex, hexToBytes } from \"./encoding.ts\";\n\n/** Compress a public key to 33 bytes (hex). */\nexport function compressPublicKey(publicKey: string | Uint8Array): string {\n\tconst hex = typeof publicKey === \"string\" ? publicKey : bytesToHex(publicKey);\n\treturn Point.fromHex(hex).toHex(true);\n}\n\n/** Uncompress a public key to 65 bytes (hex). */\nexport function uncompressPublicKey(publicKey: string | Uint8Array): string {\n\tconst hex = typeof publicKey === \"string\" ? publicKey : bytesToHex(publicKey);\n\treturn Point.fromHex(hex).toHex(false);\n}\n\n/** Check if a public key is in compressed format (starts with 0x02 or 0x03). */\nexport function isCompressedPublicKey(publicKey: string | Uint8Array): boolean {\n\tconst bytes =\n\t\ttypeof publicKey === \"string\" ? hexToBytes(publicKey) : publicKey;\n\treturn bytes.length === 33 && (bytes[0] === 0x02 || bytes[0] === 0x03);\n}\n\n/** Generate cryptographically secure random bytes. Defaults to 32 bytes. */\nexport function randomBytes(length?: number): Uint8Array {\n\treturn etc.randomBytes(length ?? 32);\n}\n"
|
|
7
13
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAuB,IAAvB;AACoD,IAApD;AAqBO,SAAS,cAAc,CAAC,KAAmC;AAAA,EACjE,MAAM,QAAQ,IAAI,WAAW,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI;AAAA,EACpD,IAAI,MAAM,WAAW,KAAK;AAAA,IACzB,MAAM,IAAI,MACT,yDAAyD,MAAM,QAChE;AAAA,EACD;AAAA,EACA,OAAO;AAAA,IACN,UAAU,OAAO,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,IAC/C,GAAG,MAAM,MAAM,GAAG,EAAE;AAAA,IACpB,GAAG,MAAM,MAAM,IAAI,GAAG;AAAA,EACvB;AAAA;AAMM,SAAS,kBAAkB,CAAC,KAAmC;AAAA,EACrE,MAAM,IAAI,IAAI,SAAS,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAAA,EACnD,OAAO,IAAI,IAAI,IAAI,IAAI;AAAA;AAIjB,SAAS,iBAAiB,CAAC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CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
formatUnits,
|
|
4
4
|
parseStx,
|
|
5
5
|
parseUnits
|
|
6
|
-
} from "../../shared/stacks-
|
|
6
|
+
} from "../../shared/stacks-esm-v45990hx.js";
|
|
7
7
|
import {
|
|
8
8
|
AddressVersion,
|
|
9
9
|
CONTRACT_NAME_REGEX,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
parsePrincipal,
|
|
23
23
|
publicKeyToAddress,
|
|
24
24
|
validateStacksAddress
|
|
25
|
-
} from "../../shared/stacks-
|
|
25
|
+
} from "../../shared/stacks-esm-2mc7ebrm.js";
|
|
26
26
|
import {
|
|
27
27
|
asciiToBytes,
|
|
28
28
|
bigIntToBytes,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
writeUInt16BE,
|
|
54
54
|
writeUInt32BE,
|
|
55
55
|
writeUInt8
|
|
56
|
-
} from "../../shared/stacks-
|
|
56
|
+
} from "../../shared/stacks-esm-cvhazvhd.js";
|
|
57
57
|
// src/utils/signature.ts
|
|
58
58
|
import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
|
|
59
59
|
import { Signature as NobleSignature, verify } from "@noble/secp256k1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secondlayer/stacks",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Typed Stacks client for TypeScript: read contracts, decode Clarity, build and send transactions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -99,16 +99,6 @@
|
|
|
99
99
|
"import": "./dist/src/connect/walletconnect/index.js",
|
|
100
100
|
"require": "./dist/src/connect/walletconnect/index.cjs"
|
|
101
101
|
},
|
|
102
|
-
"./tools": {
|
|
103
|
-
"types": "./dist/src/tools/index.d.ts",
|
|
104
|
-
"import": "./dist/src/tools/index.js",
|
|
105
|
-
"require": "./dist/src/tools/index.cjs"
|
|
106
|
-
},
|
|
107
|
-
"./tools/btc": {
|
|
108
|
-
"types": "./dist/src/tools/btc/index.d.ts",
|
|
109
|
-
"import": "./dist/src/tools/btc/index.js",
|
|
110
|
-
"require": "./dist/src/tools/btc/index.cjs"
|
|
111
|
-
},
|
|
112
102
|
"./filters": {
|
|
113
103
|
"types": "./dist/src/filters/index.d.ts",
|
|
114
104
|
"import": "./dist/src/filters/index.js",
|
|
@@ -133,16 +123,12 @@
|
|
|
133
123
|
"devDependencies": {
|
|
134
124
|
"@stacks/clarinet-sdk": "3.21.1",
|
|
135
125
|
"@stacks/transactions": "7.0.6",
|
|
136
|
-
"@types/bun": "latest"
|
|
137
|
-
"ai": "6.0.167",
|
|
138
|
-
"zod": "^4.3.6"
|
|
126
|
+
"@types/bun": "latest"
|
|
139
127
|
},
|
|
140
128
|
"peerDependencies": {
|
|
141
129
|
"@stacks/clarinet-sdk": "^3",
|
|
142
130
|
"@stacks/transactions": "^7",
|
|
143
|
-
"
|
|
144
|
-
"typescript": "^5",
|
|
145
|
-
"zod": "^4"
|
|
131
|
+
"typescript": "^5"
|
|
146
132
|
},
|
|
147
133
|
"peerDependenciesMeta": {
|
|
148
134
|
"@stacks/clarinet-sdk": {
|
|
@@ -150,12 +136,6 @@
|
|
|
150
136
|
},
|
|
151
137
|
"@stacks/transactions": {
|
|
152
138
|
"optional": true
|
|
153
|
-
},
|
|
154
|
-
"ai": {
|
|
155
|
-
"optional": true
|
|
156
|
-
},
|
|
157
|
-
"zod": {
|
|
158
|
-
"optional": true
|
|
159
139
|
}
|
|
160
140
|
},
|
|
161
141
|
"dependencies": {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// src/accounts/providerToAccount.ts
|
|
2
|
-
async function providerToAccount(provider) {
|
|
3
|
-
const result = await provider.request("stx_getAddresses");
|
|
4
|
-
const entry = result?.addresses?.[0];
|
|
5
|
-
if (!entry?.address || !entry?.publicKey) {
|
|
6
|
-
throw new Error("Provider did not return a valid address");
|
|
7
|
-
}
|
|
8
|
-
return {
|
|
9
|
-
type: "provider",
|
|
10
|
-
address: entry.address,
|
|
11
|
-
publicKey: entry.publicKey,
|
|
12
|
-
provider
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//# debugId=92C250F1EE7F3F3064756E2164756E21
|
|
17
|
-
//# sourceMappingURL=stacks-02actsrx.cjs.map
|