@secondlayer/stacks 3.3.0 → 4.0.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.
Files changed (65) hide show
  1. package/dist/shared/{stacks-6bgh2c9h.js → stacks-27fmgajb.js} +11 -3
  2. package/dist/shared/{stacks-b221qkst.cjs.map → stacks-27fmgajb.js.map} +4 -3
  3. package/dist/shared/{stacks-jknrzd6v.js → stacks-2evvn48s.js} +2 -2
  4. package/dist/shared/{stacks-s361pmzs.cjs → stacks-90jcxs98.js} +84 -2
  5. package/dist/shared/{stacks-9d2d0qjc.js.map → stacks-90jcxs98.js.map} +6 -4
  6. package/dist/shared/{stacks-8e5atbps.cjs → stacks-dr5en54r.cjs} +9 -2
  7. package/dist/shared/{stacks-8e5atbps.cjs.map → stacks-dr5en54r.cjs.map} +2 -2
  8. package/dist/shared/{stacks-bm49tsh0.js → stacks-fse1f76h.js} +2 -3
  9. package/dist/shared/{stacks-bm49tsh0.js.map → stacks-fse1f76h.js.map} +1 -1
  10. package/dist/shared/{stacks-b221qkst.cjs → stacks-nyaw1z2a.cjs} +7 -2
  11. package/dist/shared/{stacks-6bgh2c9h.js.map → stacks-nyaw1z2a.cjs.map} +4 -3
  12. package/dist/shared/{stacks-9d2d0qjc.js → stacks-tdsp5gsb.cjs} +54 -23
  13. package/dist/shared/{stacks-s361pmzs.cjs.map → stacks-tdsp5gsb.cjs.map} +6 -4
  14. package/dist/shared/{stacks-r1m1r72q.js → stacks-thkhfwz8.js} +35 -5
  15. package/dist/shared/{stacks-r1m1r72q.js.map → stacks-thkhfwz8.js.map} +4 -3
  16. package/dist/shared/{stacks-v1hzk599.js → stacks-z3vztaz1.js} +7 -9
  17. package/dist/shared/{stacks-v1hzk599.js.map → stacks-z3vztaz1.js.map} +2 -2
  18. package/dist/shared/{stacks-fvnxj77s.cjs → stacks-zwgsbbb2.cjs} +28 -2
  19. package/dist/shared/{stacks-fvnxj77s.cjs.map → stacks-zwgsbbb2.cjs.map} +4 -3
  20. package/dist/src/actions/index.js +18 -23
  21. package/dist/src/actions/index.js.map +1 -1
  22. package/dist/src/bitcoin/index.js +3 -5
  23. package/dist/src/bitcoin/index.js.map +2 -2
  24. package/dist/src/bns/index.js +5 -8
  25. package/dist/src/bns/index.js.map +2 -2
  26. package/dist/src/index.js +19 -25
  27. package/dist/src/index.js.map +2 -2
  28. package/dist/src/postconditions/index.js +2 -3
  29. package/dist/src/postconditions/index.js.map +1 -1
  30. package/dist/src/pox/index.js +5 -8
  31. package/dist/src/pox/index.js.map +2 -2
  32. package/dist/src/pox5/index.js +5 -7
  33. package/dist/src/pox5/index.js.map +2 -2
  34. package/dist/src/sbtc/index.cjs +2 -2
  35. package/dist/src/sbtc/index.cjs.map +3 -3
  36. package/dist/src/sbtc/index.d.cts +3 -3
  37. package/dist/src/sbtc/index.d.ts +3 -3
  38. package/dist/src/sbtc/index.js +5 -7
  39. package/dist/src/sbtc/index.js.map +3 -3
  40. package/dist/src/stackingdao/index.js +5 -8
  41. package/dist/src/stackingdao/index.js.map +2 -2
  42. package/package.json +1 -6
  43. package/dist/shared/stacks-1mpmzzyp.js +0 -85
  44. package/dist/shared/stacks-1mpmzzyp.js.map +0 -11
  45. package/dist/shared/stacks-44y18a8e.cjs +0 -28
  46. package/dist/shared/stacks-44y18a8e.cjs.map +0 -10
  47. package/dist/shared/stacks-8khy9v27.cjs +0 -7
  48. package/dist/shared/stacks-8khy9v27.cjs.map +0 -10
  49. package/dist/shared/stacks-d6pgp4qk.cjs +0 -9
  50. package/dist/shared/stacks-d6pgp4qk.cjs.map +0 -9
  51. package/dist/shared/stacks-fh48neva.js +0 -13
  52. package/dist/shared/stacks-fh48neva.js.map +0 -10
  53. package/dist/shared/stacks-fjrpnkt3.cjs +0 -55
  54. package/dist/shared/stacks-fjrpnkt3.cjs.map +0 -11
  55. package/dist/shared/stacks-w8tt1fmt.js +0 -44
  56. package/dist/shared/stacks-w8tt1fmt.js.map +0 -10
  57. package/dist/shared/stacks-z53fwfcm.js +0 -3
  58. package/dist/shared/stacks-z53fwfcm.js.map +0 -9
  59. package/dist/src/x402/index.cjs +0 -65
  60. package/dist/src/x402/index.cjs.map +0 -11
  61. package/dist/src/x402/index.d.cts +0 -501
  62. package/dist/src/x402/index.d.ts +0 -501
  63. package/dist/src/x402/index.js +0 -90
  64. package/dist/src/x402/index.js.map +0 -11
  65. /package/dist/shared/{stacks-jknrzd6v.js.map → stacks-2evvn48s.js.map} +0 -0
@@ -1,3 +1,6 @@
1
+ import {
2
+ BaseError
3
+ } from "./stacks-709tra19.js";
1
4
  import {
2
5
  deserializeCVBytes,
3
6
  serializeCVBytes
@@ -10,6 +13,11 @@ import {
10
13
  with0x
11
14
  } from "./stacks-qs5fzts5.js";
12
15
 
16
+ // src/errors/response.ts
17
+ class MalformedResponseError extends BaseError {
18
+ name = "MalformedResponseError";
19
+ }
20
+
13
21
  // src/actions/public/readContract.ts
14
22
  async function readContract(client, params) {
15
23
  const [address, name] = parseContractId(params.contract);
@@ -29,7 +37,7 @@ async function readContract(client, params) {
29
37
  throw new Error(data.cause ?? "Read-only call failed");
30
38
  }
31
39
 
32
- export { readContract };
40
+ export { MalformedResponseError, readContract };
33
41
 
34
- //# debugId=0C52945E9698380964756E2164756E21
35
- //# sourceMappingURL=stacks-6bgh2c9h.js.map
42
+ //# debugId=9666294BE2DE5A1364756E2164756E21
43
+ //# sourceMappingURL=stacks-27fmgajb.js.map
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/actions/public/readContract.ts"],
3
+ "sources": ["../src/errors/response.ts", "../src/actions/public/readContract.ts"],
4
4
  "sourcesContent": [
5
+ "import { BaseError } from \"./base.ts\";\n\n/** Thrown when a node/API response is missing an expected field. */\nexport class MalformedResponseError extends BaseError {\n\toverride name = \"MalformedResponseError\";\n}\n",
5
6
  "import { deserializeCVBytes } from \"../../clarity/deserialize.ts\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\nimport { bytesToHex, with0x } from \"../../utils/encoding.ts\";\n\nexport type ReadContractParams = {\n\tcontract: string; // \"address.name\"\n\tfunctionName: string;\n\targs?: ClarityValue[];\n\tsender?: string;\n\t/**\n\t * Nakamoto StacksBlockId to evaluate against. Without it the node answers\n\t * at its own moving tip, which makes a read non-deterministic — the same\n\t * reindex of the same block can return a different value.\n\t */\n\ttip?: string;\n};\n\nexport async function readContract<T extends ClarityValue = ClarityValue>(\n\tclient: Client,\n\tparams: ReadContractParams,\n): Promise<T> {\n\tconst [address, name] = parseContractId(params.contract);\n\tconst sender = params.sender ?? address;\n\n\tconst serializedArgs = (params.args ?? []).map((arg) =>\n\t\twith0x(bytesToHex(serializeCVBytes(arg))),\n\t);\n\n\tconst path = `/v2/contracts/call-read/${address}/${name}/${params.functionName}`;\n\tconst data = await client.request(\n\t\tparams.tip ? `${path}?tip=${params.tip}` : path,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\tbody: {\n\t\t\t\tsender,\n\t\t\t\targuments: serializedArgs,\n\t\t\t},\n\t\t},\n\t);\n\n\tif (data.okay) {\n\t\treturn deserializeCVBytes<T>(data.result);\n\t}\n\tthrow new Error(data.cause ?? \"Read-only call failed\");\n}\n"
6
7
  ],
7
- "mappings": ";AAoBA,eAAsB,YAAmD,CACxE,QACA,QACa;AAAA,EACb,OAAO,SAAS,QAAQ,gBAAgB,OAAO,QAAQ;AAAA,EACvD,MAAM,SAAS,OAAO,UAAU;AAAA,EAEhC,MAAM,kBAAkB,OAAO,QAAQ,CAAC,GAAG,IAAI,CAAC,QAC/C,OAAO,WAAW,iBAAiB,GAAG,CAAC,CAAC,CACzC;AAAA,EAEA,MAAM,OAAO,2BAA2B,WAAW,QAAQ,OAAO;AAAA,EAClE,MAAM,OAAO,MAAM,OAAO,QACzB,OAAO,MAAM,GAAG,YAAY,OAAO,QAAQ,MAC3C;AAAA,IACC,QAAQ;AAAA,IACR,MAAM;AAAA,MACL;AAAA,MACA,WAAW;AAAA,IACZ;AAAA,EACD,CACD;AAAA,EAEA,IAAI,KAAK,MAAM;AAAA,IACd,OAAO,mBAAsB,KAAK,MAAM;AAAA,EACzC;AAAA,EACA,MAAM,IAAI,MAAM,KAAK,SAAS,uBAAuB;AAAA;",
8
- "debugId": "A685DA67AFAB0E6764756E2164756E21",
8
+ "mappings": ";;;;;;;;;;;;;;;;AAGO,MAAM,+BAA+B,UAAU;AAAA,EAC5C,OAAO;AACjB;;;ACeA,eAAsB,YAAmD,CACxE,QACA,QACa;AAAA,EACb,OAAO,SAAS,QAAQ,gBAAgB,OAAO,QAAQ;AAAA,EACvD,MAAM,SAAS,OAAO,UAAU;AAAA,EAEhC,MAAM,kBAAkB,OAAO,QAAQ,CAAC,GAAG,IAAI,CAAC,QAC/C,OAAO,WAAW,iBAAiB,GAAG,CAAC,CAAC,CACzC;AAAA,EAEA,MAAM,OAAO,2BAA2B,WAAW,QAAQ,OAAO;AAAA,EAClE,MAAM,OAAO,MAAM,OAAO,QACzB,OAAO,MAAM,GAAG,YAAY,OAAO,QAAQ,MAC3C;AAAA,IACC,QAAQ;AAAA,IACR,MAAM;AAAA,MACL;AAAA,MACA,WAAW;AAAA,IACZ;AAAA,EACD,CACD;AAAA,EAEA,IAAI,KAAK,MAAM;AAAA,IACd,OAAO,mBAAsB,KAAK,MAAM;AAAA,EACzC;AAAA,EACA,MAAM,IAAI,MAAM,KAAK,SAAS,uBAAuB;AAAA;",
9
+ "debugId": "9666294BE2DE5A1364756E2164756E21",
9
10
  "names": []
10
11
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readContract
3
- } from "./stacks-6bgh2c9h.js";
3
+ } from "./stacks-27fmgajb.js";
4
4
 
