@secondlayer/stacks 0.2.2 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/stacks-02actsrx.cjs.map +2 -2
- package/dist/shared/{stacks-xp9n3r0t.js → stacks-09wa7ewe.js} +108 -108
- package/dist/shared/stacks-09wa7ewe.js.map +15 -0
- package/dist/shared/{stacks-ky14tdf6.cjs → stacks-0nfexv24.cjs} +20 -8
- package/dist/shared/stacks-0nfexv24.cjs.map +14 -0
- package/dist/shared/{stacks-an5k8n4t.cjs → stacks-14pgpkrr.cjs} +82 -73
- package/dist/shared/stacks-14pgpkrr.cjs.map +23 -0
- package/dist/shared/{stacks-v6ja2eh7.cjs → stacks-17sdtaxg.cjs} +106 -102
- package/dist/shared/stacks-17sdtaxg.cjs.map +15 -0
- package/dist/shared/{stacks-96gaxfcf.js → stacks-1s5w4ncf.js} +44 -32
- package/dist/shared/stacks-1s5w4ncf.js.map +17 -0
- package/dist/shared/stacks-24h5k94q.cjs.map +3 -3
- package/dist/shared/{stacks-evnzth1q.cjs → stacks-4vzmhw3q.cjs} +3 -3
- package/dist/shared/stacks-4vzmhw3q.cjs.map +10 -0
- package/dist/shared/{stacks-k9p8m3wf.js → stacks-4x2bcc2k.js} +87 -78
- package/dist/shared/stacks-4x2bcc2k.js.map +23 -0
- package/dist/shared/stacks-5tprhns9.cjs.map +3 -3
- package/dist/shared/stacks-709tra19.js.map +2 -2
- package/dist/shared/{stacks-q79dx28x.js → stacks-70p84bgg.js} +3 -3
- package/dist/shared/stacks-70p84bgg.js.map +10 -0
- package/dist/shared/{stacks-k2p5tv6x.js → stacks-913a2rx7.js} +3 -3
- package/dist/shared/stacks-913a2rx7.js.map +10 -0
- package/dist/shared/{stacks-jrnmh4kc.js → stacks-96d6m1zy.js} +15 -6
- package/dist/shared/stacks-96d6m1zy.js.map +11 -0
- package/dist/shared/stacks-9g0jhab3.cjs.map +2 -2
- package/dist/shared/stacks-dr5en54r.cjs.map +2 -2
- package/dist/shared/stacks-fcaefc5b.cjs.map +2 -2
- package/dist/shared/stacks-gck1sq7h.cjs.map +2 -2
- package/dist/shared/stacks-je937aas.js.map +2 -2
- package/dist/shared/{stacks-k58k970n.js → stacks-kg1npstf.js} +5 -3
- package/dist/shared/stacks-kg1npstf.js.map +10 -0
- package/dist/shared/{stacks-qvg7c24g.cjs → stacks-n98w7g57.cjs} +5 -3
- package/dist/shared/stacks-n98w7g57.cjs.map +10 -0
- package/dist/shared/{stacks-6m1z4j07.js → stacks-nqae5amn.cjs} +74 -160
- package/dist/shared/stacks-nqae5amn.cjs.map +10 -0
- package/dist/shared/stacks-qcae5852.js.map +2 -2
- package/dist/shared/stacks-qt8ehebn.js.map +3 -3
- package/dist/shared/stacks-ra02bpny.cjs.map +3 -3
- package/dist/shared/stacks-rwfgts3s.js.map +2 -2
- package/dist/shared/stacks-s10yb9gz.js.map +2 -2
- package/dist/shared/{stacks-etf219gs.cjs → stacks-s30kkvm8.js} +101 -118
- package/dist/shared/stacks-s30kkvm8.js.map +10 -0
- package/dist/shared/stacks-s7z5q8be.js.map +3 -3
- package/dist/shared/stacks-v9jqcpd4.js.map +2 -2
- package/dist/shared/stacks-vdfag81a.cjs.map +2 -2
- package/dist/shared/{stacks-rg1g0fja.js → stacks-wjem3xw9.js} +21 -9
- package/dist/shared/stacks-wjem3xw9.js.map +14 -0
- package/dist/shared/{stacks-k08tgzyp.cjs → stacks-wyxj879g.cjs} +3 -3
- package/dist/shared/stacks-wyxj879g.cjs.map +13 -0
- package/dist/shared/stacks-y3dh7hv1.js.map +3 -3
- package/dist/shared/{stacks-2ar4prfz.cjs → stacks-y5262j0z.cjs} +14 -5
- package/dist/shared/stacks-y5262j0z.cjs.map +11 -0
- package/dist/shared/stacks-ya3x01yd.cjs.map +2 -2
- package/dist/shared/{stacks-p93g814f.js → stacks-zf7rbpzp.js} +4 -4
- package/dist/shared/stacks-zf7rbpzp.js.map +13 -0
- package/dist/shared/{stacks-61rvzkz1.cjs → stacks-znrb59ce.cjs} +41 -29
- package/dist/shared/stacks-znrb59ce.cjs.map +17 -0
- package/dist/src/accounts/index.cjs +2 -2
- package/dist/src/accounts/index.cjs.map +5 -5
- package/dist/src/accounts/index.js +2 -6
- package/dist/src/accounts/index.js.map +5 -5
- package/dist/src/actions/index.d.cts +29 -29
- package/dist/src/actions/index.d.ts +29 -29
- package/dist/src/actions/index.js +7 -7
- package/dist/src/bns/index.cjs +55 -43
- package/dist/src/bns/index.cjs.map +9 -9
- package/dist/src/bns/index.d.cts +29 -29
- package/dist/src/bns/index.d.ts +29 -29
- package/dist/src/bns/index.js +62 -50
- package/dist/src/bns/index.js.map +9 -9
- package/dist/src/clarity/index.js +4 -4
- package/dist/src/connect/index.cjs +114 -112
- package/dist/src/connect/index.cjs.map +13 -13
- package/dist/src/connect/index.js +114 -112
- package/dist/src/connect/index.js.map +13 -13
- package/dist/src/connect/walletconnect/index.cjs +3 -3
- package/dist/src/connect/walletconnect/index.cjs.map +10 -10
- package/dist/src/connect/walletconnect/index.js +3 -3
- package/dist/src/connect/walletconnect/index.js.map +10 -10
- package/dist/src/index.cjs +108 -2
- package/dist/src/index.cjs.map +19 -15
- package/dist/src/index.d.cts +291 -112
- package/dist/src/index.d.ts +291 -112
- package/dist/src/index.js +122 -9
- package/dist/src/index.js.map +19 -15
- package/dist/src/pox/index.cjs.map +6 -6
- package/dist/src/pox/index.d.cts +29 -29
- package/dist/src/pox/index.d.ts +29 -29
- package/dist/src/pox/index.js +5 -5
- package/dist/src/pox/index.js.map +6 -6
- package/dist/src/stackingdao/index.cjs +31 -6
- package/dist/src/stackingdao/index.cjs.map +6 -6
- package/dist/src/stackingdao/index.d.cts +29 -29
- package/dist/src/stackingdao/index.d.ts +29 -29
- package/dist/src/stackingdao/index.js +37 -12
- package/dist/src/stackingdao/index.js.map +6 -6
- package/dist/src/subscriptions/index.d.cts +29 -29
- package/dist/src/subscriptions/index.d.ts +29 -29
- package/dist/src/tools/btc/index.cjs +130 -0
- package/dist/src/tools/btc/index.cjs.map +10 -0
- package/dist/src/tools/btc/index.d.cts +8 -0
- package/dist/src/tools/btc/index.d.ts +8 -0
- package/dist/src/tools/btc/index.js +89 -0
- package/dist/src/tools/btc/index.js.map +10 -0
- package/dist/src/tools/index.cjs +2470 -0
- package/dist/src/tools/index.cjs.map +61 -0
- package/dist/src/tools/index.d.cts +144 -0
- package/dist/src/tools/index.d.ts +144 -0
- package/dist/src/tools/index.js +2435 -0
- package/dist/src/tools/index.js.map +61 -0
- package/dist/src/transactions/index.js +3 -3
- package/dist/src/triggers/index.cjs +66 -0
- package/dist/src/triggers/index.cjs.map +10 -0
- package/dist/src/triggers/index.d.cts +120 -0
- package/dist/src/triggers/index.d.ts +120 -0
- package/dist/src/triggers/index.js +25 -0
- package/dist/src/triggers/index.js.map +10 -0
- package/dist/src/tx/index.cjs +65 -0
- package/dist/src/tx/index.cjs.map +10 -0
- package/dist/src/tx/index.d.cts +42 -0
- package/dist/src/tx/index.d.ts +42 -0
- package/dist/src/tx/index.js +22 -0
- package/dist/src/tx/index.js.map +10 -0
- package/dist/src/ui/index.cjs +431 -0
- package/dist/src/ui/index.cjs.map +27 -0
- package/dist/src/ui/index.d.cts +107 -0
- package/dist/src/ui/index.d.ts +107 -0
- package/dist/src/ui/index.js +391 -0
- package/dist/src/ui/index.js.map +27 -0
- package/dist/src/ui/schemas.cjs +134 -0
- package/dist/src/ui/schemas.cjs.map +18 -0
- package/dist/src/ui/schemas.d.cts +83 -0
- package/dist/src/ui/schemas.d.ts +83 -0
- package/dist/src/ui/schemas.js +91 -0
- package/dist/src/ui/schemas.js.map +18 -0
- package/dist/src/utils/index.cjs +3 -3
- package/dist/src/utils/index.cjs.map +4 -4
- package/dist/src/utils/index.js +4 -4
- package/dist/src/utils/index.js.map +4 -4
- package/package.json +156 -105
- package/dist/shared/stacks-2ar4prfz.cjs.map +0 -11
- package/dist/shared/stacks-61rvzkz1.cjs.map +0 -17
- package/dist/shared/stacks-6m1z4j07.js.map +0 -10
- package/dist/shared/stacks-96gaxfcf.js.map +0 -17
- package/dist/shared/stacks-an5k8n4t.cjs.map +0 -23
- package/dist/shared/stacks-etf219gs.cjs.map +0 -10
- package/dist/shared/stacks-evnzth1q.cjs.map +0 -10
- package/dist/shared/stacks-jrnmh4kc.js.map +0 -11
- package/dist/shared/stacks-k08tgzyp.cjs.map +0 -13
- package/dist/shared/stacks-k2p5tv6x.js.map +0 -10
- package/dist/shared/stacks-k58k970n.js.map +0 -10
- package/dist/shared/stacks-k9p8m3wf.js.map +0 -23
- package/dist/shared/stacks-ky14tdf6.cjs.map +0 -13
- package/dist/shared/stacks-p93g814f.js.map +0 -13
- package/dist/shared/stacks-q79dx28x.js.map +0 -10
- package/dist/shared/stacks-qvg7c24g.cjs.map +0 -10
- package/dist/shared/stacks-rg1g0fja.js.map +0 -13
- package/dist/shared/stacks-v6ja2eh7.cjs.map +0 -15
- package/dist/shared/stacks-xp9n3r0t.js.map +0 -15
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
// src/actions/public/estimateFee.ts
|
|
2
|
+
async function estimateFee(client, params) {
|
|
3
|
+
const payloadHex = bytesToHex(serializePayload(params.transaction.payload));
|
|
4
|
+
const txHex = bytesToHex(serializeTransaction(params.transaction));
|
|
5
|
+
const data = await client.request("/v2/fees/transaction", {
|
|
6
|
+
method: "POST",
|
|
7
|
+
body: {
|
|
8
|
+
estimated_len: Math.ceil(txHex.length / 2),
|
|
9
|
+
transaction_payload: "0x" + payloadHex
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
return (data.estimations ?? []).map((e) => ({
|
|
13
|
+
feeRate: e.fee_rate,
|
|
14
|
+
fee: e.fee
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/actions/public/getMapEntry.ts
|
|
19
|
+
async function getMapEntry(client, params) {
|
|
20
|
+
const [address, name] = parseContractId(params.contract);
|
|
21
|
+
const serializedKey = with0x(bytesToHex(serializeCVBytes(params.key)));
|
|
22
|
+
const data = await client.request(`/v2/map_entry/${address}/${name}/${params.mapName}`, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: serializedKey
|
|
25
|
+
});
|
|
26
|
+
return deserializeCVBytes(data.data);
|
|
27
|
+
}
|
|
28
|
+
|
|
1
29
|
// src/actions/public/getNonce.ts
|
|
2
30
|
async function getNonce(client, params) {
|
|
3
31
|
const data = await client.request(`/v2/accounts/${params.address}`, {
|
|
@@ -24,35 +52,11 @@ async function readContract(client, params) {
|
|
|
24
52
|
throw new Error(data.cause ?? "Read-only call failed");
|
|
25
53
|
}
|
|
26
54
|
|
|
27
|
-
// src/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const serializedKey = with0x(bytesToHex(serializeCVBytes(params.key)));
|
|
31
|
-
const data = await client.request(`/v2/map_entry/${address}/${name}/${params.mapName}`, {
|
|
32
|
-
method: "POST",
|
|
33
|
-
body: serializedKey
|
|
34
|
-
});
|
|
35
|
-
return deserializeCVBytes(data.data);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/actions/public/estimateFee.ts
|
|
39
|
-
async function estimateFee(client, params) {
|
|
40
|
-
const payloadHex = bytesToHex(serializePayload(params.transaction.payload));
|
|
41
|
-
const txHex = bytesToHex(serializeTransaction(params.transaction));
|
|
42
|
-
const data = await client.request("/v2/fees/transaction", {
|
|
43
|
-
method: "POST",
|
|
44
|
-
body: {
|
|
45
|
-
estimated_len: Math.ceil(txHex.length / 2),
|
|
46
|
-
transaction_payload: "0x" + payloadHex
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return (data.estimations ?? []).map((e) => ({
|
|
50
|
-
feeRate: e.fee_rate,
|
|
51
|
-
fee: e.fee
|
|
52
|
-
}));
|
|
55
|
+
// src/errors/transaction.ts
|
|
56
|
+
class TransactionError extends BaseError {
|
|
57
|
+
name = "TransactionError";
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
// src/errors/transaction.ts
|
|
56
60
|
class BroadcastError extends BaseError {
|
|
57
61
|
name = "BroadcastError";
|
|
58
62
|
txid;
|
|
@@ -64,6 +68,14 @@ class BroadcastError extends BaseError {
|
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
|
|
71
|
+
class SerializationError extends BaseError {
|
|
72
|
+
name = "SerializationError";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
class SigningError extends BaseError {
|
|
76
|
+
name = "SigningError";
|
|
77
|
+
}
|
|
78
|
+
|
|
67
79
|
// src/actions/wallet/sendTransaction.ts
|
|
68
80
|
async function sendTransaction(client, params) {
|
|
69
81
|
const hex = bytesToHex(serializeTransaction(params.transaction));
|
|
@@ -128,5 +140,5 @@ async function callContract(client, params) {
|
|
|
128
140
|
return result.txid;
|
|
129
141
|
}
|
|
130
142
|
|
|
131
|
-
//# debugId=
|
|
132
|
-
//# sourceMappingURL=stacks-
|
|
143
|
+
//# debugId=BE1E5B637739D1BE64756E2164756E21
|
|
144
|
+
//# sourceMappingURL=stacks-znrb59ce.cjs.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/actions/public/estimateFee.ts", "../src/actions/public/getMapEntry.ts", "../src/actions/public/getNonce.ts", "../src/actions/public/readContract.ts", "../src/errors/transaction.ts", "../src/actions/wallet/sendTransaction.ts", "../src/actions/wallet/utils.ts", "../src/actions/wallet/callContract.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Client } from \"../../clients/types.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\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\treturn (data.estimations ?? []).map((e: any) => ({\n\t\tfeeRate: e.fee_rate,\n\t\tfee: e.fee,\n\t}));\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 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\treturn deserializeCVBytes<T>(data.data);\n}\n",
|
|
7
|
+
"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\treturn BigInt(data.nonce);\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 { 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};\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 data = await client.request(\n\t\t`/v2/contracts/call-read/${address}/${name}/${params.functionName}`,\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",
|
|
9
|
+
"import { BaseError } from \"./base.ts\";\n\nexport class TransactionError extends BaseError {\n\toverride name = \"TransactionError\";\n}\n\nexport class BroadcastError extends BaseError {\n\toverride name = \"BroadcastError\";\n\ttxid?: string;\n\treason?: string;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions?: { cause?: Error; txid?: string; reason?: string },\n\t) {\n\t\tsuper(message, options);\n\t\tthis.txid = options?.txid;\n\t\tthis.reason = options?.reason;\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",
|
|
10
|
+
"import type { Client } from \"../../clients/types.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};\n\nexport type SendTransactionResult = {\n\ttxid: string;\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\tconst data = await client.request(\"/v2/transactions\", {\n\t\tmethod: \"POST\",\n\t\tbody,\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});\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\treturn { txid };\n}\n",
|
|
11
|
+
"import type { ProviderAccount } from \"../../accounts/types.ts\";\nimport type { Account } from \"../../clients/types.ts\";\n\nexport function isProviderAccount(\n\taccount: Account,\n): account is ProviderAccount {\n\treturn account.type === \"provider\";\n}\n",
|
|
12
|
+
"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 { estimateFee } from \"../public/estimateFee.ts\";\nimport { getNonce } from \"../public/getNonce.ts\";\nimport { sendTransaction } from \"./sendTransaction.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type CallContractParams = {\n\tcontract: string; // \"address.name\"\n\tfunctionName: string;\n\tfunctionArgs?: ClarityValue[];\n\tfee?: IntegerType;\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// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\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 [contractAddress, contractName] = parseContractId(params.contract);\n\n\tconst nonce =\n\t\tparams.nonce ?? (await getNonce(client, { address: account.address }));\n\n\tconst unsigned = buildContractCall({\n\t\tcontractAddress,\n\t\tcontractName,\n\t\tfunctionName: params.functionName,\n\t\tfunctionArgs: params.functionArgs ?? [],\n\t\tfee: params.fee ?? 0n,\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 (params.fee === undefined) {\n\t\tconst estimates = await estimateFee(client, { transaction: unsigned });\n\t\tconst mid = estimates[1] ?? estimates[0];\n\t\tif (mid) {\n\t\t\t(unsigned.auth.spendingCondition as any).fee = BigInt(mid.fee);\n\t\t}\n\t}\n\n\tconst signed = await signTransactionWithAccount(unsigned, account);\n\tconst result = await sendTransaction(client, { transaction: signed });\n\treturn result.txid;\n}\n"
|
|
13
|
+
],
|
|
14
|
+
"mappings": ";AAiBA,eAAsB,WAAW,CACh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AAU,OAAO;AAAA,EACjE,MAAM,SAAS,MAAM,gBAAgB,QAAQ,EAAE,aAAa,OAAO,CAAC;AAAA,EACpE,OAAO,OAAO;AAAA;",
|
|
15
|
+
"debugId": "BE1E5B637739D1BE64756E2164756E21",
|
|
16
|
+
"names": []
|
|
17
|
+
}
|
|
@@ -10,9 +10,9 @@ __export(exports_accounts, {
|
|
|
10
10
|
module.exports = __toCommonJS(exports_accounts);
|
|
11
11
|
|
|
12
12
|
// src/accounts/privateKeyToAccount.ts
|
|
13
|
-
var import_secp256k1 = require("@noble/secp256k1");
|
|
14
13
|
var import_hmac = require("@noble/hashes/hmac.js");
|
|
15
14
|
var import_sha2 = require("@noble/hashes/sha2.js");
|
|
15
|
+
var import_secp256k1 = require("@noble/secp256k1");
|
|
16
16
|
function ensureSyncSigning() {
|
|
17
17
|
if (!import_secp256k1.etc.hmacSha256Sync) {
|
|
18
18
|
import_secp256k1.etc.hmacSha256Sync = (key, ...msgs) => {
|
|
@@ -86,5 +86,5 @@ function toAccount(source) {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
//# debugId=
|
|
89
|
+
//# debugId=7A61E0D86E2E8DC764756E2164756E21
|
|
90
90
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/accounts/privateKeyToAccount.ts", "../src/accounts/mnemonicToAccount.ts", "../src/accounts/toAccount.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import {
|
|
6
|
-
"import { HDKey } from \"@scure/bip32\";\nimport { mnemonicToSeedSync } from \"@scure/bip39\";\nimport { bytesToHex } from \"../utils/encoding.ts\";\nimport {
|
|
7
|
-
"import type { AccountSource, CustomAccount } from \"./types.ts\";\n\nexport function toAccount(source: AccountSource): CustomAccount {\n
|
|
5
|
+
"import { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport { etc, getPublicKey as nobleGetPublicKey, sign } from \"@noble/secp256k1\";\nimport { c32address } from \"../utils/c32.ts\";\nimport { bytesToHex, hexToBytes, without0x } from \"../utils/encoding.ts\";\nimport { hash160 } from \"../utils/hash.ts\";\nimport type { LocalAccount } from \"./types.ts\";\n\nfunction ensureSyncSigning() {\n\tif (!etc.hmacSha256Sync) {\n\t\tetc.hmacSha256Sync = (key: Uint8Array, ...msgs: Uint8Array[]) => {\n\t\t\tconst h = hmac.create(sha256, key);\n\t\t\tmsgs.forEach((msg) => h.update(msg));\n\t\t\treturn h.digest();\n\t\t};\n\t}\n}\n\nconst PRIVATE_KEY_COMPRESSED_LENGTH = 33;\n\nexport function privateKeyToAccount(\n\tprivateKey: string | Uint8Array,\n\toptions?: { addressVersion?: number },\n): LocalAccount {\n\tensureSyncSigning();\n\tconst keyBytes = normalizePrivateKey(privateKey);\n\tconst rawKey = keyBytes.slice(0, 32);\n\n\t// Always derive compressed public key\n\tconst publicKeyBytes = nobleGetPublicKey(rawKey, true);\n\tconst publicKeyHex = bytesToHex(publicKeyBytes);\n\n\t// Default to mainnet single-sig (22)\n\tconst addressVersion = options?.addressVersion ?? 22;\n\tconst address = c32address(\n\t\taddressVersion,\n\t\tbytesToHex(hash160(publicKeyBytes)),\n\t);\n\n\treturn {\n\t\ttype: \"local\",\n\t\taddress,\n\t\tpublicKey: publicKeyHex,\n\n\t\tsign(hash: Uint8Array): Uint8Array {\n\t\t\tconst sig = sign(hash, rawKey, { lowS: true });\n\t\t\tconst result = new Uint8Array(65);\n\t\t\tresult[0] = sig.recovery;\n\t\t\tresult.set(sig.toCompactRawBytes(), 1);\n\t\t\treturn result;\n\t\t},\n\n\t\tsignMessage(message: string | Uint8Array): string {\n\t\t\tconst msgBytes =\n\t\t\t\ttypeof message === \"string\"\n\t\t\t\t\t? new TextEncoder().encode(message)\n\t\t\t\t\t: message;\n\t\t\tconst msgHash = sha256(msgBytes);\n\t\t\tconst sigBytes = this.sign(msgHash);\n\t\t\treturn bytesToHex(sigBytes);\n\t\t},\n\t};\n}\n\nfunction normalizePrivateKey(key: string | Uint8Array): Uint8Array {\n\tif (typeof key === \"string\") {\n\t\treturn hexToBytes(without0x(key));\n\t}\n\treturn key;\n}\n\n/** Append 0x01 suffix if not already compressed */\nexport function compressPrivateKey(key: string | Uint8Array): string {\n\tconst hex = typeof key === \"string\" ? without0x(key) : bytesToHex(key);\n\tif (hex.length === PRIVATE_KEY_COMPRESSED_LENGTH * 2) return hex;\n\treturn `${hex}01`;\n}\n",
|
|
6
|
+
"import { HDKey } from \"@scure/bip32\";\nimport { mnemonicToSeedSync } from \"@scure/bip39\";\nimport { bytesToHex } from \"../utils/encoding.ts\";\nimport {\n\tcompressPrivateKey,\n\tprivateKeyToAccount,\n} from \"./privateKeyToAccount.ts\";\nimport type { LocalAccount } from \"./types.ts\";\n\nconst STX_DERIVATION_PATH = \"m/44'/5757'/0'/0\";\n\nexport function mnemonicToAccount(\n\tmnemonic: string,\n\toptions?: {\n\t\taccountIndex?: number;\n\t\taddressVersion?: number;\n\t},\n): LocalAccount {\n\tconst { accountIndex = 0, addressVersion } = options ?? {};\n\n\tconst seed = mnemonicToSeedSync(mnemonic);\n\tconst root = HDKey.fromMasterSeed(seed);\n\tconst child = root.derive(`${STX_DERIVATION_PATH}/${accountIndex}`);\n\n\tif (!child.privateKey) throw new Error(\"Failed to derive private key\");\n\n\tconst privateKeyHex = compressPrivateKey(bytesToHex(child.privateKey));\n\treturn privateKeyToAccount(privateKeyHex, { addressVersion });\n}\n",
|
|
7
|
+
"import type { AccountSource, CustomAccount } from \"./types.ts\";\n\nexport function toAccount(source: AccountSource): CustomAccount {\n\treturn {\n\t\ttype: \"custom\",\n\t\taddress: source.address,\n\t\tpublicKey: source.publicKey,\n\t\tsign: source.sign,\n\t};\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";;;;;;;;;;;;
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";;;;;;;;;;;;AAAq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AA;AAGD,SAAS,mBAAmB,CAAC,KAAsC;AAAA,EAClE,IAAI,OAAO,QAAQ,UAAU;AAAA,IAC5B,OAAO,WAAW,UAAU,GAAG,CAAC;AAAA,EACjC;AAAA,EACA,OAAO;AAAA;AAID,SAAS,kBAAkB,CAAC,KAAkC;AAAA,EACpE,MAAM,MAAM,OAAO,QAAQ,WAAW,UAAU,GAAG,IAAI,WAAW,GAAG;AAAA,EACrE,IAAI,IAAI,WAAW,gCAAgC;AAAA,IAAG,OAAO;AAAA,EAC7D,OAAO,GAAG;AAAA;;AC3EW,IAAtB;AACmC,IAAnC;AAQA,IAAM,sBAAsB;AAErB,SAAS,iBAAiB,CAChC,UACA,SAIe;AAAA,EACf,QAAQ,eAAe,GAAG,mBAAmB,WAAW,CAAC;AAAA,EAEzD,MAAM,OAAO,gCAAmB,QAAQ;AAAA,EACxC,MAAM,OAAO,mBAAM,eAAe,IAAI;AAAA,EACtC,MAAM,QAAQ,KAAK,OAAO,GAAG,uBAAuB,cAAc;AAAA,EAElE,IAAI,CAAC,MAAM;AAAA,IAAY,MAAM,IAAI,MAAM,8BAA8B;AAAA,EAErE,MAAM,gBAAgB,mBAAmB,WAAW,MAAM,UAAU,CAAC;AAAA,EACrE,OAAO,oBAAoB,eAAe,EAAE,eAAe,CAAC;AAAA;;ACzBtD,SAAS,SAAS,CAAC,QAAsC;AAAA,EAC/D,OAAO;AAAA,IACN,MAAM;AAAA,IACN,SAAS,OAAO;AAAA,IAChB,WAAW,OAAO;AAAA,IAClB,MAAM,OAAO;AAAA,EACd;AAAA;",
|
|
10
|
+
"debugId": "7A61E0D86E2E8DC764756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -12,13 +12,9 @@ import {
|
|
|
12
12
|
} from "../../shared/stacks-s7z5q8be.js";
|
|
13
13
|
|
|
14
14
|
// src/accounts/privateKeyToAccount.ts
|
|
15
|
-
import {
|
|
16
|
-
getPublicKey as nobleGetPublicKey,
|
|
17
|
-
sign,
|
|
18
|
-
etc
|
|
19
|
-
} from "@noble/secp256k1";
|
|
20
15
|
import { hmac } from "@noble/hashes/hmac.js";
|
|
21
16
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
17
|
+
import { etc, getPublicKey as nobleGetPublicKey, sign } from "@noble/secp256k1";
|
|
22
18
|
function ensureSyncSigning() {
|
|
23
19
|
if (!etc.hmacSha256Sync) {
|
|
24
20
|
etc.hmacSha256Sync = (key, ...msgs) => {
|
|
@@ -99,5 +95,5 @@ export {
|
|
|
99
95
|
compressPrivateKey
|
|
100
96
|
};
|
|
101
97
|
|
|
102
|
-
//# debugId=
|
|
98
|
+
//# debugId=73E71BA0E076678C64756E2164756E21
|
|
103
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/accounts/privateKeyToAccount.ts", "../src/accounts/mnemonicToAccount.ts", "../src/accounts/toAccount.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import {
|
|
6
|
-
"import { HDKey } from \"@scure/bip32\";\nimport { mnemonicToSeedSync } from \"@scure/bip39\";\nimport { bytesToHex } from \"../utils/encoding.ts\";\nimport {
|
|
7
|
-
"import type { AccountSource, CustomAccount } from \"./types.ts\";\n\nexport function toAccount(source: AccountSource): CustomAccount {\n
|
|
5
|
+
"import { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport { etc, getPublicKey as nobleGetPublicKey, sign } from \"@noble/secp256k1\";\nimport { c32address } from \"../utils/c32.ts\";\nimport { bytesToHex, hexToBytes, without0x } from \"../utils/encoding.ts\";\nimport { hash160 } from \"../utils/hash.ts\";\nimport type { LocalAccount } from \"./types.ts\";\n\nfunction ensureSyncSigning() {\n\tif (!etc.hmacSha256Sync) {\n\t\tetc.hmacSha256Sync = (key: Uint8Array, ...msgs: Uint8Array[]) => {\n\t\t\tconst h = hmac.create(sha256, key);\n\t\t\tmsgs.forEach((msg) => h.update(msg));\n\t\t\treturn h.digest();\n\t\t};\n\t}\n}\n\nconst PRIVATE_KEY_COMPRESSED_LENGTH = 33;\n\nexport function privateKeyToAccount(\n\tprivateKey: string | Uint8Array,\n\toptions?: { addressVersion?: number },\n): LocalAccount {\n\tensureSyncSigning();\n\tconst keyBytes = normalizePrivateKey(privateKey);\n\tconst rawKey = keyBytes.slice(0, 32);\n\n\t// Always derive compressed public key\n\tconst publicKeyBytes = nobleGetPublicKey(rawKey, true);\n\tconst publicKeyHex = bytesToHex(publicKeyBytes);\n\n\t// Default to mainnet single-sig (22)\n\tconst addressVersion = options?.addressVersion ?? 22;\n\tconst address = c32address(\n\t\taddressVersion,\n\t\tbytesToHex(hash160(publicKeyBytes)),\n\t);\n\n\treturn {\n\t\ttype: \"local\",\n\t\taddress,\n\t\tpublicKey: publicKeyHex,\n\n\t\tsign(hash: Uint8Array): Uint8Array {\n\t\t\tconst sig = sign(hash, rawKey, { lowS: true });\n\t\t\tconst result = new Uint8Array(65);\n\t\t\tresult[0] = sig.recovery;\n\t\t\tresult.set(sig.toCompactRawBytes(), 1);\n\t\t\treturn result;\n\t\t},\n\n\t\tsignMessage(message: string | Uint8Array): string {\n\t\t\tconst msgBytes =\n\t\t\t\ttypeof message === \"string\"\n\t\t\t\t\t? new TextEncoder().encode(message)\n\t\t\t\t\t: message;\n\t\t\tconst msgHash = sha256(msgBytes);\n\t\t\tconst sigBytes = this.sign(msgHash);\n\t\t\treturn bytesToHex(sigBytes);\n\t\t},\n\t};\n}\n\nfunction normalizePrivateKey(key: string | Uint8Array): Uint8Array {\n\tif (typeof key === \"string\") {\n\t\treturn hexToBytes(without0x(key));\n\t}\n\treturn key;\n}\n\n/** Append 0x01 suffix if not already compressed */\nexport function compressPrivateKey(key: string | Uint8Array): string {\n\tconst hex = typeof key === \"string\" ? without0x(key) : bytesToHex(key);\n\tif (hex.length === PRIVATE_KEY_COMPRESSED_LENGTH * 2) return hex;\n\treturn `${hex}01`;\n}\n",
|
|
6
|
+
"import { HDKey } from \"@scure/bip32\";\nimport { mnemonicToSeedSync } from \"@scure/bip39\";\nimport { bytesToHex } from \"../utils/encoding.ts\";\nimport {\n\tcompressPrivateKey,\n\tprivateKeyToAccount,\n} from \"./privateKeyToAccount.ts\";\nimport type { LocalAccount } from \"./types.ts\";\n\nconst STX_DERIVATION_PATH = \"m/44'/5757'/0'/0\";\n\nexport function mnemonicToAccount(\n\tmnemonic: string,\n\toptions?: {\n\t\taccountIndex?: number;\n\t\taddressVersion?: number;\n\t},\n): LocalAccount {\n\tconst { accountIndex = 0, addressVersion } = options ?? {};\n\n\tconst seed = mnemonicToSeedSync(mnemonic);\n\tconst root = HDKey.fromMasterSeed(seed);\n\tconst child = root.derive(`${STX_DERIVATION_PATH}/${accountIndex}`);\n\n\tif (!child.privateKey) throw new Error(\"Failed to derive private key\");\n\n\tconst privateKeyHex = compressPrivateKey(bytesToHex(child.privateKey));\n\treturn privateKeyToAccount(privateKeyHex, { addressVersion });\n}\n",
|
|
7
|
+
"import type { AccountSource, CustomAccount } from \"./types.ts\";\n\nexport function toAccount(source: AccountSource): CustomAccount {\n\treturn {\n\t\ttype: \"custom\",\n\t\taddress: source.address,\n\t\tpublicKey: source.publicKey,\n\t\tsign: source.sign,\n\t};\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AACA;AACA,8BAAc;AAMd,SAAS,iBAAiB,GAAG;AAAA,EAC5B,IAAI,CAAC,IAAI,gBAAgB;AAAA,IACxB,IAAI,iBAAiB,CAAC,QAAoB,SAAuB;AAAA,MAChE,MAAM,IAAI,KAAK,OAAO,QAAQ,GAAG;AAAA,MACjC,KAAK,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,CAAC;AAAA,MACnC,OAAO,EAAE,OAAO;AAAA;AAAA,EAElB;AAAA;AAGD,IAA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O,GAAG;AAAA;;AC3EX;AACA;AAQA,IAAM,sBAAsB;AAErB,SAAS,iBAAiB,CAChC,UACA,SAIe;AAAA,EACf,QAAQ,eAAe,GAAG,mBAAmB,WAAW,CAAC;AAAA,EAEzD,MAAM,OAAO,mBAAmB,QAAQ;AAAA,EACxC,MAAM,OAAO,MAAM,eAAe,IAAI;AAAA,EACtC,MAAM,QAAQ,KAAK,OAAO,GAAG,uBAAuB,cAAc;AAAA,EAElE,IAAI,CAAC,MAAM;AAAA,IAAY,MAAM,IAAI,MAAM,8BAA8B;AAAA,EAErE,MAAM,gBAAgB,mBAAmB,WAAW,MAAM,UAAU,CAAC;AAAA,EACrE,OAAO,oBAAoB,eAAe,EAAE,eAAe,CAAC;AAAA;;ACzBtD,SAAS,SAAS,CAAC,QAAsC;AAAA,EAC/D,OAAO;AAAA,IACN,MAAM;AAAA,IACN,SAAS,OAAO;AAAA,IAChB,WAAW,OAAO;AAAA,IAClB,MAAM,OAAO;AAAA,EACd;AAAA;",
|
|
10
|
+
"debugId": "73E71BA0E076678C64756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
/** Account derived from a local private key (mnemonic or raw key). */
|
|
2
|
+
type LocalAccount = {
|
|
3
|
+
type: "local"
|
|
4
|
+
address: string
|
|
5
|
+
/** Compressed public key (hex) */
|
|
6
|
+
publicKey: string
|
|
7
|
+
/** Raw ECDSA sign over a hash */
|
|
8
|
+
sign(hash: Uint8Array): Uint8Array
|
|
9
|
+
/** Sign a structured message (SIP-018) */
|
|
10
|
+
signMessage(message: string | Uint8Array): string
|
|
11
|
+
};
|
|
12
|
+
/** Account with a user-provided signing function (sync or async). */
|
|
13
|
+
type CustomAccount = {
|
|
14
|
+
type: "custom"
|
|
15
|
+
address: string
|
|
16
|
+
publicKey: string
|
|
17
|
+
sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
|
|
18
|
+
};
|
|
19
|
+
/** Browser wallet provider interface (e.g. Leather, Xverse). */
|
|
20
|
+
type StacksProvider = {
|
|
21
|
+
request(method: string, params?: any): Promise<any>
|
|
22
|
+
};
|
|
23
|
+
/** Account backed by a browser wallet {@link StacksProvider}. */
|
|
24
|
+
type ProviderAccount = {
|
|
25
|
+
type: "provider"
|
|
26
|
+
address: string
|
|
27
|
+
publicKey: string
|
|
28
|
+
provider: StacksProvider
|
|
29
|
+
};
|
|
1
30
|
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
2
31
|
type StacksChain = {
|
|
3
32
|
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
@@ -64,35 +93,6 @@ type Transport = {
|
|
|
64
93
|
config: TransportConfig
|
|
65
94
|
destroy?: () => void
|
|
66
95
|
};
|
|
67
|
-
/** Account derived from a local private key (mnemonic or raw key). */
|
|
68
|
-
type LocalAccount = {
|
|
69
|
-
type: "local"
|
|
70
|
-
address: string
|
|
71
|
-
/** Compressed public key (hex) */
|
|
72
|
-
publicKey: string
|
|
73
|
-
/** Raw ECDSA sign over a hash */
|
|
74
|
-
sign(hash: Uint8Array): Uint8Array
|
|
75
|
-
/** Sign a structured message (SIP-018) */
|
|
76
|
-
signMessage(message: string | Uint8Array): string
|
|
77
|
-
};
|
|
78
|
-
/** Account with a user-provided signing function (sync or async). */
|
|
79
|
-
type CustomAccount = {
|
|
80
|
-
type: "custom"
|
|
81
|
-
address: string
|
|
82
|
-
publicKey: string
|
|
83
|
-
sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
|
|
84
|
-
};
|
|
85
|
-
/** Browser wallet provider interface (e.g. Leather, Xverse). */
|
|
86
|
-
type StacksProvider = {
|
|
87
|
-
request(method: string, params?: any): Promise<any>
|
|
88
|
-
};
|
|
89
|
-
/** Account backed by a browser wallet {@link StacksProvider}. */
|
|
90
|
-
type ProviderAccount = {
|
|
91
|
-
type: "provider"
|
|
92
|
-
address: string
|
|
93
|
-
publicKey: string
|
|
94
|
-
provider: StacksProvider
|
|
95
|
-
};
|
|
96
96
|
/** Union of all supported account types (local key, custom signer, or browser provider). */
|
|
97
97
|
type Account = LocalAccount | CustomAccount | ProviderAccount;
|
|
98
98
|
/**
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
/** Account derived from a local private key (mnemonic or raw key). */
|
|
2
|
+
type LocalAccount = {
|
|
3
|
+
type: "local"
|
|
4
|
+
address: string
|
|
5
|
+
/** Compressed public key (hex) */
|
|
6
|
+
publicKey: string
|
|
7
|
+
/** Raw ECDSA sign over a hash */
|
|
8
|
+
sign(hash: Uint8Array): Uint8Array
|
|
9
|
+
/** Sign a structured message (SIP-018) */
|
|
10
|
+
signMessage(message: string | Uint8Array): string
|
|
11
|
+
};
|
|
12
|
+
/** Account with a user-provided signing function (sync or async). */
|
|
13
|
+
type CustomAccount = {
|
|
14
|
+
type: "custom"
|
|
15
|
+
address: string
|
|
16
|
+
publicKey: string
|
|
17
|
+
sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
|
|
18
|
+
};
|
|
19
|
+
/** Browser wallet provider interface (e.g. Leather, Xverse). */
|
|
20
|
+
type StacksProvider = {
|
|
21
|
+
request(method: string, params?: any): Promise<any>
|
|
22
|
+
};
|
|
23
|
+
/** Account backed by a browser wallet {@link StacksProvider}. */
|
|
24
|
+
type ProviderAccount = {
|
|
25
|
+
type: "provider"
|
|
26
|
+
address: string
|
|
27
|
+
publicKey: string
|
|
28
|
+
provider: StacksProvider
|
|
29
|
+
};
|
|
1
30
|
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
2
31
|
type StacksChain = {
|
|
3
32
|
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
@@ -64,35 +93,6 @@ type Transport = {
|
|
|
64
93
|
config: TransportConfig
|
|
65
94
|
destroy?: () => void
|
|
66
95
|
};
|
|
67
|
-
/** Account derived from a local private key (mnemonic or raw key). */
|
|
68
|
-
type LocalAccount = {
|
|
69
|
-
type: "local"
|
|
70
|
-
address: string
|
|
71
|
-
/** Compressed public key (hex) */
|
|
72
|
-
publicKey: string
|
|
73
|
-
/** Raw ECDSA sign over a hash */
|
|
74
|
-
sign(hash: Uint8Array): Uint8Array
|
|
75
|
-
/** Sign a structured message (SIP-018) */
|
|
76
|
-
signMessage(message: string | Uint8Array): string
|
|
77
|
-
};
|
|
78
|
-
/** Account with a user-provided signing function (sync or async). */
|
|
79
|
-
type CustomAccount = {
|
|
80
|
-
type: "custom"
|
|
81
|
-
address: string
|
|
82
|
-
publicKey: string
|
|
83
|
-
sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
|
|
84
|
-
};
|
|
85
|
-
/** Browser wallet provider interface (e.g. Leather, Xverse). */
|
|
86
|
-
type StacksProvider = {
|
|
87
|
-
request(method: string, params?: any): Promise<any>
|
|
88
|
-
};
|
|
89
|
-
/** Account backed by a browser wallet {@link StacksProvider}. */
|
|
90
|
-
type ProviderAccount = {
|
|
91
|
-
type: "provider"
|
|
92
|
-
address: string
|
|
93
|
-
publicKey: string
|
|
94
|
-
provider: StacksProvider
|
|
95
|
-
};
|
|
96
96
|
/** Union of all supported account types (local key, custom signer, or browser provider). */
|
|
97
97
|
type Account = LocalAccount | CustomAccount | ProviderAccount;
|
|
98
98
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContractResponseError,
|
|
3
3
|
getContract
|
|
4
|
-
} from "../../shared/stacks-
|
|
4
|
+
} from "../../shared/stacks-70p84bgg.js";
|
|
5
5
|
import {
|
|
6
6
|
deployContract,
|
|
7
7
|
getAccountInfo,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
simulateTransaction,
|
|
17
17
|
sponsorTransaction,
|
|
18
18
|
transferStx
|
|
19
|
-
} from "../../shared/stacks-
|
|
19
|
+
} from "../../shared/stacks-4x2bcc2k.js";
|
|
20
20
|
import {
|
|
21
21
|
callContract,
|
|
22
22
|
estimateFee,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isProviderAccount,
|
|
26
26
|
readContract,
|
|
27
27
|
sendTransaction
|
|
28
|
-
} from "../../shared/stacks-
|
|
28
|
+
} from "../../shared/stacks-1s5w4ncf.js";
|
|
29
29
|
import {
|
|
30
30
|
watchAddress,
|
|
31
31
|
watchAddressBalance,
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
watchTransaction
|
|
36
36
|
} from "../../shared/stacks-y3dh7hv1.js";
|
|
37
37
|
import"../../shared/stacks-709tra19.js";
|
|
38
|
-
import"../../shared/stacks-
|
|
39
|
-
import"../../shared/stacks-
|
|
40
|
-
import"../../shared/stacks-
|
|
41
|
-
import"../../shared/stacks-
|
|
38
|
+
import"../../shared/stacks-zf7rbpzp.js";
|
|
39
|
+
import"../../shared/stacks-s30kkvm8.js";
|
|
40
|
+
import"../../shared/stacks-09wa7ewe.js";
|
|
41
|
+
import"../../shared/stacks-wjem3xw9.js";
|
|
42
42
|
import"../../shared/stacks-v9jqcpd4.js";
|
|
43
43
|
import"../../shared/stacks-rwfgts3s.js";
|
|
44
44
|
import"../../shared/stacks-s10yb9gz.js";
|
package/dist/src/bns/index.cjs
CHANGED
|
@@ -131,7 +131,10 @@ var BNS_ABI = {
|
|
|
131
131
|
outputs: {
|
|
132
132
|
optional: {
|
|
133
133
|
tuple: [
|
|
134
|
-
{
|
|
134
|
+
{
|
|
135
|
+
name: "hashed-salted-fqn-preorder",
|
|
136
|
+
type: { optional: { buff: { length: 20 } } }
|
|
137
|
+
},
|
|
135
138
|
{ name: "imported-at", type: { optional: "uint128" } },
|
|
136
139
|
{ name: "owner", type: "principal" },
|
|
137
140
|
{ name: "preordered-by", type: { optional: "principal" } },
|
|
@@ -200,45 +203,6 @@ var BNS_ABI = {
|
|
|
200
203
|
non_fungible_tokens: [{ name: "BNS-V2", type: "uint128" }]
|
|
201
204
|
};
|
|
202
205
|
|
|
203
|
-
// src/bns/zonefile-abi.ts
|
|
204
|
-
var ZONEFILE_RESOLVER_ABI = {
|
|
205
|
-
functions: [
|
|
206
|
-
{
|
|
207
|
-
name: "resolve-name",
|
|
208
|
-
access: "read-only",
|
|
209
|
-
args: [
|
|
210
|
-
{ name: "name", type: { buff: { length: 48 } } },
|
|
211
|
-
{ name: "namespace", type: { buff: { length: 20 } } }
|
|
212
|
-
],
|
|
213
|
-
outputs: {
|
|
214
|
-
response: {
|
|
215
|
-
ok: { optional: { buff: { length: 8192 } } },
|
|
216
|
-
error: "uint128"
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: "update-zonefile",
|
|
222
|
-
access: "public",
|
|
223
|
-
args: [
|
|
224
|
-
{ name: "name", type: { buff: { length: 48 } } },
|
|
225
|
-
{ name: "namespace", type: { buff: { length: 20 } } },
|
|
226
|
-
{ name: "new-zonefile", type: { optional: { buff: { length: 8192 } } } }
|
|
227
|
-
],
|
|
228
|
-
outputs: { response: { ok: "bool", error: "uint128" } }
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
name: "revoke-name",
|
|
232
|
-
access: "public",
|
|
233
|
-
args: [
|
|
234
|
-
{ name: "name", type: { buff: { length: 48 } } },
|
|
235
|
-
{ name: "namespace", type: { buff: { length: 20 } } }
|
|
236
|
-
],
|
|
237
|
-
outputs: { response: { ok: "bool", error: "uint128" } }
|
|
238
|
-
}
|
|
239
|
-
]
|
|
240
|
-
};
|
|
241
|
-
|
|
242
206
|
// src/bns/constants.ts
|
|
243
207
|
var BNS_CONTRACTS = {
|
|
244
208
|
mainnet: {
|
|
@@ -317,6 +281,48 @@ function hashPreorder(name, namespace, salt) {
|
|
|
317
281
|
return hash160(combined);
|
|
318
282
|
}
|
|
319
283
|
|
|
284
|
+
// src/bns/zonefile-abi.ts
|
|
285
|
+
var ZONEFILE_RESOLVER_ABI = {
|
|
286
|
+
functions: [
|
|
287
|
+
{
|
|
288
|
+
name: "resolve-name",
|
|
289
|
+
access: "read-only",
|
|
290
|
+
args: [
|
|
291
|
+
{ name: "name", type: { buff: { length: 48 } } },
|
|
292
|
+
{ name: "namespace", type: { buff: { length: 20 } } }
|
|
293
|
+
],
|
|
294
|
+
outputs: {
|
|
295
|
+
response: {
|
|
296
|
+
ok: { optional: { buff: { length: 8192 } } },
|
|
297
|
+
error: "uint128"
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "update-zonefile",
|
|
303
|
+
access: "public",
|
|
304
|
+
args: [
|
|
305
|
+
{ name: "name", type: { buff: { length: 48 } } },
|
|
306
|
+
{ name: "namespace", type: { buff: { length: 20 } } },
|
|
307
|
+
{
|
|
308
|
+
name: "new-zonefile",
|
|
309
|
+
type: { optional: { buff: { length: 8192 } } }
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
outputs: { response: { ok: "bool", error: "uint128" } }
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: "revoke-name",
|
|
316
|
+
access: "public",
|
|
317
|
+
args: [
|
|
318
|
+
{ name: "name", type: { buff: { length: 48 } } },
|
|
319
|
+
{ name: "namespace", type: { buff: { length: 20 } } }
|
|
320
|
+
],
|
|
321
|
+
outputs: { response: { ok: "bool", error: "uint128" } }
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
};
|
|
325
|
+
|
|
320
326
|
// src/bns/actions.ts
|
|
321
327
|
function getBnsContract(client) {
|
|
322
328
|
if (!client.chain) {
|
|
@@ -429,7 +435,11 @@ async function getNameId(client, nameOrFQN) {
|
|
|
429
435
|
}
|
|
430
436
|
}
|
|
431
437
|
async function preorder(client, params) {
|
|
432
|
-
const {
|
|
438
|
+
const {
|
|
439
|
+
name: nameInput,
|
|
440
|
+
namespace: namespaceInput,
|
|
441
|
+
salt: providedSalt
|
|
442
|
+
} = params;
|
|
433
443
|
const fqn = namespaceInput ? `${nameInput}.${namespaceInput}` : nameInput;
|
|
434
444
|
if (!validateFQN(fqn)) {
|
|
435
445
|
throw new Error(`Invalid name format: ${fqn}`);
|
|
@@ -447,7 +457,9 @@ async function preorder(client, params) {
|
|
|
447
457
|
hashedSaltedFqn,
|
|
448
458
|
stxToBurn: price
|
|
449
459
|
}, {
|
|
450
|
-
postConditions: [
|
|
460
|
+
postConditions: [
|
|
461
|
+
Pc.principal(client.account.address).willSendLte(price).ustx()
|
|
462
|
+
]
|
|
451
463
|
});
|
|
452
464
|
return { txid, salt };
|
|
453
465
|
}
|
|
@@ -603,5 +615,5 @@ function bns() {
|
|
|
603
615
|
});
|
|
604
616
|
}
|
|
605
617
|
|
|
606
|
-
//# debugId=
|
|
618
|
+
//# debugId=788A7C34582E286F64756E2164756E21
|
|
607
619
|
//# sourceMappingURL=index.cjs.map
|