algosdk 1.13.0-beta.2 → 1.13.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/README.md +4 -4
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/src/client/v2/algod/algod.js +255 -7
- package/dist/cjs/src/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/indexer.js +153 -1
- package/dist/cjs/src/client/v2/indexer/indexer.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAssetBalances.js +98 -6
- package/dist/cjs/src/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/cjs/src/client/v2/serviceClient.js.map +1 -1
- package/dist/cjs/src/dryrun.js +103 -0
- package/dist/cjs/src/dryrun.js.map +1 -0
- package/dist/cjs/src/main.js +1 -0
- package/dist/cjs/src/main.js.map +1 -1
- package/dist/esm/src/client/v2/algod/algod.js +255 -7
- package/dist/esm/src/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/indexer.js +153 -1
- package/dist/esm/src/client/v2/indexer/indexer.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAssetBalances.js +98 -6
- package/dist/esm/src/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/esm/src/client/v2/serviceClient.js.map +1 -1
- package/dist/esm/src/dryrun.js +99 -0
- package/dist/esm/src/dryrun.js.map +1 -0
- package/dist/esm/src/main.js +1 -0
- package/dist/esm/src/main.js.map +1 -1
- package/dist/types/src/client/v2/algod/algod.d.ts +255 -7
- package/dist/types/src/client/v2/indexer/indexer.d.ts +153 -1
- package/dist/types/src/client/v2/indexer/lookupAssetBalances.d.ts +98 -0
- package/dist/types/src/client/v2/serviceClient.d.ts +2 -0
- package/dist/types/src/dryrun.d.ts +20 -0
- package/dist/types/src/main.d.ts +1 -0
- package/package.json +2 -2
|
@@ -5,6 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsonrequest_1 = __importDefault(require("../jsonrequest"));
|
|
7
7
|
class LookupAssetBalances extends jsonrequest_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* Returns the list of accounts which hold the given asset and their balance.
|
|
10
|
+
*
|
|
11
|
+
* #### Example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const assetId = 163650;
|
|
14
|
+
* const assetBalances = await indexerClient.lookupAssetBalances(assetId).do();
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-idbalances)
|
|
18
|
+
* @param index - The asset ID to look up.
|
|
19
|
+
*/
|
|
8
20
|
constructor(c, intDecoding, index) {
|
|
9
21
|
super(c, intDecoding);
|
|
10
22
|
this.index = index;
|
|
@@ -13,32 +25,112 @@ class LookupAssetBalances extends jsonrequest_1.default {
|
|
|
13
25
|
path() {
|
|
14
26
|
return `/v2/assets/${this.index}/balances`;
|
|
15
27
|
}
|
|
16
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Add a limit for filter.
|
|
30
|
+
*
|
|
31
|
+
* #### Example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const assetId = 163650;
|
|
34
|
+
* const maxResults = 20;
|
|
35
|
+
* const assetBalances = await indexerClient
|
|
36
|
+
* .lookupAssetBalances(assetId)
|
|
37
|
+
* .limit(maxResults)
|
|
38
|
+
* .do();
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param limit - maximum number of results to return.
|
|
42
|
+
*/
|
|
17
43
|
limit(limit) {
|
|
18
44
|
this.query.limit = limit;
|
|
19
45
|
return this;
|
|
20
46
|
}
|
|
21
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Specify round to filter with.
|
|
49
|
+
*
|
|
50
|
+
* #### Example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const assetId = 163650;
|
|
53
|
+
* const targetBlock = 18309917;
|
|
54
|
+
* const assetBalances = await indexerClient
|
|
55
|
+
* .lookupAssetBalances(assetId)
|
|
56
|
+
* .round(targetBlock)
|
|
57
|
+
* .do();
|
|
58
|
+
* ```
|
|
59
|
+
* @param round
|
|
60
|
+
*/
|
|
22
61
|
round(round) {
|
|
23
62
|
this.query.round = round;
|
|
24
63
|
return this;
|
|
25
64
|
}
|
|
26
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Filtered results should have an asset balance greater than this value.
|
|
67
|
+
*
|
|
68
|
+
* #### Example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const assetId = 163650;
|
|
71
|
+
* const minBalance = 1000000;
|
|
72
|
+
* const assetBalances = await indexerClient
|
|
73
|
+
* .lookupAssetBalances(assetId)
|
|
74
|
+
* .currencyGreaterThan(minBalance)
|
|
75
|
+
* .do();
|
|
76
|
+
* ```
|
|
77
|
+
* @param greater
|
|
78
|
+
*/
|
|
27
79
|
currencyGreaterThan(greater) {
|
|
28
80
|
this.query['currency-greater-than'] = greater;
|
|
29
81
|
return this;
|
|
30
82
|
}
|
|
31
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Filtered results should have an asset balance less than this value.
|
|
85
|
+
*
|
|
86
|
+
* #### Example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const assetId = 163650;
|
|
89
|
+
* const maxBalance = 2000000;
|
|
90
|
+
* const assetBalances = await indexerClient
|
|
91
|
+
* .lookupAssetBalances(assetId)
|
|
92
|
+
* .currencyLessThan(maxBalance)
|
|
93
|
+
* .do();
|
|
94
|
+
* ```
|
|
95
|
+
* @param lesser
|
|
96
|
+
*/
|
|
32
97
|
currencyLessThan(lesser) {
|
|
33
98
|
this.query['currency-less-than'] = lesser;
|
|
34
99
|
return this;
|
|
35
100
|
}
|
|
36
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Specify the next page of results.
|
|
103
|
+
*
|
|
104
|
+
* #### Example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const assetId = 163650;
|
|
107
|
+
* const maxResults = 20;
|
|
108
|
+
* const nextToken = "APA6C7C3NCANRPIBUWQOF7WSKLJMK6RPQUVFLLDV4U5WCQE4DEF26D4E3E";
|
|
109
|
+
* const assetBalances = await indexerClient
|
|
110
|
+
* .lookupAssetBalances(assetId)
|
|
111
|
+
* .limit(maxResults)
|
|
112
|
+
* .next(nextToken)
|
|
113
|
+
* .do();
|
|
114
|
+
* ```
|
|
115
|
+
* @param nextToken - provided by the previous results.
|
|
116
|
+
*/
|
|
37
117
|
nextToken(nextToken) {
|
|
38
118
|
this.query.next = nextToken;
|
|
39
119
|
return this;
|
|
40
120
|
}
|
|
41
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates
|
|
123
|
+
*
|
|
124
|
+
* #### Example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const assetId = 163650;
|
|
127
|
+
* const assetBalances = await indexerClient
|
|
128
|
+
* .lookupAssetBalances(assetId)
|
|
129
|
+
* .includeAll(false)
|
|
130
|
+
* .do();
|
|
131
|
+
* ```
|
|
132
|
+
* @param value
|
|
133
|
+
*/
|
|
42
134
|
includeAll(value = true) {
|
|
43
135
|
this.query['include-all'] = value;
|
|
44
136
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookupAssetBalances.js","sourceRoot":"","sources":["../../../../../../src/client/v2/indexer/lookupAssetBalances.ts"],"names":[],"mappings":";;;;;AAAA,iEAAyC;AAIzC,MAAqB,mBAAoB,SAAQ,qBAAW;IAC1D,YAAY,CAAa,EAAE,WAAwB,EAAU,KAAa;QACxE,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QADqC,UAAK,GAAL,KAAK,CAAQ;QAExE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,IAAI;QACF,OAAO,cAAc,IAAI,CAAC,KAAK,WAAW,CAAC;IAC7C,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"lookupAssetBalances.js","sourceRoot":"","sources":["../../../../../../src/client/v2/indexer/lookupAssetBalances.ts"],"names":[],"mappings":";;;;;AAAA,iEAAyC;AAIzC,MAAqB,mBAAoB,SAAQ,qBAAW;IAC1D;;;;;;;;;;;OAWG;IACH,YAAY,CAAa,EAAE,WAAwB,EAAU,KAAa;QACxE,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QADqC,UAAK,GAAL,KAAK,CAAQ;QAExE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,IAAI;QACF,OAAO,cAAc,IAAI,CAAC,KAAK,WAAW,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,KAAa;QACjB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,KAAa;QACjB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,mBAAmB,CAAC,OAAe;QACjC,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,MAAc;QAC7B,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,GAAG,MAAM,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,SAAiB;QACzB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,KAAK,GAAG,IAAI;QACrB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzID,sCAyIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceClient.js","sourceRoot":"","sources":["../../../../../src/client/v2/serviceClient.ts"],"names":[],"mappings":";;;;;AAAA,uDAAmC;AACnC,0EAAkD;AAUlD;;;;GAIG;AACH,SAAS,+BAA+B,CACtC,QAAgB,EAAE,EAClB,gBAAuC;IAEvC,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,WAAW,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;IACtC,OAAO,WAA0B,CAAC;AACpC,CAAC;AAED,SAAS,gBAAgB,CACvB,GAA0C;IAE1C,OAAO,OAAQ,GAAsB,CAAC,GAAG,KAAK,UAAU,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAA8B,aAAa;
|
|
1
|
+
{"version":3,"file":"serviceClient.js","sourceRoot":"","sources":["../../../../../src/client/v2/serviceClient.ts"],"names":[],"mappings":";;;;;AAAA,uDAAmC;AACnC,0EAAkD;AAUlD;;;;GAIG;AACH,SAAS,+BAA+B,CACtC,QAAgB,EAAE,EAClB,gBAAuC;IAEvC,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,WAAW,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;IACtC,OAAO,WAA0B,CAAC;AACpC,CAAC;AAED,SAAS,gBAAgB,CACvB,GAA0C;IAE1C,OAAO,OAAQ,GAAsB,CAAC,GAAG,KAAK,UAAU,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAA8B,aAAa;IAMzC,YACE,qBAA4C,EAC5C,4BAAmE,EACnE,UAAkB,EAClB,IAAsB,EACtB,iBAAsC,EAAE;QAExC,IAAI,gBAAgB,CAAC,4BAA4B,CAAC,EAAE;YAClD,6BAA6B;YAC7B,IAAI,CAAC,CAAC,GAAG,IAAI,gBAAU,CAAC,4BAA4B,CAAC,CAAC;SACvD;aAAM;YACL,0CAA0C;YAC1C,qEAAqE;YACrE,IAAI,WAAwB,CAAC;YAC7B,IAAI,OAAO,4BAA4B,KAAK,QAAQ,EAAE;gBACpD,WAAW,GAAG,+BAA+B,CAC3C,4BAA4B,EAC5B,qBAAqB,CACtB,CAAC;aACH;iBAAM;gBACL,WAAW,GAAG,4BAA4B,CAAC;aAC5C;YAED,IAAI,CAAC,CAAC,GAAG,IAAI,gBAAU,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;SACxE;QAED,IAAI,CAAC,WAAW,GAAG,qBAAW,CAAC,OAAO,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,MAAmB;QAChC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AAnDD,gCAmDC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDryrun = void 0;
|
|
4
|
+
const types_1 = require("./client/v2/algod/models/types");
|
|
5
|
+
const transactions_1 = require("./types/transactions");
|
|
6
|
+
const address_1 = require("./encoding/address");
|
|
7
|
+
const defaultAppId = 1380011588;
|
|
8
|
+
function decodePrograms(ap) {
|
|
9
|
+
// eslint-disable-next-line no-param-reassign
|
|
10
|
+
ap.params['approval-program'] = Buffer.from(ap.params['approval-program'].toString(), 'base64');
|
|
11
|
+
// eslint-disable-next-line no-param-reassign
|
|
12
|
+
ap.params['clear-state-program'] = Buffer.from(ap.params['clear-state-program'].toString(), 'base64');
|
|
13
|
+
return ap;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* createDryrun takes an Algod Client (from algod.AlgodV2Client) and an array of Signed Transactions
|
|
17
|
+
* from (transaction.SignedTransaction) and creates a DryrunRequest object with relevant balances
|
|
18
|
+
* @param client - the AlgodClient to make requests against
|
|
19
|
+
* @param txns - the array of SignedTransaction to use for generating the DryrunRequest object
|
|
20
|
+
* @param protocolVersion - the string representing the protocol version to use
|
|
21
|
+
* @param latestTimestamp - the timestamp
|
|
22
|
+
* @returns the DryrunRequest object constructed from the SignedTransactions passed
|
|
23
|
+
*/
|
|
24
|
+
async function createDryrun({ client, txns, protocolVersion, latestTimestamp, round, sources, }) {
|
|
25
|
+
const appInfos = [];
|
|
26
|
+
const acctInfos = [];
|
|
27
|
+
const apps = [];
|
|
28
|
+
const assets = [];
|
|
29
|
+
const accts = [];
|
|
30
|
+
for (const t of txns) {
|
|
31
|
+
if (t.txn.type === transactions_1.TransactionType.appl) {
|
|
32
|
+
accts.push(address_1.encodeAddress(t.txn.from.publicKey));
|
|
33
|
+
if (t.txn.appAccounts)
|
|
34
|
+
accts.push(...t.txn.appAccounts.map((a) => address_1.encodeAddress(a.publicKey)));
|
|
35
|
+
if (t.txn.appForeignApps)
|
|
36
|
+
apps.push(...t.txn.appForeignApps);
|
|
37
|
+
if (t.txn.appForeignAssets)
|
|
38
|
+
assets.push(...t.txn.appForeignAssets);
|
|
39
|
+
// Create application,
|
|
40
|
+
if (t.txn.appIndex === 0) {
|
|
41
|
+
appInfos.push(new types_1.Application(defaultAppId, new types_1.ApplicationParams({
|
|
42
|
+
creator: address_1.encodeAddress(t.txn.from.publicKey),
|
|
43
|
+
approvalProgram: t.txn.appApprovalProgram,
|
|
44
|
+
clearStateProgram: t.txn.appClearProgram,
|
|
45
|
+
localStateSchema: new types_1.ApplicationStateSchema(t.txn.appLocalInts, t.txn.appLocalByteSlices),
|
|
46
|
+
globalStateSchema: new types_1.ApplicationStateSchema(t.txn.appGlobalInts, t.txn.appGlobalByteSlices),
|
|
47
|
+
})));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
apps.push(t.txn.appIndex);
|
|
51
|
+
accts.push(address_1.getApplicationAddress(t.txn.appIndex));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Dedupe and add creator to accts array
|
|
56
|
+
const assetPromises = [];
|
|
57
|
+
for (const assetId of [...new Set(assets)]) {
|
|
58
|
+
assetPromises.push(client
|
|
59
|
+
.getAssetByID(assetId)
|
|
60
|
+
.do()
|
|
61
|
+
.then((assetInfo) => {
|
|
62
|
+
accts.push(assetInfo.params.creator);
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
// Wait for assets to finish since we append to accts array
|
|
66
|
+
await Promise.all(assetPromises);
|
|
67
|
+
// Dedupe and get app info for all apps
|
|
68
|
+
const appPromises = [];
|
|
69
|
+
for (const appId of [...new Set(apps)]) {
|
|
70
|
+
appPromises.push(client
|
|
71
|
+
.getApplicationByID(appId)
|
|
72
|
+
.do()
|
|
73
|
+
.then((appInfo) => {
|
|
74
|
+
const ai = decodePrograms(appInfo);
|
|
75
|
+
appInfos.push(ai);
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
const acctPromises = [];
|
|
79
|
+
for (const acct of [...new Set(accts)]) {
|
|
80
|
+
acctPromises.push(client
|
|
81
|
+
.accountInformation(acct)
|
|
82
|
+
.do()
|
|
83
|
+
.then((acctInfo) => {
|
|
84
|
+
if ('created-apps' in acctInfo) {
|
|
85
|
+
// eslint-disable-next-line no-param-reassign
|
|
86
|
+
acctInfo['created-apps'] = acctInfo['created-apps'].map((app) => decodePrograms(app));
|
|
87
|
+
}
|
|
88
|
+
acctInfos.push(acctInfo);
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
await Promise.all([...appPromises, ...acctPromises]);
|
|
92
|
+
return new types_1.DryrunRequest({
|
|
93
|
+
txns: txns.map((st) => ({ ...st, txn: st.txn.get_obj_for_encoding() })),
|
|
94
|
+
accounts: acctInfos,
|
|
95
|
+
apps: appInfos,
|
|
96
|
+
latestTimestamp,
|
|
97
|
+
round,
|
|
98
|
+
protocolVersion,
|
|
99
|
+
sources,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
exports.createDryrun = createDryrun;
|
|
103
|
+
//# sourceMappingURL=dryrun.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dryrun.js","sourceRoot":"","sources":["../../../src/dryrun.ts"],"names":[],"mappings":";;;AACA,0DAMwC;AAExC,uDAAuD;AACvD,gDAA0E;AAE1E,MAAM,YAAY,GAAG,UAAU,CAAC;AAYhC,SAAS,cAAc,CAAC,EAAoB;IAC1C,6CAA6C;IAC7C,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC,IAAI,CACzC,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,EACxC,QAAQ,CACT,CAAC;IACF,6CAA6C;IAC7C,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,MAAM,CAAC,IAAI,CAC5C,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,EAC3C,QAAQ,CACT,CAAC;IAEF,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,YAAY,CAAC,EACjC,MAAM,EACN,IAAI,EACJ,eAAe,EACf,eAAe,EACf,KAAK,EACL,OAAO,GAQR;IACC,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,8BAAe,CAAC,IAAI,EAAE;YACvC,KAAK,CAAC,IAAI,CAAC,uBAAa,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC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,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC9D,cAAc,CAAC,GAAG,CAAC,CACpB,CAAC;aACH;YACD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC,CAAC,CACL,CAAC;KACH;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IAErD,OAAO,IAAI,qBAAa,CAAC;QACvB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;QACvE,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,QAAQ;QACd,eAAe;QACf,KAAK;QACL,eAAe;QACf,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AArHD,oCAqHC"}
|
package/dist/cjs/src/main.js
CHANGED
|
@@ -176,6 +176,7 @@ Object.defineProperty(exports, "mergeMultisigTransactions", { enumerable: true,
|
|
|
176
176
|
Object.defineProperty(exports, "appendSignMultisigTransaction", { enumerable: true, get: function () { return multisig_1.appendSignMultisigTransaction; } });
|
|
177
177
|
Object.defineProperty(exports, "multisigAddress", { enumerable: true, get: function () { return multisig_1.multisigAddress; } });
|
|
178
178
|
exports.LogicTemplates = LogicTemplatesCommonJSExport.default;
|
|
179
|
+
__exportStar(require("./dryrun"), exports);
|
|
179
180
|
__exportStar(require("./makeTxn"), exports);
|
|
180
181
|
__exportStar(require("./transaction"), exports);
|
|
181
182
|
__exportStar(require("./signer"), exports);
|
package/dist/cjs/src/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAC5C,4DAA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GAAA,mBAAmB,OAAA;AACnB,+GAAA,mBAAmB,OAAA;AACnB,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAElB,qCAImB;AAHjB,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AACjB,uHAAA,4BAA4B,OAAA;AAE9B,iCAAwD;AAA/C,uGAAA,cAAc,OAAA;AAAE,sGAAA,aAAa,OAAA;AACtC,uCAQoB;AAPlB,2GAAA,eAAe,OAAA;AACf,wGAAA,YAAY,OAAA;AACZ,mHAAA,uBAAuB,OAAA;AACvB,yHAAA,6BAA6B,OAAA;AAC7B,4GAAA,gBAAgB,OAAA;AAChB,oGAAA,QAAQ,OAAA;AACR,+GAAA,mBAAmB,OAAA;AAErB,uCAKoB;AAJlB,mHAAA,uBAAuB,OAAA;AACvB,qHAAA,yBAAyB,OAAA;AACzB,yHAAA,6BAA6B,OAAA;AAC7B,2GAAA,eAAe,OAAA;AAEJ,QAAA,cAAc,GAAG,4BAA4B,CAAC,OAAO,CAAC;AAEnE,2CAAyB;AACzB,4CAA0B;AAC1B,gDAA8B;AAC9B,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB;AACxB,wCAAsB"}
|
|
@@ -17,115 +17,363 @@ import Supply from './supply';
|
|
|
17
17
|
import Versions from './versions';
|
|
18
18
|
import Genesis from './genesis';
|
|
19
19
|
import Proof from './proof';
|
|
20
|
+
/**
|
|
21
|
+
* Algod client connects an application to the Algorand blockchain. The algod client requires a valid algod REST endpoint IP address and algod token from an Algorand node that is connected to the network you plan to interact with.
|
|
22
|
+
*
|
|
23
|
+
* Algod is the main Algorand process for handling the blockchain. Messages between nodes are processed, the protocol steps are executed, and the blocks are written to disk. The algod process also exposes a REST API server that developers can use to communicate with the node and the network. Algod uses the data directory for storage and configuration information.
|
|
24
|
+
*
|
|
25
|
+
* #### Relevant Information
|
|
26
|
+
* [How do I obtain an algod address and token?](https://developer.algorand.org/docs/archive/build-apps/setup/?from_query=algod#how-do-i-obtain-an-algod-address-and-token)
|
|
27
|
+
*
|
|
28
|
+
* [Run Algod in Postman OAS3](https://developer.algorand.org/docs/rest-apis/restendpoints/?from_query=algod#algod-indexer-and-kmd-rest-endpoints)
|
|
29
|
+
*/
|
|
20
30
|
export default class AlgodClient extends ServiceClient {
|
|
21
31
|
/**
|
|
22
32
|
* Create an AlgodClient from
|
|
23
33
|
* * either a token, baseServer, port, and optional headers
|
|
24
34
|
* * or a base client server for interoperability with external dApp wallets
|
|
35
|
+
*
|
|
36
|
+
* #### Example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
39
|
+
* const server = "http://localhost";
|
|
40
|
+
* const port = 4001;
|
|
41
|
+
* const algodClient = new algosdk.Algodv2(token, server, port);
|
|
42
|
+
* ```
|
|
43
|
+
* @remarks
|
|
44
|
+
* The above configuration is for a sandbox private network.
|
|
45
|
+
* For applications on production, you are encouraged to run your own node, or use an Algorand REST API provider with a dedicated API key.
|
|
46
|
+
*
|
|
47
|
+
* @param tokenOrBaseClient - The algod token from the Algorand node you are interacting with
|
|
48
|
+
* @param baseServer - REST endpoint
|
|
49
|
+
* @param port - Port number if specifically configured by the server
|
|
50
|
+
* @param headers - Optional headers
|
|
25
51
|
*/
|
|
26
52
|
constructor(tokenOrBaseClient, baseServer = 'http://r2.algorand.network', port = 4180, headers = {}) {
|
|
27
53
|
super('X-Algo-API-Token', tokenOrBaseClient, baseServer, port, headers);
|
|
28
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns OK if healthy.
|
|
57
|
+
*
|
|
58
|
+
* #### Example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const health = await algodClient.healthCheck().do();
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-health)
|
|
64
|
+
* @category GET
|
|
65
|
+
*/
|
|
29
66
|
healthCheck() {
|
|
30
67
|
return new HealthCheck(this.c);
|
|
31
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves the supported API versions, binary build versions, and genesis information.
|
|
71
|
+
*
|
|
72
|
+
* #### Example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const versionsDetails = await algodClient.versionsCheck().do();
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-versions)
|
|
78
|
+
* @category GET
|
|
79
|
+
*/
|
|
32
80
|
versionsCheck() {
|
|
33
81
|
return new Versions(this.c);
|
|
34
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Broadcasts a raw transaction to the network.
|
|
85
|
+
*
|
|
86
|
+
* #### Example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const { txId } = await algodClient.sendRawTransaction(signedTxns).do();
|
|
89
|
+
* const result = await waitForConfirmation(algodClient, txid, 3);
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2transactions)
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* Often used with {@linkcode waitForConfirmation}
|
|
96
|
+
* @param stxOrStxs - Signed transactions
|
|
97
|
+
* @category POST
|
|
98
|
+
*/
|
|
35
99
|
sendRawTransaction(stxOrStxs) {
|
|
36
100
|
return new SendRawTransaction(this.c, stxOrStxs);
|
|
37
101
|
}
|
|
38
102
|
/**
|
|
39
|
-
* Returns the given account's
|
|
103
|
+
* Returns the given account's status, balance and spendable amounts.
|
|
104
|
+
*
|
|
105
|
+
* #### Example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
108
|
+
* const accountInfo = await algodClient.accountInformation(address).do();
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2accountsaddress)
|
|
40
112
|
* @param account - The address of the account to look up.
|
|
113
|
+
* @category GET
|
|
41
114
|
*/
|
|
42
115
|
accountInformation(account) {
|
|
43
116
|
return new AccountInformation(this.c, this.intDecoding, account);
|
|
44
117
|
}
|
|
45
118
|
/**
|
|
46
119
|
* Gets the block info for the given round.
|
|
120
|
+
*
|
|
121
|
+
* #### Example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const roundNumber = 18038133;
|
|
124
|
+
* const block = await algodClient.block(roundNumber).do();
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2blocksround)
|
|
47
128
|
* @param roundNumber - The round number of the block to get.
|
|
129
|
+
* @category GET
|
|
48
130
|
*/
|
|
49
131
|
block(roundNumber) {
|
|
50
132
|
return new Block(this.c, roundNumber);
|
|
51
133
|
}
|
|
52
134
|
/**
|
|
53
135
|
* Returns the transaction information for a specific pending transaction.
|
|
136
|
+
*
|
|
137
|
+
* #### Example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const txId = "DRJS6R745A7GFVMXEXWP4TGVDGKW7VILFTA7HC2BR2GRLHNY5CTA";
|
|
140
|
+
* const pending = await algodClient.pendingTransactionInformation(txId).do();
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2transactionspendingtxid)
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* <br><br>
|
|
147
|
+
* There are several cases when this might succeed:
|
|
148
|
+
* - transaction committed (committed round > 0)
|
|
149
|
+
* - transaction still in the pool (committed round = 0, pool error = "")
|
|
150
|
+
* - transaction removed from pool due to error (committed round = 0, pool error != "")
|
|
151
|
+
*
|
|
152
|
+
* Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error.
|
|
153
|
+
*
|
|
54
154
|
* @param txid - The TxID string of the pending transaction to look up.
|
|
155
|
+
* @category GET
|
|
55
156
|
*/
|
|
56
157
|
pendingTransactionInformation(txid) {
|
|
57
158
|
return new PendingTransactionInformation(this.c, txid);
|
|
58
159
|
}
|
|
59
160
|
/**
|
|
60
|
-
* Returns
|
|
161
|
+
* Returns the list of pending transactions in the pool, sorted by priority, in decreasing order, truncated at the end at MAX.
|
|
162
|
+
* If MAX = 0, returns all pending transactions.
|
|
163
|
+
*
|
|
164
|
+
* #### Example 1
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const pendingTxns = await algodClient.pendingTransactionsInformation().do();
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* #### Example 2
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const maxTxns = 5;
|
|
172
|
+
* const pendingTxns = await algodClient
|
|
173
|
+
* .pendingTransactionsInformation()
|
|
174
|
+
* .max(maxTxns)
|
|
175
|
+
* .do();
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2transactionspending)
|
|
179
|
+
* @category GET
|
|
61
180
|
*/
|
|
62
181
|
pendingTransactionsInformation() {
|
|
63
182
|
return new PendingTransactions(this.c);
|
|
64
183
|
}
|
|
65
184
|
/**
|
|
66
|
-
* Returns
|
|
185
|
+
* Returns the list of pending transactions sent by the address, sorted by priority, in decreasing order, truncated at the end at MAX.
|
|
186
|
+
* If MAX = 0, returns all pending transactions.
|
|
187
|
+
*
|
|
188
|
+
* #### Example 1
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
191
|
+
* const pendingTxnsByAddr = await algodClient.pendingTransactionByAddress(address).do();
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* #### Example 2
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const maxTxns = 5;
|
|
197
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
198
|
+
* const pendingTxns = await algodClient
|
|
199
|
+
* .pendingTransactionByAddress(address)
|
|
200
|
+
* .max(maxTxns)
|
|
201
|
+
* .do();
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2accountsaddresstransactionspending)
|
|
67
205
|
* @param address - The address of the sender.
|
|
206
|
+
* @category GET
|
|
68
207
|
*/
|
|
69
208
|
pendingTransactionByAddress(address) {
|
|
70
209
|
return new PendingTransactionsByAddress(this.c, address);
|
|
71
210
|
}
|
|
72
211
|
/**
|
|
73
212
|
* Retrieves the StatusResponse from the running node.
|
|
213
|
+
*
|
|
214
|
+
* #### Example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* const status = await algodClient.status().do();
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2status)
|
|
220
|
+
* @category GET
|
|
74
221
|
*/
|
|
75
222
|
status() {
|
|
76
223
|
return new Status(this.c, this.intDecoding);
|
|
77
224
|
}
|
|
78
225
|
/**
|
|
79
|
-
* Waits for a specific round to occur then returns the StatusResponse for that round.
|
|
226
|
+
* Waits for a specific round to occur then returns the `StatusResponse` for that round.
|
|
227
|
+
*
|
|
228
|
+
* #### Example
|
|
229
|
+
* ```typescript
|
|
230
|
+
* const round = 18038133;
|
|
231
|
+
* const statusAfterBlock = await algodClient.statusAfterBlock(round).do();
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2statuswait-for-block-afterround)
|
|
80
235
|
* @param round - The number of the round to wait for.
|
|
236
|
+
* @category GET
|
|
81
237
|
*/
|
|
82
238
|
statusAfterBlock(round) {
|
|
83
239
|
return new StatusAfterBlock(this.c, this.intDecoding, round);
|
|
84
240
|
}
|
|
85
241
|
/**
|
|
86
242
|
* Returns the common needed parameters for a new transaction.
|
|
243
|
+
*
|
|
244
|
+
* #### Example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* const suggestedParams = await algodClient.getTransactionParams().do();
|
|
247
|
+
* const amountInMicroAlgos = algosdk.algosToMicroalgos(2); // 2 Algos
|
|
248
|
+
* const unsignedTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
|
|
249
|
+
* from: senderAddress,
|
|
250
|
+
* to: receiverAddress,
|
|
251
|
+
* amount: amountInMicroAlgos,
|
|
252
|
+
* suggestedParams: suggestedParams,
|
|
253
|
+
* });
|
|
254
|
+
* ```
|
|
255
|
+
*
|
|
256
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2transactionsparams)
|
|
257
|
+
*
|
|
258
|
+
* @remarks
|
|
259
|
+
* Often used with
|
|
260
|
+
* {@linkcode makePaymentTxnWithSuggestedParamsFromObject}, {@linkcode algosToMicroalgos}
|
|
261
|
+
* @category GET
|
|
87
262
|
*/
|
|
88
263
|
getTransactionParams() {
|
|
89
264
|
return new SuggestedParams(this.c);
|
|
90
265
|
}
|
|
91
266
|
/**
|
|
92
|
-
*
|
|
267
|
+
* Returns the supply details for the specified node's ledger.
|
|
268
|
+
*
|
|
269
|
+
* #### Example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* const supplyDetails = await algodClient.supply().do();
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2ledgersupply)
|
|
275
|
+
* @category GET
|
|
93
276
|
*/
|
|
94
277
|
supply() {
|
|
95
278
|
return new Supply(this.c, this.intDecoding);
|
|
96
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* Compiles TEAL source code to binary, returns base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style).
|
|
282
|
+
*
|
|
283
|
+
* #### Example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* const source = "TEAL SOURCE CODE";
|
|
286
|
+
* const compiledSmartContract = await algodClient.compile(source).do();
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2tealcompile)
|
|
290
|
+
* @remarks
|
|
291
|
+
* This endpoint is only enabled when a node's configuration file sets `EnableDeveloperAPI` to true.
|
|
292
|
+
* @param source
|
|
293
|
+
* @category POST
|
|
294
|
+
*/
|
|
97
295
|
compile(source) {
|
|
98
296
|
return new Compile(this.c, source);
|
|
99
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Provides debugging information for a transaction (or group).
|
|
300
|
+
*
|
|
301
|
+
* 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.
|
|
302
|
+
*
|
|
303
|
+
* #### Example
|
|
304
|
+
* ```typescript
|
|
305
|
+
* const dryRunResult = await algodClient.dryrun(dr).do();
|
|
306
|
+
* ```
|
|
307
|
+
*
|
|
308
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2tealdryrun)
|
|
309
|
+
* @param dr
|
|
310
|
+
* @category POST
|
|
311
|
+
*/
|
|
100
312
|
dryrun(dr) {
|
|
101
313
|
return new Dryrun(this.c, dr);
|
|
102
314
|
}
|
|
103
315
|
/**
|
|
104
316
|
* Given an asset ID, return asset information including creator, name, total supply and
|
|
105
317
|
* special addresses.
|
|
318
|
+
*
|
|
319
|
+
* #### Example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* const asset_id = 163650;
|
|
322
|
+
* const asset = await algodClient.getAssetByID(asset_id).do();
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2assetsasset-id)
|
|
106
326
|
* @param index - The asset ID to look up.
|
|
327
|
+
* @category GET
|
|
107
328
|
*/
|
|
108
329
|
getAssetByID(index) {
|
|
109
330
|
return new GetAssetByID(this.c, this.intDecoding, index);
|
|
110
331
|
}
|
|
111
332
|
/**
|
|
112
|
-
* Given an application ID,
|
|
333
|
+
* Given an application ID, return the application information including creator, approval
|
|
113
334
|
* and clear programs, global and local schemas, and global state.
|
|
335
|
+
*
|
|
336
|
+
* #### Example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* const index = 60553466;
|
|
339
|
+
* const app = await algodClient.getApplicationByID(index).do();
|
|
340
|
+
* ```
|
|
341
|
+
*
|
|
342
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2applicationsapplication-id)
|
|
114
343
|
* @param index - The application ID to look up.
|
|
344
|
+
* @category GET
|
|
115
345
|
*/
|
|
116
346
|
getApplicationByID(index) {
|
|
117
347
|
return new GetApplicationByID(this.c, this.intDecoding, index);
|
|
118
348
|
}
|
|
119
349
|
/**
|
|
120
350
|
* Returns the entire genesis file.
|
|
351
|
+
*
|
|
352
|
+
* #### Example
|
|
353
|
+
* ```typescript
|
|
354
|
+
* const genesis = await algodClient.genesis().do();
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-genesis)
|
|
358
|
+
* @category GET
|
|
121
359
|
*/
|
|
122
360
|
genesis() {
|
|
123
361
|
return new Genesis(this.c, this.intDecoding);
|
|
124
362
|
}
|
|
125
363
|
/**
|
|
126
|
-
*
|
|
364
|
+
* Returns a Merkle proof for a given transaction in a block.
|
|
365
|
+
*
|
|
366
|
+
* #### Example
|
|
367
|
+
* ```typescript
|
|
368
|
+
* const round = 18038133;
|
|
369
|
+
* const txId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA";
|
|
370
|
+
* const proof = await algodClient.getProof(round, txId).do();
|
|
371
|
+
* ```
|
|
372
|
+
*
|
|
373
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2blocksroundtransactionstxidproof)
|
|
127
374
|
* @param round - The round in which the transaction appears.
|
|
128
375
|
* @param txID - The transaction ID for which to generate a proof.
|
|
376
|
+
* @category GET
|
|
129
377
|
*/
|
|
130
378
|
getProof(round, txID) {
|
|
131
379
|
return new Proof(this.c, this.intDecoding, round, txID);
|