@secondlayer/stacks 3.3.1 → 4.0.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-6bgh2c9h.js → stacks-27fmgajb.js} +11 -3
- package/dist/shared/{stacks-b221qkst.cjs.map → stacks-27fmgajb.js.map} +4 -3
- package/dist/shared/{stacks-jknrzd6v.js → stacks-2evvn48s.js} +2 -2
- package/dist/shared/{stacks-s361pmzs.cjs → stacks-90jcxs98.js} +84 -2
- package/dist/shared/{stacks-9d2d0qjc.js.map → stacks-90jcxs98.js.map} +6 -4
- package/dist/shared/{stacks-8e5atbps.cjs → stacks-dr5en54r.cjs} +9 -2
- package/dist/shared/{stacks-8e5atbps.cjs.map → stacks-dr5en54r.cjs.map} +2 -2
- package/dist/shared/{stacks-bm49tsh0.js → stacks-fse1f76h.js} +2 -3
- package/dist/shared/{stacks-bm49tsh0.js.map → stacks-fse1f76h.js.map} +1 -1
- package/dist/shared/{stacks-b221qkst.cjs → stacks-nyaw1z2a.cjs} +7 -2
- package/dist/shared/{stacks-6bgh2c9h.js.map → stacks-nyaw1z2a.cjs.map} +4 -3
- package/dist/shared/{stacks-9d2d0qjc.js → stacks-tdsp5gsb.cjs} +54 -23
- package/dist/shared/{stacks-s361pmzs.cjs.map → stacks-tdsp5gsb.cjs.map} +6 -4
- package/dist/shared/{stacks-r1m1r72q.js → stacks-thkhfwz8.js} +35 -5
- package/dist/shared/{stacks-r1m1r72q.js.map → stacks-thkhfwz8.js.map} +4 -3
- package/dist/shared/{stacks-v1hzk599.js → stacks-z3vztaz1.js} +7 -9
- package/dist/shared/{stacks-v1hzk599.js.map → stacks-z3vztaz1.js.map} +2 -2
- package/dist/shared/{stacks-fvnxj77s.cjs → stacks-zwgsbbb2.cjs} +28 -2
- package/dist/shared/{stacks-fvnxj77s.cjs.map → stacks-zwgsbbb2.cjs.map} +4 -3
- package/dist/src/actions/index.js +18 -23
- package/dist/src/actions/index.js.map +1 -1
- package/dist/src/bitcoin/index.js +3 -5
- package/dist/src/bitcoin/index.js.map +2 -2
- package/dist/src/bns/index.js +5 -8
- package/dist/src/bns/index.js.map +2 -2
- package/dist/src/index.js +19 -25
- package/dist/src/index.js.map +2 -2
- package/dist/src/postconditions/index.js +2 -3
- package/dist/src/postconditions/index.js.map +1 -1
- package/dist/src/pox/index.js +5 -8
- package/dist/src/pox/index.js.map +2 -2
- package/dist/src/pox5/index.js +5 -7
- package/dist/src/pox5/index.js.map +2 -2
- package/dist/src/sbtc/index.js +4 -6
- package/dist/src/sbtc/index.js.map +2 -2
- package/dist/src/stackingdao/index.js +5 -8
- package/dist/src/stackingdao/index.js.map +2 -2
- package/package.json +1 -6
- package/dist/shared/stacks-1mpmzzyp.js +0 -85
- package/dist/shared/stacks-1mpmzzyp.js.map +0 -11
- package/dist/shared/stacks-44y18a8e.cjs +0 -28
- package/dist/shared/stacks-44y18a8e.cjs.map +0 -10
- package/dist/shared/stacks-8khy9v27.cjs +0 -7
- package/dist/shared/stacks-8khy9v27.cjs.map +0 -10
- package/dist/shared/stacks-d6pgp4qk.cjs +0 -9
- package/dist/shared/stacks-d6pgp4qk.cjs.map +0 -9
- package/dist/shared/stacks-fh48neva.js +0 -13
- package/dist/shared/stacks-fh48neva.js.map +0 -10
- package/dist/shared/stacks-fjrpnkt3.cjs +0 -55
- package/dist/shared/stacks-fjrpnkt3.cjs.map +0 -11
- package/dist/shared/stacks-w8tt1fmt.js +0 -44
- package/dist/shared/stacks-w8tt1fmt.js.map +0 -10
- package/dist/shared/stacks-z53fwfcm.js +0 -3
- package/dist/shared/stacks-z53fwfcm.js.map +0 -9
- package/dist/src/x402/index.cjs +0 -65
- package/dist/src/x402/index.cjs.map +0 -11
- package/dist/src/x402/index.d.cts +0 -501
- package/dist/src/x402/index.d.ts +0 -501
- package/dist/src/x402/index.js +0 -90
- package/dist/src/x402/index.js.map +0 -11
- /package/dist/shared/{stacks-jknrzd6v.js.map → stacks-2evvn48s.js.map} +0 -0
|
@@ -1,501 +0,0 @@
|
|
|
1
|
-
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
2
|
-
type StacksChain = {
|
|
3
|
-
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
4
|
-
id: number
|
|
5
|
-
/** Human-readable name */
|
|
6
|
-
name: string
|
|
7
|
-
/** Network type */
|
|
8
|
-
network: "mainnet" | "testnet"
|
|
9
|
-
/** Transaction version byte for serialization */
|
|
10
|
-
transactionVersion: number
|
|
11
|
-
/** Peer network ID for P2P broadcasting */
|
|
12
|
-
peerNetworkId: number
|
|
13
|
-
/** Address version bytes */
|
|
14
|
-
addressVersion: {
|
|
15
|
-
singleSig: number
|
|
16
|
-
multiSig: number
|
|
17
|
-
}
|
|
18
|
-
/** Magic bytes for network identification */
|
|
19
|
-
magicBytes: string
|
|
20
|
-
/** Boot address (system contracts deployer) */
|
|
21
|
-
bootAddress: string
|
|
22
|
-
/** Native currency info */
|
|
23
|
-
nativeCurrency: {
|
|
24
|
-
name: string
|
|
25
|
-
symbol: string
|
|
26
|
-
decimals: number
|
|
27
|
-
}
|
|
28
|
-
/** Default RPC URLs */
|
|
29
|
-
rpcUrls: {
|
|
30
|
-
default: {
|
|
31
|
-
http: string[]
|
|
32
|
-
ws?: string[]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/** Block explorer URLs */
|
|
36
|
-
blockExplorers?: {
|
|
37
|
-
default: {
|
|
38
|
-
name: string
|
|
39
|
-
url: string
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
type IntCV = {
|
|
44
|
-
readonly type: "int"
|
|
45
|
-
readonly value: bigint
|
|
46
|
-
};
|
|
47
|
-
type UIntCV = {
|
|
48
|
-
readonly type: "uint"
|
|
49
|
-
readonly value: bigint
|
|
50
|
-
};
|
|
51
|
-
type BooleanCV = TrueCV | FalseCV;
|
|
52
|
-
type TrueCV = {
|
|
53
|
-
readonly type: "true"
|
|
54
|
-
};
|
|
55
|
-
type FalseCV = {
|
|
56
|
-
readonly type: "false"
|
|
57
|
-
};
|
|
58
|
-
type BufferCV = {
|
|
59
|
-
readonly type: "buffer"
|
|
60
|
-
readonly value: string
|
|
61
|
-
};
|
|
62
|
-
type NoneCV = {
|
|
63
|
-
readonly type: "none"
|
|
64
|
-
};
|
|
65
|
-
type SomeCV = {
|
|
66
|
-
readonly type: "some"
|
|
67
|
-
readonly value: ClarityValue
|
|
68
|
-
};
|
|
69
|
-
type ResponseOkCV = {
|
|
70
|
-
readonly type: "ok"
|
|
71
|
-
readonly value: ClarityValue
|
|
72
|
-
};
|
|
73
|
-
type ResponseErrorCV = {
|
|
74
|
-
readonly type: "err"
|
|
75
|
-
readonly value: ClarityValue
|
|
76
|
-
};
|
|
77
|
-
type StandardPrincipalCV = {
|
|
78
|
-
readonly type: "address"
|
|
79
|
-
readonly value: string
|
|
80
|
-
};
|
|
81
|
-
type ContractPrincipalCV = {
|
|
82
|
-
readonly type: "contract"
|
|
83
|
-
readonly value: string
|
|
84
|
-
};
|
|
85
|
-
type ListCV = {
|
|
86
|
-
type: "list"
|
|
87
|
-
value: ClarityValue[]
|
|
88
|
-
};
|
|
89
|
-
type TupleData = {
|
|
90
|
-
[key: string]: ClarityValue
|
|
91
|
-
};
|
|
92
|
-
type TupleCV = {
|
|
93
|
-
type: "tuple"
|
|
94
|
-
value: TupleData
|
|
95
|
-
};
|
|
96
|
-
type StringAsciiCV = {
|
|
97
|
-
readonly type: "ascii"
|
|
98
|
-
readonly value: string
|
|
99
|
-
};
|
|
100
|
-
type StringUtf8CV = {
|
|
101
|
-
readonly type: "utf8"
|
|
102
|
-
readonly value: string
|
|
103
|
-
};
|
|
104
|
-
type ClarityValue = IntCV | UIntCV | BooleanCV | BufferCV | NoneCV | SomeCV | ResponseOkCV | ResponseErrorCV | StandardPrincipalCV | ContractPrincipalCV | ListCV | TupleCV | StringAsciiCV | StringUtf8CV;
|
|
105
|
-
declare const AuthType: {
|
|
106
|
-
readonly Standard: 0x04
|
|
107
|
-
readonly Sponsored: 0x05
|
|
108
|
-
};
|
|
109
|
-
type AuthType = (typeof AuthType)[keyof typeof AuthType];
|
|
110
|
-
declare const PayloadType: {
|
|
111
|
-
readonly TokenTransfer: 0x00
|
|
112
|
-
readonly SmartContract: 0x01
|
|
113
|
-
readonly ContractCall: 0x02
|
|
114
|
-
readonly PoisonMicroblock: 0x03
|
|
115
|
-
readonly Coinbase: 0x04
|
|
116
|
-
readonly CoinbaseToAltRecipient: 0x05
|
|
117
|
-
readonly VersionedSmartContract: 0x06
|
|
118
|
-
readonly TenureChange: 0x07
|
|
119
|
-
readonly NakamotoCoinbase: 0x08
|
|
120
|
-
};
|
|
121
|
-
type PayloadType = (typeof PayloadType)[keyof typeof PayloadType];
|
|
122
|
-
declare const ClarityVersion: {
|
|
123
|
-
readonly Clarity1: 1
|
|
124
|
-
readonly Clarity2: 2
|
|
125
|
-
readonly Clarity3: 3
|
|
126
|
-
readonly Clarity4: 4
|
|
127
|
-
readonly Clarity5: 5
|
|
128
|
-
readonly Clarity6: 6
|
|
129
|
-
};
|
|
130
|
-
type ClarityVersion = (typeof ClarityVersion)[keyof typeof ClarityVersion];
|
|
131
|
-
declare const AnchorMode: {
|
|
132
|
-
readonly OnChainOnly: 0x01
|
|
133
|
-
readonly OffChainOnly: 0x02
|
|
134
|
-
readonly Any: 0x03
|
|
135
|
-
};
|
|
136
|
-
type AnchorMode = (typeof AnchorMode)[keyof typeof AnchorMode];
|
|
137
|
-
declare const PostConditionModeWire: {
|
|
138
|
-
readonly Allow: 0x01
|
|
139
|
-
readonly Deny: 0x02
|
|
140
|
-
};
|
|
141
|
-
type PostConditionModeWire = (typeof PostConditionModeWire)[keyof typeof PostConditionModeWire];
|
|
142
|
-
declare const AddressHashMode: {
|
|
143
|
-
readonly P2PKH: 0x00
|
|
144
|
-
readonly P2SH: 0x01
|
|
145
|
-
readonly P2WPKH: 0x02
|
|
146
|
-
readonly P2WSH: 0x03
|
|
147
|
-
readonly P2SH_NonSequential: 0x05
|
|
148
|
-
readonly P2WSH_P2SH_NonSequential: 0x07
|
|
149
|
-
};
|
|
150
|
-
type AddressHashMode = (typeof AddressHashMode)[keyof typeof AddressHashMode];
|
|
151
|
-
declare const PubKeyEncoding: {
|
|
152
|
-
readonly Compressed: 0x00
|
|
153
|
-
readonly Uncompressed: 0x01
|
|
154
|
-
};
|
|
155
|
-
type PubKeyEncoding = (typeof PubKeyEncoding)[keyof typeof PubKeyEncoding];
|
|
156
|
-
declare const PoxConditionCode: {
|
|
157
|
-
readonly WillNotPerform: 0x30
|
|
158
|
-
readonly MayPerform: 0x31
|
|
159
|
-
readonly WillPerform: 0x32
|
|
160
|
-
};
|
|
161
|
-
type PoxConditionCode = (typeof PoxConditionCode)[keyof typeof PoxConditionCode];
|
|
162
|
-
declare const TenureChangeCause: {
|
|
163
|
-
readonly BlockFound: 0x00
|
|
164
|
-
readonly Extended: 0x01
|
|
165
|
-
readonly ExtendedRuntime: 0x02
|
|
166
|
-
readonly ExtendedReadCount: 0x03
|
|
167
|
-
readonly ExtendedReadLength: 0x04
|
|
168
|
-
readonly ExtendedWriteCount: 0x05
|
|
169
|
-
readonly ExtendedWriteLength: 0x06
|
|
170
|
-
};
|
|
171
|
-
type TenureChangeCause = (typeof TenureChangeCause)[keyof typeof TenureChangeCause];
|
|
172
|
-
type TokenTransferPayload = {
|
|
173
|
-
payloadType: typeof PayloadType.TokenTransfer
|
|
174
|
-
recipient: ClarityValue
|
|
175
|
-
amount: bigint
|
|
176
|
-
memo: string
|
|
177
|
-
};
|
|
178
|
-
type ContractCallPayload = {
|
|
179
|
-
payloadType: typeof PayloadType.ContractCall
|
|
180
|
-
contractAddress: string
|
|
181
|
-
contractName: string
|
|
182
|
-
functionName: string
|
|
183
|
-
functionArgs: ClarityValue[]
|
|
184
|
-
};
|
|
185
|
-
type SmartContractPayload = {
|
|
186
|
-
payloadType: typeof PayloadType.SmartContract | typeof PayloadType.VersionedSmartContract
|
|
187
|
-
clarityVersion?: ClarityVersion
|
|
188
|
-
contractName: string
|
|
189
|
-
codeBody: string
|
|
190
|
-
};
|
|
191
|
-
type CoinbasePayload = {
|
|
192
|
-
payloadType: typeof PayloadType.Coinbase
|
|
193
|
-
coinbaseBuffer: string
|
|
194
|
-
};
|
|
195
|
-
type CoinbaseToAltRecipientPayload = {
|
|
196
|
-
payloadType: typeof PayloadType.CoinbaseToAltRecipient
|
|
197
|
-
coinbaseBuffer: string
|
|
198
|
-
recipient: ClarityValue
|
|
199
|
-
};
|
|
200
|
-
type PoisonMicroblockPayload = {
|
|
201
|
-
payloadType: typeof PayloadType.PoisonMicroblock
|
|
202
|
-
header1: string
|
|
203
|
-
header2: string
|
|
204
|
-
};
|
|
205
|
-
type TenureChangePayload = {
|
|
206
|
-
payloadType: typeof PayloadType.TenureChange
|
|
207
|
-
tenureConsensusHash: string
|
|
208
|
-
prevTenureConsensusHash: string
|
|
209
|
-
burnViewConsensusHash: string
|
|
210
|
-
previousTenureEnd: string
|
|
211
|
-
previousTenureBlocks: number
|
|
212
|
-
cause: TenureChangeCause
|
|
213
|
-
pubkeyHash: string
|
|
214
|
-
};
|
|
215
|
-
type NakamotoCoinbasePayload = {
|
|
216
|
-
payloadType: typeof PayloadType.NakamotoCoinbase
|
|
217
|
-
coinbaseBuffer: string
|
|
218
|
-
recipient: ClarityValue | null
|
|
219
|
-
vrfProof: string
|
|
220
|
-
};
|
|
221
|
-
type TransactionPayload = TokenTransferPayload | ContractCallPayload | SmartContractPayload | CoinbasePayload | CoinbaseToAltRecipientPayload | PoisonMicroblockPayload | TenureChangePayload | NakamotoCoinbasePayload;
|
|
222
|
-
type SingleSigSpendingCondition = {
|
|
223
|
-
hashMode: typeof AddressHashMode.P2PKH | typeof AddressHashMode.P2WPKH
|
|
224
|
-
signer: string
|
|
225
|
-
nonce: bigint
|
|
226
|
-
fee: bigint
|
|
227
|
-
keyEncoding: PubKeyEncoding
|
|
228
|
-
signature: string
|
|
229
|
-
};
|
|
230
|
-
type TransactionAuthField = {
|
|
231
|
-
pubKeyEncoding: PubKeyEncoding
|
|
232
|
-
type: "publicKey" | "signature"
|
|
233
|
-
data: string
|
|
234
|
-
};
|
|
235
|
-
type MultiSigHashMode = typeof AddressHashMode.P2SH | typeof AddressHashMode.P2WSH | typeof AddressHashMode.P2SH_NonSequential | typeof AddressHashMode.P2WSH_P2SH_NonSequential;
|
|
236
|
-
type MultiSigSpendingCondition = {
|
|
237
|
-
hashMode: MultiSigHashMode
|
|
238
|
-
signer: string
|
|
239
|
-
nonce: bigint
|
|
240
|
-
fee: bigint
|
|
241
|
-
fields: TransactionAuthField[]
|
|
242
|
-
signaturesRequired: number
|
|
243
|
-
};
|
|
244
|
-
type SpendingCondition = SingleSigSpendingCondition | MultiSigSpendingCondition;
|
|
245
|
-
type StandardAuthorization = {
|
|
246
|
-
authType: typeof AuthType.Standard
|
|
247
|
-
spendingCondition: SpendingCondition
|
|
248
|
-
};
|
|
249
|
-
type SponsoredAuthorization = {
|
|
250
|
-
authType: typeof AuthType.Sponsored
|
|
251
|
-
spendingCondition: SpendingCondition
|
|
252
|
-
sponsorSpendingCondition: SpendingCondition
|
|
253
|
-
};
|
|
254
|
-
type Authorization = StandardAuthorization | SponsoredAuthorization;
|
|
255
|
-
type StacksTransaction = {
|
|
256
|
-
version: number
|
|
257
|
-
chainId: number
|
|
258
|
-
auth: Authorization
|
|
259
|
-
anchorMode: AnchorMode
|
|
260
|
-
postConditionMode: PostConditionModeWire
|
|
261
|
-
postConditions: PostConditionWire[]
|
|
262
|
-
payload: TransactionPayload
|
|
263
|
-
/** Multi-sig signer metadata — not part of the wire format, preserved
|
|
264
|
-
* through serialize/deserialize round-trip for auto-detection. */
|
|
265
|
-
_multisig?: {
|
|
266
|
-
publicKeys: string[]
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
type PostConditionWire = StxPostConditionWire | FtPostConditionWire | NftPostConditionWire | StakingPostConditionWire | PoxPostConditionWire;
|
|
270
|
-
type StxPostConditionWire = {
|
|
271
|
-
type: "stx"
|
|
272
|
-
principal: PostConditionPrincipalWire
|
|
273
|
-
conditionCode: number
|
|
274
|
-
amount: bigint
|
|
275
|
-
};
|
|
276
|
-
type FtPostConditionWire = {
|
|
277
|
-
type: "ft"
|
|
278
|
-
principal: PostConditionPrincipalWire
|
|
279
|
-
asset: AssetInfoWire
|
|
280
|
-
conditionCode: number
|
|
281
|
-
amount: bigint
|
|
282
|
-
};
|
|
283
|
-
type NftPostConditionWire = {
|
|
284
|
-
type: "nft"
|
|
285
|
-
principal: PostConditionPrincipalWire
|
|
286
|
-
asset: AssetInfoWire
|
|
287
|
-
conditionCode: number
|
|
288
|
-
assetId: ClarityValue
|
|
289
|
-
};
|
|
290
|
-
type StakingPostConditionWire = {
|
|
291
|
-
type: "staking"
|
|
292
|
-
principal: PostConditionPrincipalWire
|
|
293
|
-
conditionCode: number
|
|
294
|
-
amount: bigint
|
|
295
|
-
};
|
|
296
|
-
type PoxPostConditionWire = {
|
|
297
|
-
type: "pox"
|
|
298
|
-
principal: PostConditionPrincipalWire
|
|
299
|
-
conditionCode: PoxConditionCode
|
|
300
|
-
};
|
|
301
|
-
type PostConditionPrincipalWire = {
|
|
302
|
-
type: "origin"
|
|
303
|
-
} | {
|
|
304
|
-
type: "standard"
|
|
305
|
-
address: string
|
|
306
|
-
} | {
|
|
307
|
-
type: "contract"
|
|
308
|
-
address: string
|
|
309
|
-
contractName: string
|
|
310
|
-
};
|
|
311
|
-
type AssetInfoWire = {
|
|
312
|
-
address: string
|
|
313
|
-
contractName: string
|
|
314
|
-
assetName: string
|
|
315
|
-
};
|
|
316
|
-
type IntegerType = number | string | bigint | Uint8Array;
|
|
317
|
-
/**
|
|
318
|
-
* The asset an x402 payment moves. Either native STX or a SIP-010 token,
|
|
319
|
-
* in which case the fully-qualified contract id and the fungible-token asset
|
|
320
|
-
* name (the `::<asset-name>` suffix, e.g. `sbtc-token`) are both required —
|
|
321
|
-
* the asset name is not always equal to the contract name.
|
|
322
|
-
*/
|
|
323
|
-
type X402Asset = {
|
|
324
|
-
kind: "stx"
|
|
325
|
-
} | {
|
|
326
|
-
kind: "sip010"
|
|
327
|
-
contractId: string
|
|
328
|
-
assetName: string
|
|
329
|
-
};
|
|
330
|
-
type BuildExactTransferOptions = {
|
|
331
|
-
/** The asset and amount to move. */
|
|
332
|
-
asset: X402Asset
|
|
333
|
-
amount: IntegerType
|
|
334
|
-
/** Recipient principal (the resource server's `payTo`). */
|
|
335
|
-
payTo: string
|
|
336
|
-
/** Origin/payer principal — pinned by the post-condition. */
|
|
337
|
-
payer: string
|
|
338
|
-
/** Origin compressed public key (the payer signs origin-only). */
|
|
339
|
-
payerPublicKey: string
|
|
340
|
-
/** The payer account's next nonce. */
|
|
341
|
-
accountNonce: IntegerType
|
|
342
|
-
/**
|
|
343
|
-
* The x402 challenge nonce, carried in the on-chain memo so the facilitator
|
|
344
|
-
* can correlate the settled tx with the challenge. Bound to ≤ 34 bytes
|
|
345
|
-
* (UTF-8) — both the STX memo and the SIP-010 `(buff 34)` memo arg cap there.
|
|
346
|
-
*/
|
|
347
|
-
nonce: string
|
|
348
|
-
chain?: StacksChain
|
|
349
|
-
};
|
|
350
|
-
/**
|
|
351
|
-
* Build an exact-amount, Deny-mode, post-conditioned, **sponsored** transfer
|
|
352
|
-
* (origin-only, un-broadcast). The origin sets fee `0`; the facilitator's
|
|
353
|
-
* sponsor fills in + pays the fee at settle time. The Deny-mode post-condition
|
|
354
|
-
* asserts EXACTLY `amount` leaves `payer` to `payTo`, so settlement aborts
|
|
355
|
-
* on-chain if anything differs — the "exact amount" x402 guarantee is enforced
|
|
356
|
-
* by Clarity, not just by facilitator simulation.
|
|
357
|
-
*/
|
|
358
|
-
declare function buildExactTransfer(options: BuildExactTransferOptions): StacksTransaction;
|
|
359
|
-
/** Account derived from a local private key (mnemonic or raw key). */
|
|
360
|
-
type LocalAccount = {
|
|
361
|
-
type: "local"
|
|
362
|
-
address: string
|
|
363
|
-
/** Compressed public key (hex) */
|
|
364
|
-
publicKey: string
|
|
365
|
-
/** Raw ECDSA sign over a hash */
|
|
366
|
-
sign(hash: Uint8Array): Uint8Array
|
|
367
|
-
/** Sign a structured message (SIP-018) */
|
|
368
|
-
signMessage(message: string | Uint8Array): string
|
|
369
|
-
};
|
|
370
|
-
/** Account with a user-provided signing function (sync or async). */
|
|
371
|
-
type CustomAccount = {
|
|
372
|
-
type: "custom"
|
|
373
|
-
address: string
|
|
374
|
-
publicKey: string
|
|
375
|
-
sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
|
|
376
|
-
};
|
|
377
|
-
/** Browser wallet provider interface (e.g. Leather, Xverse). */
|
|
378
|
-
type StacksProvider = {
|
|
379
|
-
request(method: string, params?: any): Promise<any>
|
|
380
|
-
};
|
|
381
|
-
/** Account backed by a browser wallet {@link StacksProvider}. */
|
|
382
|
-
type ProviderAccount = {
|
|
383
|
-
type: "provider"
|
|
384
|
-
address: string
|
|
385
|
-
publicKey: string
|
|
386
|
-
provider: StacksProvider
|
|
387
|
-
};
|
|
388
|
-
/** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
|
|
389
|
-
type NonceManager = {
|
|
390
|
-
consume(params: {
|
|
391
|
-
client: Client
|
|
392
|
-
address: string
|
|
393
|
-
}): Promise<bigint>
|
|
394
|
-
reset(params: {
|
|
395
|
-
client: Client
|
|
396
|
-
address: string
|
|
397
|
-
}): void | Promise<void>
|
|
398
|
-
/** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
|
|
399
|
-
peek(params: {
|
|
400
|
-
client: Client
|
|
401
|
-
address: string
|
|
402
|
-
}): Promise<bigint | undefined>
|
|
403
|
-
};
|
|
404
|
-
/** Function that sends an HTTP request to a Stacks node API path. */
|
|
405
|
-
type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
|
|
406
|
-
/** Options for a transport-level HTTP request. */
|
|
407
|
-
type RequestOptions = {
|
|
408
|
-
method?: "GET" | "POST" | "PUT" | "DELETE"
|
|
409
|
-
body?: unknown
|
|
410
|
-
headers?: Record<string, string>
|
|
411
|
-
};
|
|
412
|
-
/** Shared configuration for all transport types. */
|
|
413
|
-
type TransportConfig = {
|
|
414
|
-
url?: string
|
|
415
|
-
timeout?: number
|
|
416
|
-
retryCount?: number
|
|
417
|
-
retryDelay?: number
|
|
418
|
-
fetchOptions?: RequestInit
|
|
419
|
-
apiKey?: string
|
|
420
|
-
};
|
|
421
|
-
/** A resolved transport instance with a bound request function. */
|
|
422
|
-
type Transport = {
|
|
423
|
-
type: string
|
|
424
|
-
request: RequestFn
|
|
425
|
-
config: TransportConfig
|
|
426
|
-
destroy?: () => void
|
|
427
|
-
};
|
|
428
|
-
/** Union of all supported account types (local key, custom signer, or browser provider). */
|
|
429
|
-
type Account = LocalAccount | CustomAccount | ProviderAccount;
|
|
430
|
-
/**
|
|
431
|
-
* Core client instance that holds chain context, transport, and extensible actions.
|
|
432
|
-
* Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
|
|
433
|
-
*/
|
|
434
|
-
type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
|
|
435
|
-
chain?: StacksChain
|
|
436
|
-
account?: Account
|
|
437
|
-
transport: Transport
|
|
438
|
-
request: RequestFn
|
|
439
|
-
/** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
|
|
440
|
-
nonceManager?: NonceManager
|
|
441
|
-
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
442
|
-
} & TExtended;
|
|
443
|
-
/**
|
|
444
|
-
* Pluggable transaction-status sources for {@link getTransaction} /
|
|
445
|
-
* `waitForTransactionReceipt`.
|
|
446
|
-
*
|
|
447
|
-
* A bare stacks-node has no confirmed-transaction endpoint, so status reads
|
|
448
|
-
* need a host that indexes transactions. Where that data comes from is
|
|
449
|
-
* pluggable, mirroring the nonce sources:
|
|
450
|
-
*
|
|
451
|
-
* - {@link extendedApiSource} — default; `/extended/v1/tx/{txid}` on the
|
|
452
|
-
* client's transport host (Hiro API or any extended-API-compatible host).
|
|
453
|
-
* - {@link indexTxSource} — Secondlayer's `/v1/index/transactions/{txid}`;
|
|
454
|
-
* returns the chain tip in the same response, so N-confirmation waits
|
|
455
|
-
* need no second request.
|
|
456
|
-
*/
|
|
457
|
-
type TransactionStatus = "pending" | "success" | "abort_by_response" | "abort_by_post_condition" | "dropped";
|
|
458
|
-
type TransactionReceipt = {
|
|
459
|
-
txid: string
|
|
460
|
-
status: TransactionStatus
|
|
461
|
-
/** Anchor block height; absent while pending. */
|
|
462
|
-
blockHeight?: number
|
|
463
|
-
blockHash?: string
|
|
464
|
-
/** Decoded Clarity result; absent while pending or when the source omits it. */
|
|
465
|
-
result?: ClarityValue
|
|
466
|
-
resultHex?: string
|
|
467
|
-
events: unknown[]
|
|
468
|
-
/** The source's unnormalized response, for fields the receipt doesn't model. */
|
|
469
|
-
raw: unknown
|
|
470
|
-
};
|
|
471
|
-
type SponsorAndBroadcastOptions = {
|
|
472
|
-
/** Override the sponsor fee (µSTX). Defaults to a fee estimate. */
|
|
473
|
-
fee?: IntegerType
|
|
474
|
-
/** Override the sponsor account nonce. Defaults to the on-chain nonce. */
|
|
475
|
-
nonce?: IntegerType
|
|
476
|
-
/**
|
|
477
|
-
* Wait for the payment to be mined before returning (`true` = 1
|
|
478
|
-
* confirmation, a number = that many). Settlement rejects if the payment
|
|
479
|
-
* aborts or drops, instead of reporting a txid that never lands.
|
|
480
|
-
*/
|
|
481
|
-
wait?: boolean | number
|
|
482
|
-
};
|
|
483
|
-
type SponsorAndBroadcastResult = {
|
|
484
|
-
txid: string
|
|
485
|
-
/** Present when `wait` was requested. */
|
|
486
|
-
receipt?: TransactionReceipt
|
|
487
|
-
};
|
|
488
|
-
/**
|
|
489
|
-
* Take an origin-signed, sponsored transfer (hex) from the payer, sponsor-sign
|
|
490
|
-
* it with `client`'s account (paying the STX fee), and broadcast it.
|
|
491
|
-
*
|
|
492
|
-
* The payer never holds STX: they sign origin-only with fee `0`; this fills in
|
|
493
|
-
* the sponsor spending condition + fee and POSTs to `/v2/transactions`. The
|
|
494
|
-
* sponsor cannot grief the payer — amount/recipient/asset are pinned by the
|
|
495
|
-
* origin signature + Deny-mode post-conditions baked into the tx.
|
|
496
|
-
*
|
|
497
|
-
* @param client a wallet client whose `account` is the funded sponsor signer.
|
|
498
|
-
* @param signedTxHex the payer's origin-signed sponsored tx, hex-serialized.
|
|
499
|
-
*/
|
|
500
|
-
declare function sponsorAndBroadcast(client: Client, signedTxHex: string, options?: SponsorAndBroadcastOptions): Promise<SponsorAndBroadcastResult>;
|
|
501
|
-
export { sponsorAndBroadcast, buildExactTransfer, X402Asset, SponsorAndBroadcastResult, SponsorAndBroadcastOptions, BuildExactTransferOptions };
|