5
5
  // src/actions/public/multicall.ts
6
6
  async function multicall(client, params) {
@@ -19,4 +19,4 @@ async function multicall(client, params) {
19
19
  export { multicall };
20
20
 
21
21
  //# debugId=7B700090E4A219F464756E2164756E21
22
- //# sourceMappingURL=stacks-jknrzd6v.js.map
22
+ //# sourceMappingURL=stacks-2evvn48s.js.map
@@ -1,3 +1,30 @@
1
+ import {
2
+ MalformedResponseError
3
+ } from "./stacks-27fmgajb.js";
4
+ import {
5
+ BaseError
6
+ } from "./stacks-709tra19.js";
7
+ import {
8
+ buildContractCall,
9
+ clearTxCache,
10
+ getTransactionId,
11
+ serializePayload,
12
+ serializeTransaction,
13
+ signTransactionWithAccount
14
+ } from "./stacks-jx146qf1.js";
15
+ import {
16
+ deserializeCVBytes,
17
+ serializeCVBytes
18
+ } from "./stacks-ttdk2g2f.js";
19
+ import {
20
+ parseContractId
21
+ } from "./stacks-bfan7ex7.js";
22
+ import {
23
+ bytesToHex,
24
+ intToBigInt,
25
+ with0x
26
+ } from "./stacks-qs5fzts5.js";
27
+
1
28
  // src/actions/public/estimateFee.ts
2
29
  function isValidEstimation(e) {
3
30
  return typeof e === "object" && e !== null && "fee_rate" in e && "fee" in e && (typeof e.fee_rate === "number" || typeof e.fee_rate === "string") && (typeof e.fee === "number" || typeof e.fee === "string");
@@ -43,6 +70,20 @@ class HttpRequestError extends BaseError {
43
70
  }
44
71
  }
45
72
 
73
+ // src/actions/public/getMapEntry.ts
74
+ async function getMapEntry(client, params) {
75
+ const [address, name] = parseContractId(params.contract);
76
+ const serializedKey = with0x(bytesToHex(serializeCVBytes(params.key)));
77
+ const data = await client.request(`/v2/map_entry/${address}/${name}/${params.mapName}`, {
78
+ method: "POST",
79
+ body: serializedKey
80
+ });
81
+ if (typeof data?.data !== "string") {
82
+ throw new MalformedResponseError(`getMapEntry: /v2/map_entry/${address}/${name}/${params.mapName} response is missing "data"`);
83
+ }
84
+ return deserializeCVBytes(data.data);
85
+ }
86
+
46
87
  // src/actions/public/getNonce.ts
47
88
  async function getNonce(client, params) {
48
89
  const data = await client.request(`/v2/accounts/${params.address}`, {
@@ -470,5 +511,46 @@ function assertNoFeeTierForProvider(fee) {
470
511
  }
471
512
  }
472
513
 
473
- //# debugId=9E18214602131E0164756E2164756E21
474
- //# sourceMappingURL=stacks-s361pmzs.cjs.map
514
+ // src/actions/wallet/callContract.ts
515
+ async function callContract(client, params) {
516
+ const account = client.account;
517
+ if (!account)
518
+ throw new Error("Account required");
519
+ const [contractAddress, contractName] = parseContractId(params.contract);
520
+ if (isProviderAccount(account)) {
521
+ assertNoFeeTierForProvider(params.fee);
522
+ const result = await account.provider.request("stx_callContract", {
523
+ contract: params.contract,
524
+ functionName: params.functionName,
525
+ functionArgs: params.functionArgs ?? []
526
+ });
527
+ return result.txid;
528
+ }
529
+ const nonce = params.nonce ?? await resolveNonce(client, account.address);
530
+ const needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);
531
+ const unsigned = buildContractCall({
532
+ contractAddress,
533
+ contractName,
534
+ functionName: params.functionName,
535
+ functionArgs: params.functionArgs ?? [],
536
+ fee: needsFeeResolution ? 0n : params.fee,
537
+ nonce,
538
+ publicKey: account.publicKey,
539
+ chain: client.chain,
540
+ postConditionMode: params.postConditionMode,
541
+ postConditions: params.postConditions
542
+ });
543
+ if (needsFeeResolution) {
544
+ setUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));
545
+ }
546
+ const signed = await signTransactionWithAccount(unsigned, account);
547
+ return broadcastWithNonceReset(client, {
548
+ transaction: signed,
549
+ address: account.address
550
+ });
551
+ }
552
+
553
+ export { estimateFee, getBlockHeight, HttpRequestError, getMapEntry, getNonce, extendedApiSource, indexTxSource, TransactionError, BroadcastError, TransactionAbortedError, TransactionDroppedError, WaitForTransactionTimeoutError, SerializationError, SigningError, waitForTransactionReceipt, sendTransaction, jsonRpcSource, memoryStore, createNonceManager, resolveNonce, reconcileNonce, startNonceReconciler, isNonceConflictError, broadcastWithNonceReset, isProviderAccount, isFeeTier, minimumFee, resolveFee, setUnsignedFee, assertNoFeeTierForProvider, callContract };
554
+
555
+ //# debugId=7E04DC84B2A9298B64756E2164756E21
556
+ //# sourceMappingURL=stacks-90jcxs98.js.map
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/actions/public/estimateFee.ts", "../src/actions/public/getBlockHeight.ts", "../src/errors/http.ts", "../src/actions/public/getNonce.ts", "../src/actions/public/txSources.ts", "../src/errors/transaction.ts", "../src/actions/public/waitForTransactionReceipt.ts", "../src/actions/wallet/sendTransaction.ts", "../src/actions/wallet/nonceManager.ts", "../src/actions/wallet/utils.ts"],
3
+ "sources": ["../src/actions/public/estimateFee.ts", "../src/actions/public/getBlockHeight.ts", "../src/errors/http.ts", "../src/actions/public/getMapEntry.ts", "../src/actions/public/getNonce.ts", "../src/actions/public/txSources.ts", "../src/errors/transaction.ts", "../src/actions/public/waitForTransactionReceipt.ts", "../src/actions/wallet/sendTransaction.ts", "../src/actions/wallet/nonceManager.ts", "../src/actions/wallet/utils.ts", "../src/actions/wallet/callContract.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { Client } from \"../../clients/types.ts\";\nimport { MalformedResponseError } from \"../../errors/response.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport {\n\tserializePayload,\n\tserializeTransaction,\n} from \"../../transactions/wire/serialize.ts\";\nimport { bytesToHex } from \"../../utils/encoding.ts\";\n\nexport type EstimateFeeParams = {\n\ttransaction: StacksTransaction;\n};\n\nexport type FeeEstimation = {\n\tfeeRate: number;\n\tfee: number;\n};\n\nfunction isValidEstimation(\n\te: unknown,\n): e is { fee_rate: number | string; fee: number | string } {\n\treturn (\n\t\ttypeof e === \"object\" &&\n\t\te !== null &&\n\t\t\"fee_rate\" in e &&\n\t\t\"fee\" in e &&\n\t\t(typeof (e as Record<string, unknown>).fee_rate === \"number\" ||\n\t\t\ttypeof (e as Record<string, unknown>).fee_rate === \"string\") &&\n\t\t(typeof (e as Record<string, unknown>).fee === \"number\" ||\n\t\t\ttypeof (e as Record<string, unknown>).fee === \"string\")\n\t);\n}\n\nexport async function estimateFee(\n\tclient: Client,\n\tparams: EstimateFeeParams,\n): Promise<FeeEstimation[]> {\n\tconst payloadHex = bytesToHex(serializePayload(params.transaction.payload));\n\tconst txHex = bytesToHex(serializeTransaction(params.transaction));\n\n\tconst data = await client.request(\"/v2/fees/transaction\", {\n\t\tmethod: \"POST\",\n\t\tbody: {\n\t\t\testimated_len: Math.ceil(txHex.length / 2),\n\t\t\ttransaction_payload: `0x${payloadHex}`,\n\t\t},\n\t});\n\n\tconst raw = (data as { estimations?: unknown[] })?.estimations ?? [];\n\treturn raw.map((e) => {\n\t\tif (!isValidEstimation(e)) {\n\t\t\tthrow new MalformedResponseError(\n\t\t\t\t\"estimateFee: node response contains invalid fee estimation entry\",\n\t\t\t);\n\t\t}\n\t\treturn {\n\t\t\tfeeRate: Number(e.fee_rate),\n\t\t\tfee: Number(e.fee),\n\t\t};\n\t});\n}\n",
6
6
  "import type { Client } from \"../../clients/types.ts\";\nimport { MalformedResponseError } from \"../../errors/response.ts\";\n\nexport async function getBlockHeight(client: Client): Promise<number> {\n\tconst data = await client.request(\"/v2/info\", { method: \"GET\" });\n\tif (typeof data?.stacks_tip_height !== \"number\") {\n\t\tthrow new MalformedResponseError(\n\t\t\t'getBlockHeight: /v2/info response is missing \"stacks_tip_height\"',\n\t\t);\n\t}\n\treturn data.stacks_tip_height;\n}\n",
7
7
  "import { BaseError } from \"./base.ts\";\n\n/** Thrown by the HTTP transport when a response's status isn't 2xx. */\nexport class HttpRequestError extends BaseError {\n\toverride name = \"HttpRequestError\";\n\tstatus: number;\n\n\tconstructor(status: number, options?: { cause?: Error; details?: string }) {\n\t\tsuper(`HTTP request failed with status ${status}`, options);\n\t\tthis.status = status;\n\t}\n}\n",
8
+ "import { deserializeCVBytes } from \"../../clarity/deserialize.ts\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { MalformedResponseError } from \"../../errors/response.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\nimport { bytesToHex, with0x } from \"../../utils/encoding.ts\";\n\nexport type GetMapEntryParams = {\n\tcontract: string; // \"address.name\"\n\tmapName: string;\n\tkey: ClarityValue;\n};\n\nexport async function getMapEntry<T extends ClarityValue = ClarityValue>(\n\tclient: Client,\n\tparams: GetMapEntryParams,\n): Promise<T> {\n\tconst [address, name] = parseContractId(params.contract);\n\tconst serializedKey = with0x(bytesToHex(serializeCVBytes(params.key)));\n\n\tconst data = await client.request(\n\t\t`/v2/map_entry/${address}/${name}/${params.mapName}`,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\tbody: serializedKey,\n\t\t},\n\t);\n\n\tif (typeof data?.data !== \"string\") {\n\t\tthrow new MalformedResponseError(\n\t\t\t`getMapEntry: /v2/map_entry/${address}/${name}/${params.mapName} response is missing \"data\"`,\n\t\t);\n\t}\n\treturn deserializeCVBytes<T>(data.data);\n}\n",
8
9
  "import type { Client } from \"../../clients/types.ts\";\n\nexport type GetNonceParams = {\n\taddress: string;\n};\n\nexport type GetNonceResult = {\n\tnonce: bigint;\n\tpossibleNextNonce: bigint;\n};\n\nexport async function getNonce(\n\tclient: Client,\n\tparams: GetNonceParams,\n): Promise<bigint> {\n\tconst data = await client.request(`/v2/accounts/${params.address}`, {\n\t\tmethod: \"GET\",\n\t});\n\tconst nonce = (data as { nonce?: unknown })?.nonce;\n\tif (typeof nonce !== \"number\" && typeof nonce !== \"string\") {\n\t\tthrow new Error(\n\t\t\t`getNonce: unexpected /v2/accounts response for ${params.address} (missing numeric nonce)`,\n\t\t);\n\t}\n\treturn BigInt(nonce);\n}\n",
9
10
  "import { deserializeCVBytes } from \"../../clarity/deserialize.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { HttpRequestError } from \"../../errors/http.ts\";\n\n/**\n * Pluggable transaction-status sources for {@link getTransaction} /\n * `waitForTransactionReceipt`.\n *\n * A bare stacks-node has no confirmed-transaction endpoint, so status reads\n * need a host that indexes transactions. Where that data comes from is\n * pluggable, mirroring the nonce sources:\n *\n * - {@link extendedApiSource} — default; `/extended/v1/tx/{txid}` on the\n * client's transport host (Hiro API or any extended-API-compatible host).\n * - {@link indexTxSource} — Secondlayer's `/v1/index/transactions/{txid}`;\n * returns the chain tip in the same response, so N-confirmation waits\n * need no second request.\n */\n\nexport type TransactionStatus =\n\t| \"pending\"\n\t| \"success\"\n\t| \"abort_by_response\"\n\t| \"abort_by_post_condition\"\n\t| \"dropped\";\n\nexport type TransactionReceipt = {\n\ttxid: string;\n\tstatus: TransactionStatus;\n\t/** Anchor block height; absent while pending. */\n\tblockHeight?: number;\n\tblockHash?: string;\n\t/** Decoded Clarity result; absent while pending or when the source omits it. */\n\tresult?: ClarityValue;\n\tresultHex?: string;\n\tevents: unknown[];\n\t/** The source's unnormalized response, for fields the receipt doesn't model. */\n\traw: unknown;\n};\n\nexport type TransactionSnapshot = {\n\t/** `null` when the source has no record of the tx (mempool + chain). */\n\treceipt: TransactionReceipt | null;\n\t/** Chain tip height, when the source knows it (saves a round-trip). */\n\ttip?: number;\n};\n\nexport type TransactionStatusSource = {\n\tget(args: { client: Client; txid: string }): Promise<TransactionSnapshot>;\n};\n\ntype FetchImpl = typeof globalThis.fetch;\n\nfunction resolveFetch(fetchImpl?: FetchImpl): FetchImpl {\n\tconst f = fetchImpl ?? globalThis.fetch;\n\tif (!f)\n\t\tthrow new Error(\"No fetch implementation available; pass `fetchImpl`\");\n\treturn f;\n}\n\nfunction normalizeTxid(txid: string): string {\n\treturn txid.startsWith(\"0x\") ? txid : `0x${txid}`;\n}\n\nfunction decodeResultHex(hex: string | null | undefined): {\n\tresult?: ClarityValue;\n\tresultHex?: string;\n} {\n\tif (!hex) return {};\n\ttry {\n\t\treturn { result: deserializeCVBytes(hex), resultHex: hex };\n\t} catch {\n\t\treturn { resultHex: hex };\n\t}\n}\n\n/** Map a Hiro `tx_status` string onto the receipt vocabulary. */\nfunction normalizeStatus(txStatus: string): TransactionStatus | undefined {\n\tswitch (txStatus) {\n\t\tcase \"pending\":\n\t\tcase \"success\":\n\t\tcase \"abort_by_response\":\n\t\tcase \"abort_by_post_condition\":\n\t\t\treturn txStatus;\n\t\tdefault:\n\t\t\treturn txStatus.startsWith(\"dropped\") ? \"dropped\" : undefined;\n\t}\n}\n\n/**\n * Default source: `GET /extended/v1/tx/{txid}` via the client's transport.\n * Requires a host that serves Hiro's extended API (a bare stacks-node does\n * not). Does not report the chain tip — the wait action fetches it separately\n * when `confirmations > 1`.\n */\nexport function extendedApiSource(): TransactionStatusSource {\n\treturn {\n\t\tasync get({ client, txid }) {\n\t\t\tlet data: Awaited<ReturnType<Client[\"request\"]>>;\n\t\t\ttry {\n\t\t\t\tdata = await client.request(`/extended/v1/tx/${normalizeTxid(txid)}`, {\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof HttpRequestError && error.status === 404) {\n\t\t\t\t\treturn { receipt: null };\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tconst txStatus =\n\t\t\t\ttypeof data?.tx_status === \"string\" ? data.tx_status : undefined;\n\t\t\tif (!txStatus) return { receipt: null }; // unexpected shape\n\n\t\t\tconst status = normalizeStatus(txStatus);\n\t\t\tif (!status) return { receipt: null };\n\n\t\t\treturn {\n\t\t\t\treceipt: {\n\t\t\t\t\ttxid: normalizeTxid(txid),\n\t\t\t\t\tstatus,\n\t\t\t\t\tblockHeight:\n\t\t\t\t\t\ttypeof data.block_height === \"number\" && data.block_height > 0\n\t\t\t\t\t\t\t? data.block_height\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tblockHash: data.block_hash ?? undefined,\n\t\t\t\t\t...decodeResultHex(data.tx_result?.hex),\n\t\t\t\t\tevents: Array.isArray(data.events) ? data.events : [],\n\t\t\t\t\traw: data,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport type IndexTxSourceParams = {\n\t/** Base URL of a Secondlayer-shaped index API. */\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tfetchImpl?: FetchImpl;\n};\n\n/**\n * Source backed by Secondlayer's `/v1/index/transactions/{txid}`. The response\n * embeds the chain tip, so N-confirmation math needs no extra request. The\n * index only returns canonical (mined) transactions — while a tx is in the\n * mempool this source reports `receipt: null`, and the wait action's grace\n * window carries it until inclusion.\n */\nexport function indexTxSource(\n\tparams: IndexTxSourceParams = {},\n): TransactionStatusSource {\n\tconst baseUrl = (params.baseUrl ?? \"https://api.secondlayer.tools\").replace(\n\t\t/\\/$/,\n\t\t\"\",\n\t);\n\tconst fetchImpl = resolveFetch(params.fetchImpl);\n\n\treturn {\n\t\tasync get({ txid }) {\n\t\t\tconst res = await fetchImpl(\n\t\t\t\t`${baseUrl}/v1/index/transactions/${normalizeTxid(txid)}`,\n\t\t\t\t{\n\t\t\t\t\theaders: params.apiKey ? { \"x-api-key\": params.apiKey } : undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (res.status === 404) {\n\t\t\t\treturn { receipt: null };\n\t\t\t}\n\t\t\tif (!res.ok) {\n\t\t\t\tthrow new Error(`indexTxSource: /v1/index/transactions ${res.status}`);\n\t\t\t}\n\n\t\t\tconst data = (await res.json()) as {\n\t\t\t\ttransaction?: {\n\t\t\t\t\ttx_id: string;\n\t\t\t\t\tblock_height: number;\n\t\t\t\t\tstatus: string;\n\t\t\t\t\tcontract_call?: { result_hex: string | null };\n\t\t\t\t};\n\t\t\t\ttip?: { block_height: number };\n\t\t\t};\n\t\t\tconst tx = data.transaction;\n\t\t\tconst tip = data.tip?.block_height;\n\t\t\tif (!tx) return { receipt: null, tip };\n\n\t\t\tconst status = normalizeStatus(tx.status) ?? \"success\";\n\t\t\treturn {\n\t\t\t\treceipt: {\n\t\t\t\t\ttxid: normalizeTxid(tx.tx_id),\n\t\t\t\t\tstatus,\n\t\t\t\t\tblockHeight: tx.block_height,\n\t\t\t\t\t...decodeResultHex(tx.contract_call?.result_hex),\n\t\t\t\t\tevents: [],\n\t\t\t\t\traw: data,\n\t\t\t\t},\n\t\t\t\ttip,\n\t\t\t};\n\t\t},\n\t};\n}\n",
10
11
  "import { BaseError } from \"./base.ts\";\n\nexport class TransactionError extends BaseError {\n\toverride name = \"TransactionError\";\n}\n\n/**\n * Rejection reasons a stacks-node returns from `POST /v2/transactions`.\n * Wire strings from stacks-core `MemPoolRejection::into_json`\n * (`stackslib/src/chainstate/stacks/db/blocks.rs`).\n */\nexport type TxRejectionReason =\n\t| \"Serialization\"\n\t| \"Deserialization\"\n\t| \"SignatureValidation\"\n\t| \"BadNonce\"\n\t| \"ConflictingNonceInMempool\"\n\t| \"TooMuchChaining\"\n\t| \"FeeTooLow\"\n\t| \"NotEnoughFunds\"\n\t| \"NoSuchContract\"\n\t| \"NoSuchPublicFunction\"\n\t| \"BadFunctionArgument\"\n\t| \"ContractAlreadyExists\"\n\t| \"BadTransactionVersion\"\n\t| \"TransferRecipientCannotEqualSender\"\n\t| \"TransferAmountMustBePositive\"\n\t| \"PoisonMicroblocksDoNotConflict\"\n\t| \"PoisonMicroblockHasUnknownPubKeyHash\"\n\t| \"PoisonMicroblockIsInvalid\"\n\t| \"BadAddressVersionByte\"\n\t| \"NoCoinbaseViaMempool\"\n\t| \"NoTenureChangeViaMempool\"\n\t| \"EstimatorError\"\n\t| \"TemporarilyBlacklisted\"\n\t| \"ServerFailureNoSuchChainTip\"\n\t| \"ServerFailureDatabase\"\n\t| \"ServerFailureOther\";\n\nexport class BroadcastError extends BaseError {\n\toverride name = \"BroadcastError\";\n\ttxid?: string;\n\t// `(string & {})` keeps forward-compat with reasons newer nodes may add\n\t// while preserving literal-union completions.\n\treason?: TxRejectionReason | (string & {});\n\t/** Node-provided detail; shape varies per reason (see stacks-core RPC docs). */\n\treasonData?: unknown;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions?: {\n\t\t\tcause?: Error;\n\t\t\ttxid?: string;\n\t\t\treason?: string;\n\t\t\treasonData?: unknown;\n\t\t},\n\t) {\n\t\tsuper(message, options);\n\t\tthis.txid = options?.txid;\n\t\tthis.reason = options?.reason;\n\t\tthis.reasonData = options?.reasonData;\n\t}\n}\n\n/** The transaction was mined but its execution aborted (runtime error or failed post-condition). */\nexport class TransactionAbortedError extends BaseError {\n\toverride name = \"TransactionAbortedError\";\n\t/** The abort receipt (status, block info, raw source response). */\n\treceipt: unknown;\n\n\tconstructor(message: string, options: { receipt: unknown; cause?: Error }) {\n\t\tsuper(message, options);\n\t\tthis.receipt = options.receipt;\n\t}\n}\n\n/** The transaction left the mempool without being mined (dropped/replaced). */\nexport class TransactionDroppedError extends BaseError {\n\toverride name = \"TransactionDroppedError\";\n\ttxid: string;\n\n\tconstructor(message: string, options: { txid: string; cause?: Error }) {\n\t\tsuper(message, options);\n\t\tthis.txid = options.txid;\n\t}\n}\n\n/** waitForTransactionReceipt gave up before the tx reached the requested state. */\nexport class WaitForTransactionTimeoutError extends BaseError {\n\toverride name = \"WaitForTransactionTimeoutError\";\n\ttxid: string;\n\n\tconstructor(message: string, options: { txid: string; cause?: Error }) {\n\t\tsuper(message, options);\n\t\tthis.txid = options.txid;\n\t}\n}\n\nexport class SerializationError extends BaseError {\n\toverride name = \"SerializationError\";\n}\n\nexport class SigningError extends BaseError {\n\toverride name = \"SigningError\";\n}\n",
11
12
  "import type { Client } from \"../../clients/types.ts\";\nimport {\n\tTransactionAbortedError,\n\tTransactionDroppedError,\n\tWaitForTransactionTimeoutError,\n} from \"../../errors/transaction.ts\";\nimport { getBlockHeight } from \"./getBlockHeight.ts\";\nimport {\n\ttype TransactionReceipt,\n\ttype TransactionStatusSource,\n\textendedApiSource,\n} from \"./txSources.ts\";\n\nexport type WaitForTransactionReceiptParams = {\n\ttxid: string;\n\t/** Anchor-block confirmations to wait for. Default 1 (mined). */\n\tconfirmations?: number;\n\t/** Give up after this many ms. Default 180_000 (3 min). */\n\ttimeout?: number;\n\t/** Delay between status polls, ms. Default 3_000. */\n\tpollingInterval?: number;\n\t/**\n\t * How long a tx may be unknown to the source before it counts as dropped,\n\t * ms. Covers broadcast propagation lag and canonical-only sources that\n\t * can't see the mempool. Default 30_000.\n\t */\n\tdroppedGracePeriod?: number;\n\t/** Where to read status from. Defaults to {@link extendedApiSource}. */\n\tsource?: TransactionStatusSource;\n};\n\nconst sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));\n\n/**\n * Poll until a transaction is mined with N confirmations, then return its\n * receipt.\n *\n * Rejects with {@link TransactionAbortedError} when the tx mines but aborts\n * (`abort_by_response` / `abort_by_post_condition`) — the receipt is attached.\n * Rejects with {@link TransactionDroppedError} when the tx leaves the mempool\n * unmined or stays unknown past `droppedGracePeriod`, and\n * {@link WaitForTransactionTimeoutError} at `timeout`.\n *\n * Reorg-tolerant: every cycle re-reads the receipt (block height may change)\n * and recomputes confirmations from the current tip.\n */\nexport async function waitForTransactionReceipt(\n\tclient: Client,\n\tparams: WaitForTransactionReceiptParams,\n): Promise<TransactionReceipt> {\n\tconst {\n\t\ttxid,\n\t\tconfirmations = 1,\n\t\ttimeout = 180_000,\n\t\tpollingInterval = 3_000,\n\t\tdroppedGracePeriod = 30_000,\n\t} = params;\n\tconst source = params.source ?? extendedApiSource();\n\n\tconst startedAt = Date.now();\n\tlet unknownSince: number | null = null;\n\tlet everPending = false;\n\n\twhile (true) {\n\t\tconst snapshot = await source.get({ client, txid });\n\t\tconst receipt = snapshot.receipt;\n\n\t\tif (receipt === null) {\n\t\t\t// Unknown to the source: propagation lag, a canonical-only source\n\t\t\t// looking at a mempool tx, or a genuine drop. Only the grace clock\n\t\t\t// distinguishes them.\n\t\t\tunknownSince ??= Date.now();\n\t\t\tif (Date.now() - unknownSince >= droppedGracePeriod) {\n\t\t\t\tthrow new TransactionDroppedError(\n\t\t\t\t\teverPending\n\t\t\t\t\t\t? `Transaction ${txid} left the mempool without being mined`\n\t\t\t\t\t\t: `Transaction ${txid} was never observed by the status source`,\n\t\t\t\t\t{ txid },\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tunknownSince = null;\n\n\t\t\tswitch (receipt.status) {\n\t\t\t\tcase \"dropped\":\n\t\t\t\t\tthrow new TransactionDroppedError(\n\t\t\t\t\t\t`Transaction ${txid} was dropped from the mempool`,\n\t\t\t\t\t\t{ txid },\n\t\t\t\t\t);\n\t\t\t\tcase \"abort_by_response\":\n\t\t\t\tcase \"abort_by_post_condition\":\n\t\t\t\t\tthrow new TransactionAbortedError(\n\t\t\t\t\t\t`Transaction ${txid} aborted (${receipt.status})`,\n\t\t\t\t\t\t{ receipt },\n\t\t\t\t\t);\n\t\t\t\tcase \"pending\":\n\t\t\t\t\teverPending = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"success\": {\n\t\t\t\t\tif (confirmations <= 1) return receipt;\n\t\t\t\t\tif (receipt.blockHeight !== undefined) {\n\t\t\t\t\t\tconst tip = snapshot.tip ?? (await getBlockHeight(client));\n\t\t\t\t\t\tif (tip - receipt.blockHeight + 1 >= confirmations) return receipt;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Date.now() - startedAt >= timeout) {\n\t\t\tthrow new WaitForTransactionTimeoutError(\n\t\t\t\t`Timed out after ${timeout}ms waiting for transaction ${txid}`,\n\t\t\t\t{ txid },\n\t\t\t);\n\t\t}\n\t\tawait sleep(pollingInterval);\n\t}\n}\n",
12
13
  "import type { TransactionReceipt } from \"../../actions/public/txSources.ts\";\nimport { waitForTransactionReceipt } from \"../../actions/public/waitForTransactionReceipt.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { HttpRequestError } from \"../../errors/http.ts\";\nimport { BroadcastError } from \"../../errors/transaction.ts\";\nimport { getTransactionId } from \"../../transactions/signer.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { serializeTransaction } from \"../../transactions/wire/serialize.ts\";\nimport { bytesToHex } from \"../../utils/encoding.ts\";\n\nexport type SendTransactionParams = {\n\ttransaction: StacksTransaction;\n\tattachment?: Uint8Array | string;\n\t/**\n\t * Wait for the transaction to be mined before returning. `true` waits for\n\t * 1 confirmation; a number waits for that many. The receipt lands on the\n\t * result. Rejects if the tx aborts, is dropped, or the wait times out.\n\t */\n\twait?: boolean | number;\n};\n\nexport type SendTransactionResult = {\n\ttxid: string;\n\t/** Present when `wait` was requested. */\n\treceipt?: TransactionReceipt;\n};\n\n/** Broadcast a signed transaction to the network */\nexport async function sendTransaction(\n\tclient: Client,\n\tparams: SendTransactionParams,\n): Promise<SendTransactionResult> {\n\tconst hex = bytesToHex(serializeTransaction(params.transaction));\n\n\tconst body: Record<string, string> = { tx: hex };\n\tif (params.attachment) {\n\t\tbody.attachment =\n\t\t\ttypeof params.attachment === \"string\"\n\t\t\t\t? params.attachment\n\t\t\t\t: bytesToHex(params.attachment);\n\t}\n\n\t// A stacks-node responds to a rejected broadcast with a non-2xx status\n\t// (the transport now throws for that) but the rejection JSON — the thing\n\t// this function actually needs — rides along as the error body.\n\tlet data: Awaited<ReturnType<Client[\"request\"]>>;\n\ttry {\n\t\tdata = await client.request(\"/v2/transactions\", { method: \"POST\", body });\n\t} catch (error) {\n\t\tif (error instanceof HttpRequestError && error.details) {\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse(error.details);\n\t\t\t} catch {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t} else {\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tif (data.error) {\n\t\tthrow new BroadcastError(data.reason ?? data.error, {\n\t\t\treason: data.reason,\n\t\t\treasonData: data.reason_data,\n\t\t\ttxid: data.txid ?? getTransactionId(params.transaction),\n\t\t});\n\t}\n\n\tconst txid =\n\t\ttypeof data === \"string\"\n\t\t\t? data.replace(/\"/g, \"\")\n\t\t\t: (data.txid ?? getTransactionId(params.transaction));\n\n\tif (params.wait) {\n\t\tconst confirmations = params.wait === true ? 1 : params.wait;\n\t\tconst receipt = await waitForTransactionReceipt(client, {\n\t\t\ttxid,\n\t\t\tconfirmations,\n\t\t});\n\t\treturn { txid, receipt };\n\t}\n\n\treturn { txid };\n}\n",
13
14
  "import type { Client } from \"../../clients/types.ts\";\nimport { BroadcastError } from \"../../errors/transaction.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { getNonce } from \"../public/getNonce.ts\";\nimport { sendTransaction } from \"./sendTransaction.ts\";\n\n/**\n * Provides the confirmed on-chain nonce floor for an address.\n *\n * The default {@link jsonRpcSource} reads the configured node's `/v2/accounts`\n * endpoint — node-agnostic, no Hiro dependency. Other sources (mempool-aware,\n * first-party Index) can be swapped in without touching the manager.\n */\nexport type NonceManagerSource = {\n\tget(params: { client: Client; address: string }): Promise<bigint>;\n};\n\n/**\n * Holds per-address allocation state and hands out the next nonce.\n *\n * `reserve` MUST be atomic per `key`: two concurrent reservations for the same\n * key must never return the same value. The in-memory {@link memoryStore}\n * serializes with a per-key promise chain; a persisted store (Redis `INCR`,\n * Postgres `SELECT ... FOR UPDATE`) becomes the cross-process lock for the\n * multi-builder / smart-wallet-as-a-service case.\n */\nexport type NonceStore = {\n\t/**\n\t * Reserve the next nonce for `key`. `getFloor` reads the confirmed on-chain\n\t * nonce; it is only invoked when the store has no tracked value (cold start\n\t * or after {@link NonceStore.reset}).\n\t */\n\treserve(key: string, getFloor: () => Promise<bigint>): Promise<bigint>;\n\t/** Forget tracked state for `key` so the next reserve re-syncs from the floor. */\n\treset(key: string): void | Promise<void>;\n\t/**\n\t * Return the next nonce that {@link NonceStore.reserve} would hand out for\n\t * `key` WITHOUT consuming it, or `undefined` if `key` is untracked. Used by\n\t * {@link reconcileNonce} to detect drift. Optional — stores that omit it\n\t * simply opt out of reconciliation.\n\t */\n\tpeek?(key: string): Promise<bigint | undefined> | bigint | undefined;\n};\n\n/** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */\nexport type NonceManager = {\n\tconsume(params: { client: Client; address: string }): Promise<bigint>;\n\treset(params: { client: Client; address: string }): void | Promise<void>;\n\t/** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */\n\tpeek(params: {\n\t\tclient: Client;\n\t\taddress: string;\n\t}): Promise<bigint | undefined>;\n};\n\nexport type CreateNonceManagerParams = {\n\tsource?: NonceManagerSource;\n\tstore?: NonceStore;\n};\n\n/** Confirmed-nonce source backed by the configured node's `/v2/accounts` RPC (no Hiro dependency). */\nexport function jsonRpcSource(): NonceManagerSource {\n\treturn {\n\t\tget: ({ client, address }) => getNonce(client, { address }),\n\t};\n}\n\n/**\n * In-memory, single-process store. Tracks the next nonce per key and serializes\n * concurrent reservations with a per-key promise chain.\n *\n * Correct only within one process — swap in a persisted store for multi-process\n * deployments that share a signing key.\n */\nexport function memoryStore(): NonceStore {\n\tconst next = new Map<string, bigint>();\n\tconst locks = new Map<string, Promise<unknown>>();\n\n\tfunction withLock<T>(key: string, fn: () => Promise<T>): Promise<T> {\n\t\tconst prev = locks.get(key) ?? Promise.resolve();\n\t\t// Chain onto the prior reservation regardless of how it settled, so a\n\t\t// rejected reserve never wedges the key.\n\t\tconst run = prev.then(fn, fn);\n\t\tlocks.set(\n\t\t\tkey,\n\t\t\trun.catch(() => {}),\n\t\t);\n\t\treturn run;\n\t}\n\n\treturn {\n\t\treserve(key, getFloor) {\n\t\t\treturn withLock(key, async () => {\n\t\t\t\tlet current = next.get(key);\n\t\t\t\tif (current === undefined) current = await getFloor();\n\t\t\t\tnext.set(key, current + 1n);\n\t\t\t\treturn current;\n\t\t\t});\n\t\t},\n\t\treset(key) {\n\t\t\tnext.delete(key);\n\t\t},\n\t\tpeek(key) {\n\t\t\treturn next.get(key);\n\t\t},\n\t};\n}\n\nfunction nonceKey(client: Client, address: string): string {\n\treturn `${client.chain?.id ?? \"stacks\"}:${address}`;\n}\n\n/**\n * Create a nonce manager that floors on a confirmed-nonce {@link NonceManagerSource}\n * and increments a {@link NonceStore} on every {@link NonceManager.consume}.\n *\n * Defaults to {@link jsonRpcSource} + {@link memoryStore} — node-agnostic,\n * single-process, zero external dependencies.\n */\nexport function createNonceManager(\n\tparams: CreateNonceManagerParams = {},\n): NonceManager {\n\tconst source = params.source ?? jsonRpcSource();\n\tconst store = params.store ?? memoryStore();\n\n\treturn {\n\t\tconsume({ client, address }) {\n\t\t\treturn store.reserve(nonceKey(client, address), () =>\n\t\t\t\tsource.get({ client, address }),\n\t\t\t);\n\t\t},\n\t\treset({ client, address }) {\n\t\t\treturn store.reset(nonceKey(client, address));\n\t\t},\n\t\tasync peek({ client, address }) {\n\t\t\treturn store.peek?.(nonceKey(client, address));\n\t\t},\n\t};\n}\n\n/** Resolve the next nonce via the client's nonce manager, falling back to a confirmed read. */\nexport async function resolveNonce(\n\tclient: Client,\n\taddress: string,\n): Promise<bigint> {\n\tif (client.nonceManager)\n\t\treturn client.nonceManager.consume({ client, address });\n\treturn getNonce(client, { address });\n}\n\nexport type ReconcileNonceParams = {\n\tclient: Client;\n\taddress: string;\n\t/** Authoritative (ideally mempool-aware) source to reconcile against. */\n\tsource: NonceManagerSource;\n\t/**\n\t * Allow resetting DOWNWARD when the source's next nonce is below what the\n\t * store tracks — i.e. a previously-allocated tx is no longer pending or\n\t * confirmed (dropped/GC'd), so its nonce should be reused. Default `true`.\n\t *\n\t * Downward resets rely on `source` being current: with a go-forward mempool\n\t * source that lags broadcast, run reconciliation on an interval comfortably\n\t * longer than mempool propagation so a still-missing tx is genuinely dropped.\n\t * Set `false` for upward-only reconciliation (always safe).\n\t */\n\tdownward?: boolean;\n};\n\nexport type ReconcileNonceResult = {\n\t/** Whether the manager was reset (drift detected). */\n\treset: boolean;\n\t/** Authoritative next nonce from `source`. */\n\tauthoritative: bigint;\n\t/** Next nonce the store tracked, or `undefined` if untracked. */\n\ttracked: bigint | undefined;\n};\n\n/**\n * Reconcile a tracked nonce against an authoritative source, healing silent\n * drift that produces no broadcast error (a dropped/GC'd mempool tx leaving the\n * counter overshot, or the chain advancing past the local view).\n *\n * When the source's next nonce differs from the tracked value, the manager is\n * {@link NonceManager.reset}; the next `consume` re-seeds from `source`. A no-op\n * if the store is untracked or does not implement `peek`.\n */\nexport async function reconcileNonce(\n\tmanager: NonceManager,\n\tparams: ReconcileNonceParams,\n): Promise<ReconcileNonceResult> {\n\tconst { client, address, source } = params;\n\tconst downward = params.downward ?? true;\n\n\tconst authoritative = await source.get({ client, address });\n\tconst tracked = await manager.peek({ client, address });\n\n\tif (tracked === undefined || authoritative === tracked) {\n\t\treturn { reset: false, authoritative, tracked };\n\t}\n\tif (authoritative < tracked && !downward) {\n\t\treturn { reset: false, authoritative, tracked };\n\t}\n\n\tawait manager.reset({ client, address });\n\treturn { reset: true, authoritative, tracked };\n}\n\nexport type StartNonceReconcilerParams = {\n\tclient: Client;\n\taddresses: string[];\n\tsource: NonceManagerSource;\n\t/** Reconcile interval in ms. Default 60_000. Keep well above mempool propagation. */\n\tintervalMs?: number;\n\tdownward?: boolean;\n\t/** Per-address callback after each reconcile (observability). */\n\tonReconcile?: (address: string, result: ReconcileNonceResult) => void;\n\t/** Per-address error callback; reconciliation continues on the next tick. */\n\tonError?: (address: string, error: unknown) => void;\n\t/** Optional test clock. If provided, the reconciler advances time via\n\t * `clock.advance(ms)` instead of real `setInterval`. */\n\tclock?: {\n\t\tadvance: (ms: number) => Promise<void>;\n\t\tnow: () => number;\n\t};\n};\n\n/**\n * Run {@link reconcileNonce} on a timer for a set of addresses.\n *\n * SINGLE-WRITER: run this in exactly ONE process. With a shared persisted store,\n * a reconciler resetting the counter while other workers allocate is racy — keep\n * reconciliation on one designated process and let the others only allocate.\n *\n * Returns a handle; call `stop()` to clear the timer.\n */\nexport function startNonceReconciler(\n\tmanager: NonceManager,\n\tparams: StartNonceReconcilerParams,\n): { stop: () => void } {\n\tconst { client, addresses, source, clock } = params;\n\tconst intervalMs = params.intervalMs ?? 60_000;\n\tlet running = true;\n\n\tconst tick = async () => {\n\t\tif (!running) return;\n\t\tfor (const address of addresses) {\n\t\t\ttry {\n\t\t\t\tconst result = await reconcileNonce(manager, {\n\t\t\t\t\tclient,\n\t\t\t\t\taddress,\n\t\t\t\t\tsource,\n\t\t\t\t\tdownward: params.downward,\n\t\t\t\t});\n\t\t\t\tparams.onReconcile?.(address, result);\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tparams.onError?.(address, error);\n\t\t\t\t} catch {\n\t\t\t\t\t// A throwing onError callback must not abort the reconcile loop\n\t\t\t\t\t// or surface as an unhandled rejection on the interval timer.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (running && clock) {\n\t\t\tawait clock.advance(intervalMs);\n\t\t\ttick();\n\t\t}\n\t};\n\n\tif (clock) {\n\t\ttick();\n\t\treturn {\n\t\t\tstop: () => {\n\t\t\t\trunning = false;\n\t\t\t},\n\t\t};\n\t}\n\n\tconst timer = setInterval(tick, intervalMs);\n\t// Don't keep the event loop alive solely for reconciliation (Node/Bun).\n\t(timer as { unref?: () => void }).unref?.();\n\n\treturn {\n\t\tstop: () => clearInterval(timer),\n\t};\n}\n\n/** True when a broadcast was rejected for a nonce conflict (`ConflictingNonceInMempool`, `BadNonce`). */\nexport function isNonceConflictError(error: unknown): boolean {\n\tif (!(error instanceof BroadcastError)) return false;\n\tif (\n\t\terror.reason === \"ConflictingNonceInMempool\" ||\n\t\terror.reason === \"BadNonce\"\n\t) {\n\t\treturn true;\n\t}\n\t// Typed reason present but not nonce-related — trust it over the message\n\t// (e.g. a FeeTooLow message mentioning \"nonce\" must not trigger a reset).\n\tif (error.reason !== undefined) return false;\n\t// No structured reason (older nodes/proxies) — fall back to message match.\n\treturn error.message.toLowerCase().includes(\"nonce\");\n}\n\n/**\n * Broadcast a signed transaction; on a nonce-conflict rejection, reset the\n * manager so the next build re-syncs to the confirmed floor.\n */\nexport async function broadcastWithNonceReset(\n\tclient: Client,\n\tparams: { transaction: StacksTransaction; address: string },\n): Promise<string> {\n\ttry {\n\t\tconst result = await sendTransaction(client, {\n\t\t\ttransaction: params.transaction,\n\t\t});\n\t\treturn result.txid;\n\t} catch (error) {\n\t\tif (client.nonceManager && isNonceConflictError(error)) {\n\t\t\tawait client.nonceManager.reset({ client, address: params.address });\n\t\t}\n\t\tthrow error;\n\t}\n}\n",
14
- "import type { ProviderAccount } from \"../../accounts/types.ts\";\nimport type { Account, Client } from \"../../clients/types.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport {\n\tclearTxCache,\n\tserializeTransaction,\n} from \"../../transactions/wire/serialize.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { intToBigInt } from \"../../utils/encoding.ts\";\nimport { estimateFee } from \"../public/estimateFee.ts\";\n\nexport function isProviderAccount(\n\taccount: Account,\n): account is ProviderAccount {\n\treturn account.type === \"provider\";\n}\n\n/**\n * Named fee tiers. `'low' | 'mid' | 'high'` map to the node's three fee\n * estimations; `'min'` is the node's minimum relay fee — 1 uSTX per byte of\n * the serialized transaction, computable offline.\n */\nexport type FeeTier = \"min\" | \"low\" | \"mid\" | \"high\";\n\n/** Fee input accepted by wallet actions: an explicit amount or a named tier. */\nexport type FeeParam = IntegerType | FeeTier;\n\nconst FEE_TIERS: readonly FeeTier[] = [\"min\", \"low\", \"mid\", \"high\"];\nconst TIER_INDEX = { low: 0, mid: 1, high: 2 } as const;\n\nexport function isFeeTier(fee: FeeParam | undefined): fee is FeeTier {\n\treturn typeof fee === \"string\" && FEE_TIERS.includes(fee as FeeTier);\n}\n\n/**\n * Minimum relay fee: 1 uSTX per byte of the serialized transaction. The fee\n * field is fixed-width (8 bytes), so the size — and therefore this floor — is\n * stable regardless of the fee value later set on the spending condition.\n */\nexport function minimumFee(transaction: StacksTransaction): bigint {\n\treturn BigInt(serializeTransaction(transaction).length);\n}\n\n/**\n * Resolve a fee param to a concrete amount. Numeric input passes through.\n * Tiers `'low' | 'mid' | 'high'` index the node's estimations (nearest\n * available when fewer than three are returned); `'min'` — and any estimation\n * failure (e.g. NoEstimateAvailable) — resolves to {@link minimumFee}, which\n * needs no network round-trip.\n */\nexport async function resolveFee(\n\tclient: Client,\n\ttransaction: StacksTransaction,\n\tfee: FeeParam | undefined,\n): Promise<bigint> {\n\tif (fee !== undefined && !isFeeTier(fee)) return intToBigInt(fee);\n\n\tconst tier = fee ?? \"mid\";\n\tif (tier === \"min\") return minimumFee(transaction);\n\n\ttry {\n\t\tconst estimates = await estimateFee(client, { transaction });\n\t\tconst pick = estimates[TIER_INDEX[tier]] ?? estimates[estimates.length - 1];\n\t\tif (pick) return BigInt(pick.fee);\n\t} catch {\n\t\t// Node could not produce an estimate — fall through to the relay floor.\n\t}\n\treturn minimumFee(transaction);\n}\n\n/** Set the resolved fee on an unsigned transaction's origin spending condition. */\nexport function setUnsignedFee(\n\ttransaction: StacksTransaction,\n\tfee: bigint,\n): void {\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t(transaction.auth.spendingCondition as any).fee = fee;\n\t// In-place mutation: invalidate the memoized serialization (resolveFee may\n\t// have already serialized this object via minimumFee/estimateFee).\n\tclearTxCache(transaction);\n}\n\n/** Throw when a named fee tier is used with a provider (wallet) account. */\nexport function assertNoFeeTierForProvider(fee: FeeParam | undefined): void {\n\tif (isFeeTier(fee)) {\n\t\tthrow new Error(\n\t\t\t`Fee tier '${fee}' requires local signing; provider (wallet) accounts set their own fee`,\n\t\t);\n\t}\n}\n"
15
+ "import type { ProviderAccount } from \"../../accounts/types.ts\";\nimport type { Account, Client } from \"../../clients/types.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport {\n\tclearTxCache,\n\tserializeTransaction,\n} from \"../../transactions/wire/serialize.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { intToBigInt } from \"../../utils/encoding.ts\";\nimport { estimateFee } from \"../public/estimateFee.ts\";\n\nexport function isProviderAccount(\n\taccount: Account,\n): account is ProviderAccount {\n\treturn account.type === \"provider\";\n}\n\n/**\n * Named fee tiers. `'low' | 'mid' | 'high'` map to the node's three fee\n * estimations; `'min'` is the node's minimum relay fee — 1 uSTX per byte of\n * the serialized transaction, computable offline.\n */\nexport type FeeTier = \"min\" | \"low\" | \"mid\" | \"high\";\n\n/** Fee input accepted by wallet actions: an explicit amount or a named tier. */\nexport type FeeParam = IntegerType | FeeTier;\n\nconst FEE_TIERS: readonly FeeTier[] = [\"min\", \"low\", \"mid\", \"high\"];\nconst TIER_INDEX = { low: 0, mid: 1, high: 2 } as const;\n\nexport function isFeeTier(fee: FeeParam | undefined): fee is FeeTier {\n\treturn typeof fee === \"string\" && FEE_TIERS.includes(fee as FeeTier);\n}\n\n/**\n * Minimum relay fee: 1 uSTX per byte of the serialized transaction. The fee\n * field is fixed-width (8 bytes), so the size — and therefore this floor — is\n * stable regardless of the fee value later set on the spending condition.\n */\nexport function minimumFee(transaction: StacksTransaction): bigint {\n\treturn BigInt(serializeTransaction(transaction).length);\n}\n\n/**\n * Resolve a fee param to a concrete amount. Numeric input passes through.\n * Tiers `'low' | 'mid' | 'high'` index the node's estimations (nearest\n * available when fewer than three are returned); `'min'` — and any estimation\n * failure (e.g. NoEstimateAvailable) — resolves to {@link minimumFee}, which\n * needs no network round-trip.\n */\nexport async function resolveFee(\n\tclient: Client,\n\ttransaction: StacksTransaction,\n\tfee: FeeParam | undefined,\n): Promise<bigint> {\n\tif (fee !== undefined && !isFeeTier(fee)) return intToBigInt(fee);\n\n\tconst tier = fee ?? \"mid\";\n\tif (tier === \"min\") return minimumFee(transaction);\n\n\ttry {\n\t\tconst estimates = await estimateFee(client, { transaction });\n\t\tconst pick = estimates[TIER_INDEX[tier]] ?? estimates[estimates.length - 1];\n\t\tif (pick) return BigInt(pick.fee);\n\t} catch {\n\t\t// Node could not produce an estimate — fall through to the relay floor.\n\t}\n\treturn minimumFee(transaction);\n}\n\n/** Set the resolved fee on an unsigned transaction's origin spending condition. */\nexport function setUnsignedFee(\n\ttransaction: StacksTransaction,\n\tfee: bigint,\n): void {\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t(transaction.auth.spendingCondition as any).fee = fee;\n\t// In-place mutation: invalidate the memoized serialization (resolveFee may\n\t// have already serialized this object via minimumFee/estimateFee).\n\tclearTxCache(transaction);\n}\n\n/** Throw when a named fee tier is used with a provider (wallet) account. */\nexport function assertNoFeeTierForProvider(fee: FeeParam | undefined): void {\n\tif (isFeeTier(fee)) {\n\t\tthrow new Error(\n\t\t\t`Fee tier '${fee}' requires local signing; provider (wallet) accounts set their own fee`,\n\t\t);\n\t}\n}\n",
16
+ "import type { ClarityValue } from \"../../clarity/types.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport { buildContractCall } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { broadcastWithNonceReset, resolveNonce } from \"./nonceManager.ts\";\nimport {\n\ttype FeeParam,\n\tassertNoFeeTierForProvider,\n\tisFeeTier,\n\tisProviderAccount,\n\tresolveFee,\n\tsetUnsignedFee,\n} from \"./utils.ts\";\n\nexport type CallContractParams = {\n\tcontract: string; // \"address.name\"\n\tfunctionName: string;\n\tfunctionArgs?: ClarityValue[];\n\tfee?: FeeParam;\n\tnonce?: IntegerType;\n\tpostConditionMode?: \"allow\" | \"deny\";\n\tpostConditions?: PostCondition[];\n};\n\n/** Build, sign, and broadcast a contract call */\nexport async function callContract(\n\tclient: Client,\n\tparams: CallContractParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\t// Validate the contract id up front so both the provider and local paths\n\t// reject malformed input instead of forwarding it to the wallet.\n\tconst [contractAddress, contractName] = parseContractId(params.contract);\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tassertNoFeeTierForProvider(params.fee);\n\t\tconst result = await account.provider.request(\"stx_callContract\", {\n\t\t\tcontract: params.contract,\n\t\t\tfunctionName: params.functionName,\n\t\t\tfunctionArgs: params.functionArgs ?? [],\n\t\t});\n\t\treturn result.txid;\n\t}\n\n\t// Local/Custom: build → sign → broadcast\n\tconst nonce = params.nonce ?? (await resolveNonce(client, account.address));\n\n\tconst needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);\n\n\tconst unsigned = buildContractCall({\n\t\tcontractAddress,\n\t\tcontractName,\n\t\tfunctionName: params.functionName,\n\t\tfunctionArgs: params.functionArgs ?? [],\n\t\tfee: needsFeeResolution ? 0n : (params.fee as IntegerType),\n\t\tnonce,\n\t\tpublicKey: account.publicKey,\n\t\tchain: client.chain,\n\t\tpostConditionMode: params.postConditionMode,\n\t\tpostConditions: params.postConditions,\n\t});\n\n\tif (needsFeeResolution) {\n\t\tsetUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));\n\t}\n\n\tconst signed = await signTransactionWithAccount(unsigned, account);\n\treturn broadcastWithNonceReset(client, {\n\t\ttransaction: signed,\n\t\taddress: account.address,\n\t});\n}\n"
15
17
  ],
16
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,iBAAiB,CACzB,GAC2D;AAAA,EAC3D,OACC,OAAO,MAAM,YACb,MAAM,QACN,cAAc,KACd,SAAS,MACR,OAAQ,EAA8B,aAAa,YACnD,OAAQ,EAA8B,aAAa,cACnD,OAAQ,EAA8B,QAAQ,YAC9C,OAAQ,EAA8B,QAAQ;AAAA;AAIjD,eAAsB,WAAW,CAChC,QACA,QAC2B;AAAA,EAC3B,MAAM,aAAa,WAAW,iBAAiB,OAAO,YAAY,OAAO,CAAC;AAAA,EAC1E,MAAM,QAAQ,WAAW,qBAAqB,OAAO,WAAW,CAAC;AAAA,EAEjE,MAAM,OAAO,MAAM,OAAO,QAAQ,wBAAwB;AAAA,IACzD,QAAQ;AAAA,IACR,MAAM;AAAA,MACL,eAAe,KAAK,KAAK,MAAM,SAAS,CAAC;AAAA,MACzC,qBAAqB,KAAK;AAAA,IAC3B;AAAA,EACD,C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;AAAA,IACA,WAAW,QAAQ;AAAA,IACnB,OAAO,OAAO;AAAA,IACd,mBAAmB,OAAO;AAAA,IAC1B,gBAAgB,OAAO;AAAA,EACxB,CAAC;AAAA,EAED,IAAI,oBAAoB;AAAA,IACvB,eAAe,UAAU,MAAM,WAAW,QAAQ,UAAU,OAAO,GAAG,CAAC;AAAA,EACxE;AAAA,EAEA,MAAM,SAAS,MAAM,2BAA2B,UAAU,OAAO;AAAA,EACjE,OAAO,wBAAwB,QAAQ;AAAA,IACtC,aAAa;AAAA,IACb,SAAS,QAAQ;AAAA,EAClB,CAAC;AAAA;",
19
+ "debugId": "7E04DC84B2A9298B64756E2164756E21",
18
20
  "names": []
19
21
  }
