@secondlayer/stacks 5.0.1 → 5.1.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.
- package/README.md +22 -2
- package/dist/shared/{stacks-6gavarmy.js → stacks-1m3m1agc.js} +2 -2
- package/dist/shared/{stacks-db3kwavg.cjs → stacks-37kz5t9f.cjs} +4 -6
- package/dist/shared/{stacks-db3kwavg.cjs.map → stacks-37kz5t9f.cjs.map} +3 -3
- package/dist/shared/{stacks-e3nwm1dz.js → stacks-gyp5ax89.js} +3 -3
- package/dist/shared/{stacks-7bqkf3b0.js → stacks-mbt36bzt.js} +3 -3
- package/dist/shared/{stacks-ga026yxz.js → stacks-qex691bh.js} +11 -4
- package/dist/shared/stacks-qex691bh.js.map +11 -0
- package/dist/shared/{stacks-n4d8j8q3.js → stacks-v03zef3g.js} +5 -7
- package/dist/shared/{stacks-n4d8j8q3.js.map → stacks-v03zef3g.js.map} +3 -3
- package/dist/shared/{stacks-ggdz96r1.cjs → stacks-wk8yp13j.cjs} +10 -3
- package/dist/shared/stacks-wk8yp13j.cjs.map +11 -0
- package/dist/src/actions/index.js +5 -5
- package/dist/src/bitcoin/index.cjs +7 -1
- package/dist/src/bitcoin/index.cjs.map +3 -3
- package/dist/src/bitcoin/index.d.cts +18 -0
- package/dist/src/bitcoin/index.d.ts +18 -0
- package/dist/src/bitcoin/index.js +8 -2
- package/dist/src/bitcoin/index.js.map +3 -3
- package/dist/src/bns/index.js +3 -3
- package/dist/src/index.cjs +2 -1
- package/dist/src/index.cjs.map +2 -2
- package/dist/src/index.d.cts +5 -1
- package/dist/src/index.d.ts +5 -1
- package/dist/src/index.js +7 -5
- package/dist/src/index.js.map +2 -2
- package/dist/src/pox/index.js +3 -3
- package/dist/src/pox5/index.js +4 -4
- package/dist/src/sbtc/index.js +3 -3
- package/dist/src/simnet/index.cjs +1675 -0
- package/dist/src/simnet/index.cjs.map +38 -0
- package/dist/src/simnet/index.d.cts +133 -0
- package/dist/src/simnet/index.d.ts +133 -0
- package/dist/src/simnet/index.js +1637 -0
- package/dist/src/simnet/index.js.map +38 -0
- package/dist/src/stackingdao/index.js +3 -3
- package/dist/src/tools/index.cjs +11 -6
- package/dist/src/tools/index.cjs.map +5 -5
- package/dist/src/tools/index.js +11 -6
- package/dist/src/tools/index.js.map +5 -5
- package/package.json +14 -1
- package/dist/shared/stacks-ga026yxz.js.map +0 -11
- package/dist/shared/stacks-ggdz96r1.cjs.map +0 -11
- /package/dist/shared/{stacks-6gavarmy.js.map → stacks-1m3m1agc.js.map} +0 -0
- /package/dist/shared/{stacks-e3nwm1dz.js.map → stacks-gyp5ax89.js.map} +0 -0
- /package/dist/shared/{stacks-7bqkf3b0.js.map → stacks-mbt36bzt.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secondlayer/stacks",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "Typed Stacks client for TypeScript: read contracts, decode Clarity, build and send transactions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -113,6 +113,11 @@
|
|
|
113
113
|
"types": "./dist/src/filters/index.d.ts",
|
|
114
114
|
"import": "./dist/src/filters/index.js",
|
|
115
115
|
"require": "./dist/src/filters/index.cjs"
|
|
116
|
+
},
|
|
117
|
+
"./simnet": {
|
|
118
|
+
"types": "./dist/src/simnet/index.d.ts",
|
|
119
|
+
"import": "./dist/src/simnet/index.js",
|
|
120
|
+
"require": "./dist/src/simnet/index.cjs"
|
|
116
121
|
}
|
|
117
122
|
},
|
|
118
123
|
"files": ["dist"],
|
|
@@ -133,11 +138,19 @@
|
|
|
133
138
|
"zod": "^4.3.6"
|
|
134
139
|
},
|
|
135
140
|
"peerDependencies": {
|
|
141
|
+
"@stacks/clarinet-sdk": "^3",
|
|
142
|
+
"@stacks/transactions": "^7",
|
|
136
143
|
"ai": "^6",
|
|
137
144
|
"typescript": "^5",
|
|
138
145
|
"zod": "^4"
|
|
139
146
|
},
|
|
140
147
|
"peerDependenciesMeta": {
|
|
148
|
+
"@stacks/clarinet-sdk": {
|
|
149
|
+
"optional": true
|
|
150
|
+
},
|
|
151
|
+
"@stacks/transactions": {
|
|
152
|
+
"optional": true
|
|
153
|
+
},
|
|
141
154
|
"ai": {
|
|
142
155
|
"optional": true
|
|
143
156
|
},
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/errors/response.ts", "../src/actions/public/readContract.ts"],
|
|
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",
|
|
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/${encodeURIComponent(address)}/${encodeURIComponent(name)}/${encodeURIComponent(params.functionName)}`;\n\tconst data = await client.request(\n\t\tparams.tip ? `${path}?tip=${encodeURIComponent(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"
|
|
7
|
-
],
|
|
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,mBAAmB,OAAO,KAAK,mBAAmB,IAAI,KAAK,mBAAmB,OAAO,YAAY;AAAA,EACzI,MAAM,OAAO,MAAM,OAAO,QACzB,OAAO,MAAM,GAAG,YAAY,mBAAmB,OAAO,GAAG,MAAM,MAC/D;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": "779EB9422D78AD1664756E2164756E21",
|
|
10
|
-
"names": []
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/errors/response.ts", "../src/actions/public/readContract.ts"],
|
|
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",
|
|
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/${encodeURIComponent(address)}/${encodeURIComponent(name)}/${encodeURIComponent(params.functionName)}`;\n\tconst data = await client.request(\n\t\tparams.tip ? `${path}?tip=${encodeURIComponent(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"
|
|
7
|
-
],
|
|
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,mBAAmB,OAAO,KAAK,mBAAmB,IAAI,KAAK,mBAAmB,OAAO,YAAY;AAAA,EACzI,MAAM,OAAO,MAAM,OAAO,QACzB,OAAO,MAAM,GAAG,YAAY,mBAAmB,OAAO,GAAG,MAAM,MAC/D;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": "4D60ABB15BA3624064756E2164756E21",
|
|
10
|
-
"names": []
|
|
11
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|