algosdk 3.5.2 → 3.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/appAccess.js +8 -5
- package/dist/cjs/appAccess.js.map +1 -1
- package/dist/cjs/client/v2/algod/accountApplicationsInformation.js +38 -0
- package/dist/cjs/client/v2/algod/accountApplicationsInformation.js.map +1 -0
- package/dist/cjs/client/v2/algod/accountAssetsInformation.js +31 -0
- package/dist/cjs/client/v2/algod/accountAssetsInformation.js.map +1 -0
- package/dist/cjs/client/v2/algod/algod.js +23 -19
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js +116 -5
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +243 -452
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/ed25519-signer.js +76 -0
- package/dist/cjs/ed25519-signer.js.map +1 -0
- package/dist/cjs/encoding/address.js +61 -1
- package/dist/cjs/encoding/address.js.map +1 -1
- package/dist/cjs/falcon-signer.js +17 -0
- package/dist/cjs/falcon-signer.js.map +1 -0
- package/dist/cjs/logicsig.js +201 -16
- package/dist/cjs/logicsig.js.map +1 -1
- package/dist/cjs/main.js +32 -63
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/mnemonic/mnemonic.js +26 -1
- package/dist/cjs/mnemonic/mnemonic.js.map +1 -1
- package/dist/cjs/multisigSigning.js +78 -1
- package/dist/cjs/multisigSigning.js.map +1 -1
- package/dist/cjs/pq-signer.js +54 -0
- package/dist/cjs/pq-signer.js.map +1 -0
- package/dist/cjs/signedTransaction.js +15 -1
- package/dist/cjs/signedTransaction.js.map +1 -1
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/signing.js +94 -7
- package/dist/cjs/signing.js.map +1 -1
- package/dist/cjs/transaction.js +9 -1
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/cjs/types/transactions/encoded.js +51 -1
- package/dist/cjs/types/transactions/encoded.js.map +1 -1
- package/dist/cjs/utils/ed25519-check.js +69 -0
- package/dist/cjs/utils/ed25519-check.js.map +1 -0
- package/dist/esm/appAccess.js +8 -5
- package/dist/esm/appAccess.js.map +1 -1
- package/dist/esm/client/v2/algod/accountApplicationsInformation.js +32 -0
- package/dist/esm/client/v2/algod/accountApplicationsInformation.js.map +1 -0
- package/dist/esm/client/v2/algod/accountAssetsInformation.js +25 -0
- package/dist/esm/client/v2/algod/accountAssetsInformation.js.map +1 -0
- package/dist/esm/client/v2/algod/algod.js +23 -19
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +116 -5
- package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +239 -445
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/ed25519-signer.js +72 -0
- package/dist/esm/ed25519-signer.js.map +1 -0
- package/dist/esm/encoding/address.js +58 -0
- package/dist/esm/encoding/address.js.map +1 -1
- package/dist/esm/falcon-signer.js +13 -0
- package/dist/esm/falcon-signer.js.map +1 -0
- package/dist/esm/logicsig.js +200 -15
- package/dist/esm/logicsig.js.map +1 -1
- package/dist/esm/main.js +8 -56
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/mnemonic/mnemonic.js +25 -1
- package/dist/esm/mnemonic/mnemonic.js.map +1 -1
- package/dist/esm/multisigSigning.js +75 -0
- package/dist/esm/multisigSigning.js.map +1 -1
- package/dist/esm/pq-signer.js +50 -0
- package/dist/esm/pq-signer.js.map +1 -0
- package/dist/esm/signedTransaction.js +16 -2
- package/dist/esm/signedTransaction.js.map +1 -1
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/signing.js +91 -8
- package/dist/esm/signing.js.map +1 -1
- package/dist/esm/transaction.js +9 -1
- package/dist/esm/transaction.js.map +1 -1
- package/dist/esm/types/transactions/encoded.js +49 -1
- package/dist/esm/types/transactions/encoded.js.map +1 -1
- package/dist/esm/utils/ed25519-check.js +65 -0
- package/dist/esm/utils/ed25519-check.js.map +1 -0
- package/dist/types/client/v2/algod/accountApplicationsInformation.d.ts +16 -0
- package/dist/types/client/v2/algod/accountAssetsInformation.d.ts +12 -0
- package/dist/types/client/v2/algod/algod.d.ts +19 -17
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +100 -5
- package/dist/types/client/v2/algod/models/types.d.ts +146 -232
- package/dist/types/ed25519-signer.d.ts +7 -0
- package/dist/types/encoding/address.d.ts +37 -0
- package/dist/types/falcon-signer.d.ts +11 -0
- package/dist/types/logicsig.d.ts +72 -1
- package/dist/types/main.d.ts +8 -44
- package/dist/types/mnemonic/mnemonic.d.ts +13 -0
- package/dist/types/multisigSigning.d.ts +49 -0
- package/dist/types/pq-signer.d.ts +8 -0
- package/dist/types/signedTransaction.d.ts +7 -2
- package/dist/types/signer.d.ts +38 -0
- package/dist/types/signing.d.ts +45 -0
- package/dist/types/transaction.d.ts +9 -0
- package/dist/types/types/transactions/encoded.d.ts +27 -0
- package/dist/types/utils/ed25519-check.d.ts +10 -0
- package/package.json +2 -1
- package/src/appAccess.ts +10 -5
- package/src/client/v2/algod/accountApplicationsInformation.ts +46 -0
- package/src/client/v2/algod/accountAssetsInformation.ts +33 -0
- package/src/client/v2/algod/algod.ts +25 -20
- package/src/client/v2/algod/getApplicationBoxes.ts +123 -5
- package/src/client/v2/algod/models/types.ts +523 -846
- package/src/ed25519-signer.ts +125 -0
- package/src/encoding/address.ts +80 -0
- package/src/falcon-signer.ts +30 -0
- package/src/logicsig.ts +258 -16
- package/src/main.ts +30 -60
- package/src/mnemonic/mnemonic.ts +34 -1
- package/src/multisigSigning.ts +111 -0
- package/src/pq-signer.ts +90 -0
- package/src/signedTransaction.ts +24 -0
- package/src/signer.ts +53 -0
- package/src/signing.ts +109 -8
- package/src/transaction.ts +9 -1
- package/src/types/transactions/encoded.ts +88 -0
- package/src/utils/ed25519-check.ts +67 -0
- package/dist/cjs/client/v2/algod/dryrun.js +0 -34
- package/dist/cjs/client/v2/algod/dryrun.js.map +0 -1
- package/dist/cjs/dryrun.js +0 -214
- package/dist/cjs/dryrun.js.map +0 -1
- package/dist/esm/client/v2/algod/dryrun.js +0 -28
- package/dist/esm/client/v2/algod/dryrun.js.map +0 -1
- package/dist/esm/dryrun.js +0 -208
- package/dist/esm/dryrun.js.map +0 -1
- package/dist/types/client/v2/algod/dryrun.d.ts +0 -11
- package/dist/types/dryrun.d.ts +0 -28
- package/src/client/v2/algod/dryrun.ts +0 -38
- package/src/dryrun.ts +0 -292
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest.js';
|
|
2
|
+
import { HTTPClient, HTTPClientResponse } from '../../client.js';
|
|
3
|
+
import { decodeJSON } from '../../../encoding/encoding.js';
|
|
4
|
+
import { AccountAssetsInformationResponse } from './models/types.js';
|
|
5
|
+
import { Address } from '../../../encoding/address.js';
|
|
6
|
+
|
|
7
|
+
export default class AccountAssetsInformation extends JSONRequest<AccountAssetsInformationResponse> {
|
|
8
|
+
private account: string;
|
|
9
|
+
|
|
10
|
+
constructor(c: HTTPClient, account: string | Address) {
|
|
11
|
+
super(c);
|
|
12
|
+
this.account = account.toString();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
path() {
|
|
16
|
+
return `/v2/accounts/${this.account}/assets`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
limit(limit: number) {
|
|
20
|
+
this.query.limit = limit;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
next(next: string) {
|
|
25
|
+
this.query.next = next;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line class-methods-use-this
|
|
30
|
+
prepare(response: HTTPClientResponse): AccountAssetsInformationResponse {
|
|
31
|
+
return decodeJSON(response.getJSONText(), AccountAssetsInformationResponse);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -2,10 +2,11 @@ import ServiceClient from '../serviceClient.js';
|
|
|
2
2
|
import * as modelsv2 from './models/types.js';
|
|
3
3
|
import AccountInformation from './accountInformation.js';
|
|
4
4
|
import AccountAssetInformation from './accountAssetInformation.js';
|
|
5
|
+
import AccountAssetsInformation from './accountAssetsInformation.js';
|
|
6
|
+
import AccountApplicationsInformation from './accountApplicationsInformation.js';
|
|
5
7
|
import AccountApplicationInformation from './accountApplicationInformation.js';
|
|
6
8
|
import Block from './block.js';
|
|
7
9
|
import Compile from './compile.js';
|
|
8
|
-
import Dryrun from './dryrun.js';
|
|
9
10
|
import Genesis from './genesis.js';
|
|
10
11
|
import GetAssetByID from './getAssetByID.js';
|
|
11
12
|
import GetApplicationByID from './getApplicationByID.js';
|
|
@@ -177,6 +178,26 @@ export class AlgodClient extends ServiceClient {
|
|
|
177
178
|
return new AccountAssetInformation(this.c, account, index);
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Returns the given account's asset holdings, paginated.
|
|
183
|
+
*
|
|
184
|
+
* @param account - The address of the account to look up.
|
|
185
|
+
* @category GET
|
|
186
|
+
*/
|
|
187
|
+
accountAssetsInformation(account: string | Address) {
|
|
188
|
+
return new AccountAssetsInformation(this.c, account);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Returns the given account's application holdings, paginated.
|
|
193
|
+
*
|
|
194
|
+
* @param account - The address of the account to look up.
|
|
195
|
+
* @category GET
|
|
196
|
+
*/
|
|
197
|
+
accountApplicationsInformation(account: string | Address) {
|
|
198
|
+
return new AccountApplicationsInformation(this.c, account);
|
|
199
|
+
}
|
|
200
|
+
|
|
180
201
|
/**
|
|
181
202
|
* Returns the given account's application information for a specific application.
|
|
182
203
|
*
|
|
@@ -438,24 +459,6 @@ export class AlgodClient extends ServiceClient {
|
|
|
438
459
|
return new Disassemble(this.c, source);
|
|
439
460
|
}
|
|
440
461
|
|
|
441
|
-
/**
|
|
442
|
-
* Provides debugging information for a transaction (or group).
|
|
443
|
-
*
|
|
444
|
-
* Executes TEAL program(s) in context and returns debugging information about the execution. This endpoint is only enabled when a node's configureation file sets `EnableDeveloperAPI` to true.
|
|
445
|
-
*
|
|
446
|
-
* #### Example
|
|
447
|
-
* ```typescript
|
|
448
|
-
* const dryRunResult = await algodClient.dryrun(dr).do();
|
|
449
|
-
* ```
|
|
450
|
-
*
|
|
451
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2tealdryrun)
|
|
452
|
-
* @param dr
|
|
453
|
-
* @category POST
|
|
454
|
-
*/
|
|
455
|
-
dryrun(dr: modelsv2.DryrunRequest) {
|
|
456
|
-
return new Dryrun(this.c, dr);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
462
|
/**
|
|
460
463
|
* Given an asset ID, return asset information including creator, name, total supply and
|
|
461
464
|
* special addresses.
|
|
@@ -512,7 +515,7 @@ export class AlgodClient extends ServiceClient {
|
|
|
512
515
|
}
|
|
513
516
|
|
|
514
517
|
/**
|
|
515
|
-
* Given an application ID, return all the
|
|
518
|
+
* Given an application ID, return all the boxes associated with the app.
|
|
516
519
|
*
|
|
517
520
|
* #### Example
|
|
518
521
|
* ```typescript
|
|
@@ -520,6 +523,8 @@ export class AlgodClient extends ServiceClient {
|
|
|
520
523
|
* const boxesResponse = await algodClient.getApplicationBoxes(index).max(3).do();
|
|
521
524
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
522
525
|
* ```
|
|
526
|
+
* With the `.include("values")` parameter, returns values in addition to names. Pagination is supported with `limit`. If using pagination,
|
|
527
|
+
* it is recommended to use the `.round()` parameter to ensure each page is for the same round.
|
|
523
528
|
*
|
|
524
529
|
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
525
530
|
* @param index - The application ID to look up.
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import JSONRequest from '../jsonrequest.js';
|
|
2
2
|
import { HTTPClient, HTTPClientResponse } from '../../client.js';
|
|
3
3
|
import { decodeJSON } from '../../../encoding/encoding.js';
|
|
4
|
+
import { bytesToBase64 } from '../../../encoding/binarydata.js';
|
|
5
|
+
import { ensureSafeInteger } from '../../../utils/utils.js';
|
|
4
6
|
import { BoxesResponse } from './models/types.js';
|
|
5
7
|
|
|
8
|
+
export type BoxInclude = 'values';
|
|
9
|
+
|
|
6
10
|
/**
|
|
7
|
-
* Given an application ID, return all the
|
|
11
|
+
* Given an application ID, return all the boxes associated with the app.
|
|
8
12
|
*
|
|
9
13
|
* #### Example
|
|
10
14
|
* ```typescript
|
|
@@ -13,6 +17,9 @@ import { BoxesResponse } from './models/types.js';
|
|
|
13
17
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
14
18
|
* ```
|
|
15
19
|
*
|
|
20
|
+
* With the `.include("values")` parameter, returns values in addition to names. Pagination is supported with `limit`. If using pagination,
|
|
21
|
+
* it is recommended to use the `.round()` parameter to ensure each page is for the same round.
|
|
22
|
+
*
|
|
16
23
|
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
17
24
|
* @param index - The application ID to look up.
|
|
18
25
|
* @category GET
|
|
@@ -34,18 +41,20 @@ export default class GetApplicationBoxes extends JSONRequest<BoxesResponse> {
|
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
/**
|
|
37
|
-
*
|
|
44
|
+
* @deprecated - Use `limit` instead for proper pagination with a limit.
|
|
45
|
+
*
|
|
46
|
+
* Set the max amount of boxes to return. Returns HTTP 400 if max is exceeded.
|
|
38
47
|
*
|
|
39
48
|
* #### Example
|
|
40
49
|
* ```typescript
|
|
41
50
|
* const maxResults = 20;
|
|
42
51
|
* const boxesResult = await algodClient
|
|
43
|
-
* .
|
|
44
|
-
* .
|
|
52
|
+
* .getApplicationBoxes(1234)
|
|
53
|
+
* .max(maxResults)
|
|
45
54
|
* .do();
|
|
46
55
|
* ```
|
|
47
56
|
*
|
|
48
|
-
* @param
|
|
57
|
+
* @param max - maximum number of results to return.
|
|
49
58
|
* @category query
|
|
50
59
|
*/
|
|
51
60
|
max(max: number) {
|
|
@@ -53,6 +62,115 @@ export default class GetApplicationBoxes extends JSONRequest<BoxesResponse> {
|
|
|
53
62
|
return this;
|
|
54
63
|
}
|
|
55
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Pagination token returned by the previous call.
|
|
67
|
+
*
|
|
68
|
+
* This is the value returned by a previous call to this endpoint in the
|
|
69
|
+
* `next-token` response field. Provide this token to get the next page of
|
|
70
|
+
* results. The token is the box name to use as the pagination cursor,
|
|
71
|
+
* encoded in the goal app call arg form.
|
|
72
|
+
*
|
|
73
|
+
* #### Example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const boxesResponse = await algodClient
|
|
76
|
+
* .getApplicationBoxes(1234)
|
|
77
|
+
* .limit(20)
|
|
78
|
+
* .next("b64:AAECAw==")
|
|
79
|
+
* .do();
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @param nextToken - The next token to use for pagination.
|
|
83
|
+
* @category query
|
|
84
|
+
*/
|
|
85
|
+
next(nextToken: string | undefined) {
|
|
86
|
+
this.query.next = nextToken;
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Filter box names by a prefix.
|
|
92
|
+
*
|
|
93
|
+
* #### Example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const boxesResponse = await algodClient
|
|
96
|
+
* .getApplicationBoxes(1234)
|
|
97
|
+
* .prefix(myAddr.publicKey)
|
|
98
|
+
* .do();
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @param prefix - The prefix to filter box names by
|
|
102
|
+
* @category query
|
|
103
|
+
*/
|
|
104
|
+
prefix(prefix: Uint8Array) {
|
|
105
|
+
this.query.prefix = `b64:${bytesToBase64(prefix)}`;
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Include additional items in the response.
|
|
111
|
+
*
|
|
112
|
+
* Use `values` to include box values.
|
|
113
|
+
*
|
|
114
|
+
* #### Example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const boxesResponse = await algodClient
|
|
117
|
+
* .getApplicationBoxes(1234)
|
|
118
|
+
* .prefix(myAddr.publicKey)
|
|
119
|
+
* .include("values")
|
|
120
|
+
* .do();
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @param include - The additional items to include in the response.
|
|
124
|
+
* @category query
|
|
125
|
+
*/
|
|
126
|
+
include(...include: BoxInclude[]) {
|
|
127
|
+
this.query.include = include.join(',');
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Limits results per page when using pagination.
|
|
133
|
+
*
|
|
134
|
+
* #### Example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const maxResults = 20;
|
|
137
|
+
* const boxesResult = await algodClient
|
|
138
|
+
* .getApplicationBoxes(1234)
|
|
139
|
+
* .limit(maxResults)
|
|
140
|
+
* .do();
|
|
141
|
+
* const { nextToken } = boxesResult
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @param limit - maximum number of results to return per page.
|
|
145
|
+
* @category query
|
|
146
|
+
*/
|
|
147
|
+
limit(limit: number) {
|
|
148
|
+
this.query.limit = limit;
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Return results for the specified round.
|
|
154
|
+
*
|
|
155
|
+
* If not provided, results will be from the latest round. This parameter
|
|
156
|
+
* can be used to pin all pages of a paginated query to a consistent round.
|
|
157
|
+
*
|
|
158
|
+
* #### Example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const boxesResponse = await algodClient
|
|
161
|
+
* .getApplicationBoxes(1234)
|
|
162
|
+
* .round(12345678)
|
|
163
|
+
* .do();
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param roundNumber - The round to query.
|
|
167
|
+
* @category query
|
|
168
|
+
*/
|
|
169
|
+
round(roundNumber: number | bigint) {
|
|
170
|
+
this.query.round = ensureSafeInteger(roundNumber);
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
|
|
56
174
|
// eslint-disable-next-line class-methods-use-this
|
|
57
175
|
prepare(response: HTTPClientResponse): BoxesResponse {
|
|
58
176
|
return decodeJSON(response.getJSONText(), BoxesResponse);
|