@secondlayer/stacks 2.15.1 → 2.17.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 -1
- package/dist/shared/{stacks-2x04a6ss.js → stacks-1x9b2k5y.js} +8 -6
- package/dist/shared/{stacks-2x04a6ss.js.map → stacks-1x9b2k5y.js.map} +3 -3
- package/dist/shared/{stacks-jbmcwky5.js → stacks-905052xe.js} +33 -3
- package/dist/shared/{stacks-jbmcwky5.js.map → stacks-905052xe.js.map} +3 -3
- package/dist/shared/{stacks-shn9zw99.cjs → stacks-9mqveyjv.cjs} +3 -3
- package/dist/shared/stacks-9mqveyjv.cjs.map +10 -0
- package/dist/shared/{stacks-ggxnnph5.cjs → stacks-bq0weg6n.js} +46 -2
- package/dist/shared/stacks-bq0weg6n.js.map +11 -0
- package/dist/shared/{stacks-q45x3389.js → stacks-fjrpnkt3.cjs} +15 -20
- package/dist/shared/stacks-fjrpnkt3.cjs.map +11 -0
- package/dist/shared/{stacks-1xk4wby6.cjs → stacks-fvnxj77s.cjs} +5 -3
- package/dist/shared/{stacks-1xk4wby6.cjs.map → stacks-fvnxj77s.cjs.map} +3 -3
- package/dist/shared/{stacks-wamwv8q8.cjs → stacks-g2qnr5qn.cjs} +12 -3
- package/dist/shared/{stacks-wamwv8q8.cjs.map → stacks-g2qnr5qn.cjs.map} +5 -5
- package/dist/shared/{stacks-y9w78e2b.js → stacks-mbnfwekf.js} +21 -4
- package/dist/shared/{stacks-y9w78e2b.js.map → stacks-mbnfwekf.js.map} +4 -4
- package/dist/shared/{stacks-1k0kmpcw.js → stacks-p2c0w0sq.js} +3 -3
- package/dist/shared/{stacks-g11v9a35.js → stacks-qchg7s2m.js} +9 -5
- package/dist/shared/{stacks-g11v9a35.js.map → stacks-qchg7s2m.js.map} +3 -3
- package/dist/shared/{stacks-5nskdw7w.cjs → stacks-qjgh6pqr.cjs} +8 -4
- package/dist/shared/{stacks-5nskdw7w.cjs.map → stacks-qjgh6pqr.cjs.map} +3 -3
- package/dist/shared/{stacks-refg7hca.js → stacks-rb9shyk8.js} +9 -10
- package/dist/shared/stacks-rb9shyk8.js.map +10 -0
- package/dist/shared/{stacks-70xxh5h1.cjs → stacks-s361pmzs.cjs} +19 -3
- package/dist/shared/{stacks-70xxh5h1.cjs.map → stacks-s361pmzs.cjs.map} +4 -4
- package/dist/shared/{stacks-ssndnbbd.js → stacks-sd9sc71n.js} +13 -4
- package/dist/shared/{stacks-ssndnbbd.js.map → stacks-sd9sc71n.js.map} +5 -5
- package/dist/shared/{stacks-b9904rc2.cjs → stacks-v889ttgp.cjs} +37 -2
- package/dist/shared/{stacks-b9904rc2.cjs.map → stacks-v889ttgp.cjs.map} +3 -3
- package/dist/src/actions/index.d.cts +5 -0
- package/dist/src/actions/index.d.ts +5 -0
- package/dist/src/actions/index.js +9 -11
- package/dist/src/actions/index.js.map +1 -1
- package/dist/src/bitcoin/index.js +1 -1
- package/dist/src/bns/index.js +6 -7
- package/dist/src/bns/index.js.map +2 -2
- package/dist/src/clarity/index.d.cts +11 -1
- package/dist/src/clarity/index.d.ts +11 -1
- package/dist/src/clarity/index.js +12 -2
- package/dist/src/clarity/index.js.map +1 -1
- package/dist/src/index.cjs +4 -4
- package/dist/src/index.cjs.map +3 -3
- package/dist/src/index.d.cts +11 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.js +12 -13
- package/dist/src/index.js.map +3 -3
- package/dist/src/pox/index.js +5 -6
- package/dist/src/pox/index.js.map +2 -2
- package/dist/src/pox5/index.cjs +654 -116
- package/dist/src/pox5/index.cjs.map +6 -5
- package/dist/src/pox5/index.d.cts +56 -29
- package/dist/src/pox5/index.d.ts +56 -29
- package/dist/src/pox5/index.js +664 -125
- package/dist/src/pox5/index.js.map +6 -5
- package/dist/src/sbtc/index.js +5 -6
- package/dist/src/sbtc/index.js.map +2 -2
- package/dist/src/stackingdao/index.js +5 -6
- package/dist/src/stackingdao/index.js.map +2 -2
- package/dist/src/tools/btc/index.cjs.map +2 -2
- package/dist/src/tools/btc/index.d.cts +2 -1
- package/dist/src/tools/btc/index.d.ts +2 -1
- package/dist/src/tools/btc/index.js.map +2 -2
- package/dist/src/tools/index.cjs +19 -5
- package/dist/src/tools/index.cjs.map +9 -9
- package/dist/src/tools/index.js +19 -5
- package/dist/src/tools/index.js.map +9 -9
- package/dist/src/transactions/index.d.cts +10 -1
- package/dist/src/transactions/index.d.ts +10 -1
- package/dist/src/transactions/index.js +2 -2
- package/dist/src/x402/index.d.cts +5 -0
- package/dist/src/x402/index.d.ts +5 -0
- package/dist/src/x402/index.js +4 -4
- package/package.json +1 -1
- package/dist/shared/stacks-ggxnnph5.cjs.map +0 -10
- package/dist/shared/stacks-pdcz1w1d.js +0 -33
- package/dist/shared/stacks-pdcz1w1d.js.map +0 -10
- package/dist/shared/stacks-q45x3389.js.map +0 -10
- package/dist/shared/stacks-refg7hca.js.map +0 -10
- package/dist/shared/stacks-shn9zw99.cjs.map +0 -10
- package/dist/shared/stacks-yetejw9x.cjs +0 -16
- package/dist/shared/stacks-yetejw9x.cjs.map +0 -10
- /package/dist/shared/{stacks-1k0kmpcw.js.map → stacks-p2c0w0sq.js.map} +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/tools/btc/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * Bitcoin read tools for AI SDK tool calls. Useful for sBTC peg-in/peg-out\n * flows, BTC-collateralized lending, and anywhere a Stacks contract's\n * behaviour depends on BTC state.\n *\n * Backed by mempool.space by default. Swap endpoints by setting\n * `BTC_MEMPOOL_URL` in the caller's env. Reads only — no BTC writes.\n *\n * import { generateText } from \"ai\"\n * import { btcConfirmations, btcBalance } from \"@secondlayer/stacks/tools/btc\"\n * await generateText({\n * model: anthropic(\"claude-sonnet-4-6\"),\n * tools: { btcConfirmations, btcBalance },\n * prompt: \"…\",\n * })\n */\n\nimport { type Tool, tool } from \"ai\";\nimport { z } from \"zod\";\n\n// biome-ignore lint/suspicious/noExplicitAny: Tool's input-schema generic too precise for isolated-declarations; AI SDK validates at runtime\ntype LooseTool = Tool<any, any>;\n\nfunction baseUrl(): string {\n\treturn (process.env.BTC_MEMPOOL_URL ?? \"https://mempool.space\").replace(\n\t\t/\\/$/,\n\t\t\"\",\n\t);\n}\n\nasync function get<T>(path: string): Promise<T> {\n\tconst res = await fetch(`${baseUrl()}${path}`, {\n\t\theaders: { Accept: \"application/json\" },\n\t});\n\tif (!res.ok) {\n\t\tthrow new Error(\n\t\t\t`BTC mempool.space ${path} → ${res.status} ${res.statusText}`,\n\t\t);\n\t}\n\tconst contentType = res.headers.get(\"content-type\") ?? \"\";\n\tif (contentType.includes(\"application/json\")) return res.json() as Promise<T>;\n\treturn res.text() as unknown as Promise<T>;\n}\n\nconst BTC_TXID = z\n\t.string()\n\t.regex(/^[0-9a-fA-F]{64}$/, \"64-character hex BTC txid\");\nexport const BTC_ADDRESS = z\n\t.string()\n\t.regex(\n\t\t/^(1[a-zA-HJ-NP-Z0-9]{25,34}|3[a-zA-HJ-NP-Z0-9]{25,34}|bc1[a-zA-HJ-NP-Z0-9]{11,71}|tb1[a-zA-HJ-NP-Z0-9]{11,71})$/,\n\t\t{ message: \"Invalid Bitcoin address\" },\n\t);\n\nexport const btcConfirmations: LooseTool = tool({\n\tdescription:\n\t\t\"Number of confirmations for a Bitcoin transaction. Returns { confirmations, confirmed }.\",\n\tinputSchema: z.object({ txid: BTC_TXID }),\n\texecute: async ({ txid }) => {\n\t\tconst tx = await get<{\n\t\t\tstatus: { confirmed: boolean; block_height?: number };\n\t\t}>(`/api/tx/${txid}`);\n\t\tif (!tx.status.confirmed || tx.status.block_height == null) {\n\t\t\treturn { confirmed: false, confirmations: 0 };\n\t\t}\n\t\tconst tip = await get<number>(\"/api/blocks/tip/height\");\n\t\treturn {\n\t\t\tconfirmed: true,\n\t\t\tconfirmations: Math.max(0, tip - tx.status.block_height + 1),\n\t\t\tblockHeight: tx.status.block_height,\n\t\t};\n\t},\n});\n\nexport const btcBalance: LooseTool = tool({\n\tdescription:\n\t\t\"Bitcoin balance for an address, in satoshis. Returns { confirmedSat, unconfirmedSat }.\",\n\tinputSchema: z.object({ address: BTC_ADDRESS }),\n\texecute: async ({ address }) => {\n\t\tconst info = await get<{\n\t\t\tchain_stats: { funded_txo_sum: number; spent_txo_sum: number };\n\t\t\tmempool_stats: { funded_txo_sum: number; spent_txo_sum: number };\n\t\t}>(`/api/address/${encodeURIComponent(address)}`);\n\t\treturn {\n\t\t\tconfirmedSat:\n\t\t\t\tinfo.chain_stats.funded_txo_sum - info.chain_stats.spent_txo_sum,\n\t\t\tunconfirmedSat:\n\t\t\t\tinfo.mempool_stats.funded_txo_sum - info.mempool_stats.spent_txo_sum,\n\t\t};\n\t},\n});\n\nexport const btcUtxos: LooseTool = tool({\n\tdescription:\n\t\t\"List of unspent outputs for a Bitcoin address (truncated to `limit`).\",\n\tinputSchema: z.object({\n\t\taddress: BTC_ADDRESS,\n\t\tlimit: z.number().int().min(1).max(50).default(25),\n\t}),\n\texecute: async ({ address, limit }) => {\n\t\tconst utxos = await get<\n\t\t\tArray<{\n\t\t\t\ttxid: string;\n\t\t\t\tvout: number;\n\t\t\t\tvalue: number;\n\t\t\t\tstatus: { confirmed: boolean; block_height?: number };\n\t\t\t}>\n\t\t>(`/api/address/${encodeURIComponent(address)}/utxo`);\n\t\treturn { utxos: utxos.slice(0, limit) };\n\t},\n});\n\nexport const btcFeeEstimate: LooseTool = tool({\n\tdescription:\n\t\t\"Current Bitcoin fee estimates in sat/vB across priority tiers (fastest, 30-min, hour, economy).\",\n\tinputSchema: z.object({}),\n\texecute: async () => {\n\t\tconst fees = await get<Record<string, number>>(\"/api/v1/fees/recommended\");\n\t\treturn {\n\t\t\tfastestSatVb: fees.fastestFee ?? 0,\n\t\t\thalfHourSatVb: fees.halfHourFee ?? 0,\n\t\t\thourSatVb: fees.hourFee ?? 0,\n\t\t\teconomySatVb: fees.economyFee ?? 0,\n\t\t\tminimumSatVb: fees.minimumFee ?? 0,\n\t\t};\n\t},\n});\n\nexport const btcBlockHeight: LooseTool = tool({\n\tdescription: \"Current Bitcoin chain tip height.\",\n\tinputSchema: z.object({}),\n\texecute: async () => ({\n\t\theight: await get<number>(\"/api/blocks/tip/height\"),\n\t}),\n});\n"
|
|
5
|
+
"/**\n * Bitcoin read tools for AI SDK tool calls. Useful for sBTC peg-in/peg-out\n * flows, BTC-collateralized lending, and anywhere a Stacks contract's\n * behaviour depends on BTC state.\n *\n * Backed by mempool.space by default. Swap endpoints by setting\n * `BTC_MEMPOOL_URL` in the caller's env. Reads only — no BTC writes.\n *\n * import { generateText } from \"ai\"\n * import { btcConfirmations, btcBalance } from \"@secondlayer/stacks/tools/btc\"\n * await generateText({\n * model: anthropic(\"claude-sonnet-4-6\"),\n * tools: { btcConfirmations, btcBalance },\n * prompt: \"…\",\n * })\n */\n\nimport { type Tool, tool } from \"ai\";\nimport { z } from \"zod\";\n\n// biome-ignore lint/suspicious/noExplicitAny: Tool's input-schema generic too precise for isolated-declarations; AI SDK validates at runtime\ntype LooseTool = Tool<any, any>;\n\nfunction baseUrl(): string {\n\treturn (process.env.BTC_MEMPOOL_URL ?? \"https://mempool.space\").replace(\n\t\t/\\/$/,\n\t\t\"\",\n\t);\n}\n\nasync function get<T>(path: string): Promise<T> {\n\tconst res = await fetch(`${baseUrl()}${path}`, {\n\t\theaders: { Accept: \"application/json\" },\n\t});\n\tif (!res.ok) {\n\t\tthrow new Error(\n\t\t\t`BTC mempool.space ${path} → ${res.status} ${res.statusText}`,\n\t\t);\n\t}\n\tconst contentType = res.headers.get(\"content-type\") ?? \"\";\n\tif (contentType.includes(\"application/json\")) return res.json() as Promise<T>;\n\treturn res.text() as unknown as Promise<T>;\n}\n\nconst BTC_TXID = z\n\t.string()\n\t.regex(/^[0-9a-fA-F]{64}$/, \"64-character hex BTC txid\");\nexport const BTC_ADDRESS: z.ZodString = z\n\t.string()\n\t.regex(\n\t\t/^(1[a-zA-HJ-NP-Z0-9]{25,34}|3[a-zA-HJ-NP-Z0-9]{25,34}|bc1[a-zA-HJ-NP-Z0-9]{11,71}|tb1[a-zA-HJ-NP-Z0-9]{11,71})$/,\n\t\t{ message: \"Invalid Bitcoin address\" },\n\t);\n\nexport const btcConfirmations: LooseTool = tool({\n\tdescription:\n\t\t\"Number of confirmations for a Bitcoin transaction. Returns { confirmations, confirmed }.\",\n\tinputSchema: z.object({ txid: BTC_TXID }),\n\texecute: async ({ txid }) => {\n\t\tconst tx = await get<{\n\t\t\tstatus: { confirmed: boolean; block_height?: number };\n\t\t}>(`/api/tx/${txid}`);\n\t\tif (!tx.status.confirmed || tx.status.block_height == null) {\n\t\t\treturn { confirmed: false, confirmations: 0 };\n\t\t}\n\t\tconst tip = await get<number>(\"/api/blocks/tip/height\");\n\t\treturn {\n\t\t\tconfirmed: true,\n\t\t\tconfirmations: Math.max(0, tip - tx.status.block_height + 1),\n\t\t\tblockHeight: tx.status.block_height,\n\t\t};\n\t},\n});\n\nexport const btcBalance: LooseTool = tool({\n\tdescription:\n\t\t\"Bitcoin balance for an address, in satoshis. Returns { confirmedSat, unconfirmedSat }.\",\n\tinputSchema: z.object({ address: BTC_ADDRESS }),\n\texecute: async ({ address }) => {\n\t\tconst info = await get<{\n\t\t\tchain_stats: { funded_txo_sum: number; spent_txo_sum: number };\n\t\t\tmempool_stats: { funded_txo_sum: number; spent_txo_sum: number };\n\t\t}>(`/api/address/${encodeURIComponent(address)}`);\n\t\treturn {\n\t\t\tconfirmedSat:\n\t\t\t\tinfo.chain_stats.funded_txo_sum - info.chain_stats.spent_txo_sum,\n\t\t\tunconfirmedSat:\n\t\t\t\tinfo.mempool_stats.funded_txo_sum - info.mempool_stats.spent_txo_sum,\n\t\t};\n\t},\n});\n\nexport const btcUtxos: LooseTool = tool({\n\tdescription:\n\t\t\"List of unspent outputs for a Bitcoin address (truncated to `limit`).\",\n\tinputSchema: z.object({\n\t\taddress: BTC_ADDRESS,\n\t\tlimit: z.number().int().min(1).max(50).default(25),\n\t}),\n\texecute: async ({ address, limit }) => {\n\t\tconst utxos = await get<\n\t\t\tArray<{\n\t\t\t\ttxid: string;\n\t\t\t\tvout: number;\n\t\t\t\tvalue: number;\n\t\t\t\tstatus: { confirmed: boolean; block_height?: number };\n\t\t\t}>\n\t\t>(`/api/address/${encodeURIComponent(address)}/utxo`);\n\t\treturn { utxos: utxos.slice(0, limit) };\n\t},\n});\n\nexport const btcFeeEstimate: LooseTool = tool({\n\tdescription:\n\t\t\"Current Bitcoin fee estimates in sat/vB across priority tiers (fastest, 30-min, hour, economy).\",\n\tinputSchema: z.object({}),\n\texecute: async () => {\n\t\tconst fees = await get<Record<string, number>>(\"/api/v1/fees/recommended\");\n\t\treturn {\n\t\t\tfastestSatVb: fees.fastestFee ?? 0,\n\t\t\thalfHourSatVb: fees.halfHourFee ?? 0,\n\t\t\thourSatVb: fees.hourFee ?? 0,\n\t\t\teconomySatVb: fees.economyFee ?? 0,\n\t\t\tminimumSatVb: fees.minimumFee ?? 0,\n\t\t};\n\t},\n});\n\nexport const btcBlockHeight: LooseTool = tool({\n\tdescription: \"Current Bitcoin chain tip height.\",\n\tinputSchema: z.object({}),\n\texecute: async () => ({\n\t\theight: await get<number>(\"/api/blocks/tip/height\"),\n\t}),\n});\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";AAiBA;AACA;AAKA,SAAS,OAAO,GAAW;AAAA,EAC1B,QAAQ,QAAQ,IAAI,mBAAmB,yBAAyB,QAC/D,OACA,EACD;AAAA;AAGD,eAAe,GAAM,CAAC,MAA0B;AAAA,EAC/C,MAAM,MAAM,MAAM,MAAM,GAAG,QAAQ,IAAI,QAAQ;AAAA,IAC9C,SAAS,EAAE,QAAQ,mBAAmB;AAAA,EACvC,CAAC;AAAA,EACD,IAAI,CAAC,IAAI,IAAI;AAAA,IACZ,MAAM,IAAI,MACT,qBAAqB,UAAS,IAAI,UAAU,I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K,cAAc;AAAA,MACjC,cAAc,KAAK,cAAc;AAAA,IAClC;AAAA;AAEF,CAAC;AAEM,IAAM,iBAA4B,KAAK;AAAA,EAC7C,aAAa;AAAA,EACb,aAAa,EAAE,OAAO,CAAC,CAAC;AAAA,EACxB,SAAS,aAAa;AAAA,IACrB,QAAQ,MAAM,IAAY,wBAAwB;AAAA,EACnD;AACD,CAAC;",
|
|
8
8
|
"debugId": "E811F99F534F2FE364756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/src/tools/index.cjs
CHANGED
|
@@ -685,8 +685,17 @@ function serializePayload(payload) {
|
|
|
685
685
|
}
|
|
686
686
|
return concatBytes(...parts);
|
|
687
687
|
}
|
|
688
|
+
var _txCache = new WeakMap;
|
|
689
|
+
function clearTxCache(tx) {
|
|
690
|
+
_txCache.delete(tx);
|
|
691
|
+
}
|
|
688
692
|
function serializeTransaction(tx) {
|
|
689
|
-
|
|
693
|
+
const cached = _txCache.get(tx);
|
|
694
|
+
if (cached)
|
|
695
|
+
return cached;
|
|
696
|
+
const bytes = concatBytes(writeUInt8(tx.version), writeUInt32BE(tx.chainId), serializeAuthorization(tx.auth), writeUInt8(tx.anchorMode), writeUInt8(tx.postConditionMode), serializePostConditions(tx.postConditions), serializePayload(tx.payload));
|
|
697
|
+
_txCache.set(tx, bytes);
|
|
698
|
+
return bytes;
|
|
690
699
|
}
|
|
691
700
|
|
|
692
701
|
// src/actions/public/estimateFee.ts
|
|
@@ -1812,6 +1821,7 @@ async function resolveFee(client, transaction, fee) {
|
|
|
1812
1821
|
}
|
|
1813
1822
|
function setUnsignedFee(transaction, fee) {
|
|
1814
1823
|
transaction.auth.spendingCondition.fee = fee;
|
|
1824
|
+
clearTxCache(transaction);
|
|
1815
1825
|
}
|
|
1816
1826
|
function assertNoFeeTierForProvider(fee) {
|
|
1817
1827
|
if (isFeeTier(fee)) {
|
|
@@ -1955,7 +1965,7 @@ function getContract(params) {
|
|
|
1955
1965
|
});
|
|
1956
1966
|
const mid = estimates[1] ?? estimates[0];
|
|
1957
1967
|
if (mid) {
|
|
1958
|
-
unsigned
|
|
1968
|
+
setUnsignedFee(unsigned, BigInt(mid.fee));
|
|
1959
1969
|
}
|
|
1960
1970
|
}
|
|
1961
1971
|
return unsigned;
|
|
@@ -2796,10 +2806,10 @@ function readPayload(r) {
|
|
|
2796
2806
|
throw new Error(`Unknown payload type: ${payloadType}`);
|
|
2797
2807
|
}
|
|
2798
2808
|
}
|
|
2799
|
-
function deserializeTransaction(input) {
|
|
2809
|
+
function deserializeTransaction(input, meta) {
|
|
2800
2810
|
const bytes = typeof input === "string" ? hexToBytes(without0x(input)) : input;
|
|
2801
2811
|
const r = new BytesReader(bytes);
|
|
2802
|
-
|
|
2812
|
+
const tx = {
|
|
2803
2813
|
version: r.readUInt8(),
|
|
2804
2814
|
chainId: r.readUInt32BE(),
|
|
2805
2815
|
auth: readAuthorization(r),
|
|
@@ -2808,6 +2818,10 @@ function deserializeTransaction(input) {
|
|
|
2808
2818
|
postConditions: readPostConditions(r),
|
|
2809
2819
|
payload: readPayload(r)
|
|
2810
2820
|
};
|
|
2821
|
+
if (meta?._multisig) {
|
|
2822
|
+
tx._multisig = meta._multisig;
|
|
2823
|
+
}
|
|
2824
|
+
return tx;
|
|
2811
2825
|
}
|
|
2812
2826
|
|
|
2813
2827
|
// src/chains/definitions.ts
|
|
@@ -3454,5 +3468,5 @@ var getNftHoldings2 = import_ai.tool({
|
|
|
3454
3468
|
execute: ({ principal, limit }) => nftHoldings(getDefaultPublicClient(), principal, limit)
|
|
3455
3469
|
});
|
|
3456
3470
|
|
|
3457
|
-
//# debugId=
|
|
3471
|
+
//# debugId=0CE36B45A67DEB3C64756E2164756E21
|
|
3458
3472
|
//# sourceMappingURL=index.cjs.map
|