@secondlayer/stacks 2.11.0 → 2.13.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/README.md +47 -0
- package/dist/shared/{stacks-v150hffx.js → stacks-01pbr7gf.js} +13 -12
- package/dist/shared/stacks-01pbr7gf.js.map +11 -0
- package/dist/shared/stacks-0cdm20eh.js +225 -0
- package/dist/shared/stacks-0cdm20eh.js.map +11 -0
- package/dist/shared/{stacks-hxm7r5ay.cjs → stacks-44y18a8e.cjs} +3 -10
- package/dist/shared/stacks-44y18a8e.cjs.map +10 -0
- package/dist/shared/{stacks-7nvbv61d.js → stacks-59xy6t1p.js} +27 -25
- package/dist/shared/{stacks-7nvbv61d.js.map → stacks-59xy6t1p.js.map} +6 -6
- package/dist/shared/{stacks-63xbc6cj.js → stacks-6n2m9hyk.js} +3 -3
- package/dist/shared/stacks-bnbdqznq.cjs +211 -0
- package/dist/shared/stacks-bnbdqznq.cjs.map +11 -0
- package/dist/shared/stacks-esn3wcw5.cjs +416 -0
- package/dist/shared/stacks-esn3wcw5.cjs.map +18 -0
- package/dist/shared/{stacks-3kmj5yre.js → stacks-g67f4w1d.js} +5 -12
- package/dist/shared/stacks-g67f4w1d.js.map +10 -0
- package/dist/shared/stacks-kjg7fw4y.js +434 -0
- package/dist/shared/stacks-kjg7fw4y.js.map +18 -0
- package/dist/shared/{stacks-maamjqma.cjs → stacks-tbv5p6pn.cjs} +7 -9
- package/dist/shared/stacks-tbv5p6pn.cjs.map +11 -0
- package/dist/shared/{stacks-k5an9zcw.cjs → stacks-y5epf0sb.cjs} +19 -22
- package/dist/shared/{stacks-k5an9zcw.cjs.map → stacks-y5epf0sb.cjs.map} +6 -6
- package/dist/src/accounts/index.cjs +28 -1
- package/dist/src/accounts/index.cjs.map +4 -3
- package/dist/src/accounts/index.d.cts +23 -1
- package/dist/src/accounts/index.d.ts +23 -1
- package/dist/src/accounts/index.js +33 -1
- package/dist/src/accounts/index.js.map +4 -3
- package/dist/src/actions/index.cjs +8 -1
- package/dist/src/actions/index.cjs.map +1 -1
- package/dist/src/actions/index.d.cts +140 -6
- package/dist/src/actions/index.d.ts +140 -6
- package/dist/src/actions/index.js +22 -8
- package/dist/src/actions/index.js.map +1 -1
- package/dist/src/bitcoin/index.cjs +4 -175
- package/dist/src/bitcoin/index.cjs.map +4 -6
- package/dist/src/bitcoin/index.d.cts +18 -2
- package/dist/src/bitcoin/index.d.ts +18 -2
- package/dist/src/bitcoin/index.js +18 -181
- package/dist/src/bitcoin/index.js.map +4 -6
- package/dist/src/bns/index.js +3 -3
- package/dist/src/index.cjs +10 -1
- package/dist/src/index.cjs.map +3 -3
- package/dist/src/index.d.cts +167 -9
- package/dist/src/index.d.ts +167 -9
- package/dist/src/index.js +23 -7
- package/dist/src/index.js.map +3 -3
- package/dist/src/pox/index.js +3 -3
- package/dist/src/sbtc/index.cjs +49 -7
- package/dist/src/sbtc/index.cjs.map +6 -6
- package/dist/src/sbtc/index.d.cts +8 -2
- package/dist/src/sbtc/index.d.ts +8 -2
- package/dist/src/sbtc/index.js +56 -10
- package/dist/src/sbtc/index.js.map +6 -6
- package/dist/src/stackingdao/index.js +3 -3
- package/dist/src/tools/index.cjs +194 -13
- package/dist/src/tools/index.cjs.map +12 -9
- package/dist/src/tools/index.js +194 -13
- package/dist/src/tools/index.js.map +12 -9
- package/dist/src/x402/index.cjs +5 -2
- package/dist/src/x402/index.cjs.map +3 -3
- package/dist/src/x402/index.d.cts +36 -0
- package/dist/src/x402/index.d.ts +36 -0
- package/dist/src/x402/index.js +7 -4
- package/dist/src/x402/index.js.map +3 -3
- package/package.json +2 -4
- package/dist/shared/stacks-3kmj5yre.js.map +0 -10
- package/dist/shared/stacks-502j0efj.js +0 -210
- package/dist/shared/stacks-502j0efj.js.map +0 -15
- package/dist/shared/stacks-hxm7r5ay.cjs.map +0 -10
- package/dist/shared/stacks-maamjqma.cjs.map +0 -11
- package/dist/shared/stacks-v150hffx.js.map +0 -11
- package/dist/shared/stacks-xmsms921.cjs +0 -196
- package/dist/shared/stacks-xmsms921.cjs.map +0 -15
- /package/dist/shared/{stacks-63xbc6cj.js.map → stacks-6n2m9hyk.js.map} +0 -0
|
@@ -34,12 +34,6 @@ async function getBlock(client, params) {
|
|
|
34
34
|
return client.request("/extended/v2/blocks?limit=1", { method: "GET" });
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
// src/actions/public/getBlockHeight.ts
|
|
38
|
-
async function getBlockHeight(client) {
|
|
39
|
-
const data = await client.request("/v2/info", { method: "GET" });
|
|
40
|
-
return data.stacks_tip_height;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
37
|
// src/actions/public/getContractAbi.ts
|
|
44
38
|
async function getContractAbi(client, params) {
|
|
45
39
|
const [address, name] = parseContractId(params.contract);
|
|
@@ -48,6 +42,13 @@ async function getContractAbi(client, params) {
|
|
|
48
42
|
});
|
|
49
43
|
}
|
|
50
44
|
|
|
45
|
+
// src/actions/public/getTransaction.ts
|
|
46
|
+
async function getTransaction(client, params) {
|
|
47
|
+
const source = params.source ?? extendedApiSource();
|
|
48
|
+
const { receipt } = await source.get({ client, txid: params.txid });
|
|
49
|
+
return receipt;
|
|
50
|
+
}
|
|
51
|
+
|
|
51
52
|
// src/actions/public/multicall.ts
|
|
52
53
|
async function multicall(client, params) {
|
|
53
54
|
const { calls, allowFailure = true } = params;
|
|
@@ -142,6 +143,7 @@ async function deployContract(client, params) {
|
|
|
142
143
|
if (!isClarityName(params.contractName))
|
|
143
144
|
throw new Error(`Invalid contract name: ${params.contractName}`);
|
|
144
145
|
if (isProviderAccount(account)) {
|
|
146
|
+
assertNoFeeTierForProvider(params.fee);
|
|
145
147
|
const result = await account.provider.request("stx_deployContract", {
|
|
146
148
|
contractName: params.contractName,
|
|
147
149
|
codeBody: params.codeBody,
|
|
@@ -150,23 +152,20 @@ async function deployContract(client, params) {
|
|
|
150
152
|
return result.txid;
|
|
151
153
|
}
|
|
152
154
|
const nonce = params.nonce ?? await resolveNonce(client, account.address);
|
|
155
|
+
const needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);
|
|
153
156
|
const unsigned = buildContractDeploy({
|
|
154
157
|
contractName: params.contractName,
|
|
155
158
|
codeBody: params.codeBody,
|
|
156
159
|
clarityVersion: params.clarityVersion,
|
|
157
|
-
fee: params.fee
|
|
160
|
+
fee: needsFeeResolution ? 0n : params.fee,
|
|
158
161
|
nonce,
|
|
159
162
|
publicKey: account.publicKey,
|
|
160
163
|
chain: client.chain,
|
|
161
164
|
postConditionMode: params.postConditionMode,
|
|
162
165
|
postConditions: params.postConditions
|
|
163
166
|
});
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
const mid = estimates[1] ?? estimates[0];
|
|
167
|
-
if (mid) {
|
|
168
|
-
unsigned.auth.spendingCondition.fee = BigInt(mid.fee);
|
|
169
|
-
}
|
|
167
|
+
if (needsFeeResolution) {
|
|
168
|
+
setUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));
|
|
170
169
|
}
|
|
171
170
|
const signed = await signTransactionWithAccount(unsigned, account);
|
|
172
171
|
return broadcastWithNonceReset(client, {
|
|
@@ -238,6 +237,7 @@ async function transferStx(client, params) {
|
|
|
238
237
|
if (!validateStacksAddress(params.to))
|
|
239
238
|
throw new Error(`Invalid recipient address: ${params.to}`);
|
|
240
239
|
if (isProviderAccount(account)) {
|
|
240
|
+
assertNoFeeTierForProvider(params.fee);
|
|
241
241
|
const result = await account.provider.request("stx_transferStx", {
|
|
242
242
|
recipient: params.to,
|
|
243
243
|
amount: String(params.amount),
|
|
@@ -246,23 +246,20 @@ async function transferStx(client, params) {
|
|
|
246
246
|
return result.txid;
|
|
247
247
|
}
|
|
248
248
|
const nonce = params.nonce ?? await resolveNonce(client, account.address);
|
|
249
|
+
const needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);
|
|
249
250
|
const unsigned = buildTokenTransfer({
|
|
250
251
|
recipient: params.to,
|
|
251
252
|
amount: params.amount,
|
|
252
253
|
memo: params.memo,
|
|
253
|
-
fee: params.fee
|
|
254
|
+
fee: needsFeeResolution ? 0n : params.fee,
|
|
254
255
|
nonce,
|
|
255
256
|
publicKey: account.publicKey,
|
|
256
257
|
chain: client.chain,
|
|
257
258
|
postConditionMode: params.postConditionMode,
|
|
258
259
|
postConditions: params.postConditions
|
|
259
260
|
});
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
const mid = estimates[1] ?? estimates[0];
|
|
263
|
-
if (mid) {
|
|
264
|
-
unsigned.auth.spendingCondition.fee = BigInt(mid.fee);
|
|
265
|
-
}
|
|
261
|
+
if (needsFeeResolution) {
|
|
262
|
+
setUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));
|
|
266
263
|
}
|
|
267
264
|
const signed = await signTransactionWithAccount(unsigned, account);
|
|
268
265
|
return broadcastWithNonceReset(client, {
|
|
@@ -271,5 +268,5 @@ async function transferStx(client, params) {
|
|
|
271
268
|
});
|
|
272
269
|
}
|
|
273
270
|
|
|
274
|
-
//# debugId=
|
|
275
|
-
//# sourceMappingURL=stacks-
|
|
271
|
+
//# debugId=DB85D1168A53BA1164756E2164756E21
|
|
272
|
+
//# sourceMappingURL=stacks-y5epf0sb.cjs.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/actions/public/getAccountInfo.ts", "../src/actions/public/getBalance.ts", "../src/actions/public/getBlock.ts", "../src/actions/public/
|
|
3
|
+
"sources": ["../src/actions/public/getAccountInfo.ts", "../src/actions/public/getBalance.ts", "../src/actions/public/getBlock.ts", "../src/actions/public/getContractAbi.ts", "../src/actions/public/getTransaction.ts", "../src/actions/public/multicall.ts", "../src/errors/simulation.ts", "../src/actions/public/simulateCall.ts", "../src/actions/public/simulateTransaction.ts", "../src/actions/wallet/deployContract.ts", "../src/actions/wallet/signMessage.ts", "../src/actions/wallet/signTransaction.ts", "../src/actions/wallet/transferStx.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { Client } from \"../../clients/types.ts\";\n\nexport type GetAccountInfoParams = {\n\taddress: string;\n};\n\nexport type AccountInfo = {\n\tbalance: bigint;\n\tnonce: bigint;\n\tbalanceProof: string;\n\tnonceProof: string;\n};\n\nexport async function getAccountInfo(\n\tclient: Client,\n\tparams: GetAccountInfoParams,\n): Promise<AccountInfo> {\n\tconst data = await client.request(`/v2/accounts/${params.address}?proof=1`, {\n\t\tmethod: \"GET\",\n\t});\n\treturn {\n\t\tbalance: BigInt(data.balance),\n\t\tnonce: BigInt(data.nonce),\n\t\tbalanceProof: data.balance_proof ?? \"\",\n\t\tnonceProof: data.nonce_proof ?? \"\",\n\t};\n}\n",
|
|
6
6
|
"import type { Client } from \"../../clients/types.ts\";\n\nexport type GetBalanceParams = {\n\taddress: string;\n};\n\nexport async function getBalance(\n\tclient: Client,\n\tparams: GetBalanceParams,\n): Promise<bigint> {\n\tconst data = await client.request(`/v2/accounts/${params.address}`, {\n\t\tmethod: \"GET\",\n\t});\n\treturn BigInt(data.balance);\n}\n",
|
|
7
7
|
"import type { Client } from \"../../clients/types.ts\";\n\nexport type GetBlockParams = {\n\theight?: number;\n\thash?: string;\n};\n\nexport async function getBlock(\n\tclient: Client,\n\tparams?: GetBlockParams,\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n): Promise<any> {\n\tif (params?.hash) {\n\t\treturn client.request(`/extended/v2/blocks/${params.hash}`, {\n\t\t\tmethod: \"GET\",\n\t\t});\n\t}\n\tif (params?.height !== undefined) {\n\t\treturn client.request(`/extended/v2/blocks/${params.height}`, {\n\t\t\tmethod: \"GET\",\n\t\t});\n\t}\n\t// Latest block\n\treturn client.request(\"/extended/v2/blocks?limit=1\", { method: \"GET\" });\n}\n",
|
|
8
|
-
"import type { Client } from \"../../clients/types.ts\";\n\nexport async function getBlockHeight(client: Client): Promise<number> {\n\tconst data = await client.request(\"/v2/info\", { method: \"GET\" });\n\treturn data.stacks_tip_height;\n}\n",
|
|
9
8
|
"import type { Client } from \"../../clients/types.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\n\nexport type GetContractAbiParams = {\n\tcontract: string; // \"address.name\"\n};\n\nexport async function getContractAbi(\n\tclient: Client,\n\tparams: GetContractAbiParams,\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n): Promise<any> {\n\tconst [address, name] = parseContractId(params.contract);\n\treturn client.request(`/v2/contracts/interface/${address}/${name}`, {\n\t\tmethod: \"GET\",\n\t});\n}\n",
|
|
9
|
+
"import type { Client } from \"../../clients/types.ts\";\nimport {\n\ttype TransactionReceipt,\n\ttype TransactionStatusSource,\n\textendedApiSource,\n} from \"./txSources.ts\";\n\nexport type GetTransactionParams = {\n\ttxid: string;\n\t/** Where to read status from. Defaults to {@link extendedApiSource}. */\n\tsource?: TransactionStatusSource;\n};\n\n/**\n * Fetch a transaction's receipt (status, block info, decoded result).\n * Returns `null` when the source has no record of the transaction.\n */\nexport async function getTransaction(\n\tclient: Client,\n\tparams: GetTransactionParams,\n): Promise<TransactionReceipt | null> {\n\tconst source = params.source ?? extendedApiSource();\n\tconst { receipt } = await source.get({ client, txid: params.txid });\n\treturn receipt;\n}\n",
|
|
10
10
|
"import type { ClarityValue } from \"../../clarity/types.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { readContract } from \"./readContract.ts\";\n\nexport type MulticallCall = {\n\tcontract: string;\n\tfunctionName: string;\n\targs?: ClarityValue[];\n\tsender?: string;\n};\n\nexport type MulticallParams<TAllowFailure extends boolean = true> = {\n\tcalls: readonly MulticallCall[];\n\tallowFailure?: TAllowFailure;\n};\n\nexport type MulticallSuccessResult = {\n\tstatus: \"success\";\n\tresult: ClarityValue;\n};\nexport type MulticallFailureResult = { status: \"failure\"; error: Error };\n\nexport type MulticallResult<T extends boolean> = T extends true\n\t? (MulticallSuccessResult | MulticallFailureResult)[]\n\t: ClarityValue[];\n\nexport async function multicall<TAllowFailure extends boolean = true>(\n\tclient: Client,\n\tparams: MulticallParams<TAllowFailure>,\n): Promise<MulticallResult<TAllowFailure>> {\n\tconst { calls, allowFailure = true } = params;\n\n\tif (allowFailure) {\n\t\tconst settled = await Promise.allSettled(\n\t\t\tcalls.map((call) => readContract(client, call)),\n\t\t);\n\t\treturn settled.map((r) =>\n\t\t\tr.status === \"fulfilled\"\n\t\t\t\t? { status: \"success\" as const, result: r.value }\n\t\t\t\t: {\n\t\t\t\t\t\tstatus: \"failure\" as const,\n\t\t\t\t\t\terror:\n\t\t\t\t\t\t\tr.reason instanceof Error\n\t\t\t\t\t\t\t\t? r.reason\n\t\t\t\t\t\t\t\t: new Error(String(r.reason)),\n\t\t\t\t\t},\n\t\t) as MulticallResult<TAllowFailure>;\n\t}\n\n\tconst results = await Promise.all(\n\t\tcalls.map((call) => readContract(client, call)),\n\t);\n\treturn results as MulticallResult<TAllowFailure>;\n}\n",
|
|
11
11
|
"import { BaseError } from \"./base.ts\";\n\nexport class SimulationError extends BaseError {\n\toverride name = \"SimulationError\";\n\twritesDetected: boolean;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: { writesDetected: boolean; details?: string },\n\t) {\n\t\tsuper(message, { details: options.details });\n\t\tthis.writesDetected = options.writesDetected;\n\t}\n}\n",
|
|
12
12
|
"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 { SimulationError } from \"../../errors/simulation.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\nimport { bytesToHex, with0x } from \"../../utils/encoding.ts\";\n\nexport type SimulateCallParams = {\n\tcontract: string;\n\tfunctionName: string;\n\targs?: ClarityValue[];\n\tsender?: string;\n\ttip?: string;\n};\n\nexport type SimulateCallSuccess = { success: true; result: ClarityValue };\nexport type SimulateCallFailure = { success: false; error: SimulationError };\nexport type SimulateCallResult = SimulateCallSuccess | SimulateCallFailure;\n\nexport async function simulateCall(\n\tclient: Client,\n\tparams: SimulateCallParams,\n): Promise<SimulateCallResult> {\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\tlet path = `/v2/contracts/call-read/${address}/${name}/${params.functionName}`;\n\tif (params.tip) {\n\t\tpath += `?tip=${params.tip}`;\n\t}\n\n\tconst data = await client.request(path, {\n\t\tmethod: \"POST\",\n\t\tbody: {\n\t\t\tsender,\n\t\t\targuments: serializedArgs,\n\t\t},\n\t});\n\n\tif (data.okay) {\n\t\treturn { success: true, result: deserializeCVBytes(data.result) };\n\t}\n\n\tconst cause: string = data.cause ?? \"Simulation failed\";\n\tconst writesDetected =\n\t\tcause.includes(\"NotReadOnly\") || cause.includes(\"CostBalanceExceeded\");\n\n\treturn {\n\t\tsuccess: false,\n\t\terror: new SimulationError(\n\t\t\twritesDetected\n\t\t\t\t? \"Function mutates state and cannot be simulated\"\n\t\t\t\t: \"Simulation failed\",\n\t\t\t{ writesDetected, details: cause },\n\t\t),\n\t};\n}\n",
|
|
13
13
|
"import type { Client } from \"../../clients/types.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { AddressHashMode, PayloadType } from \"../../transactions/types.ts\";\nimport { c32address } from \"../../utils/address.ts\";\nimport { type FeeEstimation, estimateFee } from \"./estimateFee.ts\";\nimport { type SimulateCallResult, simulateCall } from \"./simulateCall.ts\";\n\nexport type SimulateTransactionParams = {\n\ttransaction: StacksTransaction;\n\tsender?: string;\n\ttip?: string;\n};\n\nexport type SimulateContractCallResult = {\n\ttype: \"contract-call\";\n\texecution: SimulateCallResult;\n\tfees: FeeEstimation[];\n};\n\nexport type SimulateTransferResult = {\n\ttype: \"token-transfer\";\n\tfees: FeeEstimation[];\n};\n\nexport type SimulateDeployResult = {\n\ttype: \"contract-deploy\";\n\tfees: FeeEstimation[];\n};\n\nexport type SimulateTransactionResult =\n\t| SimulateContractCallResult\n\t| SimulateTransferResult\n\t| SimulateDeployResult;\n\nfunction isMultiSig(hashMode: number): boolean {\n\treturn (\n\t\thashMode === AddressHashMode.P2SH ||\n\t\thashMode === AddressHashMode.P2WSH ||\n\t\thashMode === AddressHashMode.P2SH_NonSequential ||\n\t\thashMode === AddressHashMode.P2WSH_P2SH_NonSequential\n\t);\n}\n\nfunction extractSender(tx: StacksTransaction, client: Client): string {\n\tconst { hashMode, signer } = tx.auth.spendingCondition;\n\tconst chain = client.chain;\n\tconst version = isMultiSig(hashMode)\n\t\t? (chain?.addressVersion.multiSig ?? 20)\n\t\t: (chain?.addressVersion.singleSig ?? 22);\n\treturn c32address(version, signer);\n}\n\nexport async function simulateTransaction(\n\tclient: Client,\n\tparams: SimulateTransactionParams,\n): Promise<SimulateTransactionResult> {\n\tconst { transaction, tip } = params;\n\tconst { payload } = transaction;\n\n\tif (payload.payloadType === PayloadType.ContractCall) {\n\t\tconst sender = params.sender ?? extractSender(transaction, client);\n\t\tconst contract = `${payload.contractAddress}.${payload.contractName}`;\n\n\t\tconst [execution, fees] = await Promise.all([\n\t\t\tsimulateCall(client, {\n\t\t\t\tcontract,\n\t\t\t\tfunctionName: payload.functionName,\n\t\t\t\targs: payload.functionArgs,\n\t\t\t\tsender,\n\t\t\t\ttip,\n\t\t\t}),\n\t\t\testimateFee(client, { transaction }),\n\t\t]);\n\n\t\treturn { type: \"contract-call\", execution, fees };\n\t}\n\n\tconst fees = await estimateFee(client, { transaction });\n\n\tif (\n\t\tpayload.payloadType === PayloadType.SmartContract ||\n\t\tpayload.payloadType === PayloadType.VersionedSmartContract\n\t) {\n\t\treturn { type: \"contract-deploy\", fees };\n\t}\n\n\treturn { type: \"token-transfer\", fees };\n}\n",
|
|
14
|
-
"import type { Client } from \"../../clients/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport { buildContractDeploy } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport type { ClarityVersion } from \"../../transactions/types.ts\";\nimport { isClarityName } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport {
|
|
14
|
+
"import type { Client } from \"../../clients/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport { buildContractDeploy } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport type { ClarityVersion } from \"../../transactions/types.ts\";\nimport { isClarityName } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { broadcastWithNonceReset, resolveNonce } from \"./nonceManager.ts\";\nimport {\n\ttype FeeParam,\n\tassertNoFeeTierForProvider,\n\tisFeeTier,\n\tisProviderAccount,\n\tresolveFee,\n\tsetUnsignedFee,\n} from \"./utils.ts\";\n\nexport type DeployContractParams = {\n\tcontractName: string;\n\tcodeBody: string;\n\tclarityVersion?: ClarityVersion;\n\tfee?: FeeParam;\n\tnonce?: IntegerType;\n\tpostConditionMode?: \"allow\" | \"deny\";\n\tpostConditions?: PostCondition[];\n};\n\n/** Build, sign, and broadcast a contract deploy */\nexport async function deployContract(\n\tclient: Client,\n\tparams: DeployContractParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\tif (!isClarityName(params.contractName))\n\t\tthrow new Error(`Invalid contract name: ${params.contractName}`);\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tassertNoFeeTierForProvider(params.fee);\n\t\tconst result = await account.provider.request(\"stx_deployContract\", {\n\t\t\tcontractName: params.contractName,\n\t\t\tcodeBody: params.codeBody,\n\t\t\tclarityVersion: params.clarityVersion,\n\t\t});\n\t\treturn result.txid;\n\t}\n\n\t// Local/Custom: build → sign → broadcast\n\tconst nonce = params.nonce ?? (await resolveNonce(client, account.address));\n\n\tconst needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);\n\n\tconst unsigned = buildContractDeploy({\n\t\tcontractName: params.contractName,\n\t\tcodeBody: params.codeBody,\n\t\tclarityVersion: params.clarityVersion,\n\t\tfee: needsFeeResolution ? 0n : (params.fee as IntegerType),\n\t\tnonce,\n\t\tpublicKey: account.publicKey,\n\t\tchain: client.chain,\n\t\tpostConditionMode: params.postConditionMode,\n\t\tpostConditions: params.postConditions,\n\t});\n\n\tif (needsFeeResolution) {\n\t\tsetUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));\n\t}\n\n\tconst signed = await signTransactionWithAccount(unsigned, account);\n\treturn broadcastWithNonceReset(client, {\n\t\ttransaction: signed,\n\t\taddress: account.address,\n\t});\n}\n",
|
|
15
15
|
"import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport { Cl } from \"../../clarity/values.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { bytesToHex, concatBytes } from \"../../utils/encoding.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type SignMessageParams = {\n\tmessage: string | ClarityValue;\n\tdomain?: {\n\t\tname: string;\n\t\tversion: string;\n\t\tchainId: number;\n\t};\n};\n\nconst SIP018_PREFIX = new Uint8Array([0x53, 0x49, 0x50, 0x30, 0x31, 0x38]); // \"SIP018\"\n\n/** Sign a structured message per SIP-018 */\nexport async function signMessage(\n\tclient: Client,\n\tparams: SignMessageParams,\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 method = params.domain\n\t\t\t? \"stx_signStructuredMessage\"\n\t\t\t: \"stx_signMessage\";\n\t\tconst result = await account.provider.request(method, {\n\t\t\tmessage: params.message,\n\t\t\tdomain: params.domain,\n\t\t});\n\t\treturn result.signature;\n\t}\n\n\t// Local/Custom: sign locally\n\tconst cv =\n\t\ttypeof params.message === \"string\"\n\t\t\t? Cl.stringAscii(params.message)\n\t\t\t: params.message;\n\n\tconst serializedMsg = serializeCVBytes(cv);\n\n\tlet hash: Uint8Array;\n\n\tif (params.domain) {\n\t\tconst domainCV = Cl.tuple({\n\t\t\tname: Cl.stringAscii(params.domain.name),\n\t\t\tversion: Cl.stringAscii(params.domain.version),\n\t\t\t\"chain-id\": Cl.uint(params.domain.chainId),\n\t\t});\n\t\tconst serializedDomain = serializeCVBytes(domainCV);\n\t\thash = sha256(concatBytes(SIP018_PREFIX, serializedDomain, serializedMsg));\n\t} else {\n\t\thash = sha256(serializedMsg);\n\t}\n\n\tconst sigBytes = await account.sign(hash);\n\treturn bytesToHex(sigBytes);\n}\n",
|
|
16
16
|
"import type { Client } from \"../../clients/types.ts\";\nimport { signMultiSigWithAccount } from \"../../transactions/multisig.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { deserializeTransaction } from \"../../transactions/wire/deserialize.ts\";\nimport { serializeTransactionHex } from \"../../transactions/wire/serialize.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type SignTransactionParams = {\n\ttransaction: StacksTransaction;\n\t/** Public keys for multi-sig signing (auto-detected from _multisig metadata if omitted) */\n\tsigners?: string[];\n};\n\n/** Sign a transaction using the client's account */\nexport async function signTransactionAction(\n\tclient: Client,\n\tparams: SignTransactionParams,\n): Promise<StacksTransaction> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\t// Provider: send hex to wallet, get signed hex back\n\tif (isProviderAccount(account)) {\n\t\tconst hex = serializeTransactionHex(params.transaction);\n\t\tconst result = await account.provider.request(\"stx_signTransaction\", {\n\t\t\ttransaction: hex,\n\t\t});\n\t\treturn deserializeTransaction(result.transaction);\n\t}\n\n\t// Multi-sig: auto-detect from fields or _multisig metadata\n\tconst condition = params.transaction.auth.spendingCondition;\n\tif (\"fields\" in condition) {\n\t\tconst publicKeys =\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tparams.signers ?? (params.transaction as any)._multisig?.publicKeys;\n\t\tif (!publicKeys)\n\t\t\tthrow new Error(\"Multi-sig signing requires signers (publicKeys)\");\n\t\treturn signMultiSigWithAccount(params.transaction, account, publicKeys);\n\t}\n\n\t// Local/Custom: sign with account\n\treturn signTransactionWithAccount(params.transaction, account);\n}\n",
|
|
17
|
-
"import type { Client } from \"../../clients/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport { buildTokenTransfer } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport { validateStacksAddress } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport {
|
|
17
|
+
"import type { Client } from \"../../clients/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport { buildTokenTransfer } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport { validateStacksAddress } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { broadcastWithNonceReset, resolveNonce } from \"./nonceManager.ts\";\nimport {\n\ttype FeeParam,\n\tassertNoFeeTierForProvider,\n\tisFeeTier,\n\tisProviderAccount,\n\tresolveFee,\n\tsetUnsignedFee,\n} from \"./utils.ts\";\n\nexport type TransferStxParams = {\n\tto: string;\n\tamount: IntegerType;\n\tmemo?: string;\n\tfee?: FeeParam;\n\tnonce?: IntegerType;\n\tpostConditionMode?: \"allow\" | \"deny\";\n\tpostConditions?: PostCondition[];\n};\n\n/** Build, sign, and broadcast an STX transfer */\nexport async function transferStx(\n\tclient: Client,\n\tparams: TransferStxParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\tif (!validateStacksAddress(params.to))\n\t\tthrow new Error(`Invalid recipient address: ${params.to}`);\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tassertNoFeeTierForProvider(params.fee);\n\t\tconst result = await account.provider.request(\"stx_transferStx\", {\n\t\t\trecipient: params.to,\n\t\t\tamount: String(params.amount),\n\t\t\tmemo: params.memo,\n\t\t});\n\t\treturn result.txid;\n\t}\n\n\t// Local/Custom: build → sign → broadcast\n\tconst nonce = params.nonce ?? (await resolveNonce(client, account.address));\n\n\tconst needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);\n\n\tconst unsigned = buildTokenTransfer({\n\t\trecipient: params.to,\n\t\tamount: params.amount,\n\t\tmemo: params.memo,\n\t\tfee: needsFeeResolution ? 0n : (params.fee as IntegerType),\n\t\tnonce,\n\t\tpublicKey: account.publicKey,\n\t\tchain: client.chain,\n\t\tpostConditionMode: params.postConditionMode,\n\t\tpostConditions: params.postConditions,\n\t});\n\n\tif (needsFeeResolution) {\n\t\tsetUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));\n\t}\n\n\tconst signed = await signTransactionWithAccount(unsigned, account);\n\treturn broadcastWithNonceReset(client, {\n\t\ttransaction: signed,\n\t\taddress: account.address,\n\t});\n}\n"
|
|
18
18
|
],
|
|
19
|
-
"mappings": ";AAaA,eAAsB,cAAc,CACnC,QACA,QACuB;AAAA,EACvB,MAAM,OAAO,MAAM,OAAO,QAAQ,gBAAgB,OAAO,mBAAmB;AAAA,IAC3E,QAAQ;AAAA,EACT,CAAC;AAAA,EACD,OAAO;AAAA,IACN,SAAS,OAAO,KAAK,OAAO;AAAA,IAC5B,OAAO,OAAO,KAAK,KAAK;AAAA,IACxB,cAAc,KAAK,iBAAiB;AAAA,IACpC,YAAY,KAAK,eAAe;AAAA,EACjC;AAAA;;;ACnBD,eAAsB,UAAU,CAC/B,QACA,QACkB;AAAA,EAClB,MAAM,OAAO,MAAM,OAAO,QAAQ,gBAAgB,OAAO,WAAW;AAAA,IACnE,QAAQ;AAAA,EACT,CAAC;AAAA,EACD,O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",
|
|
21
21
|
"names": []
|
|
22
22
|
}
|
|
@@ -4,6 +4,7 @@ __export(exports_accounts, {
|
|
|
4
4
|
toAccount: () => toAccount,
|
|
5
5
|
providerToAccount: () => providerToAccount,
|
|
6
6
|
privateKeyToAccount: () => privateKeyToAccount,
|
|
7
|
+
mnemonicToBitcoinKeys: () => mnemonicToBitcoinKeys,
|
|
7
8
|
mnemonicToAccount: () => mnemonicToAccount,
|
|
8
9
|
compressPrivateKey: () => compressPrivateKey
|
|
9
10
|
});
|
|
@@ -77,6 +78,32 @@ function mnemonicToAccount(mnemonic, options) {
|
|
|
77
78
|
const privateKeyHex = compressPrivateKey(bytesToHex(child.privateKey));
|
|
78
79
|
return privateKeyToAccount(privateKeyHex, { addressVersion });
|
|
79
80
|
}
|
|
81
|
+
// src/accounts/mnemonicToBitcoinKeys.ts
|
|
82
|
+
var import_bip322 = require("@scure/bip32");
|
|
83
|
+
var import_bip392 = require("@scure/bip39");
|
|
84
|
+
var PURPOSE = { p2wpkh: 84, p2tr: 86 };
|
|
85
|
+
function mnemonicToBitcoinKeys(mnemonic, options) {
|
|
86
|
+
const {
|
|
87
|
+
type,
|
|
88
|
+
network = "mainnet",
|
|
89
|
+
accountIndex = 0,
|
|
90
|
+
changeIndex = 0,
|
|
91
|
+
addressIndex = 0
|
|
92
|
+
} = options;
|
|
93
|
+
const coinType = network === "mainnet" ? 0 : 1;
|
|
94
|
+
const path = `m/${PURPOSE[type]}'/${coinType}'/${accountIndex}'/${changeIndex}/${addressIndex}`;
|
|
95
|
+
const seed = import_bip392.mnemonicToSeedSync(mnemonic);
|
|
96
|
+
const child = import_bip322.HDKey.fromMasterSeed(seed).derive(path);
|
|
97
|
+
if (!child.privateKey || !child.publicKey)
|
|
98
|
+
throw new Error("Failed to derive Bitcoin key");
|
|
99
|
+
const address = type === "p2wpkh" ? publicKeyToP2wpkhAddress(child.publicKey, network) : publicKeyToP2trAddress(child.publicKey, network);
|
|
100
|
+
return {
|
|
101
|
+
privateKey: bytesToHex(child.privateKey),
|
|
102
|
+
publicKey: bytesToHex(child.publicKey),
|
|
103
|
+
address,
|
|
104
|
+
path
|
|
105
|
+
};
|
|
106
|
+
}
|
|
80
107
|
// src/accounts/toAccount.ts
|
|
81
108
|
function toAccount(source) {
|
|
82
109
|
return {
|
|
@@ -87,5 +114,5 @@ function toAccount(source) {
|
|
|
87
114
|
};
|
|
88
115
|
}
|
|
89
116
|
|
|
90
|
-
//# debugId=
|
|
117
|
+
//# debugId=D2C5E3F81BCB428564756E2164756E21
|
|
91
118
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/accounts/privateKeyToAccount.ts", "../src/accounts/mnemonicToAccount.ts", "../src/accounts/toAccount.ts"],
|
|
3
|
+
"sources": ["../src/accounts/privateKeyToAccount.ts", "../src/accounts/mnemonicToAccount.ts", "../src/accounts/mnemonicToBitcoinKeys.ts", "../src/accounts/toAccount.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
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\tfor (const msg of msgs) 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
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 { HDKey } from \"@scure/bip32\";\nimport { mnemonicToSeedSync } from \"@scure/bip39\";\nimport {\n\tpublicKeyToP2trAddress,\n\tpublicKeyToP2wpkhAddress,\n} from \"../bitcoin/address.ts\";\nimport type { BitcoinNetwork } from \"../bitcoin/constants.ts\";\nimport { bytesToHex } from \"../utils/encoding.ts\";\n\nexport type BitcoinKeyType = \"p2wpkh\" | \"p2tr\";\n\nexport type MnemonicToBitcoinKeysOptions = {\n\t/** `'p2wpkh'` (BIP84, `bc1q…`) or `'p2tr'` (BIP86, `bc1p…`). */\n\ttype: BitcoinKeyType;\n\tnetwork?: BitcoinNetwork;\n\taccountIndex?: number;\n\t/** 0 = receive chain, 1 = change chain. */\n\tchangeIndex?: number;\n\taddressIndex?: number;\n};\n\nexport type BitcoinKeys = {\n\t/** 32-byte private key, hex. */\n\tprivateKey: string;\n\t/** 33-byte compressed public key, hex. */\n\tpublicKey: string;\n\taddress: string;\n\t/** Full BIP84/BIP86 derivation path. */\n\tpath: string;\n};\n\nconst PURPOSE: Record<BitcoinKeyType, number> = { p2wpkh: 84, p2tr: 86 };\n\n/**\n * Derive Bitcoin keys + address from the same mnemonic that backs a Stacks\n * account — BIP84 (native segwit) or BIP86 (taproot) paths, matching what\n * Leather/Xverse derive for the paired BTC account. Pure derivation: no\n * Bitcoin transaction building or signing.\n *\n * @example\n * const btc = mnemonicToBitcoinKeys(mnemonic, { type: \"p2tr\" });\n * btc.address; // bc1p…\n * btc.path; // m/86'/0'/0'/0/0\n */\nexport function mnemonicToBitcoinKeys(\n\tmnemonic: string,\n\toptions: MnemonicToBitcoinKeysOptions,\n): BitcoinKeys {\n\tconst {\n\t\ttype,\n\t\tnetwork = \"mainnet\",\n\t\taccountIndex = 0,\n\t\tchangeIndex = 0,\n\t\taddressIndex = 0,\n\t} = options;\n\n\t// BIP44 coin type: 0' mainnet, 1' testnet/regtest.\n\tconst coinType = network === \"mainnet\" ? 0 : 1;\n\tconst path = `m/${PURPOSE[type]}'/${coinType}'/${accountIndex}'/${changeIndex}/${addressIndex}`;\n\n\tconst seed = mnemonicToSeedSync(mnemonic);\n\tconst child = HDKey.fromMasterSeed(seed).derive(path);\n\tif (!child.privateKey || !child.publicKey)\n\t\tthrow new Error(\"Failed to derive Bitcoin key\");\n\n\tconst address =\n\t\ttype === \"p2wpkh\"\n\t\t\t? publicKeyToP2wpkhAddress(child.publicKey, network)\n\t\t\t: publicKeyToP2trAddress(child.publicKey, network);\n\n\treturn {\n\t\tprivateKey: bytesToHex(child.privateKey),\n\t\tpublicKey: bytesToHex(child.publicKey),\n\t\taddress,\n\t\tpath,\n\t};\n}\n",
|
|
7
8
|
"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
9
|
],
|
|
9
|
-
"mappings": "
|
|
10
|
-
"debugId": "
|
|
10
|
+
"mappings": ";;;;;;;;;;;;;AAAqB,IAArB;AACuB,IAAvB;AAC6D,IAA7D;AAMA,SAAS,iBAAiB,GAAG;AAAA,EAC5B,IAAI,CAAC,qBAAI,gBAAgB;AAA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UACL,SAAS,WACN,yBAAyB,MAAM,WAAW,OAAO,IACjD,uBAAuB,MAAM,WAAW,OAAO;AAAA,EAEnD,OAAO;AAAA,IACN,YAAY,WAAW,MAAM,UAAU;AAAA,IACvC,WAAW,WAAW,MAAM,SAAS;AAAA,IACrC;AAAA,IACA;AAAA,EACD;AAAA;;ACzEM,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;",
|
|
11
|
+
"debugId": "D2C5E3F81BCB428564756E2164756E21",
|
|
11
12
|
"names": []
|
|
12
13
|
}
|
|
@@ -41,7 +41,29 @@ declare function mnemonicToAccount(mnemonic: string, options?: {
|
|
|
41
41
|
accountIndex?: number
|
|
42
42
|
addressVersion?: number
|
|
43
43
|
}): LocalAccount;
|
|
44
|
+
type BitcoinNetwork = "mainnet" | "testnet" | "regtest";
|
|
45
|
+
type BitcoinKeyType = "p2wpkh" | "p2tr";
|
|
46
|
+
type MnemonicToBitcoinKeysOptions = {
|
|
47
|
+
/** `'p2wpkh'` (BIP84, `bc1q…`) or `'p2tr'` (BIP86, `bc1p…`). */
|
|
48
|
+
type: BitcoinKeyType
|
|
49
|
+
network?: BitcoinNetwork
|
|
50
|
+
accountIndex?: number
|
|
51
|
+
/** 0 = receive chain, 1 = change chain. */
|
|
52
|
+
changeIndex?: number
|
|
53
|
+
addressIndex?: number
|
|
54
|
+
};
|
|
55
|
+
type BitcoinKeys = {
|
|
56
|
+
/** 32-byte private key, hex. */
|
|
57
|
+
privateKey: string
|
|
58
|
+
/** 33-byte compressed public key, hex. */
|
|
59
|
+
publicKey: string
|
|
60
|
+
address: string
|
|
61
|
+
/** Full BIP84/BIP86 derivation path. */
|
|
62
|
+
path: string
|
|
63
|
+
};
|
|
64
|
+
/**\\n* Derive Bitcoin keys + address from the same mnemonic that backs a Stacks\\n* account — BIP84 (native segwit) or BIP86 (taproot) paths, matching what\\n* Leather/Xverse derive for the paired BTC account. Pure derivation: no\\n* Bitcoin transaction building or signing.\\n*\\n* @example\\n* const btc = mnemonicToBitcoinKeys(mnemonic, { type: "p2tr" });\\n* btc.address; // bc1p…\\n* btc.path; // m/86'/0'/0'/0/0\\n*/
|
|
65
|
+
declare function mnemonicToBitcoinKeys(mnemonic: string, options: MnemonicToBitcoinKeysOptions): BitcoinKeys;
|
|
44
66
|
declare function toAccount(source: AccountSource): CustomAccount;
|
|
45
67
|
/** Create a ProviderAccount by querying the wallet for addresses */
|
|
46
68
|
declare function providerToAccount(provider: StacksProvider): Promise<ProviderAccount>;
|
|
47
|
-
export { toAccount, providerToAccount, privateKeyToAccount, mnemonicToAccount, compressPrivateKey, StacksProvider, ProviderAccount, LocalAccount, CustomAccount, AccountSource };
|
|
69
|
+
export { toAccount, providerToAccount, privateKeyToAccount, mnemonicToBitcoinKeys, mnemonicToAccount, compressPrivateKey, StacksProvider, ProviderAccount, MnemonicToBitcoinKeysOptions, LocalAccount, CustomAccount, BitcoinKeys, BitcoinKeyType, AccountSource };
|
|
@@ -41,7 +41,29 @@ declare function mnemonicToAccount(mnemonic: string, options?: {
|
|
|
41
41
|
accountIndex?: number
|
|
42
42
|
addressVersion?: number
|
|
43
43
|
}): LocalAccount;
|
|
44
|
+
type BitcoinNetwork = "mainnet" | "testnet" | "regtest";
|
|
45
|
+
type BitcoinKeyType = "p2wpkh" | "p2tr";
|
|
46
|
+
type MnemonicToBitcoinKeysOptions = {
|
|
47
|
+
/** `'p2wpkh'` (BIP84, `bc1q…`) or `'p2tr'` (BIP86, `bc1p…`). */
|
|
48
|
+
type: BitcoinKeyType
|
|
49
|
+
network?: BitcoinNetwork
|
|
50
|
+
accountIndex?: number
|
|
51
|
+
/** 0 = receive chain, 1 = change chain. */
|
|
52
|
+
changeIndex?: number
|
|
53
|
+
addressIndex?: number
|
|
54
|
+
};
|
|
55
|
+
type BitcoinKeys = {
|
|
56
|
+
/** 32-byte private key, hex. */
|
|
57
|
+
privateKey: string
|
|
58
|
+
/** 33-byte compressed public key, hex. */
|
|
59
|
+
publicKey: string
|
|
60
|
+
address: string
|
|
61
|
+
/** Full BIP84/BIP86 derivation path. */
|
|
62
|
+
path: string
|
|
63
|
+
};
|
|
64
|
+
/**\\n* Derive Bitcoin keys + address from the same mnemonic that backs a Stacks\\n* account — BIP84 (native segwit) or BIP86 (taproot) paths, matching what\\n* Leather/Xverse derive for the paired BTC account. Pure derivation: no\\n* Bitcoin transaction building or signing.\\n*\\n* @example\\n* const btc = mnemonicToBitcoinKeys(mnemonic, { type: "p2tr" });\\n* btc.address; // bc1p…\\n* btc.path; // m/86'/0'/0'/0/0\\n*/
|
|
65
|
+
declare function mnemonicToBitcoinKeys(mnemonic: string, options: MnemonicToBitcoinKeysOptions): BitcoinKeys;
|
|
44
66
|
declare function toAccount(source: AccountSource): CustomAccount;
|
|
45
67
|
/** Create a ProviderAccount by querying the wallet for addresses */
|
|
46
68
|
declare function providerToAccount(provider: StacksProvider): Promise<ProviderAccount>;
|
|
47
|
-
export { toAccount, providerToAccount, privateKeyToAccount, mnemonicToAccount, compressPrivateKey, StacksProvider, ProviderAccount, LocalAccount, CustomAccount, AccountSource };
|
|
69
|
+
export { toAccount, providerToAccount, privateKeyToAccount, mnemonicToBitcoinKeys, mnemonicToAccount, compressPrivateKey, StacksProvider, ProviderAccount, MnemonicToBitcoinKeysOptions, LocalAccount, CustomAccount, BitcoinKeys, BitcoinKeyType, AccountSource };
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
publicKeyToP2trAddress,
|
|
3
|
+
publicKeyToP2wpkhAddress
|
|
4
|
+
} from "../../shared/stacks-0cdm20eh.js";
|
|
5
|
+
import"../../shared/stacks-5nmz5ad9.js";
|
|
1
6
|
import {
|
|
2
7
|
providerToAccount
|
|
3
8
|
} from "../../shared/stacks-qcae5852.js";
|
|
@@ -78,6 +83,32 @@ function mnemonicToAccount(mnemonic, options) {
|
|
|
78
83
|
const privateKeyHex = compressPrivateKey(bytesToHex(child.privateKey));
|
|
79
84
|
return privateKeyToAccount(privateKeyHex, { addressVersion });
|
|
80
85
|
}
|
|
86
|
+
// src/accounts/mnemonicToBitcoinKeys.ts
|
|
87
|
+
import { HDKey as HDKey2 } from "@scure/bip32";
|
|
88
|
+
import { mnemonicToSeedSync as mnemonicToSeedSync2 } from "@scure/bip39";
|
|
89
|
+
var PURPOSE = { p2wpkh: 84, p2tr: 86 };
|
|
90
|
+
function mnemonicToBitcoinKeys(mnemonic, options) {
|
|
91
|
+
const {
|
|
92
|
+
type,
|
|
93
|
+
network = "mainnet",
|
|
94
|
+
accountIndex = 0,
|
|
95
|
+
changeIndex = 0,
|
|
96
|
+
addressIndex = 0
|
|
97
|
+
} = options;
|
|
98
|
+
const coinType = network === "mainnet" ? 0 : 1;
|
|
99
|
+
const path = `m/${PURPOSE[type]}'/${coinType}'/${accountIndex}'/${changeIndex}/${addressIndex}`;
|
|
100
|
+
const seed = mnemonicToSeedSync2(mnemonic);
|
|
101
|
+
const child = HDKey2.fromMasterSeed(seed).derive(path);
|
|
102
|
+
if (!child.privateKey || !child.publicKey)
|
|
103
|
+
throw new Error("Failed to derive Bitcoin key");
|
|
104
|
+
const address = type === "p2wpkh" ? publicKeyToP2wpkhAddress(child.publicKey, network) : publicKeyToP2trAddress(child.publicKey, network);
|
|
105
|
+
return {
|
|
106
|
+
privateKey: bytesToHex(child.privateKey),
|
|
107
|
+
publicKey: bytesToHex(child.publicKey),
|
|
108
|
+
address,
|
|
109
|
+
path
|
|
110
|
+
};
|
|
111
|
+
}
|
|
81
112
|
// src/accounts/toAccount.ts
|
|
82
113
|
function toAccount(source) {
|
|
83
114
|
return {
|
|
@@ -91,9 +122,10 @@ export {
|
|
|
91
122
|
toAccount,
|
|
92
123
|
providerToAccount,
|
|
93
124
|
privateKeyToAccount,
|
|
125
|
+
mnemonicToBitcoinKeys,
|
|
94
126
|
mnemonicToAccount,
|
|
95
127
|
compressPrivateKey
|
|
96
128
|
};
|
|
97
129
|
|
|
98
|
-
//# debugId=
|
|
130
|
+
//# debugId=D63669131B82ABCA64756E2164756E21
|
|
99
131
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/accounts/privateKeyToAccount.ts", "../src/accounts/mnemonicToAccount.ts", "../src/accounts/toAccount.ts"],
|
|
3
|
+
"sources": ["../src/accounts/privateKeyToAccount.ts", "../src/accounts/mnemonicToAccount.ts", "../src/accounts/mnemonicToBitcoinKeys.ts", "../src/accounts/toAccount.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
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\tfor (const msg of msgs) 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
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 { HDKey } from \"@scure/bip32\";\nimport { mnemonicToSeedSync } from \"@scure/bip39\";\nimport {\n\tpublicKeyToP2trAddress,\n\tpublicKeyToP2wpkhAddress,\n} from \"../bitcoin/address.ts\";\nimport type { BitcoinNetwork } from \"../bitcoin/constants.ts\";\nimport { bytesToHex } from \"../utils/encoding.ts\";\n\nexport type BitcoinKeyType = \"p2wpkh\" | \"p2tr\";\n\nexport type MnemonicToBitcoinKeysOptions = {\n\t/** `'p2wpkh'` (BIP84, `bc1q…`) or `'p2tr'` (BIP86, `bc1p…`). */\n\ttype: BitcoinKeyType;\n\tnetwork?: BitcoinNetwork;\n\taccountIndex?: number;\n\t/** 0 = receive chain, 1 = change chain. */\n\tchangeIndex?: number;\n\taddressIndex?: number;\n};\n\nexport type BitcoinKeys = {\n\t/** 32-byte private key, hex. */\n\tprivateKey: string;\n\t/** 33-byte compressed public key, hex. */\n\tpublicKey: string;\n\taddress: string;\n\t/** Full BIP84/BIP86 derivation path. */\n\tpath: string;\n};\n\nconst PURPOSE: Record<BitcoinKeyType, number> = { p2wpkh: 84, p2tr: 86 };\n\n/**\n * Derive Bitcoin keys + address from the same mnemonic that backs a Stacks\n * account — BIP84 (native segwit) or BIP86 (taproot) paths, matching what\n * Leather/Xverse derive for the paired BTC account. Pure derivation: no\n * Bitcoin transaction building or signing.\n *\n * @example\n * const btc = mnemonicToBitcoinKeys(mnemonic, { type: \"p2tr\" });\n * btc.address; // bc1p…\n * btc.path; // m/86'/0'/0'/0/0\n */\nexport function mnemonicToBitcoinKeys(\n\tmnemonic: string,\n\toptions: MnemonicToBitcoinKeysOptions,\n): BitcoinKeys {\n\tconst {\n\t\ttype,\n\t\tnetwork = \"mainnet\",\n\t\taccountIndex = 0,\n\t\tchangeIndex = 0,\n\t\taddressIndex = 0,\n\t} = options;\n\n\t// BIP44 coin type: 0' mainnet, 1' testnet/regtest.\n\tconst coinType = network === \"mainnet\" ? 0 : 1;\n\tconst path = `m/${PURPOSE[type]}'/${coinType}'/${accountIndex}'/${changeIndex}/${addressIndex}`;\n\n\tconst seed = mnemonicToSeedSync(mnemonic);\n\tconst child = HDKey.fromMasterSeed(seed).derive(path);\n\tif (!child.privateKey || !child.publicKey)\n\t\tthrow new Error(\"Failed to derive Bitcoin key\");\n\n\tconst address =\n\t\ttype === \"p2wpkh\"\n\t\t\t? publicKeyToP2wpkhAddress(child.publicKey, network)\n\t\t\t: publicKeyToP2trAddress(child.publicKey, network);\n\n\treturn {\n\t\tprivateKey: bytesToHex(child.privateKey),\n\t\tpublicKey: bytesToHex(child.publicKey),\n\t\taddress,\n\t\tpath,\n\t};\n}\n",
|
|
7
8
|
"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
9
|
],
|
|
9
|
-
"mappings": "
|
|
10
|
-
"debugId": "
|
|
10
|
+
"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,WAAW,OAAO;AAAA,QAAM,EAAE,OAAO,GAAG;AAAA,MACpC,OAAO,EAAE,OAAO;AAAA;AAAA,EAElB;AAAA;AAGD,IAAM,gCAAgC;AAE/B,S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O;AAAA,IACN,MAAM;AAAA,IACN,SAAS,OAAO;AAAA,IAChB,WAAW,OAAO;AAAA,IAClB,MAAM,OAAO;AAAA,EACd;AAAA;",
|
|
11
|
+
"debugId": "D63669131B82ABCA64756E2164756E21",
|
|
11
12
|
"names": []
|
|
12
13
|
}
|
|
@@ -7,6 +7,7 @@ __export(exports_actions, {
|
|
|
7
7
|
watchBlocks: () => watchBlocks,
|
|
8
8
|
watchAddressBalance: () => watchAddressBalance,
|
|
9
9
|
watchAddress: () => watchAddress,
|
|
10
|
+
waitForTransactionReceipt: () => waitForTransactionReceipt,
|
|
10
11
|
transferStx: () => transferStx,
|
|
11
12
|
sponsorTransaction: () => sponsorTransaction,
|
|
12
13
|
simulateTransaction: () => simulateTransaction,
|
|
@@ -14,9 +15,14 @@ __export(exports_actions, {
|
|
|
14
15
|
signTransactionAction: () => signTransactionAction,
|
|
15
16
|
signMessage: () => signMessage,
|
|
16
17
|
sendTransaction: () => sendTransaction,
|
|
18
|
+
resolveFee: () => resolveFee,
|
|
17
19
|
readContract: () => readContract,
|
|
18
20
|
multicall: () => multicall,
|
|
21
|
+
minimumFee: () => minimumFee,
|
|
19
22
|
isProviderAccount: () => isProviderAccount,
|
|
23
|
+
isFeeTier: () => isFeeTier,
|
|
24
|
+
indexTxSource: () => indexTxSource,
|
|
25
|
+
getTransaction: () => getTransaction,
|
|
20
26
|
getNonce: () => getNonce,
|
|
21
27
|
getMapEntry: () => getMapEntry,
|
|
22
28
|
getContractAbi: () => getContractAbi,
|
|
@@ -25,6 +31,7 @@ __export(exports_actions, {
|
|
|
25
31
|
getBlock: () => getBlock,
|
|
26
32
|
getBalance: () => getBalance,
|
|
27
33
|
getAccountInfo: () => getAccountInfo,
|
|
34
|
+
extendedApiSource: () => extendedApiSource,
|
|
28
35
|
estimateFee: () => estimateFee,
|
|
29
36
|
deployContract: () => deployContract,
|
|
30
37
|
callContract: () => callContract,
|
|
@@ -32,5 +39,5 @@ __export(exports_actions, {
|
|
|
32
39
|
});
|
|
33
40
|
module.exports = __toCommonJS(exports_actions);
|
|
34
41
|
|
|
35
|
-
//# debugId=
|
|
42
|
+
//# debugId=38538D184946FE2164756E2164756E21
|
|
36
43
|
//# sourceMappingURL=index.cjs.map
|