@@ -1,3 +1,10 @@
1
+ // src/postconditions/index.ts
2
+ var exports_postconditions = {};
3
+ __export(exports_postconditions, {
4
+ Pc: () => Pc
5
+ });
6
+ module.exports = __toCommonJS(exports_postconditions);
7
+
1
8
  // src/postconditions/builder.ts
2
9
  class PartialPcWithPrincipal {
3
10
  address;
@@ -108,5 +115,5 @@ var Pc = {
108
115
  }
109
116
  };
110
117
 
111
- //# debugId=AD0585B08DA6241D64756E2164756E21
112
- //# sourceMappingURL=stacks-8e5atbps.cjs.map
118
+ //# debugId=60B2774FE4E4DD2564756E2164756E21
119
+ //# sourceMappingURL=stacks-dr5en54r.cjs.map
@@ -4,7 +4,7 @@
4
4
  "sourcesContent": [
5
5
  "import type { ClarityValue } from \"../clarity/types.ts\";\nimport { parseContractId, validateStacksAddress } from \"../utils/address.ts\";\nimport { type IntegerType, intToBigInt } from \"../utils/encoding.ts\";\nimport type {\n\tFtPostCondition,\n\tFungibleComparator,\n\tNftPostCondition,\n\tNonFungibleComparator,\n\tStxPostCondition,\n} from \"./types.ts\";\n\nclass PartialPcWithPrincipal {\n\tconstructor(private address: string) {}\n\n\twillSendEq(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"eq\");\n\t}\n\twillSendGte(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"gte\");\n\t}\n\twillSendGt(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"gt\");\n\t}\n\twillSendLte(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"lte\");\n\t}\n\twillSendLt(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"lt\");\n\t}\n\twillSendAsset() {\n\t\treturn new PartialPcNftWithCode(this.address, \"sent\");\n\t}\n\twillNotSendAsset() {\n\t\treturn new PartialPcNftWithCode(this.address, \"not-sent\");\n\t}\n}\n\nclass PartialPcFtWithCode {\n\tconstructor(\n\t\tprivate address: string,\n\t\tprivate amount: IntegerType,\n\t\tprivate code: FungibleComparator,\n\t) {}\n\n\tustx(): StxPostCondition {\n\t\treturn {\n\t\t\ttype: \"stx-postcondition\",\n\t\t\taddress: this.address,\n\t\t\tcondition: this.code,\n\t\t\tamount: intToBigInt(this.amount).toString(),\n\t\t};\n\t}\n\n\tft(contractId: string, tokenName: string): FtPostCondition {\n\t\tconst [address, name] = contractId.split(\".\");\n\t\tif (!address || !validateStacksAddress(address) || !name) {\n\t\t\tthrow new Error(`Invalid contract id: ${contractId}`);\n\t\t}\n\t\treturn {\n\t\t\ttype: \"ft-postcondition\",\n\t\t\taddress: this.address,\n\t\t\tcondition: this.code,\n\t\t\tamount: intToBigInt(this.amount).toString(),\n\t\t\tasset: `${contractId}::${tokenName}`,\n\t\t};\n\t}\n}\n\nclass PartialPcNftWithCode {\n\tconstructor(\n\t\tprivate address: string,\n\t\tprivate code: NonFungibleComparator,\n\t) {}\n\n\tnft(\n\t\tassetOrContractId: string,\n\t\ttokenNameOrAssetId: string | ClarityValue,\n\t\tassetId?: ClarityValue,\n\t): NftPostCondition {\n\t\tlet contractAddress: string;\n\t\tlet contractName: string;\n\t\tlet tokenName: string;\n\t\tlet id: ClarityValue;\n\n\t\tif (assetId !== undefined) {\n\t\t\t// 3 args: contractId, tokenName, assetId\n\t\t\t[contractAddress, contractName] = parseContractId(assetOrContractId);\n\t\t\ttokenName = tokenNameOrAssetId as string;\n\t\t\tid = assetId;\n\t\t} else {\n\t\t\t// 2 args: assetString (addr.contract::token), assetId\n\t\t\tconst [principal, tName] = assetOrContractId.split(\"::\");\n\t\t\tif (!principal || !tName)\n\t\t\t\tthrow new Error(`Invalid asset name: ${assetOrContractId}`);\n\t\t\t[contractAddress, contractName] = parseContractId(principal);\n\t\t\ttokenName = tName;\n\t\t\tid = tokenNameOrAssetId as ClarityValue;\n\t\t}\n\n\t\tif (!validateStacksAddress(contractAddress)) {\n\t\t\tthrow new Error(`Invalid contract address: ${contractAddress}`);\n\t\t}\n\n\t\treturn {\n\t\t\ttype: \"nft-postcondition\",\n\t\t\taddress: this.address,\n\t\t\tcondition: this.code,\n\t\t\tasset: `${contractAddress}.${contractName}::${tokenName}`,\n\t\t\tassetId: id,\n\t\t};\n\t}\n}\n\nexport const Pc = {\n\tprincipal(address: string) {\n\t\tconst [addr, name] = address.split(\".\");\n\t\tif (\n\t\t\t!addr ||\n\t\t\t!validateStacksAddress(addr) ||\n\t\t\t(typeof name === \"string\" && !name)\n\t\t) {\n\t\t\tthrow new Error(`Invalid principal: ${address}`);\n\t\t}\n\t\treturn new PartialPcWithPrincipal(address);\n\t},\n\torigin() {\n\t\treturn new PartialPcWithPrincipal(\"origin\");\n\t},\n};\n"
6
6
  ],
