@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,234 @@
1
+ // src/clarity/abi/standards.ts
2
+ var SIP010_ABI = {
3
+ functions: [
4
+ {
5
+ name: "transfer",
6
+ access: "public",
7
+ args: [
8
+ { name: "amount", type: "uint128" },
9
+ { name: "sender", type: "principal" },
10
+ { name: "recipient", type: "principal" },
11
+ { name: "memo", type: { optional: { buff: { length: 34 } } } }
12
+ ],
13
+ outputs: { response: { ok: "bool", error: "uint128" } }
14
+ },
15
+ {
16
+ name: "get-balance",
17
+ access: "read-only",
18
+ args: [{ name: "account", type: "principal" }],
19
+ outputs: { response: { ok: "uint128", error: "uint128" } }
20
+ },
21
+ {
22
+ name: "get-total-supply",
23
+ access: "read-only",
24
+ args: [],
25
+ outputs: { response: { ok: "uint128", error: "uint128" } }
26
+ },
27
+ {
28
+ name: "get-name",
29
+ access: "read-only",
30
+ args: [],
31
+ outputs: {
32
+ response: {
33
+ ok: { "string-ascii": { length: 32 } },
34
+ error: "uint128"
35
+ }
36
+ }
37
+ },
38
+ {
39
+ name: "get-symbol",
40
+ access: "read-only",
41
+ args: [],
42
+ outputs: {
43
+ response: {
44
+ ok: { "string-ascii": { length: 10 } },
45
+ error: "uint128"
46
+ }
47
+ }
48
+ },
49
+ {
50
+ name: "get-decimals",
51
+ access: "read-only",
52
+ args: [],
53
+ outputs: { response: { ok: "uint128", error: "uint128" } }
54
+ },
55
+ {
56
+ name: "get-token-uri",
57
+ access: "read-only",
58
+ args: [],
59
+ outputs: {
60
+ response: {
61
+ ok: { optional: { "string-utf8": { length: 256 } } },
62
+ error: "uint128"
63
+ }
64
+ }
65
+ }
66
+ ],
67
+ fungible_tokens: [{ name: "token" }]
68
+ };
69
+ var SIP009_ABI = {
70
+ functions: [
71
+ {
72
+ name: "transfer",
73
+ access: "public",
74
+ args: [
75
+ { name: "id", type: "uint128" },
76
+ { name: "sender", type: "principal" },
77
+ { name: "recipient", type: "principal" }
78
+ ],
79
+ outputs: { response: { ok: "bool", error: "uint128" } }
80
+ },
81
+ {
82
+ name: "get-owner",
83
+ access: "read-only",
84
+ args: [{ name: "id", type: "uint128" }],
85
+ outputs: { response: { ok: { optional: "principal" }, error: "uint128" } }
86
+ },
87
+ {
88
+ name: "get-last-token-id",
89
+ access: "read-only",
90
+ args: [],
91
+ outputs: { response: { ok: "uint128", error: "uint128" } }
92
+ },
93
+ {
94
+ name: "get-token-uri",
95
+ access: "read-only",
96
+ args: [{ name: "id", type: "uint128" }],
97
+ outputs: {
98
+ response: {
99
+ ok: { optional: { "string-utf8": { length: 256 } } },
100
+ error: "uint128"
101
+ }
102
+ }
103
+ }
104
+ ],
105
+ non_fungible_tokens: [{ name: "nft", type: "uint128" }]
106
+ };
107
+ var SIP013_ABI = {
108
+ functions: [
109
+ {
110
+ name: "transfer",
111
+ access: "public",
112
+ args: [
113
+ { name: "token-id", type: "uint128" },
114
+ { name: "amount", type: "uint128" },
115
+ { name: "sender", type: "principal" },
116
+ { name: "recipient", type: "principal" }
117
+ ],
118
+ outputs: { response: { ok: "bool", error: "uint128" } }
119
+ },
120
+ {
121
+ name: "transfer-memo",
122
+ access: "public",
123
+ args: [
124
+ { name: "token-id", type: "uint128" },
125
+ { name: "amount", type: "uint128" },
126
+ { name: "sender", type: "principal" },
127
+ { name: "recipient", type: "principal" },
128
+ { name: "memo", type: { buff: { length: 34 } } }
129
+ ],
130
+ outputs: { response: { ok: "bool", error: "uint128" } }
131
+ },
132
+ {
133
+ name: "transfer-many",
134
+ access: "public",
135
+ args: [
136
+ {
137
+ name: "transfers",
138
+ type: {
139
+ list: {
140
+ type: {
141
+ tuple: [
142
+ { name: "token-id", type: "uint128" },
143
+ { name: "amount", type: "uint128" },
144
+ { name: "sender", type: "principal" },
145
+ { name: "recipient", type: "principal" }
146
+ ]
147
+ },
148
+ length: 200
149
+ }
150
+ }
151
+ }
152
+ ],
153
+ outputs: { response: { ok: "bool", error: "uint128" } }
154
+ },
155
+ {
156
+ name: "transfer-many-memo",
157
+ access: "public",
158
+ args: [
159
+ {
160
+ name: "transfers",
161
+ type: {
162
+ list: {
163
+ type: {
164
+ tuple: [
165
+ { name: "token-id", type: "uint128" },
166
+ { name: "amount", type: "uint128" },
167
+ { name: "sender", type: "principal" },
168
+ { name: "recipient", type: "principal" },
169
+ { name: "memo", type: { buff: { length: 34 } } }
170
+ ]
171
+ },
172
+ length: 200
173
+ }
174
+ }
175
+ }
176
+ ],
177
+ outputs: { response: { ok: "bool", error: "uint128" } }
178
+ },
179
+ {
180
+ name: "get-balance",
181
+ access: "read-only",
182
+ args: [
183
+ { name: "token-id", type: "uint128" },
184
+ { name: "account", type: "principal" }
185
+ ],
186
+ outputs: { response: { ok: "uint128", error: "uint128" } }
187
+ },
188
+ {
189
+ name: "get-overall-balance",
190
+ access: "read-only",
191
+ args: [{ name: "account", type: "principal" }],
192
+ outputs: { response: { ok: "uint128", error: "uint128" } }
193
+ },
194
+ {
195
+ name: "get-total-supply",
196
+ access: "read-only",
197
+ args: [{ name: "token-id", type: "uint128" }],
198
+ outputs: { response: { ok: "uint128", error: "uint128" } }
199
+ },
200
+ {
201
+ name: "get-overall-supply",
202
+ access: "read-only",
203
+ args: [],
204
+ outputs: { response: { ok: "uint128", error: "uint128" } }
205
+ },
206
+ {
207
+ name: "get-decimals",
208
+ access: "read-only",
209
+ args: [{ name: "token-id", type: "uint128" }],
210
+ outputs: { response: { ok: "uint128", error: "uint128" } }
211
+ },
212
+ {
213
+ name: "get-token-uri",
214
+ access: "read-only",
215
+ args: [{ name: "token-id", type: "uint128" }],
216
+ outputs: {
217
+ response: {
218
+ ok: { optional: { "string-utf8": { length: 256 } } },
219
+ error: "uint128"
220
+ }
221
+ }
222
+ }
223
+ ],
224
+ fungible_tokens: [],
225
+ non_fungible_tokens: []
226
+ };
227
+ var sip010Abi = SIP010_ABI;
228
+ var sip009Abi = SIP009_ABI;
229
+ var sip013Abi = SIP013_ABI;
230
+
231
+ export { SIP010_ABI, SIP009_ABI, SIP013_ABI, sip010Abi, sip009Abi, sip013Abi };
232
+
233
+ //# debugId=02D7F66F296B4CA864756E2164756E21
234
+ //# sourceMappingURL=stacks-k58k970n.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/clarity/abi/standards.ts"],
4
+ "sourcesContent": [
5
+ "import type { AbiContract } from \"./contract.ts\";\n\nexport const SIP010_ABI = {\n functions: [\n {\n name: \"transfer\",\n access: \"public\",\n args: [\n { name: \"amount\", type: \"uint128\" },\n { name: \"sender\", type: \"principal\" },\n { name: \"recipient\", type: \"principal\" },\n { name: \"memo\", type: { optional: { buff: { length: 34 } } } },\n ],\n outputs: { response: { ok: \"bool\", error: \"uint128\" } },\n },\n {\n name: \"get-balance\",\n access: \"read-only\",\n args: [{ name: \"account\", type: \"principal\" }],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-total-supply\",\n access: \"read-only\",\n args: [],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-name\",\n access: \"read-only\",\n args: [],\n outputs: {\n response: {\n ok: { \"string-ascii\": { length: 32 } },\n error: \"uint128\",\n },\n },\n },\n {\n name: \"get-symbol\",\n access: \"read-only\",\n args: [],\n outputs: {\n response: {\n ok: { \"string-ascii\": { length: 10 } },\n error: \"uint128\",\n },\n },\n },\n {\n name: \"get-decimals\",\n access: \"read-only\",\n args: [],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-token-uri\",\n access: \"read-only\",\n args: [],\n outputs: {\n response: {\n ok: { optional: { \"string-utf8\": { length: 256 } } },\n error: \"uint128\",\n },\n },\n },\n ],\n fungible_tokens: [{ name: \"token\" }],\n} as const satisfies AbiContract;\n\nexport const SIP009_ABI = {\n functions: [\n {\n name: \"transfer\",\n access: \"public\",\n args: [\n { name: \"id\", type: \"uint128\" },\n { name: \"sender\", type: \"principal\" },\n { name: \"recipient\", type: \"principal\" },\n ],\n outputs: { response: { ok: \"bool\", error: \"uint128\" } },\n },\n {\n name: \"get-owner\",\n access: \"read-only\",\n args: [{ name: \"id\", type: \"uint128\" }],\n outputs: { response: { ok: { optional: \"principal\" }, error: \"uint128\" } },\n },\n {\n name: \"get-last-token-id\",\n access: \"read-only\",\n args: [],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-token-uri\",\n access: \"read-only\",\n args: [{ name: \"id\", type: \"uint128\" }],\n outputs: {\n response: {\n ok: { optional: { \"string-utf8\": { length: 256 } } },\n error: \"uint128\",\n },\n },\n },\n ],\n non_fungible_tokens: [{ name: \"nft\", type: \"uint128\" }],\n} as const satisfies AbiContract;\n\nexport const SIP013_ABI = {\n functions: [\n {\n name: \"transfer\",\n access: \"public\",\n args: [\n { name: \"token-id\", type: \"uint128\" },\n { name: \"amount\", type: \"uint128\" },\n { name: \"sender\", type: \"principal\" },\n { name: \"recipient\", type: \"principal\" },\n ],\n outputs: { response: { ok: \"bool\", error: \"uint128\" } },\n },\n {\n name: \"transfer-memo\",\n access: \"public\",\n args: [\n { name: \"token-id\", type: \"uint128\" },\n { name: \"amount\", type: \"uint128\" },\n { name: \"sender\", type: \"principal\" },\n { name: \"recipient\", type: \"principal\" },\n { name: \"memo\", type: { buff: { length: 34 } } },\n ],\n outputs: { response: { ok: \"bool\", error: \"uint128\" } },\n },\n {\n name: \"transfer-many\",\n access: \"public\",\n args: [\n {\n name: \"transfers\",\n type: {\n list: {\n type: {\n tuple: [\n { name: \"token-id\", type: \"uint128\" },\n { name: \"amount\", type: \"uint128\" },\n { name: \"sender\", type: \"principal\" },\n { name: \"recipient\", type: \"principal\" },\n ],\n },\n length: 200,\n },\n },\n },\n ],\n outputs: { response: { ok: \"bool\", error: \"uint128\" } },\n },\n {\n name: \"transfer-many-memo\",\n access: \"public\",\n args: [\n {\n name: \"transfers\",\n type: {\n list: {\n type: {\n tuple: [\n { name: \"token-id\", type: \"uint128\" },\n { name: \"amount\", type: \"uint128\" },\n { name: \"sender\", type: \"principal\" },\n { name: \"recipient\", type: \"principal\" },\n { name: \"memo\", type: { buff: { length: 34 } } },\n ],\n },\n length: 200,\n },\n },\n },\n ],\n outputs: { response: { ok: \"bool\", error: \"uint128\" } },\n },\n {\n name: \"get-balance\",\n access: \"read-only\",\n args: [\n { name: \"token-id\", type: \"uint128\" },\n { name: \"account\", type: \"principal\" },\n ],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-overall-balance\",\n access: \"read-only\",\n args: [{ name: \"account\", type: \"principal\" }],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-total-supply\",\n access: \"read-only\",\n args: [{ name: \"token-id\", type: \"uint128\" }],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-overall-supply\",\n access: \"read-only\",\n args: [],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-decimals\",\n access: \"read-only\",\n args: [{ name: \"token-id\", type: \"uint128\" }],\n outputs: { response: { ok: \"uint128\", error: \"uint128\" } },\n },\n {\n name: \"get-token-uri\",\n access: \"read-only\",\n args: [{ name: \"token-id\", type: \"uint128\" }],\n outputs: {\n response: {\n ok: { optional: { \"string-utf8\": { length: 256 } } },\n error: \"uint128\",\n },\n },\n },\n ],\n fungible_tokens: [],\n non_fungible_tokens: [],\n} as const satisfies AbiContract;\n\n// Camel-case aliases for better DX\nexport const sip010Abi = SIP010_ABI;\nexport const sip009Abi = SIP009_ABI;\nexport const sip013Abi = SIP013_ABI;\n"
6
+ ],
7
+ "mappings": ";AAEO,IAAM,aAAa;AAAA,EACxB,WAAW;AAAA,IACT;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,QAClC,EAAE,MAAM,UAAU,MAAM,YAAY;AAAA,QAC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,CAAC;AAAA,MACP,SAAS,EAAE,UAAU,EAAE,IAAI,WAAW,OAAO,UAAU,EAAE;AAAA,IAC3D;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM,CAAC,EAAE,MAAM,YAAY,MAAM,UAAU,CAAC;AAAA,MAC5C,SAAS,EAAE,UAAU,EAAE,IAAI,WAAW,OAAO,UAAU,EAAE;AAAA,IAC3D;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM,CAAC,EAAE,MAAM,YAAY,MAAM,UAAU,CAAC;AAAA,MAC5C,SAAS;AAAA,QACP,UAAU;AAAA,UACR,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,IAAI,EAAE,EAAE;AAAA,UACnD,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB,CAAC;AAAA,EAClB,qBAAqB,CAAC;AACxB;AAGO,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,YAAY;",
8
+ "debugId": "02D7F66F296B4CA864756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,338 @@
1
+ import {
2
+ estimateFee,
3
+ getNonce,
4
+ isProviderAccount,
5
+ readContract,
6
+ sendTransaction
7
+ } from "./stacks-zm0b3tgy.js";
8
+ import {
9
+ BaseError
10
+ } from "./stacks-709tra19.js";
11
+ import {
12
+ deserializeTransaction
13
+ } from "./stacks-dxhntr76.js";
14
+ import {
15
+ buildContractDeploy,
16
+ buildTokenTransfer,
17
+ signSponsorWithAccount,
18
+ signTransactionWithAccount
19
+ } from "./stacks-f7wdrzs3.js";
20
+ import {
21
+ AddressHashMode,
22
+ AuthType,
23
+ PayloadType,
24
+ createSingleSigSpendingCondition,
25
+ serializeTransactionHex,
26
+ signMultiSigWithAccount
27
+ } from "./stacks-yfgsm6ap.js";
28
+ import {
29
+ Cl,
30
+ deserializeCVBytes
31
+ } from "./stacks-j2cy7qtt.js";
32
+ import {
33
+ serializeCVBytes
34
+ } from "./stacks-8yykgdww.js";
35
+ import {
36
+ parseContractId
37
+ } from "./stacks-gjvbq6w7.js";
38
+ import {
39
+ bytesToHex,
40
+ c32address,
41
+ concatBytes,
42
+ intToBigInt,
43
+ with0x
44
+ } from "./stacks-nqytwfcc.js";
45
+
46
+ // src/actions/public/getBalance.ts
47
+ async function getBalance(client, params) {
48
+ const data = await client.request(`/v2/accounts/${params.address}`, {
49
+ method: "GET"
50
+ });
51
+ return BigInt(data.balance);
52
+ }
53
+
54
+ // src/actions/public/getAccountInfo.ts
55
+ async function getAccountInfo(client, params) {
56
+ const data = await client.request(`/v2/accounts/${params.address}?proof=1`, { method: "GET" });
57
+ return {
58
+ balance: BigInt(data.balance),
59
+ nonce: BigInt(data.nonce),
60
+ balanceProof: data.balance_proof ?? "",
61
+ nonceProof: data.nonce_proof ?? ""
62
+ };
63
+ }
64
+
65
+ // src/actions/public/getBlock.ts
66
+ async function getBlock(client, params) {
67
+ if (params?.hash) {
68
+ return client.request(`/extended/v2/blocks/${params.hash}`, { method: "GET" });
69
+ }
70
+ if (params?.height !== undefined) {
71
+ return client.request(`/extended/v2/blocks/${params.height}`, { method: "GET" });
72
+ }
73
+ return client.request("/extended/v2/blocks?limit=1", { method: "GET" });
74
+ }
75
+
76
+ // src/actions/public/getBlockHeight.ts
77
+ async function getBlockHeight(client) {
78
+ const data = await client.request("/v2/info", { method: "GET" });
79
+ return data.stacks_tip_height;
80
+ }
81
+
82
+ // src/actions/public/getContractAbi.ts
83
+ async function getContractAbi(client, params) {
84
+ const [address, name] = parseContractId(params.contract);
85
+ return client.request(`/v2/contracts/interface/${address}/${name}`, {
86
+ method: "GET"
87
+ });
88
+ }
89
+
90
+ // src/actions/public/multicall.ts
91
+ async function multicall(client, params) {
92
+ const { calls, allowFailure = true } = params;
93
+ if (allowFailure) {
94
+ const settled = await Promise.allSettled(calls.map((call) => readContract(client, call)));
95
+ return settled.map((r) => r.status === "fulfilled" ? { status: "success", result: r.value } : { status: "failure", error: r.reason instanceof Error ? r.reason : new Error(String(r.reason)) });
96
+ }
97
+ const results = await Promise.all(calls.map((call) => readContract(client, call)));
98
+ return results;
99
+ }
100
+
101
+ // src/errors/simulation.ts
102
+ class SimulationError extends BaseError {
103
+ name = "SimulationError";
104
+ writesDetected;
105
+ constructor(message, options) {
106
+ super(message, { details: options.details });
107
+ this.writesDetected = options.writesDetected;
108
+ }
109
+ }
110
+
111
+ // src/actions/public/simulateCall.ts
112
+ async function simulateCall(client, params) {
113
+ const [address, name] = parseContractId(params.contract);
114
+ const sender = params.sender ?? address;
115
+ const serializedArgs = (params.args ?? []).map((arg) => with0x(bytesToHex(serializeCVBytes(arg))));
116
+ let path = `/v2/contracts/call-read/${address}/${name}/${params.functionName}`;
117
+ if (params.tip) {
118
+ path += `?tip=${params.tip}`;
119
+ }
120
+ const data = await client.request(path, {
121
+ method: "POST",
122
+ body: {
123
+ sender,
124
+ arguments: serializedArgs
125
+ }
126
+ });
127
+ if (data.okay) {
128
+ return { success: true, result: deserializeCVBytes(data.result) };
129
+ }
130
+ const cause = data.cause ?? "Simulation failed";
131
+ const writesDetected = cause.includes("NotReadOnly") || cause.includes("CostBalanceExceeded");
132
+ return {
133
+ success: false,
134
+ error: new SimulationError(writesDetected ? "Function mutates state and cannot be simulated" : "Simulation failed", { writesDetected, details: cause })
135
+ };
136
+ }
137
+
138
+ // src/actions/public/simulateTransaction.ts
139
+ function isMultiSig(hashMode) {
140
+ return hashMode === AddressHashMode.P2SH || hashMode === AddressHashMode.P2WSH || hashMode === AddressHashMode.P2SH_NonSequential || hashMode === AddressHashMode.P2WSH_P2SH_NonSequential;
141
+ }
142
+ function extractSender(tx, client) {
143
+ const { hashMode, signer } = tx.auth.spendingCondition;
144
+ const chain = client.chain;
145
+ const version = isMultiSig(hashMode) ? chain?.addressVersion.multiSig ?? 20 : chain?.addressVersion.singleSig ?? 22;
146
+ return c32address(version, signer);
147
+ }
148
+ async function simulateTransaction(client, params) {
149
+ const { transaction, tip } = params;
150
+ const { payload } = transaction;
151
+ if (payload.payloadType === PayloadType.ContractCall) {
152
+ const sender = params.sender ?? extractSender(transaction, client);
153
+ const contract = `${payload.contractAddress}.${payload.contractName}`;
154
+ const [execution, fees2] = await Promise.all([
155
+ simulateCall(client, {
156
+ contract,
157
+ functionName: payload.functionName,
158
+ args: payload.functionArgs,
159
+ sender,
160
+ tip
161
+ }),
162
+ estimateFee(client, { transaction })
163
+ ]);
164
+ return { type: "contract-call", execution, fees: fees2 };
165
+ }
166
+ const fees = await estimateFee(client, { transaction });
167
+ if (payload.payloadType === PayloadType.SmartContract || payload.payloadType === PayloadType.VersionedSmartContract) {
168
+ return { type: "contract-deploy", fees };
169
+ }
170
+ return { type: "token-transfer", fees };
171
+ }
172
+
173
+ // src/actions/wallet/signTransaction.ts
174
+ async function signTransactionAction(client, params) {
175
+ const account = client.account;
176
+ if (!account)
177
+ throw new Error("Account required");
178
+ if (isProviderAccount(account)) {
179
+ const hex = serializeTransactionHex(params.transaction);
180
+ const result = await account.provider.request("stx_signTransaction", {
181
+ transaction: hex
182
+ });
183
+ return deserializeTransaction(result.transaction);
184
+ }
185
+ const condition = params.transaction.auth.spendingCondition;
186
+ if ("fields" in condition) {
187
+ const publicKeys = params.signers ?? params.transaction._multisig?.publicKeys;
188
+ if (!publicKeys)
189
+ throw new Error("Multi-sig signing requires signers (publicKeys)");
190
+ return signMultiSigWithAccount(params.transaction, account, publicKeys);
191
+ }
192
+ return signTransactionWithAccount(params.transaction, account);
193
+ }
194
+
195
+ // src/actions/wallet/transferStx.ts
196
+ async function transferStx(client, params) {
197
+ const account = client.account;
198
+ if (!account)
199
+ throw new Error("Account required");
200
+ if (isProviderAccount(account)) {
201
+ const result2 = await account.provider.request("stx_transferStx", {
202
+ recipient: params.to,
203
+ amount: String(params.amount),
204
+ memo: params.memo
205
+ });
206
+ return result2.txid;
207
+ }
208
+ const nonce = params.nonce ?? await getNonce(client, { address: account.address });
209
+ const unsigned = buildTokenTransfer({
210
+ recipient: params.to,
211
+ amount: params.amount,
212
+ memo: params.memo,
213
+ fee: params.fee ?? 0n,
214
+ nonce,
215
+ publicKey: account.publicKey,
216
+ chain: client.chain,
217
+ postConditionMode: params.postConditionMode,
218
+ postConditions: params.postConditions
219
+ });
220
+ if (params.fee === undefined) {
221
+ const estimates = await estimateFee(client, { transaction: unsigned });
222
+ const mid = estimates[1] ?? estimates[0];
223
+ if (mid) {
224
+ unsigned.auth.spendingCondition.fee = BigInt(mid.fee);
225
+ }
226
+ }
227
+ const signed = await signTransactionWithAccount(unsigned, account);
228
+ const result = await sendTransaction(client, { transaction: signed });
229
+ return result.txid;
230
+ }
231
+
232
+ // src/actions/wallet/deployContract.ts
233
+ async function deployContract(client, params) {
234
+ const account = client.account;
235
+ if (!account)
236
+ throw new Error("Account required");
237
+ if (isProviderAccount(account)) {
238
+ const result2 = await account.provider.request("stx_deployContract", {
239
+ contractName: params.contractName,
240
+ codeBody: params.codeBody,
241
+ clarityVersion: params.clarityVersion
242
+ });
243
+ return result2.txid;
244
+ }
245
+ const nonce = params.nonce ?? await getNonce(client, { address: account.address });
246
+ const unsigned = buildContractDeploy({
247
+ contractName: params.contractName,
248
+ codeBody: params.codeBody,
249
+ clarityVersion: params.clarityVersion,
250
+ fee: params.fee ?? 0n,
251
+ nonce,
252
+ publicKey: account.publicKey,
253
+ chain: client.chain,
254
+ postConditionMode: params.postConditionMode,
255
+ postConditions: params.postConditions
256
+ });
257
+ if (params.fee === undefined) {
258
+ const estimates = await estimateFee(client, { transaction: unsigned });
259
+ const mid = estimates[1] ?? estimates[0];
260
+ if (mid) {
261
+ unsigned.auth.spendingCondition.fee = BigInt(mid.fee);
262
+ }
263
+ }
264
+ const signed = await signTransactionWithAccount(unsigned, account);
265
+ const result = await sendTransaction(client, { transaction: signed });
266
+ return result.txid;
267
+ }
268
+
269
+ // src/actions/wallet/signMessage.ts
270
+ import { sha256 } from "@noble/hashes/sha2.js";
271
+ var SIP018_PREFIX = new Uint8Array([83, 73, 80, 48, 49, 56]);
272
+ async function signMessage(client, params) {
273
+ const account = client.account;
274
+ if (!account)
275
+ throw new Error("Account required");
276
+ if (isProviderAccount(account)) {
277
+ const method = params.domain ? "stx_signStructuredMessage" : "stx_signMessage";
278
+ const result = await account.provider.request(method, {
279
+ message: params.message,
280
+ domain: params.domain
281
+ });
282
+ return result.signature;
283
+ }
284
+ const cv = typeof params.message === "string" ? Cl.stringAscii(params.message) : params.message;
285
+ const serializedMsg = serializeCVBytes(cv);
286
+ let hash;
287
+ if (params.domain) {
288
+ const domainCV = Cl.tuple({
289
+ name: Cl.stringAscii(params.domain.name),
290
+ version: Cl.stringAscii(params.domain.version),
291
+ "chain-id": Cl.uint(params.domain.chainId)
292
+ });
293
+ const serializedDomain = serializeCVBytes(domainCV);
294
+ hash = sha256(concatBytes(SIP018_PREFIX, serializedDomain, serializedMsg));
295
+ } else {
296
+ hash = sha256(serializedMsg);
297
+ }
298
+ const sigBytes = await account.sign(hash);
299
+ return bytesToHex(sigBytes);
300
+ }
301
+
302
+ // src/actions/wallet/sponsorTransaction.ts
303
+ async function sponsorTransaction(client, params) {
304
+ const { transaction } = params;
305
+ if (transaction.auth.authType !== AuthType.Sponsored) {
306
+ throw new Error("Transaction must have sponsored authorization");
307
+ }
308
+ const account = client.account;
309
+ if (!account)
310
+ throw new Error("Account required");
311
+ if (isProviderAccount(account)) {
312
+ throw new Error("Provider accounts cannot sponsor transactions");
313
+ }
314
+ const nonce = params.nonce != null ? intToBigInt(params.nonce) : await getNonce(client, { address: account.address });
315
+ let fee;
316
+ if (params.fee != null) {
317
+ fee = intToBigInt(params.fee);
318
+ } else {
319
+ const estimates = await estimateFee(client, { transaction });
320
+ const mid = estimates[1] ?? estimates[0];
321
+ fee = mid ? BigInt(mid.fee) : 0n;
322
+ }
323
+ const sponsorCondition = createSingleSigSpendingCondition(account.publicKey, nonce, fee);
324
+ const auth = transaction.auth;
325
+ const sponsored = {
326
+ ...transaction,
327
+ auth: {
328
+ ...auth,
329
+ sponsorSpendingCondition: sponsorCondition
330
+ }
331
+ };
332
+ return signSponsorWithAccount(sponsored, account);
333
+ }
334
+
335
+ export { getBalance, getAccountInfo, getBlock, getBlockHeight, getContractAbi, multicall, simulateCall, simulateTransaction, signTransactionAction, transferStx, deployContract, signMessage, sponsorTransaction };
336
+
337
+ //# debugId=A1189E78FB52287464756E2164756E21
338
+ //# sourceMappingURL=stacks-n2g56wgg.js.map