@leather.io/stacks 1.19.2 → 1.19.4
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/index.d.ts +246 -169
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +434 -690
- package/dist/index.js.map +1 -1
- package/package.json +15 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
1
|
+
import * as _stacks_transactions0 from "@stacks/transactions";
|
|
2
|
+
import { AssetString, ClarityAbi, ClarityValue, ContractCallPayload, ContractIdString, ListCV, NoneCV, PostCondition, PostConditionWire, PrincipalCV, ResponseErrorCV, ResponseOkCV, SomeCV, StacksTransactionWire, TupleCV, TxBroadcastResultRejected, UIntCV, UnsignedContractCallOptions, UnsignedContractDeployOptions, UnsignedTokenTransferOptions } from "@stacks/transactions";
|
|
3
|
+
import { Signer } from "@leather.io/crypto";
|
|
4
|
+
import * as _stacks_network0 from "@stacks/network";
|
|
5
|
+
import { ChainId } from "@stacks/network";
|
|
6
|
+
import * as _stacks_common0 from "@stacks/common";
|
|
7
|
+
import { PrivateKey } from "@stacks/common";
|
|
8
|
+
import BigNumber from "bignumber.js";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { ChainId as ChainId$1, Money, NetworkModes, ReplaceTypes, TransactionErrorKey } from "@leather.io/models";
|
|
11
|
+
import { HDKey } from "@scure/bip32";
|
|
12
12
|
|
|
13
|
+
//#region src/message-signing.d.ts
|
|
13
14
|
interface SignatureData {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
signature: string;
|
|
16
|
+
publicKey: string;
|
|
16
17
|
}
|
|
17
18
|
declare function signMessage(message: string, privateKey: PrivateKey): SignatureData;
|
|
18
19
|
declare function signStructuredDataMessage(message: ClarityValue, domain: ClarityValue, privateKey: PrivateKey): SignatureData;
|
|
19
|
-
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/mocks/mocks.d.ts
|
|
20
22
|
declare const TEST_ACCOUNT_1_STX_ADDRESS = "SPS8CKF63P16J28AYF7PXW9E5AACH0NZNTEFWSFE";
|
|
21
23
|
declare const TEST_ACCOUNT_2_STX_ADDRESS = "SPXH3HNBPM5YP15VH16ZXZ9AX6CK289K3MCXRKCB";
|
|
22
24
|
declare const TEST_TESTNET_ACCOUNT_2_STX_ADDRESS = "STXH3HNBPM5YP15VH16ZXZ9AX6CK289K3NVR9T1P";
|
|
23
25
|
declare const TEST_ACCOUNT_1_STX_ADDRESS_SM = "SM3FBR6RDNZYC5K4TZWV9VZJ6NGA4VX3YBQ8X2PQ";
|
|
24
26
|
declare const TEST_TESTNET_ACCOUNT_2_STX_ADDRESS_SN = "SNXH3HNBPM5YP15VH16ZXZ9AX6CK289K3NVR9T1P";
|
|
25
|
-
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/signer/signer.d.ts
|
|
26
29
|
declare function signStacksTransaction(tx: StacksTransactionWire, privateKey: string): StacksTransactionWire;
|
|
27
30
|
type StacksSignerFn = (tx: StacksTransactionWire) => Promise<StacksTransactionWire>;
|
|
28
31
|
type StacksSignMessageFn = (message: string) => Promise<SignatureData>;
|
|
29
32
|
type StacksSignStructuredMessageFn = (message: ClarityValue, domain: ClarityValue) => Promise<SignatureData>;
|
|
30
33
|
interface StacksSigner extends Signer {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
descriptor: string;
|
|
35
|
+
keyOrigin: string;
|
|
36
|
+
address: string;
|
|
37
|
+
accountIndex: number;
|
|
38
|
+
network: NetworkModes;
|
|
39
|
+
sign: StacksSignerFn;
|
|
40
|
+
signMessage: StacksSignMessageFn;
|
|
41
|
+
signStructuredMessage: StacksSignStructuredMessageFn;
|
|
39
42
|
}
|
|
40
43
|
declare function createSignFnFromMnemonic(keyOrigin: string, getMnemonicFn: () => Promise<{
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
mnemonic: string;
|
|
45
|
+
passphrase?: string;
|
|
43
46
|
}>): (tx: StacksTransactionWire) => Promise<StacksTransactionWire>;
|
|
44
47
|
declare function createSignMessageFnFromMnemonic(keyOrigin: string, getMnemonicFn: () => Promise<{
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
mnemonic: string;
|
|
49
|
+
passphrase?: string;
|
|
47
50
|
}>): (message: string) => Promise<SignatureData>;
|
|
48
51
|
declare function createSignStructuredDataMessageFnFromMnemonic(keyOrigin: string, getMnemonicFn: () => Promise<{
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
mnemonic: string;
|
|
53
|
+
passphrase?: string;
|
|
51
54
|
}>): (message: ClarityValue, domain: ClarityValue) => Promise<SignatureData>;
|
|
52
55
|
interface InitalizeStacksSignerArgs {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
descriptor: string;
|
|
57
|
+
network: NetworkModes;
|
|
58
|
+
signFn: StacksSignerFn;
|
|
59
|
+
signMessageFn: StacksSignMessageFn;
|
|
60
|
+
signStructuredMessageFn: StacksSignStructuredMessageFn;
|
|
58
61
|
}
|
|
59
62
|
declare function initalizeStacksSigner(args: InitalizeStacksSignerArgs): StacksSigner;
|
|
60
|
-
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/stacks.utils.d.ts
|
|
61
65
|
declare const stxDerivationWithAccount = "m/44'/5757'/0'/0/{account}";
|
|
62
66
|
declare function makeAccountIndexDerivationPathFactory(derivationPath: string): (account: number) => string;
|
|
63
67
|
declare function extractStacksDerivationPathAccountIndex(path: string): number;
|
|
@@ -67,17 +71,23 @@ declare function extractStacksDerivationPathAccountIndex(path: string): number;
|
|
|
67
71
|
declare const makeStxDerivationPath: (account: number) => string;
|
|
68
72
|
declare function stacksChainIdToCoreNetworkMode(chainId: ChainId): NetworkModes;
|
|
69
73
|
interface WhenStacksChainIdMap<T> {
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
[ChainId.Mainnet]: T;
|
|
75
|
+
[ChainId.Testnet]: T;
|
|
72
76
|
}
|
|
73
77
|
declare function whenStacksChainId(chainId: ChainId): <T>(chainIdMap: WhenStacksChainIdMap<T>) => T;
|
|
74
|
-
declare function deriveStxPrivateKey({
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
declare function deriveStxPrivateKey({
|
|
79
|
+
keychain,
|
|
80
|
+
index
|
|
81
|
+
}: {
|
|
82
|
+
keychain: HDKey;
|
|
83
|
+
index: number;
|
|
77
84
|
}): string;
|
|
78
|
-
declare function deriveStxPublicKey({
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
declare function deriveStxPublicKey({
|
|
86
|
+
keychain,
|
|
87
|
+
index
|
|
88
|
+
}: {
|
|
89
|
+
keychain: HDKey;
|
|
90
|
+
index: number;
|
|
81
91
|
}): string;
|
|
82
92
|
declare function stacksRootKeychainToAccountDescriptor(keychain: HDKey, accountIndex: number): string;
|
|
83
93
|
declare function getStacksBurnAddress(chainIdChainId: ChainId): string;
|
|
@@ -85,16 +95,23 @@ declare function cleanHex(hexWithMaybePrefix: string): string;
|
|
|
85
95
|
declare function getPrincipalFromAssetString(assetString: string): string;
|
|
86
96
|
declare function formatContractId(address: string, name: string): string;
|
|
87
97
|
interface FormatAssetStringArgs {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
contractAddress: string;
|
|
99
|
+
contractName: string;
|
|
100
|
+
assetName: string;
|
|
91
101
|
}
|
|
92
|
-
declare function formatAssetString({
|
|
102
|
+
declare function formatAssetString({
|
|
103
|
+
contractAddress,
|
|
104
|
+
contractName,
|
|
105
|
+
assetName
|
|
106
|
+
}: FormatAssetStringArgs): AssetString;
|
|
93
107
|
interface FormatContractIdStringArgs {
|
|
94
|
-
|
|
95
|
-
|
|
108
|
+
contractAddress: string;
|
|
109
|
+
contractName: string;
|
|
96
110
|
}
|
|
97
|
-
declare function formatContractIdString({
|
|
111
|
+
declare function formatContractIdString({
|
|
112
|
+
contractAddress,
|
|
113
|
+
contractName
|
|
114
|
+
}: FormatContractIdStringArgs): ContractIdString;
|
|
98
115
|
/**
|
|
99
116
|
* Gets the contract name.
|
|
100
117
|
*
|
|
@@ -113,182 +130,241 @@ declare function getStacksContractAssetName(identifier: string): string;
|
|
|
113
130
|
* @param identifier - [principal].[contract-name]::[asset-name]
|
|
114
131
|
*/
|
|
115
132
|
declare function getStacksAssetStringParts(identifier: string): {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
contractAddress: string;
|
|
134
|
+
contractAssetName: string;
|
|
135
|
+
contractName: string;
|
|
119
136
|
};
|
|
120
|
-
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/transactions/create-tx-hex.d.ts
|
|
121
139
|
interface CreateTransferSip10TxHex {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
signer: StacksSigner;
|
|
141
|
+
assetId: string;
|
|
142
|
+
recipient: string;
|
|
143
|
+
amount: number;
|
|
144
|
+
nonce: number;
|
|
145
|
+
fee: Money;
|
|
146
|
+
memo?: string;
|
|
129
147
|
}
|
|
130
|
-
declare function createTransferSip10TxHex({
|
|
131
|
-
|
|
148
|
+
declare function createTransferSip10TxHex({
|
|
149
|
+
signer,
|
|
150
|
+
assetId,
|
|
151
|
+
recipient,
|
|
152
|
+
amount,
|
|
153
|
+
nonce,
|
|
154
|
+
fee,
|
|
155
|
+
memo
|
|
156
|
+
}: CreateTransferSip10TxHex): Promise<string>;
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/transactions/transaction.types.d.ts
|
|
132
159
|
declare enum TransactionTypes {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
160
|
+
ContractCall = "contract_call",
|
|
161
|
+
ContractDeploy = "smart_contract",
|
|
162
|
+
StxTokenTransfer = "token_transfer",
|
|
136
163
|
}
|
|
137
164
|
declare function isTransactionTypeSupported(txType: TransactionTypes): txType is TransactionTypes;
|
|
138
165
|
type StacksUnsignedContractCallOptions = ReplaceTypes<UnsignedContractCallOptions, {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
166
|
+
fee: Money;
|
|
167
|
+
functionArgs: string[];
|
|
168
|
+
nonce: number | string;
|
|
142
169
|
}> & {
|
|
143
|
-
|
|
170
|
+
txType: TransactionTypes.ContractCall;
|
|
144
171
|
};
|
|
145
172
|
type StacksUnsignedContractDeployOptions = ReplaceTypes<UnsignedContractDeployOptions, {
|
|
146
|
-
|
|
147
|
-
|
|
173
|
+
fee: Money;
|
|
174
|
+
nonce: number | string;
|
|
148
175
|
}> & {
|
|
149
|
-
|
|
176
|
+
txType: TransactionTypes.ContractDeploy;
|
|
150
177
|
};
|
|
151
178
|
type StacksUnsignedTokenTransferOptions = ReplaceTypes<UnsignedTokenTransferOptions, {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
179
|
+
amount: Money;
|
|
180
|
+
fee: Money;
|
|
181
|
+
nonce: number | string;
|
|
155
182
|
}> & {
|
|
156
|
-
|
|
183
|
+
txType: TransactionTypes.StxTokenTransfer;
|
|
157
184
|
};
|
|
158
185
|
type StacksUnsignedTransactionOptions = StacksUnsignedContractCallOptions | StacksUnsignedContractDeployOptions | StacksUnsignedTokenTransferOptions;
|
|
159
|
-
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/transactions/generate-unsigned-transaction.d.ts
|
|
160
188
|
declare function initNonce(nonce: number | string): BigNumber;
|
|
161
189
|
declare function getUnsignedContractCallParsedOptions(options: StacksUnsignedContractCallOptions): {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
190
|
+
fee: string;
|
|
191
|
+
functionArgs: _stacks_transactions0.ClarityValue[];
|
|
192
|
+
nonce: string;
|
|
193
|
+
postConditions: (string | _stacks_transactions0.PostCondition | _stacks_transactions0.PostConditionWire)[] | undefined;
|
|
194
|
+
publicKey: _stacks_common0.PrivateKey;
|
|
195
|
+
sponsored?: boolean | undefined;
|
|
196
|
+
network?: (_stacks_network0.StacksNetworkName | _stacks_network0.StacksNetwork) | undefined;
|
|
197
|
+
client?: _stacks_common0.ClientOpts | undefined;
|
|
198
|
+
contractAddress: string;
|
|
199
|
+
contractName: string;
|
|
200
|
+
functionName: string;
|
|
201
|
+
postConditionMode?: (_stacks_transactions0.PostConditionModeName | _stacks_transactions0.PostConditionMode) | undefined;
|
|
202
|
+
validateWithAbi?: (boolean | _stacks_transactions0.ClarityAbi) | undefined;
|
|
203
|
+
txType: TransactionTypes.ContractCall;
|
|
176
204
|
};
|
|
177
205
|
declare function getUnsignedContractDeployParsedOptions(options: StacksUnsignedContractDeployOptions): {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
206
|
+
fee: string;
|
|
207
|
+
nonce: string;
|
|
208
|
+
postConditions: _stacks_transactions0.PostConditionWire[] | undefined;
|
|
209
|
+
publicKey: _stacks_common0.PublicKey;
|
|
210
|
+
sponsored?: boolean | undefined;
|
|
211
|
+
network?: (_stacks_network0.StacksNetworkName | _stacks_network0.StacksNetwork) | undefined;
|
|
212
|
+
client?: _stacks_common0.ClientOpts | undefined;
|
|
213
|
+
contractName: string;
|
|
214
|
+
postConditionMode?: (_stacks_transactions0.PostConditionModeName | _stacks_transactions0.PostConditionMode) | undefined;
|
|
215
|
+
clarityVersion?: _stacks_transactions0.ClarityVersion | undefined;
|
|
216
|
+
codeBody: string;
|
|
217
|
+
txType: TransactionTypes.ContractDeploy;
|
|
190
218
|
};
|
|
191
219
|
declare function getUnsignedStxTokenTransferParsedOptions(options: StacksUnsignedTokenTransferOptions): {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
220
|
+
amount: string;
|
|
221
|
+
fee: string;
|
|
222
|
+
nonce: string;
|
|
223
|
+
publicKey: _stacks_common0.PublicKey;
|
|
224
|
+
recipient: string | _stacks_transactions0.PrincipalCV;
|
|
225
|
+
memo?: string | undefined;
|
|
226
|
+
sponsored?: boolean | undefined;
|
|
227
|
+
network?: (_stacks_network0.StacksNetworkName | _stacks_network0.StacksNetwork) | undefined;
|
|
228
|
+
client?: _stacks_common0.ClientOpts | undefined;
|
|
229
|
+
txType: TransactionTypes.StxTokenTransfer;
|
|
202
230
|
};
|
|
203
|
-
declare function generateStacksUnsignedTransaction(options: StacksUnsignedTransactionOptions): Promise<
|
|
204
|
-
|
|
231
|
+
declare function generateStacksUnsignedTransaction(options: StacksUnsignedTransactionOptions): Promise<_stacks_transactions0.StacksTransactionWire>;
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/transactions/get-contract-fn-args.d.ts
|
|
205
234
|
interface GetSip10FnArgs {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
235
|
+
amount: number;
|
|
236
|
+
senderStacksAddress: string;
|
|
237
|
+
recipientStacksAddress: string;
|
|
238
|
+
memo?: string;
|
|
210
239
|
}
|
|
211
|
-
declare function createSip10FnArgs({
|
|
240
|
+
declare function createSip10FnArgs({
|
|
241
|
+
amount,
|
|
242
|
+
senderStacksAddress,
|
|
243
|
+
recipientStacksAddress,
|
|
244
|
+
memo
|
|
245
|
+
}: GetSip10FnArgs): ClarityValue[];
|
|
212
246
|
interface GetSip9FnArgs {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
247
|
+
assetId: string;
|
|
248
|
+
senderStacksAddress: string;
|
|
249
|
+
recipientStacksAddress: string;
|
|
216
250
|
}
|
|
217
|
-
declare function createSip9FnArgs({
|
|
218
|
-
|
|
251
|
+
declare function createSip9FnArgs({
|
|
252
|
+
assetId,
|
|
253
|
+
senderStacksAddress,
|
|
254
|
+
recipientStacksAddress
|
|
255
|
+
}: GetSip9FnArgs): ClarityValue[];
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/transactions/get-error-message.d.ts
|
|
219
258
|
declare function getErrorMessage(reason: TxBroadcastResultRejected['reason'] | 'BadTransactionVersion' | 'ConflictingNonceInMempool' | 'EstimatorError' | 'TransferAmountMustBePositive' | 'TransferRecipientCannotEqualSender'): "Incorrect address" | "Incorrect function argument" | "Incorrect nonce" | "Incorrect transaction" | "Nonce conflict" | "Contract already exists" | "Deserialization failure" | "Estimator error" | "Fee too low" | "No coinbase via mempool" | "Contract does not exist" | "Function does not exist" | "Not enough funds" | "Microblock conflict" | "No anchor block with public key hash" | "Invalid microblock" | "Serialization failure" | "Database error" | "No such chain tip" | "Server failure" | "Failed to validate signature" | "Transfer amount must be positive" | "Cannot transfer STX to yourself" | "Something went wrong";
|
|
220
|
-
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/transactions/post-condition.utils.d.ts
|
|
221
261
|
declare function getPostConditionFromString(postCondition: string): PostConditionWire;
|
|
222
262
|
declare function ensurePostConditionWireFormat(postCondition: string | PostCondition | PostConditionWire): PostConditionWire;
|
|
223
263
|
declare function getPostCondition(postCondition: string | PostCondition | PostConditionWire): PostConditionWire;
|
|
224
264
|
declare function getPostConditions(postConditions?: (string | PostCondition | PostConditionWire)[]): PostConditionWire[] | undefined;
|
|
225
|
-
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/transactions/sip-10-contract-call.utils.d.ts
|
|
226
267
|
declare function isSip10TransferContactCall(tx: StacksTransactionWire): tx is StacksTransactionWire & {
|
|
227
|
-
|
|
268
|
+
payload: ContractCallPayload;
|
|
228
269
|
};
|
|
229
|
-
declare function isSip10Transfer({
|
|
230
|
-
|
|
231
|
-
|
|
270
|
+
declare function isSip10Transfer({
|
|
271
|
+
functionName,
|
|
272
|
+
contractInterfaceData
|
|
273
|
+
}: {
|
|
274
|
+
functionName: string;
|
|
275
|
+
contractInterfaceData: ClarityAbi;
|
|
232
276
|
}): boolean;
|
|
233
|
-
declare function getSip10TransferAmount({
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
277
|
+
declare function getSip10TransferAmount({
|
|
278
|
+
functionName,
|
|
279
|
+
functionArgs,
|
|
280
|
+
contractInterfaceData
|
|
281
|
+
}: {
|
|
282
|
+
functionName: string;
|
|
283
|
+
functionArgs: ClarityValue[];
|
|
284
|
+
contractInterfaceData: ClarityAbi;
|
|
237
285
|
}): number | null;
|
|
238
|
-
declare function getSip10TransferRecipient({
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
286
|
+
declare function getSip10TransferRecipient({
|
|
287
|
+
functionName,
|
|
288
|
+
functionArgs,
|
|
289
|
+
contractInterfaceData
|
|
290
|
+
}: {
|
|
291
|
+
functionName: string;
|
|
292
|
+
functionArgs: ClarityValue[];
|
|
293
|
+
contractInterfaceData: ClarityAbi;
|
|
242
294
|
}): string | null;
|
|
243
|
-
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/transactions/sip-9-contract-call.utils.d.ts
|
|
244
297
|
declare function isSip9TransferContactCall(tx: StacksTransactionWire): tx is StacksTransactionWire & {
|
|
245
|
-
|
|
298
|
+
payload: ContractCallPayload;
|
|
246
299
|
};
|
|
247
|
-
declare function isSip9Transfer({
|
|
248
|
-
|
|
249
|
-
|
|
300
|
+
declare function isSip9Transfer({
|
|
301
|
+
functionName,
|
|
302
|
+
contractInterfaceData
|
|
303
|
+
}: {
|
|
304
|
+
functionName: string;
|
|
305
|
+
contractInterfaceData: ClarityAbi;
|
|
250
306
|
}): boolean;
|
|
251
|
-
declare function getSip9TransferRecipient({
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
307
|
+
declare function getSip9TransferRecipient({
|
|
308
|
+
functionName,
|
|
309
|
+
functionArgs,
|
|
310
|
+
contractInterfaceData
|
|
311
|
+
}: {
|
|
312
|
+
functionName: string;
|
|
313
|
+
functionArgs: ClarityValue[];
|
|
314
|
+
contractInterfaceData: ClarityAbi;
|
|
255
315
|
}): string | null;
|
|
256
|
-
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/validation/address-validation.d.ts
|
|
257
318
|
declare function isValidStacksAddress(address: string): boolean;
|
|
258
319
|
declare function isValidAddressChain(address: string, chainId: ChainId$1): boolean;
|
|
259
320
|
declare function validatePayerNotRecipient(senderAddress: string, recipientAddress: string): boolean;
|
|
260
321
|
declare const standardPrincipalSchema: z.ZodString;
|
|
261
322
|
declare const contractPrincipalSchema: z.ZodString;
|
|
262
323
|
declare const principalSchema: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
263
|
-
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/validation/memo-validation.d.ts
|
|
264
326
|
declare function isValidStacksMemo(memo: string): boolean;
|
|
265
|
-
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/validation/stacks-error.d.ts
|
|
266
329
|
type StacksErrorKey = TransactionErrorKey | 'InvalidSameAddress' | 'UnknownBalance' | 'UnknownFee' | 'UnknownAmount';
|
|
267
330
|
declare class StacksError extends Error {
|
|
268
|
-
|
|
269
|
-
|
|
331
|
+
message: StacksErrorKey;
|
|
332
|
+
constructor(message: StacksErrorKey);
|
|
270
333
|
}
|
|
271
|
-
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/validation/transaction-validation.d.ts
|
|
272
336
|
interface StacksTransaction {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
337
|
+
amount: Money;
|
|
338
|
+
payer: string;
|
|
339
|
+
recipient: string;
|
|
340
|
+
chainId: ChainId$1;
|
|
341
|
+
availableBalance: Money;
|
|
342
|
+
fee: Money;
|
|
279
343
|
}
|
|
280
|
-
declare function isValidStacksTransaction({
|
|
281
|
-
|
|
344
|
+
declare function isValidStacksTransaction({
|
|
345
|
+
amount,
|
|
346
|
+
availableBalance,
|
|
347
|
+
fee,
|
|
348
|
+
payer,
|
|
349
|
+
recipient,
|
|
350
|
+
chainId
|
|
351
|
+
}: StacksTransaction): boolean;
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/schemas/clarity-contract.schema.d.ts
|
|
282
354
|
declare function isValidContractLength(contract: string): boolean;
|
|
283
355
|
declare const clarityContractSchema: z.ZodString;
|
|
284
|
-
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/schemas/memo.schema.d.ts
|
|
285
358
|
declare const stacksMemoSchema: z.ZodString;
|
|
286
|
-
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/transactions/serialization.d.ts
|
|
287
361
|
declare function getEstimatedUnsignedStacksTxByteLength(transaction: StacksTransactionWire): number;
|
|
288
362
|
declare function getSerializedUnsignedStacksTxPayload(transaction: StacksTransactionWire): string;
|
|
289
|
-
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/addresses.d.ts
|
|
290
365
|
declare function generateRandomStacksAddress(): string;
|
|
291
|
-
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/clarity.d.ts
|
|
292
368
|
declare function parseClarityUintResponse(response: ClarityValue): bigint;
|
|
293
369
|
declare function isClarityTuple(cv: ClarityValue): cv is TupleCV;
|
|
294
370
|
declare function isClarityResponseOk(cv: ClarityValue): cv is ResponseOkCV;
|
|
@@ -299,5 +375,6 @@ declare function isClarityPrincipal(cv: ClarityValue): cv is PrincipalCV;
|
|
|
299
375
|
declare function isClarityOptionalNone(cv: ClarityValue): cv is NoneCV;
|
|
300
376
|
declare function isClarityOptionalSome(cv: ClarityValue): cv is SomeCV;
|
|
301
377
|
declare function getClarityPrincipal(cv: PrincipalCV): string;
|
|
302
|
-
|
|
303
|
-
export {
|
|
378
|
+
//#endregion
|
|
379
|
+
export { SignatureData, StacksError, StacksErrorKey, StacksSignMessageFn, StacksSignStructuredMessageFn, StacksSigner, StacksSignerFn, StacksUnsignedContractCallOptions, StacksUnsignedContractDeployOptions, StacksUnsignedTokenTransferOptions, StacksUnsignedTransactionOptions, TEST_ACCOUNT_1_STX_ADDRESS, TEST_ACCOUNT_1_STX_ADDRESS_SM, TEST_ACCOUNT_2_STX_ADDRESS, TEST_TESTNET_ACCOUNT_2_STX_ADDRESS, TEST_TESTNET_ACCOUNT_2_STX_ADDRESS_SN, TransactionTypes, clarityContractSchema, cleanHex, contractPrincipalSchema, createSignFnFromMnemonic, createSignMessageFnFromMnemonic, createSignStructuredDataMessageFnFromMnemonic, createSip10FnArgs, createSip9FnArgs, createTransferSip10TxHex, deriveStxPrivateKey, deriveStxPublicKey, ensurePostConditionWireFormat, extractStacksDerivationPathAccountIndex, formatAssetString, formatContractId, formatContractIdString, generateRandomStacksAddress, generateStacksUnsignedTransaction, getClarityPrincipal, getErrorMessage, getEstimatedUnsignedStacksTxByteLength, getPostCondition, getPostConditionFromString, getPostConditions, getPrincipalFromAssetString, getSerializedUnsignedStacksTxPayload, getSip10TransferAmount, getSip10TransferRecipient, getSip9TransferRecipient, getStacksAssetStringParts, getStacksBurnAddress, getStacksContractAssetName, getStacksContractName, getUnsignedContractCallParsedOptions, getUnsignedContractDeployParsedOptions, getUnsignedStxTokenTransferParsedOptions, initNonce, initalizeStacksSigner, isClarityList, isClarityOptionalNone, isClarityOptionalSome, isClarityPrincipal, isClarityResponseError, isClarityResponseOk, isClarityTuple, isClarityUInt, isSip10Transfer, isSip10TransferContactCall, isSip9Transfer, isSip9TransferContactCall, isTransactionTypeSupported, isValidAddressChain, isValidContractLength, isValidStacksAddress, isValidStacksMemo, isValidStacksTransaction, makeAccountIndexDerivationPathFactory, makeStxDerivationPath, parseClarityUintResponse, principalSchema, signMessage, signStacksTransaction, signStructuredDataMessage, stacksChainIdToCoreNetworkMode, stacksMemoSchema, stacksRootKeychainToAccountDescriptor, standardPrincipalSchema, stxDerivationWithAccount, validatePayerNotRecipient, whenStacksChainId };
|
|
380
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/message-signing.ts","../src/mocks/mocks.ts","../src/signer/signer.ts","../src/stacks.utils.ts","../src/transactions/create-tx-hex.ts","../src/transactions/transaction.types.ts","../src/transactions/generate-unsigned-transaction.ts","../src/transactions/get-contract-fn-args.ts","../src/transactions/get-error-message.ts","../src/transactions/post-condition.utils.ts","../src/transactions/sip-10-contract-call.utils.ts","../src/transactions/sip-9-contract-call.utils.ts","../src/validation/address-validation.ts","../src/validation/memo-validation.ts","../src/validation/stacks-error.ts","../src/validation/transaction-validation.ts","../src/schemas/clarity-contract.schema.ts","../src/schemas/memo.schema.ts","../src/transactions/serialization.ts","../src/addresses.ts","../src/clarity.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;UAUiB,aAAA;;;;iBAID,WAAA,8BAAyC,aAAa;iBAQtD,yBAAA,UACL,sBACD,0BACI,aACX;;;cCzBU,0BAAA;cACA,0BAAA;cACA,kCAAA;cAGA,6BAAA;cACA,qCAAA;;;iBCaG,qBAAA,KAA0B,4CAAyC;KAMvE,cAAA,QAAsB,0BAA0B,QAAQ;KACxD,mBAAA,wBAA2C,QAAQ;KACnD,6BAAA,aACD,sBACD,iBACL,QAAQ;UAEI,YAAA,SAAqB;;;;;EFvBrB,OAAA,EE4BN,YF5BmB;EAId,IAAA,EEyBR,cFzBmB;EAQX,WAAA,EEkBD,mBFlB0B;EAC9B,qBAAA,EEkBc,6BFlBd;;AAEG,iBE+BE,wBAAA,CF/BF,SAAA,EAAA,MAAA,EAAA,aAAA,EAAA,GAAA,GEiCS,OFjCT,C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