@secondlayer/stacks 6.2.2 → 6.4.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/dist/shared/{stacks-esm-8f5catbf.js → stacks-esm-1mybf3yt.js} +2 -2
- package/dist/shared/{stacks-esm-tdrdye4y.js → stacks-esm-4ja7b0px.js} +2 -2
- package/dist/shared/{stacks-esm-t88hc019.js → stacks-esm-5qdnx2q9.js} +3 -3
- package/dist/shared/{stacks-esm-b54n1jdx.js → stacks-esm-6qv8gjes.js} +6 -6
- package/dist/shared/stacks-esm-6qv8gjes.js.map +12 -0
- package/dist/shared/{stacks-esm-a20wyky3.js → stacks-esm-896kv9yv.js} +2 -2
- package/dist/shared/{stacks-esm-exgw8j2j.js → stacks-esm-bragecm9.js} +7 -7
- package/dist/shared/{stacks-esm-hkw1kvd4.js → stacks-esm-gs60rd15.js} +7 -4
- package/dist/shared/{stacks-esm-hkw1kvd4.js.map → stacks-esm-gs60rd15.js.map} +3 -3
- package/dist/shared/{stacks-esm-xcd4sv1h.js → stacks-esm-hcjqgrtm.js} +5 -5
- package/dist/shared/{stacks-esm-pq0e379d.js → stacks-esm-hv11fdgy.js} +3 -3
- package/dist/shared/{stacks-esm-1b2rhv6y.js → stacks-esm-w36fvdxx.js} +2 -2
- package/dist/shared/{stacks-esm-7n5wd5md.js → stacks-esm-w8kswk0r.js} +5 -5
- package/dist/shared/{stacks-esm-0pc6tmf0.js → stacks-esm-x8gjr2v6.js} +2 -2
- package/dist/shared/{stacks-esm-nt5hf8ht.js → stacks-esm-z0rq3ejt.js} +44 -21
- package/dist/shared/stacks-esm-z0rq3ejt.js.map +12 -0
- package/dist/shared/{stacks-esm-p3zypwsw.js → stacks-esm-zwbhghxb.js} +2 -2
- package/dist/src/actions/index.cjs +6 -3
- package/dist/src/actions/index.cjs.map +3 -3
- package/dist/src/actions/index.js +10 -10
- package/dist/src/bitcoin/index.cjs +48 -21
- package/dist/src/bitcoin/index.cjs.map +4 -4
- package/dist/src/bitcoin/index.d.cts +13 -1
- package/dist/src/bitcoin/index.d.ts +13 -1
- package/dist/src/bitcoin/index.js +9 -7
- package/dist/src/bitcoin/index.js.map +2 -2
- package/dist/src/bns/index.cjs +6 -3
- package/dist/src/bns/index.cjs.map +3 -3
- package/dist/src/bns/index.js +10 -10
- package/dist/src/clarity/index.cjs +6 -3
- package/dist/src/clarity/index.cjs.map +3 -3
- package/dist/src/clarity/index.js +4 -4
- package/dist/src/filters/index.cjs +5 -5
- package/dist/src/filters/index.cjs.map +3 -3
- package/dist/src/filters/index.d.cts +6 -0
- package/dist/src/filters/index.d.ts +6 -0
- package/dist/src/filters/index.js +1 -1
- package/dist/src/index.cjs +10 -7
- package/dist/src/index.cjs.map +4 -4
- package/dist/src/index.d.cts +6 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +9 -9
- package/dist/src/postconditions/index.cjs +6 -3
- package/dist/src/postconditions/index.cjs.map +3 -3
- package/dist/src/postconditions/index.js +3 -3
- package/dist/src/pox/index.cjs +6 -3
- package/dist/src/pox/index.cjs.map +3 -3
- package/dist/src/pox/index.js +8 -8
- package/dist/src/pox5/index.cjs +47 -21
- package/dist/src/pox5/index.cjs.map +4 -4
- package/dist/src/pox5/index.js +10 -10
- package/dist/src/sbtc/index.cjs +6 -3
- package/dist/src/sbtc/index.cjs.map +3 -3
- package/dist/src/sbtc/index.js +7 -7
- package/dist/src/simnet/index.cjs +6 -16
- package/dist/src/simnet/index.cjs.map +3 -3
- package/dist/src/simnet/index.js +6 -16
- package/dist/src/simnet/index.js.map +3 -3
- package/dist/src/stackingdao/index.cjs +6 -3
- package/dist/src/stackingdao/index.cjs.map +3 -3
- package/dist/src/stackingdao/index.js +8 -8
- package/dist/src/transactions/index.cjs +6 -3
- package/dist/src/transactions/index.cjs.map +3 -3
- package/dist/src/transactions/index.js +3 -3
- package/package.json +1 -1
- package/dist/shared/stacks-esm-b54n1jdx.js.map +0 -12
- package/dist/shared/stacks-esm-nt5hf8ht.js.map +0 -12
- /package/dist/shared/{stacks-esm-8f5catbf.js.map → stacks-esm-1mybf3yt.js.map} +0 -0
- /package/dist/shared/{stacks-esm-tdrdye4y.js.map → stacks-esm-4ja7b0px.js.map} +0 -0
- /package/dist/shared/{stacks-esm-t88hc019.js.map → stacks-esm-5qdnx2q9.js.map} +0 -0
- /package/dist/shared/{stacks-esm-a20wyky3.js.map → stacks-esm-896kv9yv.js.map} +0 -0
- /package/dist/shared/{stacks-esm-exgw8j2j.js.map → stacks-esm-bragecm9.js.map} +0 -0
- /package/dist/shared/{stacks-esm-xcd4sv1h.js.map → stacks-esm-hcjqgrtm.js.map} +0 -0
- /package/dist/shared/{stacks-esm-pq0e379d.js.map → stacks-esm-hv11fdgy.js.map} +0 -0
- /package/dist/shared/{stacks-esm-1b2rhv6y.js.map → stacks-esm-w36fvdxx.js.map} +0 -0
- /package/dist/shared/{stacks-esm-7n5wd5md.js.map → stacks-esm-w8kswk0r.js.map} +0 -0
- /package/dist/shared/{stacks-esm-0pc6tmf0.js.map → stacks-esm-x8gjr2v6.js.map} +0 -0
- /package/dist/shared/{stacks-esm-p3zypwsw.js.map → stacks-esm-zwbhghxb.js.map} +0 -0
package/dist/src/pox/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import"../../shared/stacks-esm-7a0ehykf.js";
|
|
2
2
|
import"../../shared/stacks-esm-kbz5s6v8.js";
|
|
3
|
-
import"../../shared/stacks-esm-
|
|
4
|
-
import"../../shared/stacks-esm-
|
|
5
|
-
import"../../shared/stacks-esm-
|
|
6
|
-
import"../../shared/stacks-esm-
|
|
3
|
+
import"../../shared/stacks-esm-gs60rd15.js";
|
|
4
|
+
import"../../shared/stacks-esm-896kv9yv.js";
|
|
5
|
+
import"../../shared/stacks-esm-zwbhghxb.js";
|
|
6
|
+
import"../../shared/stacks-esm-hv11fdgy.js";
|
|
7
7
|
import {
|
|
8
8
|
Pc2
|
|
9
|
-
} from "../../shared/stacks-esm-
|
|
9
|
+
} from "../../shared/stacks-esm-w36fvdxx.js";
|
|
10
10
|
import"../../shared/stacks-esm-e2qhfgke.js";
|
|
11
11
|
import {
|
|
12
12
|
POX_CONTRACTS2,
|
|
@@ -18,9 +18,9 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
getContract2,
|
|
20
20
|
resolveNetworkContract
|
|
21
|
-
} from "../../shared/stacks-esm-
|
|
22
|
-
import"../../shared/stacks-esm-
|
|
23
|
-
import"../../shared/stacks-esm-
|
|
21
|
+
} from "../../shared/stacks-esm-w8kswk0r.js";
|
|
22
|
+
import"../../shared/stacks-esm-hcjqgrtm.js";
|
|
23
|
+
import"../../shared/stacks-esm-x8gjr2v6.js";
|
|
24
24
|
|
|
25
25
|
// src/pox/abi.ts
|
|
26
26
|
var POX_ABI = {
|
package/dist/src/pox5/index.cjs
CHANGED
|
@@ -1137,11 +1137,14 @@ function readCV(reader, depth = 0) {
|
|
|
1137
1137
|
case "err":
|
|
1138
1138
|
return responseErrorCV(readCV(reader, depth + 1));
|
|
1139
1139
|
case "address":
|
|
1140
|
-
return
|
|
1140
|
+
return { type: "address", value: readAddress(reader) };
|
|
1141
1141
|
case "contract": {
|
|
1142
1142
|
const addr = readAddress(reader);
|
|
1143
1143
|
const name = readLPString(reader);
|
|
1144
|
-
|
|
1144
|
+
if (new TextEncoder().encode(name).byteLength >= 128) {
|
|
1145
|
+
throw new Error("Contract name must be less than 128 bytes");
|
|
1146
|
+
}
|
|
1147
|
+
return { type: "contract", value: `${addr}.${name}` };
|
|
1145
1148
|
}
|
|
1146
1149
|
case "list": {
|
|
1147
1150
|
const len = reader.readUInt32BE();
|
|
@@ -5452,6 +5455,14 @@ function rootFromProof(leafInternal, proof) {
|
|
|
5452
5455
|
}
|
|
5453
5456
|
|
|
5454
5457
|
// src/bitcoin/proof.ts
|
|
5458
|
+
class BitcoinSourceError extends Error {
|
|
5459
|
+
code;
|
|
5460
|
+
name = "BitcoinSourceError";
|
|
5461
|
+
constructor(code, message) {
|
|
5462
|
+
super(message);
|
|
5463
|
+
this.code = code;
|
|
5464
|
+
}
|
|
5465
|
+
}
|
|
5455
5466
|
function normalizeTxid2(txid) {
|
|
5456
5467
|
return without0x(txid).toLowerCase();
|
|
5457
5468
|
}
|
|
@@ -5528,22 +5539,32 @@ function bitcoinRpcSource(config) {
|
|
|
5528
5539
|
const basic = typeof config.auth === "string" ? config.auth : btoa(`${config.auth.username}:${config.auth.password}`);
|
|
5529
5540
|
headers.authorization = `Basic ${basic}`;
|
|
5530
5541
|
}
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5542
|
+
let res;
|
|
5543
|
+
try {
|
|
5544
|
+
res = await doFetch(config.url, {
|
|
5545
|
+
method: "POST",
|
|
5546
|
+
headers,
|
|
5547
|
+
body: JSON.stringify({
|
|
5548
|
+
jsonrpc: "1.0",
|
|
5549
|
+
id: "secondlayer",
|
|
5550
|
+
method,
|
|
5551
|
+
params: rpcParams
|
|
5552
|
+
})
|
|
5553
|
+
});
|
|
5554
|
+
} catch (error) {
|
|
5555
|
+
throw new BitcoinSourceError("unavailable", `bitcoin rpc ${method} failed: ${error instanceof Error ? error.message : "network error"}`);
|
|
5556
|
+
}
|
|
5557
|
+
let json;
|
|
5558
|
+
try {
|
|
5559
|
+
json = await res.json();
|
|
5560
|
+
} catch {
|
|
5561
|
+
throw new BitcoinSourceError("unavailable", `bitcoin rpc ${method} failed: HTTP ${res.status}`);
|
|
5543
5562
|
}
|
|
5544
|
-
const json = await res.json();
|
|
5545
5563
|
if (json.error) {
|
|
5546
|
-
throw new
|
|
5564
|
+
throw new BitcoinSourceError(json.error.code === -5 ? "not-found" : "unavailable", `bitcoin rpc ${method} error: ${json.error.message}`);
|
|
5565
|
+
}
|
|
5566
|
+
if (!res.ok) {
|
|
5567
|
+
throw new BitcoinSourceError("unavailable", `bitcoin rpc ${method} failed: HTTP ${res.status}`);
|
|
5547
5568
|
}
|
|
5548
5569
|
return json.result;
|
|
5549
5570
|
}
|
|
@@ -5557,7 +5578,7 @@ function bitcoinRpcSource(config) {
|
|
|
5557
5578
|
true
|
|
5558
5579
|
]);
|
|
5559
5580
|
if (!tx.blockhash) {
|
|
5560
|
-
throw new
|
|
5581
|
+
throw new BitcoinSourceError("unconfirmed", `tx ${txid} is not in a block (node needs -txindex, or the tx is unconfirmed)`);
|
|
5561
5582
|
}
|
|
5562
5583
|
const block = await rpc("getblock", [
|
|
5563
5584
|
tx.blockhash,
|
|
@@ -5578,9 +5599,14 @@ function esploraSource(config) {
|
|
|
5578
5599
|
const doFetch = config.fetch ?? fetch;
|
|
5579
5600
|
const base = config.url.replace(/\/+$/, "");
|
|
5580
5601
|
async function get(path) {
|
|
5581
|
-
|
|
5602
|
+
let res;
|
|
5603
|
+
try {
|
|
5604
|
+
res = await doFetch(`${base}${path}`);
|
|
5605
|
+
} catch (error) {
|
|
5606
|
+
throw new BitcoinSourceError("unavailable", `esplora GET ${path} failed: ${error instanceof Error ? error.message : "network error"}`);
|
|
5607
|
+
}
|
|
5582
5608
|
if (!res.ok) {
|
|
5583
|
-
throw new
|
|
5609
|
+
throw new BitcoinSourceError(res.status === 404 ? "not-found" : "unavailable", `esplora GET ${path} failed: HTTP ${res.status}`);
|
|
5584
5610
|
}
|
|
5585
5611
|
return res;
|
|
5586
5612
|
}
|
|
@@ -5591,7 +5617,7 @@ function esploraSource(config) {
|
|
|
5591
5617
|
async getBlockForTx(txid) {
|
|
5592
5618
|
const status = await (await get(`/tx/${txid}`)).json();
|
|
5593
5619
|
if (!status.status.confirmed) {
|
|
5594
|
-
throw new
|
|
5620
|
+
throw new BitcoinSourceError("unconfirmed", `tx ${txid} is unconfirmed`);
|
|
5595
5621
|
}
|
|
5596
5622
|
const blockHashHex = status.status.block_hash;
|
|
5597
5623
|
const header = (await (await get(`/block/${blockHashHex}/header`)).text()).trim();
|
|
@@ -6137,5 +6163,5 @@ function parseSignerCalldata(calldata) {
|
|
|
6137
6163
|
};
|
|
6138
6164
|
}
|
|
6139
6165
|
|
|
6140
|
-
//# debugId=
|
|
6166
|
+
//# debugId=3EA2E5A9FF8158F764756E2164756E21
|
|
6141
6167
|
//# sourceMappingURL=index.cjs.map
|