@secondlayer/stacks 0.0.1

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 (178) hide show
  1. package/README.md +92 -0
  2. package/dist/shared/stacks-02actsrx.cjs +17 -0
  3. package/dist/shared/stacks-02actsrx.cjs.map +10 -0
  4. package/dist/shared/stacks-1aqm7c2h.cjs +110 -0
  5. package/dist/shared/stacks-1aqm7c2h.cjs.map +11 -0
  6. package/dist/shared/stacks-24h5k94q.cjs +74 -0
  7. package/dist/shared/stacks-24h5k94q.cjs.map +11 -0
  8. package/dist/shared/stacks-2ar4prfz.cjs +328 -0
  9. package/dist/shared/stacks-2ar4prfz.cjs.map +11 -0
  10. package/dist/shared/stacks-4py5pm0r.cjs +237 -0
  11. package/dist/shared/stacks-4py5pm0r.cjs.map +10 -0
  12. package/dist/shared/stacks-5tprhns9.cjs +54 -0
  13. package/dist/shared/stacks-5tprhns9.cjs.map +11 -0
  14. package/dist/shared/stacks-61rvzkz1.cjs +132 -0
  15. package/dist/shared/stacks-61rvzkz1.cjs.map +17 -0
  16. package/dist/shared/stacks-709tra19.js +30 -0
  17. package/dist/shared/stacks-709tra19.js.map +10 -0
  18. package/dist/shared/stacks-74k8cxgb.cjs +567 -0
  19. package/dist/shared/stacks-74k8cxgb.cjs.map +13 -0
  20. package/dist/shared/stacks-8m9byk2j.js +7 -0
  21. package/dist/shared/stacks-8m9byk2j.js.map +9 -0
  22. package/dist/shared/stacks-8yykgdww.js +125 -0
  23. package/dist/shared/stacks-8yykgdww.js.map +11 -0
  24. package/dist/shared/stacks-9g0jhab3.cjs +40 -0
  25. package/dist/shared/stacks-9g0jhab3.cjs.map +10 -0
  26. package/dist/shared/stacks-an5k8n4t.cjs +291 -0
  27. package/dist/shared/stacks-an5k8n4t.cjs.map +23 -0
  28. package/dist/shared/stacks-b008c3w8.cjs +214 -0
  29. package/dist/shared/stacks-b008c3w8.cjs.map +11 -0
  30. package/dist/shared/stacks-bnvfmt7y.cjs +31 -0
  31. package/dist/shared/stacks-bnvfmt7y.cjs.map +9 -0
  32. package/dist/shared/stacks-bycy6t9k.js +22 -0
  33. package/dist/shared/stacks-bycy6t9k.js.map +10 -0
  34. package/dist/shared/stacks-d1fmkv3p.js +258 -0
  35. package/dist/shared/stacks-d1fmkv3p.js.map +13 -0
  36. package/dist/shared/stacks-dr5en54r.cjs +119 -0
  37. package/dist/shared/stacks-dr5en54r.cjs.map +10 -0
  38. package/dist/shared/stacks-dxhntr76.js +278 -0
  39. package/dist/shared/stacks-dxhntr76.js.map +10 -0
  40. package/dist/shared/stacks-evnzth1q.cjs +35 -0
  41. package/dist/shared/stacks-evnzth1q.cjs.map +10 -0
  42. package/dist/shared/stacks-f3tk2k5s.js +27 -0
  43. package/dist/shared/stacks-f3tk2k5s.js.map +9 -0
  44. package/dist/shared/stacks-f7wdrzs3.js +285 -0
  45. package/dist/shared/stacks-f7wdrzs3.js.map +11 -0
  46. package/dist/shared/stacks-fcaefc5b.cjs +16 -0
  47. package/dist/shared/stacks-fcaefc5b.cjs.map +10 -0
  48. package/dist/shared/stacks-g9mcjcqg.cjs +3 -0
  49. package/dist/shared/stacks-g9mcjcqg.cjs.map +9 -0
  50. package/dist/shared/stacks-gck1sq7h.cjs +28 -0
  51. package/dist/shared/stacks-gck1sq7h.cjs.map +10 -0
  52. package/dist/shared/stacks-gjvbq6w7.js +46 -0
  53. package/dist/shared/stacks-gjvbq6w7.js.map +10 -0
  54. package/dist/shared/stacks-j2cy7qtt.js +237 -0
  55. package/dist/shared/stacks-j2cy7qtt.js.map +11 -0
  56. package/dist/shared/stacks-k08tgzyp.cjs +232 -0
  57. package/dist/shared/stacks-k08tgzyp.cjs.map +13 -0
  58. package/dist/shared/stacks-k2p5tv6x.js +37 -0
  59. package/dist/shared/stacks-k2p5tv6x.js.map +10 -0
  60. package/dist/shared/stacks-k58k970n.js +234 -0
  61. package/dist/shared/stacks-k58k970n.js.map +10 -0
  62. package/dist/shared/stacks-n2g56wgg.js +338 -0
  63. package/dist/shared/stacks-n2g56wgg.js.map +23 -0
  64. package/dist/shared/stacks-nqytwfcc.js +243 -0
  65. package/dist/shared/stacks-nqytwfcc.js.map +11 -0
  66. package/dist/shared/stacks-qcae5852.js +19 -0
  67. package/dist/shared/stacks-qcae5852.js.map +10 -0
  68. package/dist/shared/stacks-qt8ehebn.js +76 -0
  69. package/dist/shared/stacks-qt8ehebn.js.map +11 -0
  70. package/dist/shared/stacks-qvg7c24g.cjs +232 -0
  71. package/dist/shared/stacks-qvg7c24g.cjs.map +10 -0
  72. package/dist/shared/stacks-r1t6g3c3.cjs +241 -0
  73. package/dist/shared/stacks-r1t6g3c3.cjs.map +11 -0
  74. package/dist/shared/stacks-tjxmrssa.js +282 -0
  75. package/dist/shared/stacks-tjxmrssa.js.map +11 -0
  76. package/dist/shared/stacks-v9jqcpd4.js +18 -0
  77. package/dist/shared/stacks-v9jqcpd4.js.map +10 -0
  78. package/dist/shared/stacks-vdfag81a.cjs +121 -0
  79. package/dist/shared/stacks-vdfag81a.cjs.map +10 -0
  80. package/dist/shared/stacks-vdfs3e5v.js +134 -0
  81. package/dist/shared/stacks-vdfs3e5v.js.map +10 -0
  82. package/dist/shared/stacks-y3dh7hv1.js +60 -0
  83. package/dist/shared/stacks-y3dh7hv1.js.map +11 -0
  84. package/dist/shared/stacks-ya3x01yd.cjs +16 -0
  85. package/dist/shared/stacks-ya3x01yd.cjs.map +10 -0
  86. package/dist/shared/stacks-yfgsm6ap.js +599 -0
  87. package/dist/shared/stacks-yfgsm6ap.js.map +13 -0
  88. package/dist/shared/stacks-yfveb68e.js +121 -0
  89. package/dist/shared/stacks-yfveb68e.js.map +10 -0
  90. package/dist/shared/stacks-zm0b3tgy.js +160 -0
  91. package/dist/shared/stacks-zm0b3tgy.js.map +17 -0
  92. package/dist/shared/stacks-zyv9qqme.cjs +249 -0
  93. package/dist/shared/stacks-zyv9qqme.cjs.map +11 -0
  94. package/dist/src/accounts/index.cjs +90 -0
  95. package/dist/src/accounts/index.cjs.map +12 -0
  96. package/dist/src/accounts/index.d.cts +47 -0
  97. package/dist/src/accounts/index.d.ts +47 -0
  98. package/dist/src/accounts/index.js +104 -0
  99. package/dist/src/accounts/index.js.map +12 -0
  100. package/dist/src/actions/index.cjs +36 -0
  101. package/dist/src/actions/index.cjs.map +9 -0
  102. package/dist/src/actions/index.d.cts +886 -0
  103. package/dist/src/actions/index.d.ts +886 -0
  104. package/dist/src/actions/index.js +81 -0
  105. package/dist/src/actions/index.js.map +9 -0
  106. package/dist/src/bns/index.cjs +590 -0
  107. package/dist/src/bns/index.cjs.map +15 -0
  108. package/dist/src/bns/index.d.cts +241 -0
  109. package/dist/src/bns/index.d.ts +241 -0
  110. package/dist/src/bns/index.js +611 -0
  111. package/dist/src/bns/index.js.map +15 -0
  112. package/dist/src/chains/index.cjs +13 -0
  113. package/dist/src/chains/index.cjs.map +9 -0
  114. package/dist/src/chains/index.d.cts +53 -0
  115. package/dist/src/chains/index.d.ts +53 -0
  116. package/dist/src/chains/index.js +18 -0
  117. package/dist/src/chains/index.js.map +9 -0
  118. package/dist/src/clarity/index.cjs +3 -0
  119. package/dist/src/clarity/index.cjs.map +9 -0
  120. package/dist/src/clarity/index.d.cts +821 -0
  121. package/dist/src/clarity/index.d.ts +821 -0
  122. package/dist/src/clarity/index.js +145 -0
  123. package/dist/src/clarity/index.js.map +9 -0
  124. package/dist/src/connect/index.cjs +480 -0
  125. package/dist/src/connect/index.cjs.map +19 -0
  126. package/dist/src/connect/index.d.cts +110 -0
  127. package/dist/src/connect/index.d.ts +110 -0
  128. package/dist/src/connect/index.js +448 -0
  129. package/dist/src/connect/index.js.map +19 -0
  130. package/dist/src/connect/walletconnect/index.cjs +1322 -0
  131. package/dist/src/connect/walletconnect/index.cjs.map +18 -0
  132. package/dist/src/connect/walletconnect/index.d.cts +132 -0
  133. package/dist/src/connect/walletconnect/index.d.ts +132 -0
  134. package/dist/src/connect/walletconnect/index.js +1290 -0
  135. package/dist/src/connect/walletconnect/index.js.map +18 -0
  136. package/dist/src/index.cjs +557 -0
  137. package/dist/src/index.cjs.map +21 -0
  138. package/dist/src/index.d.cts +847 -0
  139. package/dist/src/index.d.ts +847 -0
  140. package/dist/src/index.js +629 -0
  141. package/dist/src/index.js.map +21 -0
  142. package/dist/src/postconditions/index.cjs +3 -0
  143. package/dist/src/postconditions/index.cjs.map +9 -0
  144. package/dist/src/postconditions/index.d.cts +91 -0
  145. package/dist/src/postconditions/index.d.ts +91 -0
  146. package/dist/src/postconditions/index.js +12 -0
  147. package/dist/src/postconditions/index.js.map +9 -0
  148. package/dist/src/pox/index.cjs +860 -0
  149. package/dist/src/pox/index.cjs.map +15 -0
  150. package/dist/src/pox/index.d.cts +244 -0
  151. package/dist/src/pox/index.d.ts +244 -0
  152. package/dist/src/pox/index.js +877 -0
  153. package/dist/src/pox/index.js.map +15 -0
  154. package/dist/src/stackingdao/index.cjs +300 -0
  155. package/dist/src/stackingdao/index.cjs.map +13 -0
  156. package/dist/src/stackingdao/index.d.cts +179 -0
  157. package/dist/src/stackingdao/index.d.ts +179 -0
  158. package/dist/src/stackingdao/index.js +318 -0
  159. package/dist/src/stackingdao/index.js.map +13 -0
  160. package/dist/src/subscriptions/index.cjs +14 -0
  161. package/dist/src/subscriptions/index.cjs.map +9 -0
  162. package/dist/src/subscriptions/index.d.cts +250 -0
  163. package/dist/src/subscriptions/index.d.ts +250 -0
  164. package/dist/src/subscriptions/index.js +21 -0
  165. package/dist/src/subscriptions/index.js.map +9 -0
  166. package/dist/src/transactions/index.cjs +50 -0
  167. package/dist/src/transactions/index.cjs.map +9 -0
  168. package/dist/src/transactions/index.d.cts +412 -0
  169. package/dist/src/transactions/index.d.ts +412 -0
  170. package/dist/src/transactions/index.js +101 -0
  171. package/dist/src/transactions/index.js.map +9 -0
  172. package/dist/src/utils/index.cjs +168 -0
  173. package/dist/src/utils/index.cjs.map +11 -0
  174. package/dist/src/utils/index.d.cts +140 -0
  175. package/dist/src/utils/index.d.ts +140 -0
  176. package/dist/src/utils/index.js +222 -0
  177. package/dist/src/utils/index.js.map +11 -0
  178. package/package.json +105 -0
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/stackingdao/abi.ts", "../src/stackingdao/constants.ts", "../src/stackingdao/actions.ts", "../src/stackingdao/index.ts"],
4
+ "sourcesContent": [
5
+ "import type { AbiContract } from \"../clarity/abi/contract.ts\";\n\nconst withdrawTuple = {\n tuple: [\n { name: \"stx-fee-amount\", type: \"uint128\" },\n { name: \"stx-user-amount\", type: \"uint128\" },\n ],\n} as const;\n\nexport const STACKING_DAO_CORE_ABI = {\n functions: [\n // Public — deposit STX, receive stSTX\n {\n name: \"deposit\",\n access: \"public\",\n args: [\n { name: \"reserve\", type: \"trait_reference\" },\n { name: \"commission-contract\", type: \"trait_reference\" },\n { name: \"staking-contract\", type: \"trait_reference\" },\n { name: \"direct-helpers\", type: \"trait_reference\" },\n { name: \"stx-amount\", type: \"uint128\" },\n { name: \"referrer\", type: { optional: \"principal\" } },\n { name: \"pool\", type: { optional: \"principal\" } },\n ],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n // Public — initiate withdrawal (burn stSTX, get NFT receipt)\n {\n name: \"init-withdraw\",\n access: \"public\",\n args: [\n { name: \"reserve\", type: \"trait_reference\" },\n { name: \"direct-helpers\", type: \"trait_reference\" },\n { name: \"ststx-amount\", type: \"uint128\" },\n ],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n // Public — finalize withdrawal (burn NFT, receive STX)\n {\n name: \"withdraw\",\n access: \"public\",\n args: [\n { name: \"reserve\", type: \"trait_reference\" },\n { name: \"commission-contract\", type: \"trait_reference\" },\n { name: \"staking-contract\", type: \"trait_reference\" },\n { name: \"nft-id\", type: \"uint128\" },\n ],\n outputs: { response: { ok: withdrawTuple, error: \"uint128\" } },\n },\n // Public — withdraw idle STX (instant, no NFT)\n {\n name: \"withdraw-idle\",\n access: \"public\",\n args: [\n { name: \"reserve\", type: \"trait_reference\" },\n { name: \"direct-helpers\", type: \"trait_reference\" },\n { name: \"commission-contract\", type: \"trait_reference\" },\n { name: \"staking-contract\", type: \"trait_reference\" },\n { name: \"ststx-amount\", type: \"uint128\" },\n ],\n outputs: { response: { ok: withdrawTuple, error: \"uint128\" } },\n },\n // Read-only — fees (direct values, no response wrapper)\n {\n name: \"get-stack-fee\",\n access: \"read-only\",\n args: [],\n outputs: \"uint128\",\n },\n {\n name: \"get-unstack-fee\",\n access: \"read-only\",\n args: [],\n outputs: \"uint128\",\n },\n {\n name: \"get-withdraw-idle-fee\",\n access: \"read-only\",\n args: [],\n outputs: \"uint128\",\n },\n // Read-only — shutdown state (direct bool, no response wrapper)\n {\n name: \"get-shutdown-deposits\",\n access: \"read-only\",\n args: [],\n outputs: \"bool\",\n },\n ],\n} as const satisfies AbiContract;\n\nexport const DATA_CORE_V1_ABI = {\n functions: [\n {\n name: \"get-withdrawals-by-nft\",\n access: \"read-only\",\n args: [{ name: \"nft-id\", type: \"uint128\" }],\n outputs: {\n tuple: [\n { name: \"ststx-amount\", type: \"uint128\" },\n { name: \"stx-amount\", type: \"uint128\" },\n { name: \"unlock-burn-height\", type: \"uint128\" },\n ],\n },\n },\n ],\n} as const satisfies AbiContract;\n\nexport const DATA_CORE_V3_ABI = {\n functions: [\n {\n name: \"get-stx-per-ststx-helper\",\n access: \"read-only\",\n args: [{ name: \"stx-amount\", type: \"uint128\" }],\n outputs: \"uint128\",\n },\n ],\n} as const satisfies AbiContract;\n\nexport const RESERVE_V1_ABI = {\n functions: [\n {\n name: \"get-total-stx\",\n access: \"read-only\",\n args: [],\n outputs: { response: { ok: \"uint128\", error: \"none\" } },\n },\n ],\n} as const satisfies AbiContract;\n",
6
+ "const DEPLOYER = \"SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG\";\n\nexport const STACKINGDAO_CONTRACTS = {\n core: { address: DEPLOYER, name: \"stacking-dao-core-v6\" },\n ststxToken: { address: DEPLOYER, name: \"ststx-token\" },\n withdrawNft: { address: DEPLOYER, name: \"ststx-withdraw-nft-v2\" },\n reserve: { address: DEPLOYER, name: \"reserve-v1\" },\n dataCore: { address: DEPLOYER, name: \"data-core-v3\" },\n dataCoreV1: { address: DEPLOYER, name: \"data-core-v1\" },\n} as const;\n\n/** Trait contracts auto-passed to core functions — users never need these. */\nexport const TRAIT_CONTRACTS = {\n reserve: `${DEPLOYER}.reserve-v1`,\n commission: `${DEPLOYER}.commission-v2`,\n directHelpers: `${DEPLOYER}.direct-helpers-v4`,\n staking: `${DEPLOYER}.staking-v0`,\n} as const;\n",
7
+ "import type { Client } from \"../clients/types.ts\";\nimport { getContract } from \"../actions/getContract.ts\";\nimport { SIP010_ABI } from \"../clarity/abi/standards.ts\";\nimport {\n STACKING_DAO_CORE_ABI,\n DATA_CORE_V1_ABI,\n DATA_CORE_V3_ABI,\n RESERVE_V1_ABI,\n} from \"./abi.ts\";\nimport { STACKINGDAO_CONTRACTS, TRAIT_CONTRACTS } from \"./constants.ts\";\nimport { Pc } from \"../postconditions/index.ts\";\nimport type {\n DepositParams,\n InitWithdrawParams,\n WithdrawParams,\n WithdrawIdleParams,\n ExchangeRateInfo,\n WithdrawalInfo,\n FeeInfo,\n} from \"./types.ts\";\n\nfunction assertMainnet(client: Client) {\n if (!client.chain) {\n throw new Error(\"Client must have a chain configured\");\n }\n if (client.chain.network !== \"mainnet\") {\n throw new Error(\"StackingDAO is only available on mainnet\");\n }\n}\n\nfunction getCoreContract(client: Client) {\n assertMainnet(client);\n const c = STACKINGDAO_CONTRACTS.core;\n return getContract({ client, address: c.address, name: c.name, abi: STACKING_DAO_CORE_ABI });\n}\n\nfunction getStstxToken(client: Client) {\n assertMainnet(client);\n const c = STACKINGDAO_CONTRACTS.ststxToken;\n return getContract({ client, address: c.address, name: c.name, abi: SIP010_ABI });\n}\n\nfunction getDataCoreV1(client: Client) {\n assertMainnet(client);\n const c = STACKINGDAO_CONTRACTS.dataCoreV1;\n return getContract({ client, address: c.address, name: c.name, abi: DATA_CORE_V1_ABI });\n}\n\nfunction getDataCoreV3(client: Client) {\n assertMainnet(client);\n const c = STACKINGDAO_CONTRACTS.dataCore;\n return getContract({ client, address: c.address, name: c.name, abi: DATA_CORE_V3_ABI });\n}\n\nfunction getReserveContract(client: Client) {\n assertMainnet(client);\n const c = STACKINGDAO_CONTRACTS.reserve;\n return getContract({ client, address: c.address, name: c.name, abi: RESERVE_V1_ABI });\n}\n\nconst traits = {\n reserve: TRAIT_CONTRACTS.reserve,\n commissionContract: TRAIT_CONTRACTS.commission,\n stakingContract: TRAIT_CONTRACTS.staking,\n directHelpers: TRAIT_CONTRACTS.directHelpers,\n};\n\n// ── User Actions ──\n\nexport async function deposit(client: Client, params: DepositParams): Promise<string> {\n const core = getCoreContract(client);\n return core.call.deposit(\n {\n ...traits,\n stxAmount: params.amount,\n referrer: params.referrer ?? null,\n pool: params.pool ?? null,\n },\n {\n postConditions: [\n Pc.principal(client.account!.address).willSendEq(params.amount).ustx(),\n ],\n },\n );\n}\n\nexport async function initWithdraw(client: Client, params: InitWithdrawParams): Promise<string> {\n const core = getCoreContract(client);\n const ststx = STACKINGDAO_CONTRACTS.ststxToken;\n return core.call[\"init-withdraw\"](\n {\n reserve: traits.reserve,\n directHelpers: traits.directHelpers,\n ststxAmount: params.ststxAmount,\n },\n {\n postConditions: [\n Pc.principal(client.account!.address)\n .willSendEq(params.ststxAmount)\n .ft(`${ststx.address}.${ststx.name}`, \"ststx\"),\n ],\n },\n );\n}\n\nexport async function withdraw(client: Client, params: WithdrawParams): Promise<string> {\n const core = getCoreContract(client);\n return core.call.withdraw({\n reserve: traits.reserve,\n commissionContract: traits.commissionContract,\n stakingContract: traits.stakingContract,\n nftId: params.nftId,\n });\n}\n\nexport async function withdrawIdle(client: Client, params: WithdrawIdleParams): Promise<string> {\n const core = getCoreContract(client);\n const ststx = STACKINGDAO_CONTRACTS.ststxToken;\n return core.call[\"withdraw-idle\"](\n {\n reserve: traits.reserve,\n directHelpers: traits.directHelpers,\n commissionContract: traits.commissionContract,\n stakingContract: traits.stakingContract,\n ststxAmount: params.ststxAmount,\n },\n {\n postConditions: [\n Pc.principal(client.account!.address)\n .willSendEq(params.ststxAmount)\n .ft(`${ststx.address}.${ststx.name}`, \"ststx\"),\n ],\n },\n );\n}\n\n// ── Read-only Queries ──\n\nexport async function getStSTXBalance(client: Client, address: string): Promise<bigint> {\n const token = getStstxToken(client);\n return (await token.read[\"get-balance\"]({ account: address })) as bigint;\n}\n\nexport async function getExchangeRate(client: Client): Promise<ExchangeRateInfo> {\n const reserve = getReserveContract(client);\n const dataV3 = getDataCoreV3(client);\n\n const [totalStx, ststxSupply] = await Promise.all([\n reserve.read[\"get-total-stx\"]({}) as Promise<bigint>,\n getTotalSupply(client),\n ]);\n\n const stxPerStstx = (await dataV3.read[\"get-stx-per-ststx-helper\"]({\n stxAmount: totalStx,\n })) as bigint;\n\n return { stxPerStstx, ststxSupply, totalStx };\n}\n\nexport async function getTotalSupply(client: Client): Promise<bigint> {\n const token = getStstxToken(client);\n return (await token.read[\"get-total-supply\"]({})) as bigint;\n}\n\nexport async function getWithdrawalInfo(\n client: Client,\n nftId: bigint,\n): Promise<WithdrawalInfo> {\n const dataV1 = getDataCoreV1(client);\n return (await dataV1.read[\"get-withdrawals-by-nft\"]({\n nftId,\n })) as WithdrawalInfo;\n}\n\nexport async function getFees(client: Client): Promise<FeeInfo> {\n const core = getCoreContract(client);\n const [stackFee, unstackFee, withdrawIdleFee] = await Promise.all([\n core.read[\"get-stack-fee\"]({}) as Promise<bigint>,\n core.read[\"get-unstack-fee\"]({}) as Promise<bigint>,\n core.read[\"get-withdraw-idle-fee\"]({}) as Promise<bigint>,\n ]);\n return { stackFee, unstackFee, withdrawIdleFee };\n}\n\nexport async function getReserveBalance(client: Client): Promise<bigint> {\n const reserve = getReserveContract(client);\n return (await reserve.read[\"get-total-stx\"]({})) as bigint;\n}\n\nexport async function getShutdownDeposits(client: Client): Promise<boolean> {\n const core = getCoreContract(client);\n return (await core.read[\"get-shutdown-deposits\"]({})) as boolean;\n}\n",
8
+ "import type { Client } from \"../clients/types.ts\";\nimport {\n deposit,\n initWithdraw,\n withdraw,\n withdrawIdle,\n getStSTXBalance,\n getExchangeRate,\n getTotalSupply,\n getWithdrawalInfo,\n getFees,\n getReserveBalance,\n getShutdownDeposits,\n} from \"./actions.ts\";\nimport type {\n DepositParams,\n InitWithdrawParams,\n WithdrawParams,\n WithdrawIdleParams,\n ExchangeRateInfo,\n WithdrawalInfo,\n FeeInfo,\n} from \"./types.ts\";\n\nexport type {\n DepositParams,\n InitWithdrawParams,\n WithdrawParams,\n WithdrawIdleParams,\n ExchangeRateInfo,\n WithdrawalInfo,\n FeeInfo,\n};\nexport { STACKINGDAO_CONTRACTS, TRAIT_CONTRACTS } from \"./constants.ts\";\n\n/**\n * StackingDAO liquid staking extension.\n * Deposit STX → receive stSTX. Auto-compounding stacking rewards.\n *\n * @example\n * import { createWalletClient, http, mainnet } from \"stacks\";\n * import { stackingDao } from \"stacks/stackingdao\";\n *\n * const client = createWalletClient({ ... }).extend(stackingDao());\n *\n * // Deposit STX for stSTX\n * await client.stackingDao.deposit({ amount: 100_000_000_000n });\n *\n * // Check exchange rate\n * const rate = await client.stackingDao.getExchangeRate();\n */\nexport function stackingDao() {\n return (client: Client) => ({\n stackingDao: {\n /** Deposit STX, receive stSTX. */\n deposit: (params: DepositParams) => deposit(client, params),\n\n /** Initiate withdrawal — burns stSTX, mints NFT receipt. */\n initWithdraw: (params: InitWithdrawParams) => initWithdraw(client, params),\n\n /** Finalize withdrawal — burns NFT, receive STX. */\n withdraw: (params: WithdrawParams) => withdraw(client, params),\n\n /** Withdraw idle STX instantly (burns stSTX). */\n withdrawIdle: (params: WithdrawIdleParams) => withdrawIdle(client, params),\n\n /** Get stSTX balance for an address. */\n getStSTXBalance: (address: string) => getStSTXBalance(client, address),\n\n /** Get current STX/stSTX exchange rate info. */\n getExchangeRate: () => getExchangeRate(client),\n\n /** Get total stSTX supply. */\n getTotalSupply: () => getTotalSupply(client),\n\n /** Get withdrawal NFT info by ID. Returns tuple with amounts and unlock height. */\n getWithdrawalInfo: (nftId: bigint) => getWithdrawalInfo(client, nftId),\n\n /** Get current fee rates. */\n getFees: () => getFees(client),\n\n /** Get total STX in reserve. */\n getReserveBalance: () => getReserveBalance(client),\n\n /** Check if deposits are shut down. */\n getShutdownDeposits: () => getShutdownDeposits(client),\n },\n });\n}\n"
9
+ ],
10
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,gBAAgB;AAAA,EACpB,OAAO;AAAA,IACL,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,mBAAmB,MAAM,UAAU;AAAA,EAC7C;AACF;AAEO,IAAM,wBAAwB;AAAA,EACnC,WAAW;AAAA,IAET;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ,EAAE,MAAM,WAAW,MAAM,kBAAkB;AAAA,QAC3C,EAAE,MAAM,uBAAuB,MAAM,kBAAkB;AAAA,QACvD,EAAE,MAAM,oBAAoB,MAAM,kBAAkB;AAAA,QACpD,EAAE,MAAM,kBAAkB,MAAM,kBAAkB;AAAA,QAClD,EAAE,MAAM,cAAc,MAAM,UAAU;AAAA,QACtC,EAAE,MAAM,YAAY,MAAM,EAAE,UAAU,YAAY,EAAE;AAAA,QACpD,EAAE,MAAM,QAAQ,MAAM,EAAE,UAAU,YAAY,EAAE;AAAA,MAClD;AAAA,MACA,SAAS,EAAE,UAAU,EAAE,IAAI,WAAW,OAAO,UAAU,EAAE;AAAA,IAC3D;AAAA,IAEA;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ,EAAE,MAAM,WAAW,MAAM,kBAAkB;AAAA,QAC3C,EAAE,MAAM,kBAAkB,MAAM,kBAAkB;AAAA,QAClD,EAAE,MAAM,gBAAgB,MAAM,UA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ptions, {
4
+ watchTransaction: () => watchTransaction,
5
+ watchNftEvent: () => watchNftEvent,
6
+ watchMempool: () => watchMempool,
7
+ watchBlocks: () => watchBlocks,
8
+ watchAddressBalance: () => watchAddressBalance,
9
+ watchAddress: () => watchAddress
10
+ });
11
+ module.exports = __toCommonJS(exports_subscriptions);
12
+
13
+ //# debugId=D92667730CEA4E8564756E2164756E21
14
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "D92667730CEA4E8564756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,250 @@
1
+ /** Handle returned by WebSocket subscription methods; call `unsubscribe()` to stop. */
2
+ type Subscription = {
3
+ unsubscribe: () => void
4
+ };
5
+ type WsEvent = "block" | "mempool" | "tx_update" | "address_tx_update" | "address_balance_update" | "nft_event" | "nft_asset_event" | "nft_collection_event";
6
+ type WsSubscribeParams = {
7
+ event: WsEvent
8
+ tx_id?: string
9
+ address?: string
10
+ asset_identifier?: string
11
+ value?: string
12
+ };
13
+ type BlockNotification = {
14
+ canonical: boolean
15
+ height: number
16
+ hash: string
17
+ index_block_hash: string
18
+ parent_block_hash: string
19
+ burn_block_height: number
20
+ burn_block_hash: string
21
+ parent_burn_block_hash: string
22
+ parent_burn_block_height: number
23
+ parent_index_block_hash: string
24
+ txs: string[]
25
+ };
26
+ type MempoolNotification = {
27
+ tx_id: string
28
+ tx_type: string
29
+ tx_status: string
30
+ receipt_time: number
31
+ receipt_time_iso: string
32
+ fee_rate: string
33
+ sender_address: string
34
+ sponsor_address?: string
35
+ nonce: number
36
+ contract_call?: {
37
+ contract_id: string
38
+ function_name: string
39
+ function_signature: string
40
+ }
41
+ token_transfer?: {
42
+ recipient_address: string
43
+ amount: string
44
+ memo: string
45
+ }
46
+ };
47
+ type TxUpdateNotification = {
48
+ tx_id: string
49
+ tx_type: string
50
+ tx_status: string
51
+ block_hash?: string
52
+ block_height?: number
53
+ burn_block_height?: number
54
+ burn_block_time?: number
55
+ tx_result?: {
56
+ hex: string
57
+ repr: string
58
+ }
59
+ };
60
+ type AddressTxNotification = {
61
+ address: string
62
+ tx_id: string
63
+ tx_type: string
64
+ tx_status: string
65
+ stx_sent: string
66
+ stx_received: string
67
+ stx_transfers: Array<{
68
+ amount: string
69
+ sender: string
70
+ recipient: string
71
+ }>
72
+ ft_transfers: Array<{
73
+ amount: string
74
+ asset_identifier: string
75
+ sender: string
76
+ recipient: string
77
+ }>
78
+ nft_transfers: Array<{
79
+ asset_identifier: string
80
+ sender: string
81
+ recipient: string
82
+ value: {
83
+ hex: string
84
+ repr: string
85
+ }
86
+ }>
87
+ };
88
+ type AddressBalanceNotification = {
89
+ address: string
90
+ balance: string
91
+ total_sent: string
92
+ total_received: string
93
+ total_fees_sent: string
94
+ total_miner_rewards_received: string
95
+ lock_tx_id: string
96
+ locked: string
97
+ lock_height: number
98
+ burnchain_lock_height: number
99
+ burnchain_unlock_height: number
100
+ };
101
+ type NftEventNotification = {
102
+ sender: string
103
+ recipient: string
104
+ asset_identifier: string
105
+ asset_event_type: string
106
+ value: {
107
+ hex: string
108
+ repr: string
109
+ }
110
+ tx_id: string
111
+ block_height: number
112
+ };
113
+ /** Full chain descriptor used by clients and transports for network-aware operations. */
114
+ type StacksChain = {
115
+ /** Chain ID (e.g. 0x00000001 for mainnet) */
116
+ id: number
117
+ /** Human-readable name */
118
+ name: string
119
+ /** Network type */
120
+ network: "mainnet" | "testnet"
121
+ /** Transaction version byte for serialization */
122
+ transactionVersion: number
123
+ /** Peer network ID for P2P broadcasting */
124
+ peerNetworkId: number
125
+ /** Address version bytes */
126
+ addressVersion: {
127
+ singleSig: number
128
+ multiSig: number
129
+ }
130
+ /** Magic bytes for network identification */
131
+ magicBytes: string
132
+ /** Boot address (system contracts deployer) */
133
+ bootAddress: string
134
+ /** Native currency info */
135
+ nativeCurrency: {
136
+ name: string
137
+ symbol: string
138
+ decimals: number
139
+ }
140
+ /** Default RPC URLs */
141
+ rpcUrls: {
142
+ default: {
143
+ http: string[]
144
+ ws?: string[]
145
+ }
146
+ }
147
+ /** Block explorer URLs */
148
+ blockExplorers?: {
149
+ default: {
150
+ name: string
151
+ url: string
152
+ }
153
+ }
154
+ };
155
+ /** Function that sends an HTTP request to a Stacks node API path. */
156
+ type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
157
+ /** Options for a transport-level HTTP request. */
158
+ type RequestOptions = {
159
+ method?: "GET" | "POST" | "PUT" | "DELETE"
160
+ body?: unknown
161
+ headers?: Record<string, string>
162
+ };
163
+ /** Shared configuration for all transport types. */
164
+ type TransportConfig = {
165
+ url?: string
166
+ timeout?: number
167
+ retryCount?: number
168
+ retryDelay?: number
169
+ fetchOptions?: RequestInit
170
+ apiKey?: string
171
+ };
172
+ /** A resolved transport instance with a bound request function. */
173
+ type Transport = {
174
+ type: string
175
+ request: RequestFn
176
+ config: TransportConfig
177
+ destroy?: () => void
178
+ };
179
+ /** Account derived from a local private key (mnemonic or raw key). */
180
+ type LocalAccount = {
181
+ type: "local"
182
+ address: string
183
+ /** Compressed public key (hex) */
184
+ publicKey: string
185
+ /** Raw ECDSA sign over a hash */
186
+ sign(hash: Uint8Array): Uint8Array
187
+ /** Sign a structured message (SIP-018) */
188
+ signMessage(message: string | Uint8Array): string
189
+ };
190
+ /** Account with a user-provided signing function (sync or async). */
191
+ type CustomAccount = {
192
+ type: "custom"
193
+ address: string
194
+ publicKey: string
195
+ sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
196
+ };
197
+ /** Browser wallet provider interface (e.g. Leather, Xverse). */
198
+ type StacksProvider = {
199
+ request(method: string, params?: any): Promise<any>
200
+ };
201
+ /** Account backed by a browser wallet {@link StacksProvider}. */
202
+ type ProviderAccount = {
203
+ type: "provider"
204
+ address: string
205
+ publicKey: string
206
+ provider: StacksProvider
207
+ };
208
+ /** Union of all supported account types (local key, custom signer, or browser provider). */
209
+ type Account = LocalAccount | CustomAccount | ProviderAccount;
210
+ /**
211
+ * Core client instance that holds chain context, transport, and extensible actions.
212
+ * Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
213
+ */
214
+ type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
215
+ chain?: StacksChain
216
+ account?: Account
217
+ transport: Transport
218
+ request: RequestFn
219
+ extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
220
+ } & TExtended;
221
+ type WatchBlocksParams = {
222
+ onBlock: (block: BlockNotification) => void
223
+ };
224
+ declare function watchBlocks(client: Client, params: WatchBlocksParams): Promise<Subscription>;
225
+ type WatchMempoolParams = {
226
+ onTransaction: (tx: MempoolNotification) => void
227
+ };
228
+ declare function watchMempool(client: Client, params: WatchMempoolParams): Promise<Subscription>;
229
+ type WatchTransactionParams = {
230
+ txId: string
231
+ onUpdate: (update: TxUpdateNotification) => void
232
+ };
233
+ declare function watchTransaction(client: Client, params: WatchTransactionParams): Promise<Subscription>;
234
+ type WatchAddressParams = {
235
+ address: string
236
+ onTransaction: (tx: AddressTxNotification) => void
237
+ };
238
+ declare function watchAddress(client: Client, params: WatchAddressParams): Promise<Subscription>;
239
+ type WatchAddressBalanceParams = {
240
+ address: string
241
+ onBalance: (balance: AddressBalanceNotification) => void
242
+ };
243
+ declare function watchAddressBalance(client: Client, params: WatchAddressBalanceParams): Promise<Subscription>;
244
+ type WatchNftEventParams = {
245
+ onEvent: (event: NftEventNotification) => void
246
+ assetIdentifier?: string
247
+ value?: string
248
+ };
249
+ declare function watchNftEvent(client: Client, params: WatchNftEventParams): Promise<Subscription>;
250
+ export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, WsSubscribeParams, WsEvent, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, TxUpdateNotification, Subscription, NftEventNotification, MempoolNotification, BlockNotification, AddressTxNotification, AddressBalanceNotification };
@@ -0,0 +1,250 @@
1
+ /** Handle returned by WebSocket subscription methods; call `unsubscribe()` to stop. */
2
+ type Subscription = {
3
+ unsubscribe: () => void
4
+ };
5
+ type WsEvent = "block" | "mempool" | "tx_update" | "address_tx_update" | "address_balance_update" | "nft_event" | "nft_asset_event" | "nft_collection_event";
6
+ type WsSubscribeParams = {
7
+ event: WsEvent
8
+ tx_id?: string
9
+ address?: string
10
+ asset_identifier?: string
11
+ value?: string
12
+ };
13
+ type BlockNotification = {
14
+ canonical: boolean
15
+ height: number
16
+ hash: string
17
+ index_block_hash: string
18
+ parent_block_hash: string
19
+ burn_block_height: number
20
+ burn_block_hash: string
21
+ parent_burn_block_hash: string
22
+ parent_burn_block_height: number
23
+ parent_index_block_hash: string
24
+ txs: string[]
25
+ };
26
+ type MempoolNotification = {
27
+ tx_id: string
28
+ tx_type: string
29
+ tx_status: string
30
+ receipt_time: number
31
+ receipt_time_iso: string
32
+ fee_rate: string
33
+ sender_address: string
34
+ sponsor_address?: string
35
+ nonce: number
36
+ contract_call?: {
37
+ contract_id: string
38
+ function_name: string
39
+ function_signature: string
40
+ }
41
+ token_transfer?: {
42
+ recipient_address: string
43
+ amount: string
44
+ memo: string
45
+ }
46
+ };
47
+ type TxUpdateNotification = {
48
+ tx_id: string
49
+ tx_type: string
50
+ tx_status: string
51
+ block_hash?: string
52
+ block_height?: number
53
+ burn_block_height?: number
54
+ burn_block_time?: number
55
+ tx_result?: {
56
+ hex: string
57
+ repr: string
58
+ }
59
+ };
60
+ type AddressTxNotification = {
61
+ address: string
62
+ tx_id: string
63
+ tx_type: string
64
+ tx_status: string
65
+ stx_sent: string
66
+ stx_received: string
67
+ stx_transfers: Array<{
68
+ amount: string
69
+ sender: string
70
+ recipient: string
71
+ }>
72
+ ft_transfers: Array<{
73
+ amount: string
74
+ asset_identifier: string
75
+ sender: string
76
+ recipient: string
77
+ }>
78
+ nft_transfers: Array<{
79
+ asset_identifier: string
80
+ sender: string
81
+ recipient: string
82
+ value: {
83
+ hex: string
84
+ repr: string
85
+ }
86
+ }>
87
+ };
88
+ type AddressBalanceNotification = {
89
+ address: string
90
+ balance: string
91
+ total_sent: string
92
+ total_received: string
93
+ total_fees_sent: string
94
+ total_miner_rewards_received: string
95
+ lock_tx_id: string
96
+ locked: string
97
+ lock_height: number
98
+ burnchain_lock_height: number
99
+ burnchain_unlock_height: number
100
+ };
101
+ type NftEventNotification = {
102
+ sender: string
103
+ recipient: string
104
+ asset_identifier: string
105
+ asset_event_type: string
106
+ value: {
107
+ hex: string
108
+ repr: string
109
+ }
110
+ tx_id: string
111
+ block_height: number
112
+ };
113
+ /** Full chain descriptor used by clients and transports for network-aware operations. */
114
+ type StacksChain = {
115
+ /** Chain ID (e.g. 0x00000001 for mainnet) */
116
+ id: number
117
+ /** Human-readable name */
118
+ name: string
119
+ /** Network type */
120
+ network: "mainnet" | "testnet"
121
+ /** Transaction version byte for serialization */
122
+ transactionVersion: number
123
+ /** Peer network ID for P2P broadcasting */
124
+ peerNetworkId: number
125
+ /** Address version bytes */
126
+ addressVersion: {
127
+ singleSig: number
128
+ multiSig: number
129
+ }
130
+ /** Magic bytes for network identification */
131
+ magicBytes: string
132
+ /** Boot address (system contracts deployer) */
133
+ bootAddress: string
134
+ /** Native currency info */
135
+ nativeCurrency: {
136
+ name: string
137
+ symbol: string
138
+ decimals: number
139
+ }
140
+ /** Default RPC URLs */
141
+ rpcUrls: {
142
+ default: {
143
+ http: string[]
144
+ ws?: string[]
145
+ }
146
+ }
147
+ /** Block explorer URLs */
148
+ blockExplorers?: {
149
+ default: {
150
+ name: string
151
+ url: string
152
+ }
153
+ }
154
+ };
155
+ /** Function that sends an HTTP request to a Stacks node API path. */
156
+ type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
157
+ /** Options for a transport-level HTTP request. */
158
+ type RequestOptions = {
159
+ method?: "GET" | "POST" | "PUT" | "DELETE"
160
+ body?: unknown
161
+ headers?: Record<string, string>
162
+ };
163
+ /** Shared configuration for all transport types. */
164
+ type TransportConfig = {
165
+ url?: string
166
+ timeout?: number
167
+ retryCount?: number
168
+ retryDelay?: number
169
+ fetchOptions?: RequestInit
170
+ apiKey?: string
171
+ };
172
+ /** A resolved transport instance with a bound request function. */
173
+ type Transport = {
174
+ type: string
175
+ request: RequestFn
176
+ config: TransportConfig
177
+ destroy?: () => void
178
+ };
179
+ /** Account derived from a local private key (mnemonic or raw key). */
180
+ type LocalAccount = {
181
+ type: "local"
182
+ address: string
183
+ /** Compressed public key (hex) */
184
+ publicKey: string
185
+ /** Raw ECDSA sign over a hash */
186
+ sign(hash: Uint8Array): Uint8Array
187
+ /** Sign a structured message (SIP-018) */
188
+ signMessage(message: string | Uint8Array): string
189
+ };
190
+ /** Account with a user-provided signing function (sync or async). */
191
+ type CustomAccount = {
192
+ type: "custom"
193
+ address: string
194
+ publicKey: string
195
+ sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
196
+ };
197
+ /** Browser wallet provider interface (e.g. Leather, Xverse). */
198
+ type StacksProvider = {
199
+ request(method: string, params?: any): Promise<any>
200
+ };
201
+ /** Account backed by a browser wallet {@link StacksProvider}. */
202
+ type ProviderAccount = {
203
+ type: "provider"
204
+ address: string
205
+ publicKey: string
206
+ provider: StacksProvider
207
+ };
208
+ /** Union of all supported account types (local key, custom signer, or browser provider). */
209
+ type Account = LocalAccount | CustomAccount | ProviderAccount;
210
+ /**
211
+ * Core client instance that holds chain context, transport, and extensible actions.
212
+ * Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
213
+ */
214
+ type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
215
+ chain?: StacksChain
216
+ account?: Account
217
+ transport: Transport
218
+ request: RequestFn
219
+ extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
220
+ } & TExtended;
221
+ type WatchBlocksParams = {
222
+ onBlock: (block: BlockNotification) => void
223
+ };
224
+ declare function watchBlocks(client: Client, params: WatchBlocksParams): Promise<Subscription>;
225
+ type WatchMempoolParams = {
226
+ onTransaction: (tx: MempoolNotification) => void
227
+ };
228
+ declare function watchMempool(client: Client, params: WatchMempoolParams): Promise<Subscription>;
229
+ type WatchTransactionParams = {
230
+ txId: string
231
+ onUpdate: (update: TxUpdateNotification) => void
232
+ };
233
+ declare function watchTransaction(client: Client, params: WatchTransactionParams): Promise<Subscription>;
234
+ type WatchAddressParams = {
235
+ address: string
236
+ onTransaction: (tx: AddressTxNotification) => void
237
+ };
238
+ declare function watchAddress(client: Client, params: WatchAddressParams): Promise<Subscription>;
239
+ type WatchAddressBalanceParams = {
240
+ address: string
241
+ onBalance: (balance: AddressBalanceNotification) => void
242
+ };
243
+ declare function watchAddressBalance(client: Client, params: WatchAddressBalanceParams): Promise<Subscription>;
244
+ type WatchNftEventParams = {
245
+ onEvent: (event: NftEventNotification) => void
246
+ assetIdentifier?: string
247
+ value?: string
248
+ };
249
+ declare function watchNftEvent(client: Client, params: WatchNftEventParams): Promise<Subscription>;
250
+ export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, WsSubscribeParams, WsEvent, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, TxUpdateNotification, Subscription, NftEventNotification, MempoolNotification, BlockNotification, AddressTxNotification, AddressBalanceNotification };
@@ -0,0 +1,21 @@
1
+ import {
2
+ watchAddress,
3
+ watchAddressBalance,
4
+ watchBlocks,
5
+ watchMempool,
6
+ watchNftEvent,
7
+ watchTransaction
8
+ } from "../../shared/stacks-y3dh7hv1.js";
9
+ import"../../shared/stacks-709tra19.js";
10
+ import"../../shared/stacks-8m9byk2j.js";
11
+ export {
12
+ watchTransaction,
13
+ watchNftEvent,
14
+ watchMempool,
15
+ watchBlocks,
16
+ watchAddressBalance,
17
+ watchAddress
18
+ };
19
+
20
+ //# debugId=2F0BAF3010C3FA8F64756E2164756E21
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "2F0BAF3010C3FA8F64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,50 @@
1
+ // src/transactions/index.ts
2
+ var exports_transactions = {};
3
+ __export(exports_transactions, {
4
+ signTransactionWithAccount: () => signTransactionWithAccount,
5
+ signTransaction: () => signTransaction,
6
+ signSponsorWithAccount: () => signSponsorWithAccount,
7
+ signSponsor: () => signSponsor,
8
+ signMultiSigWithAccount: () => signMultiSigWithAccount,
9
+ signMultiSig: () => signMultiSig,
10
+ signBegin: () => signBegin,
11
+ sigHashPreSign: () => sigHashPreSign,
12
+ sigHashPostSign: () => sigHashPostSign,
13
+ serializeTransactionHex: () => serializeTransactionHex,
14
+ serializeTransaction: () => serializeTransaction,
15
+ replayMultiSigSigHash: () => replayMultiSigSigHash,
16
+ nextSignature: () => nextSignature,
17
+ makeMultiSigAddress: () => makeMultiSigAddress,
18
+ isNonSequential: () => isNonSequential,
19
+ getTransactionId: () => getTransactionId,
20
+ getOriginSigHash: () => getOriginSigHash,
21
+ finalizeMultiSig: () => finalizeMultiSig,
22
+ deserializeTransaction: () => deserializeTransaction,
23
+ createStandardAuth: () => createStandardAuth,
24
+ createSponsoredAuth: () => createSponsoredAuth,
25
+ createSingleSigSpendingCondition: () => createSingleSigSpendingCondition,
26
+ createMultiSigSpendingCondition: () => createMultiSigSpendingCondition,
27
+ combineMultiSigSignatures: () => combineMultiSigSignatures,
28
+ buildTokenTransfer: () => buildTokenTransfer,
29
+ buildContractDeploy: () => buildContractDeploy,
30
+ buildContractCall: () => buildContractCall,
31
+ RECOVERABLE_ECDSA_SIG_LENGTH_BYTES: () => RECOVERABLE_ECDSA_SIG_LENGTH_BYTES,
32
+ PubKeyEncoding: () => PubKeyEncoding,
33
+ PostConditionPrincipalId: () => PostConditionPrincipalId,
34
+ PostConditionModeWire: () => PostConditionModeWire,
35
+ PayloadType: () => PayloadType,
36
+ NonFungibleConditionCode: () => NonFungibleConditionCode,
37
+ MEMO_MAX_LENGTH_BYTES: () => MEMO_MAX_LENGTH_BYTES,
38
+ MAX_STRING_LENGTH_BYTES: () => MAX_STRING_LENGTH_BYTES,
39
+ FungibleConditionCode: () => FungibleConditionCode,
40
+ ClarityVersion: () => ClarityVersion,
41
+ AuthType: () => AuthType,
42
+ AuthFieldType: () => AuthFieldType,
43
+ AssetType: () => AssetType,
44
+ AnchorMode: () => AnchorMode,
45
+ AddressHashMode: () => AddressHashMode
46
+ });
47
+ module.exports = __toCommonJS(exports_transactions);
48
+
49
+ //# debugId=CA1F18F15CB9DD6D64756E2164756E21
50
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "CA1F18F15CB9DD6D64756E2164756E21",
8
+ "names": []
9
+ }