7
- "mappings": ";AAWA,MAAM,uBAAuB;AAAA,EACR;AAAA,EAApB,WAAW,CAAS,SAAiB;AAAA,IAAjB;AAAA;AAAA,EAEpB,UAAU,CAAC,QAAqB;AAAA,IAC/B,OAAO,IAAI,oBAAoB,KAAK,SAAS,QAAQ,IAAI;AAAA;AAAA,EAE1D,WAAW,CAAC,QAAqB;AAAA,IAChC,OAAO,IAAI,oBAAoB,KAAK,SAAS,QAAQ,KAAK;AAAA;AAAA,EAE3D,UAAU,CAAC,QAAqB;AAAA,IAC/B,OAAO,IAAI,oBAAoB,KAAK,S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AAsB,SAAS;AAAA,IAChD;AAAA,IACA,OAAO,IAAI,uBAAuB,OAAO;AAAA;AAAA,EAE1C,MAAM,GAAG;AAAA,IACR,OAAO,IAAI,uBAAuB,QAAQ;AAAA;AAE5C;",
8
+ "debugId": "60B2774FE4E4DD2564756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -115,8 +115,7 @@ var Pc = {
115
115
  return new PartialPcWithPrincipal("origin");
116
116
  }
117
117
  };
118
-
119
118
  export { Pc };
