@algorandfoundation/algokit-utils 1.0.0-beta.8 → 1.0.0-beta.9
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/account.d.ts +87 -0
- package/account.d.ts.map +1 -0
- package/account.js +144 -0
- package/account.js.map +1 -0
- package/algo-amount.d.ts +18 -0
- package/algo-amount.d.ts.map +1 -0
- package/algo-amount.js +31 -0
- package/algo-amount.js.map +1 -0
- package/algo-http-client-with-retry.d.ts +14 -0
- package/algo-http-client-with-retry.d.ts.map +1 -0
- package/algo-http-client-with-retry.js +62 -0
- package/algo-http-client-with-retry.js.map +1 -0
- package/app.d.ts +189 -0
- package/app.d.ts.map +1 -0
- package/app.js +265 -0
- package/app.js.map +1 -0
- package/application-client.d.ts +113 -0
- package/application-client.d.ts.map +1 -0
- package/application-client.js +258 -0
- package/application-client.js.map +1 -0
- package/config.d.ts +27 -0
- package/config.d.ts.map +1 -0
- package/config.js +46 -0
- package/config.js.map +1 -0
- package/deploy-app.d.ts +164 -0
- package/deploy-app.d.ts.map +1 -0
- package/deploy-app.js +419 -0
- package/deploy-app.js.map +1 -0
- package/index.d.ts +12 -0
- package/index.d.ts.map +1 -0
- package/index.js.map +1 -0
- package/indexer-lookup.d.ts +31 -0
- package/indexer-lookup.d.ts.map +1 -0
- package/indexer-lookup.js +96 -0
- package/indexer-lookup.js.map +1 -0
- package/localnet.d.ts +54 -0
- package/localnet.d.ts.map +1 -0
- package/localnet.js +121 -0
- package/localnet.js.map +1 -0
- package/network-client.d.ts +102 -0
- package/network-client.d.ts.map +1 -0
- package/network-client.js +182 -0
- package/network-client.js.map +1 -0
- package/package.json +2 -2
- package/transaction.d.ts +157 -0
- package/transaction.d.ts.map +1 -0
- package/transaction.js +306 -0
- package/transaction.js.map +1 -0
- package/transfer.d.ts +24 -0
- package/transfer.d.ts.map +1 -0
- package/transfer.js +33 -0
- package/transfer.js.map +1 -0
- package/types/algod.d.ts +124 -0
- package/types/algod.d.ts.map +1 -0
- package/types/algod.js +3 -0
- package/types/algod.js.map +1 -0
- package/types/appspec.d.ts +78 -0
- package/types/appspec.d.ts.map +1 -0
- package/types/appspec.js +15 -0
- package/types/appspec.js.map +1 -0
- package/types/indexer.d.ts +314 -0
- package/types/indexer.d.ts.map +1 -0
- package/types/indexer.js +25 -0
- package/types/indexer.js.map +1 -0
- package/urlTokenBaseHTTPClient.d.ts +41 -0
- package/urlTokenBaseHTTPClient.d.ts.map +1 -0
- package/urlTokenBaseHTTPClient.js +151 -0
- package/urlTokenBaseHTTPClient.js.map +1 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { TransactionType } from 'algosdk';
|
|
2
|
+
import { TealKeyValue } from 'algosdk/dist/types/client/v2/algod/models/types';
|
|
3
|
+
/** https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactions */
|
|
4
|
+
export interface TransactionSearchResults {
|
|
5
|
+
'current-round': string;
|
|
6
|
+
'next-token': string;
|
|
7
|
+
transactions: TransactionResult[];
|
|
8
|
+
}
|
|
9
|
+
/** https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-id */
|
|
10
|
+
export interface AccountLookupResult {
|
|
11
|
+
'current-round': string;
|
|
12
|
+
account: AccountResult;
|
|
13
|
+
}
|
|
14
|
+
/** https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idassets */
|
|
15
|
+
export interface AssetsLookupResult {
|
|
16
|
+
'current-round': string;
|
|
17
|
+
'next-token': string;
|
|
18
|
+
assets: AssetHolding[];
|
|
19
|
+
}
|
|
20
|
+
/** https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idcreated-assets */
|
|
21
|
+
export interface AssetsCreatedLookupResult {
|
|
22
|
+
'current-round': string;
|
|
23
|
+
'next-token': string;
|
|
24
|
+
assets: AssetResult[];
|
|
25
|
+
}
|
|
26
|
+
/** https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idcreated-applications */
|
|
27
|
+
export interface ApplicationCreatedLookupResult {
|
|
28
|
+
'current-round': string;
|
|
29
|
+
'next-token': string;
|
|
30
|
+
applications: ApplicationResult[];
|
|
31
|
+
}
|
|
32
|
+
/** https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-id */
|
|
33
|
+
export interface AssetLookupResult {
|
|
34
|
+
'current-round': string;
|
|
35
|
+
asset: AssetResult;
|
|
36
|
+
}
|
|
37
|
+
/** https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactionstxid */
|
|
38
|
+
export interface TransactionLookupResult {
|
|
39
|
+
'current-round': number;
|
|
40
|
+
transaction: TransactionResult;
|
|
41
|
+
}
|
|
42
|
+
/** https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applicationsapplication-id */
|
|
43
|
+
export interface ApplicationLookupResult {
|
|
44
|
+
'current-round': string;
|
|
45
|
+
application: ApplicationResult;
|
|
46
|
+
}
|
|
47
|
+
/** Indexer result for a transaction, @see https://developer.algorand.org/docs/rest-apis/indexer/#transaction */
|
|
48
|
+
export interface TransactionResult {
|
|
49
|
+
id: string;
|
|
50
|
+
fee: number;
|
|
51
|
+
sender: string;
|
|
52
|
+
'first-valid': number;
|
|
53
|
+
'last-valid': number;
|
|
54
|
+
'confirmed-round'?: number;
|
|
55
|
+
group?: string;
|
|
56
|
+
note?: string;
|
|
57
|
+
logs?: string[];
|
|
58
|
+
'round-time'?: number;
|
|
59
|
+
'intra-round-offset'?: number;
|
|
60
|
+
signature?: TransactionSignature;
|
|
61
|
+
'application-transaction'?: ApplicationTransactionResult;
|
|
62
|
+
'created-application-index'?: number;
|
|
63
|
+
'asset-config-transaction': AssetConfigTransactionResult;
|
|
64
|
+
'created-asset-index'?: number;
|
|
65
|
+
'asset-freeze-transaction'?: AssetFreezeTransactionResult;
|
|
66
|
+
'asset-transfer-transaction'?: AssetTransferTransactionResult;
|
|
67
|
+
'keyreg-transaction'?: any;
|
|
68
|
+
'payment-transaction'?: PaymentTransactionResult;
|
|
69
|
+
'auth-addr'?: string;
|
|
70
|
+
'closing-amount'?: number;
|
|
71
|
+
'genesis-hash'?: string;
|
|
72
|
+
'genesis-id'?: string;
|
|
73
|
+
'inner-txns'?: TransactionResult[];
|
|
74
|
+
'rekey-to'?: string;
|
|
75
|
+
lease?: string;
|
|
76
|
+
'local-state-delta'?: Record<string, EvalDelta>[];
|
|
77
|
+
'global-state-delta'?: Record<string, EvalDelta>[];
|
|
78
|
+
'receiver-rewards'?: number;
|
|
79
|
+
'sender-rewards'?: number;
|
|
80
|
+
'close-rewards'?: number;
|
|
81
|
+
'tx-type': TransactionType;
|
|
82
|
+
}
|
|
83
|
+
export interface AccountResult {
|
|
84
|
+
address: string;
|
|
85
|
+
amount: number;
|
|
86
|
+
'amount-without-pending-rewards': number;
|
|
87
|
+
'apps-local-state'?: AppLocalState[];
|
|
88
|
+
'apps-total-extra-pages'?: number;
|
|
89
|
+
'apps-total-schema'?: StateSchema;
|
|
90
|
+
'auth-addr'?: string;
|
|
91
|
+
'closed-at-round'?: number;
|
|
92
|
+
'created-at-round'?: number;
|
|
93
|
+
deleted?: boolean;
|
|
94
|
+
participation: any;
|
|
95
|
+
'pending-rewards': number;
|
|
96
|
+
'reward-base': number;
|
|
97
|
+
rewards: number;
|
|
98
|
+
round: number;
|
|
99
|
+
'sig-type': SignatureType;
|
|
100
|
+
status: AccountStatus;
|
|
101
|
+
}
|
|
102
|
+
export interface PaymentTransactionResult {
|
|
103
|
+
amount: number;
|
|
104
|
+
'close-amount'?: number;
|
|
105
|
+
'close-remainder-to'?: string;
|
|
106
|
+
receiver: string;
|
|
107
|
+
}
|
|
108
|
+
export interface ApplicationTransactionResult extends Exclude<{
|
|
109
|
+
creator: string;
|
|
110
|
+
'global-state': TealKeyValue[];
|
|
111
|
+
}, ApplicationParams> {
|
|
112
|
+
'application-id': number;
|
|
113
|
+
'on-completion': ApplicationOnComplete;
|
|
114
|
+
'application-args'?: string[];
|
|
115
|
+
accounts?: string[];
|
|
116
|
+
'foreign-apps'?: number[];
|
|
117
|
+
'foreign-assets'?: number[];
|
|
118
|
+
}
|
|
119
|
+
export interface AssetConfigTransactionResult {
|
|
120
|
+
'asset-id': number;
|
|
121
|
+
params: AssetParams;
|
|
122
|
+
}
|
|
123
|
+
export interface AssetFreezeTransactionResult {
|
|
124
|
+
address: string;
|
|
125
|
+
'asset-id': number;
|
|
126
|
+
'new-freeze-status': boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface AssetTransferTransactionResult {
|
|
129
|
+
amount: number;
|
|
130
|
+
'asset-id': number;
|
|
131
|
+
'close-amount'?: number;
|
|
132
|
+
'close-to'?: string;
|
|
133
|
+
receiver?: string;
|
|
134
|
+
sender?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface AssetResult {
|
|
137
|
+
index: number;
|
|
138
|
+
deleted?: boolean;
|
|
139
|
+
'created-at-round': number;
|
|
140
|
+
'deleted-at-round': number;
|
|
141
|
+
params: AssetParams;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The result of looking up an application
|
|
145
|
+
*/
|
|
146
|
+
export interface ApplicationResult {
|
|
147
|
+
id: number;
|
|
148
|
+
params: ApplicationParams;
|
|
149
|
+
'created-at-round'?: number;
|
|
150
|
+
deleted?: boolean;
|
|
151
|
+
'deleted-at-round'?: number;
|
|
152
|
+
}
|
|
153
|
+
interface TransactionSignature {
|
|
154
|
+
logicsig: LogicTransactionSignature;
|
|
155
|
+
multisig: MultisigTransactionSignature;
|
|
156
|
+
sig: string;
|
|
157
|
+
}
|
|
158
|
+
interface LogicTransactionSignature {
|
|
159
|
+
args: string[];
|
|
160
|
+
logic: string;
|
|
161
|
+
'multisig-signature': MultisigTransactionSignature;
|
|
162
|
+
signature: string;
|
|
163
|
+
}
|
|
164
|
+
interface MultisigTransactionSignature {
|
|
165
|
+
subsignature: MultisigTransactionSubSignature;
|
|
166
|
+
threshold: number;
|
|
167
|
+
version: number;
|
|
168
|
+
}
|
|
169
|
+
interface MultisigTransactionSubSignature {
|
|
170
|
+
'public-key': string;
|
|
171
|
+
signature: string;
|
|
172
|
+
}
|
|
173
|
+
export interface EvalDelta {
|
|
174
|
+
action: number;
|
|
175
|
+
bytes: string;
|
|
176
|
+
uint: number;
|
|
177
|
+
}
|
|
178
|
+
interface ApplicationParams {
|
|
179
|
+
creator: string;
|
|
180
|
+
'approval-program': string;
|
|
181
|
+
'clear-state-program': string;
|
|
182
|
+
'extra-program-pages'?: number;
|
|
183
|
+
'global-state': TealKeyValue[];
|
|
184
|
+
'global-state-schema'?: StateSchema;
|
|
185
|
+
'local-state-schema'?: StateSchema;
|
|
186
|
+
}
|
|
187
|
+
interface StateSchema {
|
|
188
|
+
'num-byte-slice': number;
|
|
189
|
+
'num-uint': number;
|
|
190
|
+
}
|
|
191
|
+
export declare enum ApplicationOnComplete {
|
|
192
|
+
noop = "noop",
|
|
193
|
+
optin = "optin",
|
|
194
|
+
closeout = "closeout",
|
|
195
|
+
clear = "clear",
|
|
196
|
+
update = "update",
|
|
197
|
+
delete = "delete"
|
|
198
|
+
}
|
|
199
|
+
interface AssetParams {
|
|
200
|
+
/**
|
|
201
|
+
* The address that created this asset. This is the address where the parameters
|
|
202
|
+
* for this asset can be found, and also the address where unwanted asset units can
|
|
203
|
+
* be sent in the worst case.
|
|
204
|
+
*/
|
|
205
|
+
creator: string;
|
|
206
|
+
/**
|
|
207
|
+
* (dc) The number of digits to use after the decimal point when displaying this
|
|
208
|
+
* asset. If 0, the asset is not divisible. If 1, the base unit of the asset is in
|
|
209
|
+
* tenths. If 2, the base unit of the asset is in hundredths, and so on. This value
|
|
210
|
+
* must be between 0 and 19 (inclusive).
|
|
211
|
+
*/
|
|
212
|
+
decimals: number | bigint;
|
|
213
|
+
/**
|
|
214
|
+
* (t) The total number of units of this asset.
|
|
215
|
+
*/
|
|
216
|
+
total: number | bigint;
|
|
217
|
+
/**
|
|
218
|
+
* (c) Address of account used to clawback holdings of this asset. If empty,
|
|
219
|
+
* clawback is not permitted.
|
|
220
|
+
*/
|
|
221
|
+
clawback?: string;
|
|
222
|
+
/**
|
|
223
|
+
* (df) Whether holdings of this asset are frozen by default.
|
|
224
|
+
*/
|
|
225
|
+
'default-frozen'?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* (f) Address of account used to freeze holdings of this asset. If empty, freezing
|
|
228
|
+
* is not permitted.
|
|
229
|
+
*/
|
|
230
|
+
freeze?: string;
|
|
231
|
+
/**
|
|
232
|
+
* (m) Address of account used to manage the keys of this asset and to destroy it.
|
|
233
|
+
*/
|
|
234
|
+
manager?: string;
|
|
235
|
+
/**
|
|
236
|
+
* (am) A commitment to some unspecified asset metadata. The format of this
|
|
237
|
+
* metadata is up to the application.
|
|
238
|
+
*/
|
|
239
|
+
'metadata-hash'?: Uint8Array;
|
|
240
|
+
/**
|
|
241
|
+
* (an) Name of this asset, as supplied by the creator. Included only when the
|
|
242
|
+
* asset name is composed of printable utf-8 characters.
|
|
243
|
+
*/
|
|
244
|
+
name?: string;
|
|
245
|
+
/**
|
|
246
|
+
* Base64 encoded name of this asset, as supplied by the creator.
|
|
247
|
+
*/
|
|
248
|
+
'name-b64'?: Uint8Array;
|
|
249
|
+
/**
|
|
250
|
+
* (r) Address of account holding reserve (non-minted) units of this asset.
|
|
251
|
+
*/
|
|
252
|
+
reserve?: string;
|
|
253
|
+
/**
|
|
254
|
+
* (un) Name of a unit of this asset, as supplied by the creator. Included only
|
|
255
|
+
* when the name of a unit of this asset is composed of printable utf-8 characters.
|
|
256
|
+
*/
|
|
257
|
+
'unit-name'?: string;
|
|
258
|
+
/**
|
|
259
|
+
* Base64 encoded name of a unit of this asset, as supplied by the creator.
|
|
260
|
+
*/
|
|
261
|
+
'unit-name-b64'?: Uint8Array;
|
|
262
|
+
/**
|
|
263
|
+
* (au) URL where more information about the asset can be retrieved. Included only
|
|
264
|
+
* when the URL is composed of printable utf-8 characters.
|
|
265
|
+
*/
|
|
266
|
+
url?: string;
|
|
267
|
+
/**
|
|
268
|
+
* Base64 encoded URL where more information about the asset can be retrieved.
|
|
269
|
+
*/
|
|
270
|
+
'url-b64'?: Uint8Array;
|
|
271
|
+
}
|
|
272
|
+
export declare enum SignatureType {
|
|
273
|
+
sig = "sig",
|
|
274
|
+
msig = "msig",
|
|
275
|
+
lsig = "lsig"
|
|
276
|
+
}
|
|
277
|
+
export declare enum AccountStatus {
|
|
278
|
+
Offline = "Offline",
|
|
279
|
+
Online = "Online",
|
|
280
|
+
NotParticipating = "NotParticipating"
|
|
281
|
+
}
|
|
282
|
+
interface AppLocalState {
|
|
283
|
+
'closed-out-at-round': number;
|
|
284
|
+
deleted: boolean;
|
|
285
|
+
id: number;
|
|
286
|
+
'key-value': TealKeyValue[];
|
|
287
|
+
'opted-in-at-round': number;
|
|
288
|
+
schema: StateSchema;
|
|
289
|
+
}
|
|
290
|
+
export interface AssetHolding {
|
|
291
|
+
/**
|
|
292
|
+
* (a) number of units held.
|
|
293
|
+
*/
|
|
294
|
+
amount: number;
|
|
295
|
+
/**
|
|
296
|
+
* Asset ID of the holding.
|
|
297
|
+
*/
|
|
298
|
+
'asset-id': number;
|
|
299
|
+
/**
|
|
300
|
+
* Address that created this asset. This is the address where the parameters for
|
|
301
|
+
* this asset can be found, and also the address where unwanted asset units can be
|
|
302
|
+
* sent in the worst case.
|
|
303
|
+
*/
|
|
304
|
+
creator: string;
|
|
305
|
+
/**
|
|
306
|
+
* (f) whether or not the holding is frozen.
|
|
307
|
+
*/
|
|
308
|
+
'is-frozen': boolean;
|
|
309
|
+
deleted?: boolean;
|
|
310
|
+
'opted-in-at-round': number;
|
|
311
|
+
'opted-out-at-round': number;
|
|
312
|
+
}
|
|
313
|
+
export {};
|
|
314
|
+
//# sourceMappingURL=indexer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/types/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAA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C5B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,gBAAgB,qBAAqB;CACtC;AAED,UAAU,aAAa;IACrB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,YAAY,EAAE,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,MAAM,EAAE,WAAW,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;CAC7B"}
|
package/types/indexer.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountStatus = exports.SignatureType = exports.ApplicationOnComplete = void 0;
|
|
4
|
+
var ApplicationOnComplete;
|
|
5
|
+
(function (ApplicationOnComplete) {
|
|
6
|
+
ApplicationOnComplete["noop"] = "noop";
|
|
7
|
+
ApplicationOnComplete["optin"] = "optin";
|
|
8
|
+
ApplicationOnComplete["closeout"] = "closeout";
|
|
9
|
+
ApplicationOnComplete["clear"] = "clear";
|
|
10
|
+
ApplicationOnComplete["update"] = "update";
|
|
11
|
+
ApplicationOnComplete["delete"] = "delete";
|
|
12
|
+
})(ApplicationOnComplete = exports.ApplicationOnComplete || (exports.ApplicationOnComplete = {}));
|
|
13
|
+
var SignatureType;
|
|
14
|
+
(function (SignatureType) {
|
|
15
|
+
SignatureType["sig"] = "sig";
|
|
16
|
+
SignatureType["msig"] = "msig";
|
|
17
|
+
SignatureType["lsig"] = "lsig";
|
|
18
|
+
})(SignatureType = exports.SignatureType || (exports.SignatureType = {}));
|
|
19
|
+
var AccountStatus;
|
|
20
|
+
(function (AccountStatus) {
|
|
21
|
+
AccountStatus["Offline"] = "Offline";
|
|
22
|
+
AccountStatus["Online"] = "Online";
|
|
23
|
+
AccountStatus["NotParticipating"] = "NotParticipating";
|
|
24
|
+
})(AccountStatus = exports.AccountStatus || (exports.AccountStatus = {}));
|
|
25
|
+
//# sourceMappingURL=indexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../../src/types/indexer.ts"],"names":[],"mappings":";;;AAoNA,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,wCAAe,CAAA;IACf,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,0CAAiB,CAAA;IACjB,0CAAiB,CAAA;AACnB,CAAC,EAPW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAOhC;AA4ED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,4BAAW,CAAA;IACX,8BAAa,CAAA;IACb,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,sDAAqC,CAAA;AACvC,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseHTTPClient, BaseHTTPClientResponse, Query } from 'algosdk/dist/types/client/baseHTTPClient';
|
|
2
|
+
export interface AlgodTokenHeader {
|
|
3
|
+
'X-Algo-API-Token': string;
|
|
4
|
+
}
|
|
5
|
+
export interface IndexerTokenHeader {
|
|
6
|
+
'X-Indexer-API-Token': string;
|
|
7
|
+
}
|
|
8
|
+
export interface KMDTokenHeader {
|
|
9
|
+
'X-KMD-API-Token': string;
|
|
10
|
+
}
|
|
11
|
+
export interface CustomTokenHeader {
|
|
12
|
+
[headerName: string]: string;
|
|
13
|
+
}
|
|
14
|
+
export type TokenHeader = AlgodTokenHeader | IndexerTokenHeader | KMDTokenHeader | CustomTokenHeader;
|
|
15
|
+
/**
|
|
16
|
+
* Implementation of BaseHTTPClient that uses a URL and a token
|
|
17
|
+
* and make the REST queries using fetch.
|
|
18
|
+
* This is the default implementation of BaseHTTPClient.
|
|
19
|
+
*/
|
|
20
|
+
export declare class URLTokenBaseHTTPClient implements BaseHTTPClient {
|
|
21
|
+
private defaultHeaders;
|
|
22
|
+
private readonly baseURL;
|
|
23
|
+
private readonly tokenHeader;
|
|
24
|
+
constructor(tokenHeader: TokenHeader, baseServer: string, port?: string | number, defaultHeaders?: Record<string, any>);
|
|
25
|
+
/**
|
|
26
|
+
* Compute the URL for a path relative to the instance's address
|
|
27
|
+
* @param relativePath - A path string
|
|
28
|
+
* @param query - An optional key-value object of query parameters to add to the URL. If the
|
|
29
|
+
* relativePath already has query parameters on it, the additional parameters defined here will
|
|
30
|
+
* be added to the URL without modifying those (unless a key collision occurs).
|
|
31
|
+
* @returns A URL string
|
|
32
|
+
*/
|
|
33
|
+
private getURL;
|
|
34
|
+
private static formatFetchResponseHeaders;
|
|
35
|
+
private static checkHttpError;
|
|
36
|
+
private static formatFetchResponse;
|
|
37
|
+
get(relativePath: string, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
38
|
+
post(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
39
|
+
delete(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=urlTokenBaseHTTPClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlTokenBaseHTTPClient.d.ts","sourceRoot":"","sources":["../src/urlTokenBaseHTTPClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAuB,sBAAsB,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAA;AAI7H,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,qBAAqB,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;CAC7B;AAUD,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,cAAc,GAAG,iBAAiB,CAAA;AAEpG;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,cAAc;IAKuB,OAAO,CAAC,cAAc;IAJxG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;gBAG7B,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAU,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAkBlI;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM;IAkBd,OAAO,CAAC,MAAM,CAAC,0BAA0B;mBAQpB,cAAc;mBA+Bd,mBAAmB;IASlC,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAgB9H,IAAI,CACR,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC1C,OAAO,CAAC,sBAAsB,CAAC;IAkB5B,MAAM,CACV,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC1C,OAAO,CAAC,sBAAsB,CAAC;CAiBnC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.URLTokenBaseHTTPClient = void 0;
|
|
4
|
+
const buffer_1 = require("buffer");
|
|
5
|
+
const cross_fetch_1 = require("cross-fetch");
|
|
6
|
+
class URLTokenBaseHTTPError extends Error {
|
|
7
|
+
constructor(message, response) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.response = response;
|
|
10
|
+
this.name = 'URLTokenBaseHTTPError';
|
|
11
|
+
this.response = response;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Implementation of BaseHTTPClient that uses a URL and a token
|
|
16
|
+
* and make the REST queries using fetch.
|
|
17
|
+
* This is the default implementation of BaseHTTPClient.
|
|
18
|
+
*/
|
|
19
|
+
class URLTokenBaseHTTPClient {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
constructor(tokenHeader, baseServer, port, defaultHeaders = {}) {
|
|
22
|
+
this.defaultHeaders = defaultHeaders;
|
|
23
|
+
// Append a trailing slash so we can use relative paths. Without the trailing
|
|
24
|
+
// slash, the last path segment will be replaced by the relative path. See
|
|
25
|
+
// usage in `addressWithPath`.
|
|
26
|
+
const fixedBaseServer = baseServer.endsWith('/') ? baseServer : `${baseServer}/`;
|
|
27
|
+
const baseServerURL = new URL(fixedBaseServer);
|
|
28
|
+
if (typeof port !== 'undefined') {
|
|
29
|
+
baseServerURL.port = port.toString();
|
|
30
|
+
}
|
|
31
|
+
if (baseServerURL.protocol.length === 0) {
|
|
32
|
+
throw new Error('Invalid base server URL, protocol must be defined.');
|
|
33
|
+
}
|
|
34
|
+
this.baseURL = baseServerURL;
|
|
35
|
+
this.tokenHeader = tokenHeader;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Compute the URL for a path relative to the instance's address
|
|
39
|
+
* @param relativePath - A path string
|
|
40
|
+
* @param query - An optional key-value object of query parameters to add to the URL. If the
|
|
41
|
+
* relativePath already has query parameters on it, the additional parameters defined here will
|
|
42
|
+
* be added to the URL without modifying those (unless a key collision occurs).
|
|
43
|
+
* @returns A URL string
|
|
44
|
+
*/
|
|
45
|
+
getURL(relativePath, query) {
|
|
46
|
+
let fixedRelativePath;
|
|
47
|
+
if (relativePath.startsWith('./')) {
|
|
48
|
+
fixedRelativePath = relativePath;
|
|
49
|
+
}
|
|
50
|
+
else if (relativePath.startsWith('/')) {
|
|
51
|
+
fixedRelativePath = `.${relativePath}`;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
fixedRelativePath = `./${relativePath}`;
|
|
55
|
+
}
|
|
56
|
+
const address = new URL(fixedRelativePath, this.baseURL);
|
|
57
|
+
if (query) {
|
|
58
|
+
for (const [key, value] of Object.entries(query)) {
|
|
59
|
+
address.searchParams.set(key, value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return address.toString();
|
|
63
|
+
}
|
|
64
|
+
static formatFetchResponseHeaders(headers) {
|
|
65
|
+
const headersObj = {};
|
|
66
|
+
headers.forEach((key, value) => {
|
|
67
|
+
headersObj[key] = value;
|
|
68
|
+
});
|
|
69
|
+
return headersObj;
|
|
70
|
+
}
|
|
71
|
+
static async checkHttpError(res) {
|
|
72
|
+
if (res.ok) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
let body = null;
|
|
76
|
+
let bodyErrorMessage = null;
|
|
77
|
+
try {
|
|
78
|
+
body = new Uint8Array(await res.arrayBuffer());
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
+
const decoded = JSON.parse(buffer_1.Buffer.from(body).toString());
|
|
81
|
+
if (decoded.message) {
|
|
82
|
+
bodyErrorMessage = decoded.message;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (_) {
|
|
86
|
+
// ignore any error that happened while we are parsing the error response
|
|
87
|
+
}
|
|
88
|
+
let message = `Network request error. Received status ${res.status} (${res.statusText})`;
|
|
89
|
+
if (bodyErrorMessage) {
|
|
90
|
+
message += `: ${bodyErrorMessage}`;
|
|
91
|
+
}
|
|
92
|
+
throw new URLTokenBaseHTTPError(message, {
|
|
93
|
+
body: body !== null ? body : new Uint8Array(),
|
|
94
|
+
status: res.status,
|
|
95
|
+
headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
static async formatFetchResponse(res) {
|
|
99
|
+
await this.checkHttpError(res);
|
|
100
|
+
return {
|
|
101
|
+
body: new Uint8Array(await res.arrayBuffer()),
|
|
102
|
+
status: res.status,
|
|
103
|
+
headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async get(relativePath, query, requestHeaders = {}) {
|
|
107
|
+
// Expand headers for use in fetch
|
|
108
|
+
const headers = {
|
|
109
|
+
...this.tokenHeader,
|
|
110
|
+
...this.defaultHeaders,
|
|
111
|
+
...requestHeaders,
|
|
112
|
+
};
|
|
113
|
+
const res = await (0, cross_fetch_1.fetch)(this.getURL(relativePath, query), {
|
|
114
|
+
mode: 'cors',
|
|
115
|
+
headers,
|
|
116
|
+
});
|
|
117
|
+
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
118
|
+
}
|
|
119
|
+
async post(relativePath, data, query, requestHeaders = {}) {
|
|
120
|
+
// Expand headers for use in fetch
|
|
121
|
+
const headers = {
|
|
122
|
+
...this.tokenHeader,
|
|
123
|
+
...this.defaultHeaders,
|
|
124
|
+
...requestHeaders,
|
|
125
|
+
};
|
|
126
|
+
const res = await (0, cross_fetch_1.fetch)(this.getURL(relativePath, query), {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
mode: 'cors',
|
|
129
|
+
body: data,
|
|
130
|
+
headers,
|
|
131
|
+
});
|
|
132
|
+
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
133
|
+
}
|
|
134
|
+
async delete(relativePath, data, query, requestHeaders = {}) {
|
|
135
|
+
// Expand headers for use in fetch
|
|
136
|
+
const headers = {
|
|
137
|
+
...this.tokenHeader,
|
|
138
|
+
...this.defaultHeaders,
|
|
139
|
+
...requestHeaders,
|
|
140
|
+
};
|
|
141
|
+
const res = await (0, cross_fetch_1.fetch)(this.getURL(relativePath, query), {
|
|
142
|
+
method: 'DELETE',
|
|
143
|
+
mode: 'cors',
|
|
144
|
+
body: data,
|
|
145
|
+
headers,
|
|
146
|
+
});
|
|
147
|
+
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.URLTokenBaseHTTPClient = URLTokenBaseHTTPClient;
|
|
151
|
+
//# sourceMappingURL=urlTokenBaseHTTPClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlTokenBaseHTTPClient.js","sourceRoot":"","sources":["../src/urlTokenBaseHTTPClient.ts"],"names":[],"mappings":";;;AAKA,mCAA+B;AAC/B,6CAAmC;AAkBnC,MAAM,qBAAsB,SAAQ,KAAK;IACvC,YAAY,OAAe,EAAS,QAAgC;QAClE,KAAK,CAAC,OAAO,CAAC,CAA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