@secretkeylabs/stacks-tools 0.6.0-d6a9ecd → 0.6.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/index.cjs +38 -0
- package/dist/index.d.cts +59 -44
- package/dist/index.d.ts +59 -44
- package/dist/index.js +38 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1108,8 +1108,46 @@ async function readOnly(args) {
|
|
|
1108
1108
|
return success(data);
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
|
+
// src/stacks-rpc-api/smart-contracts/interface.ts
|
|
1112
|
+
async function contractInterface(args) {
|
|
1113
|
+
const search = new URLSearchParams();
|
|
1114
|
+
if (args.proof === 0) search.append("proof", "0");
|
|
1115
|
+
if (args.tip) search.append("tip", args.tip);
|
|
1116
|
+
const init = {};
|
|
1117
|
+
if (args.apiKeyConfig) {
|
|
1118
|
+
init.headers = {
|
|
1119
|
+
[args.apiKeyConfig.header]: args.apiKeyConfig.key
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
const endpoint = `${args.baseUrl}/v2/contracts/interface/${args.contractAddress}/${args.contractName}`;
|
|
1123
|
+
const res = await fetch(endpoint, init);
|
|
1124
|
+
if (!res.ok) {
|
|
1125
|
+
return error({
|
|
1126
|
+
name: "FetcContractInterfaceError",
|
|
1127
|
+
message: "Failed to fetch contract interface.",
|
|
1128
|
+
data: {
|
|
1129
|
+
init,
|
|
1130
|
+
status: res.status,
|
|
1131
|
+
statusText: res.statusText,
|
|
1132
|
+
endpoint,
|
|
1133
|
+
bodyText: await safePromise(res.text())
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
const [jsonError, data] = await safePromise(res.json());
|
|
1138
|
+
if (jsonError) {
|
|
1139
|
+
return error({
|
|
1140
|
+
name: "ParseBodyError",
|
|
1141
|
+
message: "Failed to parse response body as JSON.",
|
|
1142
|
+
data: jsonError
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
return success(data);
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1111
1148
|
// src/stacks-rpc-api/smart-contracts/index.ts
|
|
1112
1149
|
var smartContracts = {
|
|
1150
|
+
contractInterface,
|
|
1113
1151
|
mapEntry,
|
|
1114
1152
|
readOnly
|
|
1115
1153
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MempoolTransaction, OperationResponse } from '@stacks/blockchain-api-client';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
-
import { OptionalCV, TupleCV, BufferCV, UIntCV, PrincipalCV, ListCV } from '@stacks/transactions';
|
|
3
|
+
import { ClarityAbi, OptionalCV, TupleCV, BufferCV, UIntCV, PrincipalCV, ListCV } from '@stacks/transactions';
|
|
4
4
|
|
|
5
5
|
type SafeError<TName extends string = string, TData = unknown> = {
|
|
6
6
|
readonly name: TName;
|
|
@@ -49,7 +49,7 @@ type ListResponse<T = unknown> = {
|
|
|
49
49
|
results: T[];
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
type Args$
|
|
52
|
+
type Args$k = {
|
|
53
53
|
/**
|
|
54
54
|
* Filter to only return transactions with this sender address.
|
|
55
55
|
*/
|
|
@@ -74,7 +74,7 @@ type Args$j = {
|
|
|
74
74
|
order?: "asc" | "desc";
|
|
75
75
|
} & ApiRequestOptions & ApiPaginationOptions;
|
|
76
76
|
type MempoolTransactionsResponse = ListResponse<MempoolTransaction>;
|
|
77
|
-
declare function mempoolTransactions(args: Args$
|
|
77
|
+
declare function mempoolTransactions(args: Args$k): Promise<Result$1<MempoolTransactionsResponse, SafeError<"FetchMempoolTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
78
78
|
|
|
79
79
|
type mempoolTransactions$1_MempoolTransactionsResponse = MempoolTransactionsResponse;
|
|
80
80
|
declare const mempoolTransactions$1_mempoolTransactions: typeof mempoolTransactions;
|
|
@@ -421,17 +421,17 @@ declare namespace schemas {
|
|
|
421
421
|
export { type schemas_ContractCallTransaction as ContractCallTransaction, type schemas_SmartContractTransaction as SmartContractTransaction, type schemas_Transaction as Transaction, schemas_baseTransactionSchema as baseTransactionSchema, schemas_contractCallTransactionSchema as contractCallTransactionSchema, schemas_smartContractTransactionSchema as smartContractTransactionSchema, schemas_tokenTransferSchema as tokenTransferSchema, schemas_transactionSchema as transactionSchema };
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
type Args$
|
|
424
|
+
type Args$j = {
|
|
425
425
|
transactionId: string;
|
|
426
426
|
} & ApiRequestOptions;
|
|
427
|
-
declare function getTransaction(args: Args$
|
|
427
|
+
declare function getTransaction(args: Args$j): Promise<Result$1<Transaction>>;
|
|
428
428
|
|
|
429
429
|
declare const getTransaction$1_getTransaction: typeof getTransaction;
|
|
430
430
|
declare namespace getTransaction$1 {
|
|
431
431
|
export { getTransaction$1_getTransaction as getTransaction };
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
type Args$
|
|
434
|
+
type Args$i = {
|
|
435
435
|
address: string;
|
|
436
436
|
} & ApiRequestOptions & ApiPaginationOptions;
|
|
437
437
|
declare const resultSchema: v.ObjectSchema<{
|
|
@@ -913,7 +913,7 @@ declare const addressTransactionsResponseSchema: v.ObjectSchema<{
|
|
|
913
913
|
readonly total: v.NumberSchema<undefined>;
|
|
914
914
|
}, undefined>;
|
|
915
915
|
type AddressTransactionsResponse = v.InferOutput<typeof addressTransactionsResponseSchema>;
|
|
916
|
-
declare function addressTransactions(args: Args$
|
|
916
|
+
declare function addressTransactions(args: Args$i): Promise<Result$1<AddressTransactionsResponse, SafeError<"FetchAddressTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
917
917
|
|
|
918
918
|
type addressTransactions$1_AddressTransactionsResponse = AddressTransactionsResponse;
|
|
919
919
|
type addressTransactions$1_Result = Result;
|
|
@@ -922,7 +922,7 @@ declare namespace addressTransactions$1 {
|
|
|
922
922
|
export { type addressTransactions$1_AddressTransactionsResponse as AddressTransactionsResponse, type addressTransactions$1_Result as Result, type Results$3 as Results, addressTransactions$1_addressTransactions as addressTransactions };
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
-
type Args$
|
|
925
|
+
type Args$h = {
|
|
926
926
|
poolPrincipal: string;
|
|
927
927
|
afterBlock?: number;
|
|
928
928
|
unanchored?: boolean;
|
|
@@ -952,7 +952,7 @@ declare const membersResponseSchema: v.ObjectSchema<{
|
|
|
952
952
|
}, undefined>, undefined>;
|
|
953
953
|
}, undefined>;
|
|
954
954
|
type MembersResponse = v.InferOutput<typeof membersResponseSchema>;
|
|
955
|
-
declare function members(args: Args$
|
|
955
|
+
declare function members(args: Args$h): Promise<Result$1<MembersResponse>>;
|
|
956
956
|
|
|
957
957
|
type members$1_Member = Member;
|
|
958
958
|
type members$1_MembersResponse = MembersResponse;
|
|
@@ -960,10 +960,10 @@ declare const members$1_memberSchema: typeof memberSchema;
|
|
|
960
960
|
declare const members$1_members: typeof members;
|
|
961
961
|
declare const members$1_membersResponseSchema: typeof membersResponseSchema;
|
|
962
962
|
declare namespace members$1 {
|
|
963
|
-
export { type Args$
|
|
963
|
+
export { type Args$h as Args, type members$1_Member as Member, type members$1_MembersResponse as MembersResponse, members$1_memberSchema as memberSchema, members$1_members as members, members$1_membersResponseSchema as membersResponseSchema };
|
|
964
964
|
}
|
|
965
965
|
|
|
966
|
-
type Args$
|
|
966
|
+
type Args$g = {
|
|
967
967
|
cycleNumber: number;
|
|
968
968
|
signerPublicKey: string;
|
|
969
969
|
} & ApiRequestOptions & ApiPaginationOptions;
|
|
@@ -993,7 +993,7 @@ declare const stackersForSignerInCycleResponseSchema: v.ObjectSchema<{
|
|
|
993
993
|
readonly total: v.NumberSchema<undefined>;
|
|
994
994
|
}, undefined>;
|
|
995
995
|
type StackersForSignerInCycleResponse = v.InferOutput<typeof stackersForSignerInCycleResponseSchema>;
|
|
996
|
-
declare function stackersForSignerInCycle(opts: Args$
|
|
996
|
+
declare function stackersForSignerInCycle(opts: Args$g): Promise<Result$1<StackersForSignerInCycleResponse, SafeError<"FetchStackersForSignerInCycleError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
997
997
|
|
|
998
998
|
type stackersForSignerInCycle$1_StackerInfo = StackerInfo;
|
|
999
999
|
type stackersForSignerInCycle$1_StackersForSignerInCycleResponse = StackersForSignerInCycleResponse;
|
|
@@ -1001,10 +1001,10 @@ declare const stackersForSignerInCycle$1_stackerInfoSchema: typeof stackerInfoSc
|
|
|
1001
1001
|
declare const stackersForSignerInCycle$1_stackersForSignerInCycle: typeof stackersForSignerInCycle;
|
|
1002
1002
|
declare const stackersForSignerInCycle$1_stackersForSignerInCycleResponseSchema: typeof stackersForSignerInCycleResponseSchema;
|
|
1003
1003
|
declare namespace stackersForSignerInCycle$1 {
|
|
1004
|
-
export { type Args$
|
|
1004
|
+
export { type Args$g as Args, type Results$2 as Results, type stackersForSignerInCycle$1_StackerInfo as StackerInfo, type stackersForSignerInCycle$1_StackersForSignerInCycleResponse as StackersForSignerInCycleResponse, resultsSchema$2 as resultsSchema, stackersForSignerInCycle$1_stackerInfoSchema as stackerInfoSchema, stackersForSignerInCycle$1_stackersForSignerInCycle as stackersForSignerInCycle, stackersForSignerInCycle$1_stackersForSignerInCycleResponseSchema as stackersForSignerInCycleResponseSchema };
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
|
-
type Args$
|
|
1007
|
+
type Args$f = {
|
|
1008
1008
|
cycleNumber: number;
|
|
1009
1009
|
} & ApiRequestOptions & ApiPaginationOptions;
|
|
1010
1010
|
declare const signerSchema: v.ObjectSchema<{
|
|
@@ -1045,7 +1045,7 @@ declare const signersResponseSchema: v.ObjectSchema<{
|
|
|
1045
1045
|
readonly total: v.NumberSchema<undefined>;
|
|
1046
1046
|
}, undefined>;
|
|
1047
1047
|
type SignersResponse = v.InferOutput<typeof signersResponseSchema>;
|
|
1048
|
-
declare function signersInCycle(args: Args$
|
|
1048
|
+
declare function signersInCycle(args: Args$f): Promise<Result$1<SignersResponse, SafeError<"FetchSignersError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1049
1049
|
|
|
1050
1050
|
type signersInCycle$1_Signer = Signer;
|
|
1051
1051
|
type signersInCycle$1_SignersResponse = SignersResponse;
|
|
@@ -1053,10 +1053,10 @@ declare const signersInCycle$1_signerSchema: typeof signerSchema;
|
|
|
1053
1053
|
declare const signersInCycle$1_signersInCycle: typeof signersInCycle;
|
|
1054
1054
|
declare const signersInCycle$1_signersResponseSchema: typeof signersResponseSchema;
|
|
1055
1055
|
declare namespace signersInCycle$1 {
|
|
1056
|
-
export { type Args$
|
|
1056
|
+
export { type Args$f as Args, type Results$1 as Results, type signersInCycle$1_Signer as Signer, type signersInCycle$1_SignersResponse as SignersResponse, resultsSchema$1 as resultsSchema, signersInCycle$1_signerSchema as signerSchema, signersInCycle$1_signersInCycle as signersInCycle, signersInCycle$1_signersResponseSchema as signersResponseSchema };
|
|
1057
1057
|
}
|
|
1058
1058
|
|
|
1059
|
-
type Args$
|
|
1059
|
+
type Args$e = {
|
|
1060
1060
|
/**
|
|
1061
1061
|
* The signers public key as a hex string, with or without a '0x' prefix.
|
|
1062
1062
|
*/
|
|
@@ -1074,16 +1074,16 @@ declare const signerInCycleResponseSchema: v.ObjectSchema<{
|
|
|
1074
1074
|
readonly pooled_stacker_count: v.NumberSchema<undefined>;
|
|
1075
1075
|
}, undefined>;
|
|
1076
1076
|
type SignerInCycleResponse = v.InferOutput<typeof signerInCycleResponseSchema>;
|
|
1077
|
-
declare function signerInCycle(args: Args$
|
|
1077
|
+
declare function signerInCycle(args: Args$e): Promise<Result$1<SignerInCycleResponse>>;
|
|
1078
1078
|
|
|
1079
1079
|
type signerInCycle$1_SignerInCycleResponse = SignerInCycleResponse;
|
|
1080
1080
|
declare const signerInCycle$1_signerInCycle: typeof signerInCycle;
|
|
1081
1081
|
declare const signerInCycle$1_signerInCycleResponseSchema: typeof signerInCycleResponseSchema;
|
|
1082
1082
|
declare namespace signerInCycle$1 {
|
|
1083
|
-
export { type Args$
|
|
1083
|
+
export { type Args$e as Args, type signerInCycle$1_SignerInCycleResponse as SignerInCycleResponse, signerInCycle$1_signerInCycle as signerInCycle, signerInCycle$1_signerInCycleResponseSchema as signerInCycleResponseSchema };
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
1086
|
-
type Args$
|
|
1086
|
+
type Args$d = ApiRequestOptions & ApiPaginationOptions;
|
|
1087
1087
|
declare const cycleInfoSchema: v.ObjectSchema<{
|
|
1088
1088
|
readonly block_height: v.NumberSchema<undefined>;
|
|
1089
1089
|
readonly index_block_hash: v.StringSchema<undefined>;
|
|
@@ -1116,7 +1116,7 @@ declare const cyclesResponseSchema: v.ObjectSchema<{
|
|
|
1116
1116
|
readonly total: v.NumberSchema<undefined>;
|
|
1117
1117
|
}, undefined>;
|
|
1118
1118
|
type CyclesResponse = v.InferOutput<typeof cyclesResponseSchema>;
|
|
1119
|
-
declare function cycles(args: Args$
|
|
1119
|
+
declare function cycles(args: Args$d): Promise<Result$1<CyclesResponse>>;
|
|
1120
1120
|
|
|
1121
1121
|
type cycles$1_CycleInfo = CycleInfo;
|
|
1122
1122
|
type cycles$1_CyclesResponse = CyclesResponse;
|
|
@@ -1126,10 +1126,10 @@ declare const cycles$1_cycles: typeof cycles;
|
|
|
1126
1126
|
declare const cycles$1_cyclesResponseSchema: typeof cyclesResponseSchema;
|
|
1127
1127
|
declare const cycles$1_resultsSchema: typeof resultsSchema;
|
|
1128
1128
|
declare namespace cycles$1 {
|
|
1129
|
-
export { type Args$
|
|
1129
|
+
export { type Args$d as Args, type cycles$1_CycleInfo as CycleInfo, type cycles$1_CyclesResponse as CyclesResponse, type cycles$1_Results as Results, cycles$1_cycleInfoSchema as cycleInfoSchema, cycles$1_cycles as cycles, cycles$1_cyclesResponseSchema as cyclesResponseSchema, cycles$1_resultsSchema as resultsSchema };
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
|
-
type Args$
|
|
1132
|
+
type Args$c = {
|
|
1133
1133
|
cycleNumber: number;
|
|
1134
1134
|
} & ApiRequestOptions;
|
|
1135
1135
|
declare const responseSchema$2: v.ObjectSchema<{
|
|
@@ -1141,11 +1141,11 @@ declare const responseSchema$2: v.ObjectSchema<{
|
|
|
1141
1141
|
readonly total_signers: v.NumberSchema<undefined>;
|
|
1142
1142
|
}, undefined>;
|
|
1143
1143
|
type Response$2 = v.InferOutput<typeof responseSchema$2>;
|
|
1144
|
-
declare function cycle(opts: Args$
|
|
1144
|
+
declare function cycle(opts: Args$c): Promise<Result$1<Response$2, SafeError<"FetchCycleError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1145
1145
|
|
|
1146
1146
|
declare const cycle$1_cycle: typeof cycle;
|
|
1147
1147
|
declare namespace cycle$1 {
|
|
1148
|
-
export { type Args$
|
|
1148
|
+
export { type Args$c as Args, type Response$2 as Response, cycle$1_cycle as cycle, responseSchema$2 as responseSchema };
|
|
1149
1149
|
}
|
|
1150
1150
|
|
|
1151
1151
|
type FeePrioritiesResponse = {
|
|
@@ -1207,18 +1207,18 @@ declare namespace coreApi$1 {
|
|
|
1207
1207
|
export { type coreApi$1_CoreApiResponse as CoreApiResponse, coreApi$1_coreApi as coreApi };
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
|
-
type Args$
|
|
1210
|
+
type Args$b = {
|
|
1211
1211
|
address: string;
|
|
1212
1212
|
stacking?: boolean;
|
|
1213
1213
|
} & ApiRequestOptions;
|
|
1214
|
-
declare function stx(opts: Args$
|
|
1214
|
+
declare function stx(opts: Args$b): Promise<Result$1<any>>;
|
|
1215
1215
|
|
|
1216
1216
|
declare const stx$1_stx: typeof stx;
|
|
1217
1217
|
declare namespace stx$1 {
|
|
1218
|
-
export { type Args$
|
|
1218
|
+
export { type Args$b as Args, stx$1_stx as stx };
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
|
-
type Args$
|
|
1221
|
+
type Args$a = {
|
|
1222
1222
|
heightOrHash: string | number;
|
|
1223
1223
|
} & ApiRequestOptions;
|
|
1224
1224
|
declare const responseSchema$1: v.ObjectSchema<{
|
|
@@ -1243,14 +1243,14 @@ declare const responseSchema$1: v.ObjectSchema<{
|
|
|
1243
1243
|
readonly execution_cost_write_length: v.NumberSchema<undefined>;
|
|
1244
1244
|
}, undefined>;
|
|
1245
1245
|
type Response$1 = v.InferOutput<typeof responseSchema$1>;
|
|
1246
|
-
declare function getBlock(opts: Args$
|
|
1246
|
+
declare function getBlock(opts: Args$a): Promise<Result$1<Response$1, SafeError<"FetchBlockError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1247
1247
|
|
|
1248
1248
|
declare const getBlock$1_getBlock: typeof getBlock;
|
|
1249
1249
|
declare namespace getBlock$1 {
|
|
1250
|
-
export { type Args$
|
|
1250
|
+
export { type Args$a as Args, type Response$1 as Response, getBlock$1_getBlock as getBlock, responseSchema$1 as responseSchema };
|
|
1251
1251
|
}
|
|
1252
1252
|
|
|
1253
|
-
type Args$
|
|
1253
|
+
type Args$9 = {
|
|
1254
1254
|
principal: string;
|
|
1255
1255
|
} & ApiRequestOptions;
|
|
1256
1256
|
declare const responseSchema: v.ObjectSchema<{
|
|
@@ -1261,25 +1261,25 @@ declare const responseSchema: v.ObjectSchema<{
|
|
|
1261
1261
|
readonly detected_mempool_nonces: v.ArraySchema<v.NumberSchema<undefined>, undefined>;
|
|
1262
1262
|
}, undefined>;
|
|
1263
1263
|
type Response = v.InferOutput<typeof responseSchema>;
|
|
1264
|
-
declare function latestNonce(opts: Args$
|
|
1264
|
+
declare function latestNonce(opts: Args$9): Promise<Result$1<Response, SafeError<"FetchLatestNonceError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1265
1265
|
|
|
1266
1266
|
type latestNonce$1_Response = Response;
|
|
1267
1267
|
declare const latestNonce$1_latestNonce: typeof latestNonce;
|
|
1268
1268
|
declare const latestNonce$1_responseSchema: typeof responseSchema;
|
|
1269
1269
|
declare namespace latestNonce$1 {
|
|
1270
|
-
export { type Args$
|
|
1270
|
+
export { type Args$9 as Args, type latestNonce$1_Response as Response, latestNonce$1_latestNonce as latestNonce, latestNonce$1_responseSchema as responseSchema };
|
|
1271
1271
|
}
|
|
1272
1272
|
|
|
1273
|
-
type Args$
|
|
1273
|
+
type Args$8 = {
|
|
1274
1274
|
principal: string;
|
|
1275
1275
|
unanchored?: boolean;
|
|
1276
1276
|
untilBlock?: number;
|
|
1277
1277
|
} & ApiRequestOptions;
|
|
1278
|
-
declare function balances(opts: Args$
|
|
1278
|
+
declare function balances(opts: Args$8): Promise<Result$1<OperationResponse["get_account_balance"], SafeError<"FetchBalancesError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1279
1279
|
|
|
1280
1280
|
declare const balances$1_balances: typeof balances;
|
|
1281
1281
|
declare namespace balances$1 {
|
|
1282
|
-
export { type Args$
|
|
1282
|
+
export { type Args$8 as Args, balances$1_balances as balances };
|
|
1283
1283
|
}
|
|
1284
1284
|
|
|
1285
1285
|
declare const accounts: {
|
|
@@ -1400,7 +1400,7 @@ declare namespace index$6 {
|
|
|
1400
1400
|
export { index$e as Accounts, index$d as Blocks, index$c as Faucets, index$b as Info, index$7 as Mempool, index$a as ProofOfTransfer, index$9 as StackingPool, index$8 as Transactions, index$6_stacksApi as stacksApi };
|
|
1401
1401
|
}
|
|
1402
1402
|
|
|
1403
|
-
type Args$
|
|
1403
|
+
type Args$7 = {
|
|
1404
1404
|
sender: string;
|
|
1405
1405
|
arguments: string[];
|
|
1406
1406
|
contractAddress: string;
|
|
@@ -1417,15 +1417,15 @@ interface ReadOnlyContractCallFailResponse {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
type ReadOnlyContractCallResponse = ReadOnlyContractCallSuccessResponse | ReadOnlyContractCallFailResponse;
|
|
1419
1419
|
type ReadOnlyResponse = ReadOnlyContractCallResponse;
|
|
1420
|
-
declare function readOnly$1(args: Args$
|
|
1420
|
+
declare function readOnly$1(args: Args$7): Promise<Result$1<ReadOnlyResponse>>;
|
|
1421
1421
|
|
|
1422
1422
|
type readOnly$2_ReadOnlyContractCallResponse = ReadOnlyContractCallResponse;
|
|
1423
1423
|
type readOnly$2_ReadOnlyResponse = ReadOnlyResponse;
|
|
1424
1424
|
declare namespace readOnly$2 {
|
|
1425
|
-
export { type Args$
|
|
1425
|
+
export { type Args$7 as Args, type readOnly$2_ReadOnlyContractCallResponse as ReadOnlyContractCallResponse, type readOnly$2_ReadOnlyResponse as ReadOnlyResponse, readOnly$1 as readOnly };
|
|
1426
1426
|
}
|
|
1427
1427
|
|
|
1428
|
-
type Args$
|
|
1428
|
+
type Args$6 = {
|
|
1429
1429
|
contractAddress: string;
|
|
1430
1430
|
contractName: string;
|
|
1431
1431
|
mapName: string;
|
|
@@ -1445,12 +1445,25 @@ declare const mapEntryResponseSchema: v.ObjectSchema<{
|
|
|
1445
1445
|
readonly proof: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
1446
1446
|
}, undefined>;
|
|
1447
1447
|
type MapEntryResponse = v.InferOutput<typeof mapEntryResponseSchema>;
|
|
1448
|
-
declare function mapEntry(args: Args$
|
|
1448
|
+
declare function mapEntry(args: Args$6): Promise<Result$1<MapEntryResponse>>;
|
|
1449
1449
|
|
|
1450
1450
|
type mapEntry$1_MapEntryResponse = MapEntryResponse;
|
|
1451
1451
|
declare const mapEntry$1_mapEntry: typeof mapEntry;
|
|
1452
1452
|
declare namespace mapEntry$1 {
|
|
1453
|
-
export { type Args$
|
|
1453
|
+
export { type Args$6 as Args, type mapEntry$1_MapEntryResponse as MapEntryResponse, mapEntry$1_mapEntry as mapEntry };
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
type Args$5 = {
|
|
1457
|
+
contractAddress: string;
|
|
1458
|
+
contractName: string;
|
|
1459
|
+
} & ApiRequestOptions & ProofAndTip;
|
|
1460
|
+
type InterfaceResponse = ClarityAbi;
|
|
1461
|
+
declare function contractInterface(args: Args$5): Promise<Result$1<InterfaceResponse>>;
|
|
1462
|
+
|
|
1463
|
+
type _interface_InterfaceResponse = InterfaceResponse;
|
|
1464
|
+
declare const _interface_contractInterface: typeof contractInterface;
|
|
1465
|
+
declare namespace _interface {
|
|
1466
|
+
export { type Args$5 as Args, type _interface_InterfaceResponse as InterfaceResponse, _interface_contractInterface as contractInterface };
|
|
1454
1467
|
}
|
|
1455
1468
|
|
|
1456
1469
|
type Args$4 = ApiRequestOptions;
|
|
@@ -1608,13 +1621,14 @@ declare namespace poxDetails$1 {
|
|
|
1608
1621
|
}
|
|
1609
1622
|
|
|
1610
1623
|
declare const smartContracts: {
|
|
1624
|
+
contractInterface: typeof contractInterface;
|
|
1611
1625
|
mapEntry: typeof mapEntry;
|
|
1612
1626
|
readOnly: typeof readOnly$1;
|
|
1613
1627
|
};
|
|
1614
1628
|
|
|
1615
1629
|
declare const index$5_smartContracts: typeof smartContracts;
|
|
1616
1630
|
declare namespace index$5 {
|
|
1617
|
-
export { mapEntry$1 as MapEntry, readOnly$2 as ReadOnly, index$5_smartContracts as smartContracts };
|
|
1631
|
+
export { _interface as ContractInterface, mapEntry$1 as MapEntry, readOnly$2 as ReadOnly, index$5_smartContracts as smartContracts };
|
|
1618
1632
|
}
|
|
1619
1633
|
|
|
1620
1634
|
declare const pox: {
|
|
@@ -1631,6 +1645,7 @@ declare const stacksRpcApi: {
|
|
|
1631
1645
|
poxDetails: typeof poxDetails;
|
|
1632
1646
|
};
|
|
1633
1647
|
smartContracts: {
|
|
1648
|
+
contractInterface: typeof contractInterface;
|
|
1634
1649
|
mapEntry: typeof mapEntry;
|
|
1635
1650
|
readOnly: typeof readOnly$1;
|
|
1636
1651
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MempoolTransaction, OperationResponse } from '@stacks/blockchain-api-client';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
-
import { OptionalCV, TupleCV, BufferCV, UIntCV, PrincipalCV, ListCV } from '@stacks/transactions';
|
|
3
|
+
import { ClarityAbi, OptionalCV, TupleCV, BufferCV, UIntCV, PrincipalCV, ListCV } from '@stacks/transactions';
|
|
4
4
|
|
|
5
5
|
type SafeError<TName extends string = string, TData = unknown> = {
|
|
6
6
|
readonly name: TName;
|
|
@@ -49,7 +49,7 @@ type ListResponse<T = unknown> = {
|
|
|
49
49
|
results: T[];
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
type Args$
|
|
52
|
+
type Args$k = {
|
|
53
53
|
/**
|
|
54
54
|
* Filter to only return transactions with this sender address.
|
|
55
55
|
*/
|
|
@@ -74,7 +74,7 @@ type Args$j = {
|
|
|
74
74
|
order?: "asc" | "desc";
|
|
75
75
|
} & ApiRequestOptions & ApiPaginationOptions;
|
|
76
76
|
type MempoolTransactionsResponse = ListResponse<MempoolTransaction>;
|
|
77
|
-
declare function mempoolTransactions(args: Args$
|
|
77
|
+
declare function mempoolTransactions(args: Args$k): Promise<Result$1<MempoolTransactionsResponse, SafeError<"FetchMempoolTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
78
78
|
|
|
79
79
|
type mempoolTransactions$1_MempoolTransactionsResponse = MempoolTransactionsResponse;
|
|
80
80
|
declare const mempoolTransactions$1_mempoolTransactions: typeof mempoolTransactions;
|
|
@@ -421,17 +421,17 @@ declare namespace schemas {
|
|
|
421
421
|
export { type schemas_ContractCallTransaction as ContractCallTransaction, type schemas_SmartContractTransaction as SmartContractTransaction, type schemas_Transaction as Transaction, schemas_baseTransactionSchema as baseTransactionSchema, schemas_contractCallTransactionSchema as contractCallTransactionSchema, schemas_smartContractTransactionSchema as smartContractTransactionSchema, schemas_tokenTransferSchema as tokenTransferSchema, schemas_transactionSchema as transactionSchema };
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
type Args$
|
|
424
|
+
type Args$j = {
|
|
425
425
|
transactionId: string;
|
|
426
426
|
} & ApiRequestOptions;
|
|
427
|
-
declare function getTransaction(args: Args$
|
|
427
|
+
declare function getTransaction(args: Args$j): Promise<Result$1<Transaction>>;
|
|
428
428
|
|
|
429
429
|
declare const getTransaction$1_getTransaction: typeof getTransaction;
|
|
430
430
|
declare namespace getTransaction$1 {
|
|
431
431
|
export { getTransaction$1_getTransaction as getTransaction };
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
type Args$
|
|
434
|
+
type Args$i = {
|
|
435
435
|
address: string;
|
|
436
436
|
} & ApiRequestOptions & ApiPaginationOptions;
|
|
437
437
|
declare const resultSchema: v.ObjectSchema<{
|
|
@@ -913,7 +913,7 @@ declare const addressTransactionsResponseSchema: v.ObjectSchema<{
|
|
|
913
913
|
readonly total: v.NumberSchema<undefined>;
|
|
914
914
|
}, undefined>;
|
|
915
915
|
type AddressTransactionsResponse = v.InferOutput<typeof addressTransactionsResponseSchema>;
|
|
916
|
-
declare function addressTransactions(args: Args$
|
|
916
|
+
declare function addressTransactions(args: Args$i): Promise<Result$1<AddressTransactionsResponse, SafeError<"FetchAddressTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
917
917
|
|
|
918
918
|
type addressTransactions$1_AddressTransactionsResponse = AddressTransactionsResponse;
|
|
919
919
|
type addressTransactions$1_Result = Result;
|
|
@@ -922,7 +922,7 @@ declare namespace addressTransactions$1 {
|
|
|
922
922
|
export { type addressTransactions$1_AddressTransactionsResponse as AddressTransactionsResponse, type addressTransactions$1_Result as Result, type Results$3 as Results, addressTransactions$1_addressTransactions as addressTransactions };
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
-
type Args$
|
|
925
|
+
type Args$h = {
|
|
926
926
|
poolPrincipal: string;
|
|
927
927
|
afterBlock?: number;
|
|
928
928
|
unanchored?: boolean;
|
|
@@ -952,7 +952,7 @@ declare const membersResponseSchema: v.ObjectSchema<{
|
|
|
952
952
|
}, undefined>, undefined>;
|
|
953
953
|
}, undefined>;
|
|
954
954
|
type MembersResponse = v.InferOutput<typeof membersResponseSchema>;
|
|
955
|
-
declare function members(args: Args$
|
|
955
|
+
declare function members(args: Args$h): Promise<Result$1<MembersResponse>>;
|
|
956
956
|
|
|
957
957
|
type members$1_Member = Member;
|
|
958
958
|
type members$1_MembersResponse = MembersResponse;
|
|
@@ -960,10 +960,10 @@ declare const members$1_memberSchema: typeof memberSchema;
|
|
|
960
960
|
declare const members$1_members: typeof members;
|
|
961
961
|
declare const members$1_membersResponseSchema: typeof membersResponseSchema;
|
|
962
962
|
declare namespace members$1 {
|
|
963
|
-
export { type Args$
|
|
963
|
+
export { type Args$h as Args, type members$1_Member as Member, type members$1_MembersResponse as MembersResponse, members$1_memberSchema as memberSchema, members$1_members as members, members$1_membersResponseSchema as membersResponseSchema };
|
|
964
964
|
}
|
|
965
965
|
|
|
966
|
-
type Args$
|
|
966
|
+
type Args$g = {
|
|
967
967
|
cycleNumber: number;
|
|
968
968
|
signerPublicKey: string;
|
|
969
969
|
} & ApiRequestOptions & ApiPaginationOptions;
|
|
@@ -993,7 +993,7 @@ declare const stackersForSignerInCycleResponseSchema: v.ObjectSchema<{
|
|
|
993
993
|
readonly total: v.NumberSchema<undefined>;
|
|
994
994
|
}, undefined>;
|
|
995
995
|
type StackersForSignerInCycleResponse = v.InferOutput<typeof stackersForSignerInCycleResponseSchema>;
|
|
996
|
-
declare function stackersForSignerInCycle(opts: Args$
|
|
996
|
+
declare function stackersForSignerInCycle(opts: Args$g): Promise<Result$1<StackersForSignerInCycleResponse, SafeError<"FetchStackersForSignerInCycleError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
997
997
|
|
|
998
998
|
type stackersForSignerInCycle$1_StackerInfo = StackerInfo;
|
|
999
999
|
type stackersForSignerInCycle$1_StackersForSignerInCycleResponse = StackersForSignerInCycleResponse;
|
|
@@ -1001,10 +1001,10 @@ declare const stackersForSignerInCycle$1_stackerInfoSchema: typeof stackerInfoSc
|
|
|
1001
1001
|
declare const stackersForSignerInCycle$1_stackersForSignerInCycle: typeof stackersForSignerInCycle;
|
|
1002
1002
|
declare const stackersForSignerInCycle$1_stackersForSignerInCycleResponseSchema: typeof stackersForSignerInCycleResponseSchema;
|
|
1003
1003
|
declare namespace stackersForSignerInCycle$1 {
|
|
1004
|
-
export { type Args$
|
|
1004
|
+
export { type Args$g as Args, type Results$2 as Results, type stackersForSignerInCycle$1_StackerInfo as StackerInfo, type stackersForSignerInCycle$1_StackersForSignerInCycleResponse as StackersForSignerInCycleResponse, resultsSchema$2 as resultsSchema, stackersForSignerInCycle$1_stackerInfoSchema as stackerInfoSchema, stackersForSignerInCycle$1_stackersForSignerInCycle as stackersForSignerInCycle, stackersForSignerInCycle$1_stackersForSignerInCycleResponseSchema as stackersForSignerInCycleResponseSchema };
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
|
-
type Args$
|
|
1007
|
+
type Args$f = {
|
|
1008
1008
|
cycleNumber: number;
|
|
1009
1009
|
} & ApiRequestOptions & ApiPaginationOptions;
|
|
1010
1010
|
declare const signerSchema: v.ObjectSchema<{
|
|
@@ -1045,7 +1045,7 @@ declare const signersResponseSchema: v.ObjectSchema<{
|
|
|
1045
1045
|
readonly total: v.NumberSchema<undefined>;
|
|
1046
1046
|
}, undefined>;
|
|
1047
1047
|
type SignersResponse = v.InferOutput<typeof signersResponseSchema>;
|
|
1048
|
-
declare function signersInCycle(args: Args$
|
|
1048
|
+
declare function signersInCycle(args: Args$f): Promise<Result$1<SignersResponse, SafeError<"FetchSignersError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1049
1049
|
|
|
1050
1050
|
type signersInCycle$1_Signer = Signer;
|
|
1051
1051
|
type signersInCycle$1_SignersResponse = SignersResponse;
|
|
@@ -1053,10 +1053,10 @@ declare const signersInCycle$1_signerSchema: typeof signerSchema;
|
|
|
1053
1053
|
declare const signersInCycle$1_signersInCycle: typeof signersInCycle;
|
|
1054
1054
|
declare const signersInCycle$1_signersResponseSchema: typeof signersResponseSchema;
|
|
1055
1055
|
declare namespace signersInCycle$1 {
|
|
1056
|
-
export { type Args$
|
|
1056
|
+
export { type Args$f as Args, type Results$1 as Results, type signersInCycle$1_Signer as Signer, type signersInCycle$1_SignersResponse as SignersResponse, resultsSchema$1 as resultsSchema, signersInCycle$1_signerSchema as signerSchema, signersInCycle$1_signersInCycle as signersInCycle, signersInCycle$1_signersResponseSchema as signersResponseSchema };
|
|
1057
1057
|
}
|
|
1058
1058
|
|
|
1059
|
-
type Args$
|
|
1059
|
+
type Args$e = {
|
|
1060
1060
|
/**
|
|
1061
1061
|
* The signers public key as a hex string, with or without a '0x' prefix.
|
|
1062
1062
|
*/
|
|
@@ -1074,16 +1074,16 @@ declare const signerInCycleResponseSchema: v.ObjectSchema<{
|
|
|
1074
1074
|
readonly pooled_stacker_count: v.NumberSchema<undefined>;
|
|
1075
1075
|
}, undefined>;
|
|
1076
1076
|
type SignerInCycleResponse = v.InferOutput<typeof signerInCycleResponseSchema>;
|
|
1077
|
-
declare function signerInCycle(args: Args$
|
|
1077
|
+
declare function signerInCycle(args: Args$e): Promise<Result$1<SignerInCycleResponse>>;
|
|
1078
1078
|
|
|
1079
1079
|
type signerInCycle$1_SignerInCycleResponse = SignerInCycleResponse;
|
|
1080
1080
|
declare const signerInCycle$1_signerInCycle: typeof signerInCycle;
|
|
1081
1081
|
declare const signerInCycle$1_signerInCycleResponseSchema: typeof signerInCycleResponseSchema;
|
|
1082
1082
|
declare namespace signerInCycle$1 {
|
|
1083
|
-
export { type Args$
|
|
1083
|
+
export { type Args$e as Args, type signerInCycle$1_SignerInCycleResponse as SignerInCycleResponse, signerInCycle$1_signerInCycle as signerInCycle, signerInCycle$1_signerInCycleResponseSchema as signerInCycleResponseSchema };
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
1086
|
-
type Args$
|
|
1086
|
+
type Args$d = ApiRequestOptions & ApiPaginationOptions;
|
|
1087
1087
|
declare const cycleInfoSchema: v.ObjectSchema<{
|
|
1088
1088
|
readonly block_height: v.NumberSchema<undefined>;
|
|
1089
1089
|
readonly index_block_hash: v.StringSchema<undefined>;
|
|
@@ -1116,7 +1116,7 @@ declare const cyclesResponseSchema: v.ObjectSchema<{
|
|
|
1116
1116
|
readonly total: v.NumberSchema<undefined>;
|
|
1117
1117
|
}, undefined>;
|
|
1118
1118
|
type CyclesResponse = v.InferOutput<typeof cyclesResponseSchema>;
|
|
1119
|
-
declare function cycles(args: Args$
|
|
1119
|
+
declare function cycles(args: Args$d): Promise<Result$1<CyclesResponse>>;
|
|
1120
1120
|
|
|
1121
1121
|
type cycles$1_CycleInfo = CycleInfo;
|
|
1122
1122
|
type cycles$1_CyclesResponse = CyclesResponse;
|
|
@@ -1126,10 +1126,10 @@ declare const cycles$1_cycles: typeof cycles;
|
|
|
1126
1126
|
declare const cycles$1_cyclesResponseSchema: typeof cyclesResponseSchema;
|
|
1127
1127
|
declare const cycles$1_resultsSchema: typeof resultsSchema;
|
|
1128
1128
|
declare namespace cycles$1 {
|
|
1129
|
-
export { type Args$
|
|
1129
|
+
export { type Args$d as Args, type cycles$1_CycleInfo as CycleInfo, type cycles$1_CyclesResponse as CyclesResponse, type cycles$1_Results as Results, cycles$1_cycleInfoSchema as cycleInfoSchema, cycles$1_cycles as cycles, cycles$1_cyclesResponseSchema as cyclesResponseSchema, cycles$1_resultsSchema as resultsSchema };
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
|
-
type Args$
|
|
1132
|
+
type Args$c = {
|
|
1133
1133
|
cycleNumber: number;
|
|
1134
1134
|
} & ApiRequestOptions;
|
|
1135
1135
|
declare const responseSchema$2: v.ObjectSchema<{
|
|
@@ -1141,11 +1141,11 @@ declare const responseSchema$2: v.ObjectSchema<{
|
|
|
1141
1141
|
readonly total_signers: v.NumberSchema<undefined>;
|
|
1142
1142
|
}, undefined>;
|
|
1143
1143
|
type Response$2 = v.InferOutput<typeof responseSchema$2>;
|
|
1144
|
-
declare function cycle(opts: Args$
|
|
1144
|
+
declare function cycle(opts: Args$c): Promise<Result$1<Response$2, SafeError<"FetchCycleError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1145
1145
|
|
|
1146
1146
|
declare const cycle$1_cycle: typeof cycle;
|
|
1147
1147
|
declare namespace cycle$1 {
|
|
1148
|
-
export { type Args$
|
|
1148
|
+
export { type Args$c as Args, type Response$2 as Response, cycle$1_cycle as cycle, responseSchema$2 as responseSchema };
|
|
1149
1149
|
}
|
|
1150
1150
|
|
|
1151
1151
|
type FeePrioritiesResponse = {
|
|
@@ -1207,18 +1207,18 @@ declare namespace coreApi$1 {
|
|
|
1207
1207
|
export { type coreApi$1_CoreApiResponse as CoreApiResponse, coreApi$1_coreApi as coreApi };
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
|
-
type Args$
|
|
1210
|
+
type Args$b = {
|
|
1211
1211
|
address: string;
|
|
1212
1212
|
stacking?: boolean;
|
|
1213
1213
|
} & ApiRequestOptions;
|
|
1214
|
-
declare function stx(opts: Args$
|
|
1214
|
+
declare function stx(opts: Args$b): Promise<Result$1<any>>;
|
|
1215
1215
|
|
|
1216
1216
|
declare const stx$1_stx: typeof stx;
|
|
1217
1217
|
declare namespace stx$1 {
|
|
1218
|
-
export { type Args$
|
|
1218
|
+
export { type Args$b as Args, stx$1_stx as stx };
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
|
-
type Args$
|
|
1221
|
+
type Args$a = {
|
|
1222
1222
|
heightOrHash: string | number;
|
|
1223
1223
|
} & ApiRequestOptions;
|
|
1224
1224
|
declare const responseSchema$1: v.ObjectSchema<{
|
|
@@ -1243,14 +1243,14 @@ declare const responseSchema$1: v.ObjectSchema<{
|
|
|
1243
1243
|
readonly execution_cost_write_length: v.NumberSchema<undefined>;
|
|
1244
1244
|
}, undefined>;
|
|
1245
1245
|
type Response$1 = v.InferOutput<typeof responseSchema$1>;
|
|
1246
|
-
declare function getBlock(opts: Args$
|
|
1246
|
+
declare function getBlock(opts: Args$a): Promise<Result$1<Response$1, SafeError<"FetchBlockError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1247
1247
|
|
|
1248
1248
|
declare const getBlock$1_getBlock: typeof getBlock;
|
|
1249
1249
|
declare namespace getBlock$1 {
|
|
1250
|
-
export { type Args$
|
|
1250
|
+
export { type Args$a as Args, type Response$1 as Response, getBlock$1_getBlock as getBlock, responseSchema$1 as responseSchema };
|
|
1251
1251
|
}
|
|
1252
1252
|
|
|
1253
|
-
type Args$
|
|
1253
|
+
type Args$9 = {
|
|
1254
1254
|
principal: string;
|
|
1255
1255
|
} & ApiRequestOptions;
|
|
1256
1256
|
declare const responseSchema: v.ObjectSchema<{
|
|
@@ -1261,25 +1261,25 @@ declare const responseSchema: v.ObjectSchema<{
|
|
|
1261
1261
|
readonly detected_mempool_nonces: v.ArraySchema<v.NumberSchema<undefined>, undefined>;
|
|
1262
1262
|
}, undefined>;
|
|
1263
1263
|
type Response = v.InferOutput<typeof responseSchema>;
|
|
1264
|
-
declare function latestNonce(opts: Args$
|
|
1264
|
+
declare function latestNonce(opts: Args$9): Promise<Result$1<Response, SafeError<"FetchLatestNonceError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1265
1265
|
|
|
1266
1266
|
type latestNonce$1_Response = Response;
|
|
1267
1267
|
declare const latestNonce$1_latestNonce: typeof latestNonce;
|
|
1268
1268
|
declare const latestNonce$1_responseSchema: typeof responseSchema;
|
|
1269
1269
|
declare namespace latestNonce$1 {
|
|
1270
|
-
export { type Args$
|
|
1270
|
+
export { type Args$9 as Args, type latestNonce$1_Response as Response, latestNonce$1_latestNonce as latestNonce, latestNonce$1_responseSchema as responseSchema };
|
|
1271
1271
|
}
|
|
1272
1272
|
|
|
1273
|
-
type Args$
|
|
1273
|
+
type Args$8 = {
|
|
1274
1274
|
principal: string;
|
|
1275
1275
|
unanchored?: boolean;
|
|
1276
1276
|
untilBlock?: number;
|
|
1277
1277
|
} & ApiRequestOptions;
|
|
1278
|
-
declare function balances(opts: Args$
|
|
1278
|
+
declare function balances(opts: Args$8): Promise<Result$1<OperationResponse["get_account_balance"], SafeError<"FetchBalancesError" | "ParseBodyError" | "ValidateDataError">>>;
|
|
1279
1279
|
|
|
1280
1280
|
declare const balances$1_balances: typeof balances;
|
|
1281
1281
|
declare namespace balances$1 {
|
|
1282
|
-
export { type Args$
|
|
1282
|
+
export { type Args$8 as Args, balances$1_balances as balances };
|
|
1283
1283
|
}
|
|
1284
1284
|
|
|
1285
1285
|
declare const accounts: {
|
|
@@ -1400,7 +1400,7 @@ declare namespace index$6 {
|
|
|
1400
1400
|
export { index$e as Accounts, index$d as Blocks, index$c as Faucets, index$b as Info, index$7 as Mempool, index$a as ProofOfTransfer, index$9 as StackingPool, index$8 as Transactions, index$6_stacksApi as stacksApi };
|
|
1401
1401
|
}
|
|
1402
1402
|
|
|
1403
|
-
type Args$
|
|
1403
|
+
type Args$7 = {
|
|
1404
1404
|
sender: string;
|
|
1405
1405
|
arguments: string[];
|
|
1406
1406
|
contractAddress: string;
|
|
@@ -1417,15 +1417,15 @@ interface ReadOnlyContractCallFailResponse {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
type ReadOnlyContractCallResponse = ReadOnlyContractCallSuccessResponse | ReadOnlyContractCallFailResponse;
|
|
1419
1419
|
type ReadOnlyResponse = ReadOnlyContractCallResponse;
|
|
1420
|
-
declare function readOnly$1(args: Args$
|
|
1420
|
+
declare function readOnly$1(args: Args$7): Promise<Result$1<ReadOnlyResponse>>;
|
|
1421
1421
|
|
|
1422
1422
|
type readOnly$2_ReadOnlyContractCallResponse = ReadOnlyContractCallResponse;
|
|
1423
1423
|
type readOnly$2_ReadOnlyResponse = ReadOnlyResponse;
|
|
1424
1424
|
declare namespace readOnly$2 {
|
|
1425
|
-
export { type Args$
|
|
1425
|
+
export { type Args$7 as Args, type readOnly$2_ReadOnlyContractCallResponse as ReadOnlyContractCallResponse, type readOnly$2_ReadOnlyResponse as ReadOnlyResponse, readOnly$1 as readOnly };
|
|
1426
1426
|
}
|
|
1427
1427
|
|
|
1428
|
-
type Args$
|
|
1428
|
+
type Args$6 = {
|
|
1429
1429
|
contractAddress: string;
|
|
1430
1430
|
contractName: string;
|
|
1431
1431
|
mapName: string;
|
|
@@ -1445,12 +1445,25 @@ declare const mapEntryResponseSchema: v.ObjectSchema<{
|
|
|
1445
1445
|
readonly proof: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
1446
1446
|
}, undefined>;
|
|
1447
1447
|
type MapEntryResponse = v.InferOutput<typeof mapEntryResponseSchema>;
|
|
1448
|
-
declare function mapEntry(args: Args$
|
|
1448
|
+
declare function mapEntry(args: Args$6): Promise<Result$1<MapEntryResponse>>;
|
|
1449
1449
|
|
|
1450
1450
|
type mapEntry$1_MapEntryResponse = MapEntryResponse;
|
|
1451
1451
|
declare const mapEntry$1_mapEntry: typeof mapEntry;
|
|
1452
1452
|
declare namespace mapEntry$1 {
|
|
1453
|
-
export { type Args$
|
|
1453
|
+
export { type Args$6 as Args, type mapEntry$1_MapEntryResponse as MapEntryResponse, mapEntry$1_mapEntry as mapEntry };
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
type Args$5 = {
|
|
1457
|
+
contractAddress: string;
|
|
1458
|
+
contractName: string;
|
|
1459
|
+
} & ApiRequestOptions & ProofAndTip;
|
|
1460
|
+
type InterfaceResponse = ClarityAbi;
|
|
1461
|
+
declare function contractInterface(args: Args$5): Promise<Result$1<InterfaceResponse>>;
|
|
1462
|
+
|
|
1463
|
+
type _interface_InterfaceResponse = InterfaceResponse;
|
|
1464
|
+
declare const _interface_contractInterface: typeof contractInterface;
|
|
1465
|
+
declare namespace _interface {
|
|
1466
|
+
export { type Args$5 as Args, type _interface_InterfaceResponse as InterfaceResponse, _interface_contractInterface as contractInterface };
|
|
1454
1467
|
}
|
|
1455
1468
|
|
|
1456
1469
|
type Args$4 = ApiRequestOptions;
|
|
@@ -1608,13 +1621,14 @@ declare namespace poxDetails$1 {
|
|
|
1608
1621
|
}
|
|
1609
1622
|
|
|
1610
1623
|
declare const smartContracts: {
|
|
1624
|
+
contractInterface: typeof contractInterface;
|
|
1611
1625
|
mapEntry: typeof mapEntry;
|
|
1612
1626
|
readOnly: typeof readOnly$1;
|
|
1613
1627
|
};
|
|
1614
1628
|
|
|
1615
1629
|
declare const index$5_smartContracts: typeof smartContracts;
|
|
1616
1630
|
declare namespace index$5 {
|
|
1617
|
-
export { mapEntry$1 as MapEntry, readOnly$2 as ReadOnly, index$5_smartContracts as smartContracts };
|
|
1631
|
+
export { _interface as ContractInterface, mapEntry$1 as MapEntry, readOnly$2 as ReadOnly, index$5_smartContracts as smartContracts };
|
|
1618
1632
|
}
|
|
1619
1633
|
|
|
1620
1634
|
declare const pox: {
|
|
@@ -1631,6 +1645,7 @@ declare const stacksRpcApi: {
|
|
|
1631
1645
|
poxDetails: typeof poxDetails;
|
|
1632
1646
|
};
|
|
1633
1647
|
smartContracts: {
|
|
1648
|
+
contractInterface: typeof contractInterface;
|
|
1634
1649
|
mapEntry: typeof mapEntry;
|
|
1635
1650
|
readOnly: typeof readOnly$1;
|
|
1636
1651
|
};
|
package/dist/index.js
CHANGED
|
@@ -1063,8 +1063,46 @@ async function readOnly(args) {
|
|
|
1063
1063
|
return success(data);
|
|
1064
1064
|
}
|
|
1065
1065
|
|
|
1066
|
+
// src/stacks-rpc-api/smart-contracts/interface.ts
|
|
1067
|
+
async function contractInterface(args) {
|
|
1068
|
+
const search = new URLSearchParams();
|
|
1069
|
+
if (args.proof === 0) search.append("proof", "0");
|
|
1070
|
+
if (args.tip) search.append("tip", args.tip);
|
|
1071
|
+
const init = {};
|
|
1072
|
+
if (args.apiKeyConfig) {
|
|
1073
|
+
init.headers = {
|
|
1074
|
+
[args.apiKeyConfig.header]: args.apiKeyConfig.key
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
const endpoint = `${args.baseUrl}/v2/contracts/interface/${args.contractAddress}/${args.contractName}`;
|
|
1078
|
+
const res = await fetch(endpoint, init);
|
|
1079
|
+
if (!res.ok) {
|
|
1080
|
+
return error({
|
|
1081
|
+
name: "FetcContractInterfaceError",
|
|
1082
|
+
message: "Failed to fetch contract interface.",
|
|
1083
|
+
data: {
|
|
1084
|
+
init,
|
|
1085
|
+
status: res.status,
|
|
1086
|
+
statusText: res.statusText,
|
|
1087
|
+
endpoint,
|
|
1088
|
+
bodyText: await safePromise(res.text())
|
|
1089
|
+
}
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
const [jsonError, data] = await safePromise(res.json());
|
|
1093
|
+
if (jsonError) {
|
|
1094
|
+
return error({
|
|
1095
|
+
name: "ParseBodyError",
|
|
1096
|
+
message: "Failed to parse response body as JSON.",
|
|
1097
|
+
data: jsonError
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
return success(data);
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1066
1103
|
// src/stacks-rpc-api/smart-contracts/index.ts
|
|
1067
1104
|
var smartContracts = {
|
|
1105
|
+
contractInterface,
|
|
1068
1106
|
mapEntry,
|
|
1069
1107
|
readOnly
|
|
1070
1108
|
};
|