120
119
 
121
- //# debugId=596DCED919FAD1C264756E2164756E21
122
- //# sourceMappingURL=stacks-bm49tsh0.js.map
120
+ //# debugId=A955F701F76F44AE64756E2164756E21
121
+ //# sourceMappingURL=stacks-fse1f76h.js.map
@@ -5,6 +5,6 @@
5
5
  "import type { ClarityValue } from \"../clarity/types.ts\";\nimport { parseContractId, validateStacksAddress } from \"../utils/address.ts\";\nimport { type IntegerType, intToBigInt } from \"../utils/encoding.ts\";\nimport type {\n\tFtPostCondition,\n\tFungibleComparator,\n\tNftPostCondition,\n\tNonFungibleComparator,\n\tStxPostCondition,\n} from \"./types.ts\";\n\nclass PartialPcWithPrincipal {\n\tconstructor(private address: string) {}\n\n\twillSendEq(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"eq\");\n\t}\n\twillSendGte(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"gte\");\n\t}\n\twillSendGt(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"gt\");\n\t}\n\twillSendLte(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"lte\");\n\t}\n\twillSendLt(amount: IntegerType) {\n\t\treturn new PartialPcFtWithCode(this.address, amount, \"lt\");\n\t}\n\twillSendAsset() {\n\t\treturn new PartialPcNftWithCode(this.address, \"sent\");\n\t}\n\twillNotSendAsset() {\n\t\treturn new PartialPcNftWithCode(this.address, \"not-sent\");\n\t}\n}\n\nclass PartialPcFtWithCode {\n\tconstructor(\n\t\tprivate address: string,\n\t\tprivate amount: IntegerType,\n\t\tprivate code: FungibleComparator,\n\t) {}\n\n\tustx(): StxPostCondition {\n\t\treturn {\n\t\t\ttype: \"stx-postcondition\",\n\t\t\taddress: this.address,\n\t\t\tcondition: this.code,\n\t\t\tamount: intToBigInt(this.amount).toString(),\n\t\t};\n\t}\n\n\tft(contractId: string, tokenName: string): FtPostCondition {\n\t\tconst [address, name] = contractId.split(\".\");\n\t\tif (!address || !validateStacksAddress(address) || !name) {\n\t\t\tthrow new Error(`Invalid contract id: ${contractId}`);\n\t\t}\n\t\treturn {\n\t\t\ttype: \"ft-postcondition\",\n\t\t\taddress: this.address,\n\t\t\tcondition: this.code,\n\t\t\tamount: intToBigInt(this.amount).toString(),\n\t\t\tasset: `${contractId}::${tokenName}`,\n\t\t};\n\t}\n}\n\nclass PartialPcNftWithCode {\n\tconstructor(\n\t\tprivate address: string,\n\t\tprivate code: NonFungibleComparator,\n\t) {}\n\n\tnft(\n\t\tassetOrContractId: string,\n\t\ttokenNameOrAssetId: string | ClarityValue,\n\t\tassetId?: ClarityValue,\n\t): NftPostCondition {\n\t\tlet contractAddress: string;\n\t\tlet contractName: string;\n\t\tlet tokenName: string;\n\t\tlet id: ClarityValue;\n\n\t\tif (assetId !== undefined) {\n\t\t\t// 3 args: contractId, tokenName, assetId\n\t\t\t[contractAddress, contractName] = parseContractId(assetOrContractId);\n\t\t\ttokenName = tokenNameOrAssetId as string;\n\t\t\tid = assetId;\n\t\t} else {\n\t\t\t// 2 args: assetString (addr.contract::token), assetId\n\t\t\tconst [principal, tName] = assetOrContractId.split(\"::\");\n\t\t\tif (!principal || !tName)\n\t\t\t\tthrow new Error(`Invalid asset name: ${assetOrContractId}`);\n\t\t\t[contractAddress, contractName] = parseContractId(principal);\n\t\t\ttokenName = tName;\n\t\t\tid = tokenNameOrAssetId as ClarityValue;\n\t\t}\n\n\t\tif (!validateStacksAddress(contractAddress)) {\n\t\t\tthrow new Error(`Invalid contract address: ${contractAddress}`);\n\t\t}\n\n\t\treturn {\n\t\t\ttype: \"nft-postcondition\",\n\t\t\taddress: this.address,\n\t\t\tcondition: this.code,\n\t\t\tasset: `${contractAddress}.${contractName}::${tokenName}`,\n\t\t\tassetId: id,\n\t\t};\n\t}\n}\n\nexport const Pc = {\n\tprincipal(address: string) {\n\t\tconst [addr, name] = address.split(\".\");\n\t\tif (\n\t\t\t!addr ||\n\t\t\t!validateStacksAddress(addr) ||\n\t\t\t(typeof name === \"string\" && !name)\n\t\t) {\n\t\t\tthrow new Error(`Invalid principal: ${address}`);\n\t\t}\n\t\treturn new PartialPcWithPrincipal(address);\n\t},\n\torigin() {\n\t\treturn new PartialPcWithPrincipal(\"origin\");\n\t},\n};\n"
6
6
  ],
7
7
  "mappings": ";;;;;;;;;AAWA,MAAM,uBAAuB;AAAA,EACR;AAAA,EAApB,WAAW,CAAS,SAAiB;AAAA,IAAjB;AAAA;AAAA,EAEpB,UAAU,CAAC,QAAqB;AAAA,IAC/B,OAAO,IAAI,oBAAoB,KAAK,SAAS,QAAQ,IAAI;AAAA;AAAA,EAE1D,WAAW,CAAC,QAAqB;AAAA,IAChC,OAAO,IAAI,oBAAoB,KAAK,SAAS,QAAQ,KAAK;AAAA;AAAA,EAE3D,UAAU,CAAC,QAAqB;AAAA,IAC/B,OAAO,IAAI,oBAAoB,KAAK,SAAS,QAAQ,IAAI;AAAA;AAAA,EAE1D,WAAW,CAAC,QAAqB;AAAA,IAChC,OAAO,IAAI,oBAAoB,KAAK,SAAS,QAAQ,KAAK;AAAA;AAAA,EAE3D,UAAU,CAAC,QAAqB;AAAA,IAC/B,OAAO,IAAI,oBAAoB,KAAK,SAAS,QAAQ,IAAI;AAAA;AAAA,EAE1D,aAAa,GAAG;AAAA,IACf,OAAO,IAAI,qBAAqB,KAAK,SAAS,MAAM;AAAA;AAAA,EAErD,gBAAgB,GAAG;AAAA,IAClB,OAAO,IAAI,qBAAqB,KAAK,SAAS,UAAU;AAAA;AAE1D;AAA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AiB,YAAY,IAAI,gBAAgB,SAAS;AAAA,MAC3D,YAAY;AAAA,MACZ,KAAK;AAAA;AAAA,IAGN,IAAI,CAAC,sBAAsB,eAAe,GAAG;AAAA,MAC5C,MAAM,IAAI,MAAM,6BAA6B,iBAAiB;AAAA,IAC/D;AAAA,IAEA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS,KAAK;AAAA,MACd,WAAW,KAAK;AAAA,MAChB,OAAO,GAAG,mBAAmB,iBAAiB;AAAA,MAC9C,SAAS;AAAA,IACV;AAAA;AAEF;AAEO,IAAM,KAAK;AAAA,EACjB,SAAS,CAAC,SAAiB;AAAA,IAC1B,OAAO,MAAM,QAAQ,QAAQ,MAAM,GAAG;AAAA,IACtC,IACC,CAAC,QACD,CAAC,sBAAsB,IAAI,KAC1B,OAAO,SAAS,YAAY,CAAC,MAC7B;AAAA,MACD,MAAM,IAAI,MAAM,sBAAsB,SAAS;AAAA,IAChD;AAAA,IACA,OAAO,IAAI,uBAAuB,OAAO;AAAA;AAAA,EAE1C,MAAM,GAAG;AAAA,IACR,OAAO,IAAI,uBAAuB,QAAQ;AAAA;AAE5C;",
8
- "debugId": "596DCED919FAD1C264756E2164756E21",
8
+ "debugId": "A955F701F76F44AE64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,3 +1,8 @@
1
+ // src/errors/response.ts
2
+ class MalformedResponseError extends BaseError {
3
+ name = "MalformedResponseError";
4
+ }
5
+
1
6
  // src/actions/public/readContract.ts
2
7
  async function readContract(client, params) {
3
8
  const [address, name] = parseContractId(params.contract);
@@ -17,5 +22,5 @@ async function readContract(client, params) {
17
22
  throw new Error(data.cause ?? "Read-only call failed");
18
23
  }
19
24
 
20
- //# debugId=A685DA67AFAB0E6764756E2164756E21
21
- //# sourceMappingURL=stacks-b221qkst.cjs.map
25
+ //# debugId=E26625FCD8E1B4DA64756E2164756E21
26
+ //# sourceMappingURL=stacks-nyaw1z2a.cjs.map
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/actions/public/readContract.ts"],
3
+ "sources": ["../src/errors/response.ts", "../src/actions/public/readContract.ts"],
4
4
  "sourcesContent": [
5
+ "import { BaseError } from \"./base.ts\";\n\n/** Thrown when a node/API response is missing an expected field. */\nexport class MalformedResponseError extends BaseError {\n\toverride name = \"MalformedResponseError\";\n}\n",
5
6
  "import { deserializeCVBytes } from \"../../clarity/deserialize.ts\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\nimport { bytesToHex, with0x } from \"../../utils/encoding.ts\";\n\nexport type ReadContractParams = {\n\tcontract: string; // \"address.name\"\n\tfunctionName: string;\n\targs?: ClarityValue[];\n\tsender?: string;\n\t/**\n\t * Nakamoto StacksBlockId to evaluate against. Without it the node answers\n\t * at its own moving tip, which makes a read non-deterministic — the same\n\t * reindex of the same block can return a different value.\n\t */\n\ttip?: string;\n};\n\nexport async function readContract<T extends ClarityValue = ClarityValue>(\n\tclient: Client,\n\tparams: ReadContractParams,\n): Promise<T> {\n\tconst [address, name] = parseContractId(params.contract);\n\tconst sender = params.sender ?? address;\n\n\tconst serializedArgs = (params.args ?? []).map((arg) =>\n\t\twith0x(bytesToHex(serializeCVBytes(arg))),\n\t);\n\n\tconst path = `/v2/contracts/call-read/${address}/${name}/${params.functionName}`;\n\tconst data = await client.request(\n\t\tparams.tip ? `${path}?tip=${params.tip}` : path,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\tbody: {\n\t\t\t\tsender,\n\t\t\t\targuments: serializedArgs,\n\t\t\t},\n\t\t},\n\t);\n\n\tif (data.okay) {\n\t\treturn deserializeCVBytes<T>(data.result);\n\t}\n\tthrow new Error(data.cause ?? \"Read-only call failed\");\n}\n"
6
7
  ],
7
- "mappings": ";;;;;;;;;;;;;AAoBA,eAAsB,YAAmD,CACxE,QACA,QACa;AAA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IAAI,MAAM,KAAK,SAAS,uBAAuB;AAAA;",
9
+ "debugId": "E26625FCD8E1B4DA64756E2164756E21",
9
10
  "names": []
10
11
  }
@@ -1,23 +1,3 @@
1
- import {
2
- MalformedResponseError
3
- } from "./stacks-fh48neva.js";
4
- import {
5
- BaseError
6
- } from "./stacks-709tra19.js";
7
- import {
8
- clearTxCache,
9
- getTransactionId,
10
- serializePayload,
11
- serializeTransaction
12
- } from "./stacks-jx146qf1.js";
13
- import {
14
- deserializeCVBytes
15
- } from "./stacks-ttdk2g2f.js";
16
- import {
17
- bytesToHex,
18
- intToBigInt
19
- } from "./stacks-qs5fzts5.js";
20
-
21
1
  // src/actions/public/estimateFee.ts
22
2
  function isValidEstimation(e) {
23
3
  return typeof e === "object" && e !== null && "fee_rate" in e && "fee" in e && (typeof e.fee_rate === "number" || typeof e.fee_rate === "string") && (typeof e.fee === "number" || typeof e.fee === "string");
@@ -63,6 +43,20 @@ class HttpRequestError extends BaseError {
63
43
  }
64
44
  }
65
45
 
46
+ // src/actions/public/getMapEntry.ts
47
+ async function getMapEntry(client, params) {
48
+ const [address, name] = parseContractId(params.contract);
49
+ const serializedKey = with0x(bytesToHex(serializeCVBytes(params.key)));
50
+ const data = await client.request(`/v2/map_entry/${address}/${name}/${params.mapName}`, {
51
+ method: "POST",
52
+ body: serializedKey
53
+ });
54
+ if (typeof data?.data !== "string") {
55
+ throw new MalformedResponseError(`getMapEntry: /v2/map_entry/${address}/${name}/${params.mapName} response is missing "data"`);
56
+ }
57
+ return deserializeCVBytes(data.data);
58
+ }
59
+
66
60
  // src/actions/public/getNonce.ts
67
61
  async function getNonce(client, params) {
68
62
  const data = await client.request(`/v2/accounts/${params.address}`, {
@@ -490,7 +484,44 @@ function assertNoFeeTierForProvider(fee) {
490
484
  }
491
485
  }
492
486
 
493
- export { estimateFee, getBlockHeight, HttpRequestError, getNonce, extendedApiSource, indexTxSource, TransactionError, BroadcastError, TransactionAbortedError, TransactionDroppedError, WaitForTransactionTimeoutError, SerializationError, SigningError, waitForTransactionReceipt, sendTransaction, jsonRpcSource, memoryStore, createNonceManager, resolveNonce, reconcileNonce, startNonceReconciler, isNonceConflictError, broadcastWithNonceReset, isProviderAccount, isFeeTier, minimumFee, resolveFee, setUnsignedFee, assertNoFeeTierForProvider };
487
+ // src/actions/wallet/callContract.ts
488
+ async function callContract(client, params) {
489
+ const account = client.account;
490
+ if (!account)
491
+ throw new Error("Account required");
492
+ const [contractAddress, contractName] = parseContractId(params.contract);
493
+ if (isProviderAccount(account)) {
494
+ assertNoFeeTierForProvider(params.fee);
495
+ const result = await account.provider.request("stx_callContract", {
496
+ contract: params.contract,
497
+ functionName: params.functionName,
498
+ functionArgs: params.functionArgs ?? []
499
+ });
500
+ return result.txid;
501
+ }
502
+ const nonce = params.nonce ?? await resolveNonce(client, account.address);
503
+ const needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);
504
+ const unsigned = buildContractCall({
505
+ contractAddress,
506
+ contractName,
507
+ functionName: params.functionName,
508
+ functionArgs: params.functionArgs ?? [],
509
+ fee: needsFeeResolution ? 0n : params.fee,
510
+ nonce,
511
+ publicKey: account.publicKey,
512
+ chain: client.chain,
513
+ postConditionMode: params.postConditionMode,
514
+ postConditions: params.postConditions
515
+ });
516
+ if (needsFeeResolution) {
517
+ setUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));
518
+ }
519
+ const signed = await signTransactionWithAccount(unsigned, account);
520
+ return broadcastWithNonceReset(client, {
521
+ transaction: signed,
522
+ address: account.address
523
+ });
524
+ }
494
525
 
495
- //# debugId=9367C23DC56A284164756E2164756E21
496
- //# sourceMappingURL=stacks-9d2d0qjc.js.map
526
+ //# debugId=B1D5C24E13F4B8DE64756E2164756E21
527
+ //# sourceMappingURL=stacks-tdsp5gsb.cjs.map