@algorandfoundation/algokit-utils 6.0.0-beta.3 → 6.0.0-beta.5
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/account.d.ts +33 -1
- package/account/account.d.ts.map +1 -1
- package/account/account.js +63 -0
- package/account/account.js.map +1 -1
- package/account/account.mjs +62 -1
- package/account/account.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/index.mjs +3 -2
- package/index.mjs.map +1 -1
- package/indexer-lookup.d.ts +11 -2
- package/indexer-lookup.d.ts.map +1 -1
- package/indexer-lookup.js +33 -1
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs +33 -2
- package/indexer-lookup.mjs.map +1 -1
- package/package.json +1 -1
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -1
- package/testing/fixtures/algorand-fixture.js +15 -2
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +15 -2
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/types/account-manager.d.ts +211 -0
- package/types/account-manager.d.ts.map +1 -0
- package/types/account-manager.js +265 -0
- package/types/account-manager.js.map +1 -0
- package/types/account-manager.mjs +263 -0
- package/types/account-manager.mjs.map +1 -0
- package/types/account.d.ts +19 -0
- package/types/account.d.ts.map +1 -1
- package/types/account.js.map +1 -1
- package/types/account.mjs.map +1 -1
- package/types/algorand-client.d.ts +183 -0
- package/types/algorand-client.d.ts.map +1 -0
- package/types/algorand-client.js +296 -0
- package/types/algorand-client.js.map +1 -0
- package/types/algorand-client.mjs +291 -0
- package/types/algorand-client.mjs.map +1 -0
- package/types/client-manager.d.ts +99 -0
- package/types/client-manager.d.ts.map +1 -0
- package/types/client-manager.js +99 -0
- package/types/client-manager.js.map +1 -0
- package/types/client-manager.mjs +97 -0
- package/types/client-manager.mjs.map +1 -0
- package/types/composer.d.ts +331 -0
- package/types/composer.d.ts.map +1 -0
- package/types/composer.js +446 -0
- package/types/composer.js.map +1 -0
- package/types/composer.mjs +444 -0
- package/types/composer.mjs.map +1 -0
- package/types/indexer.d.ts +39 -0
- package/types/indexer.d.ts.map +1 -1
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs.map +1 -1
- package/types/network-client.d.ts +2 -2
- package/types/network-client.d.ts.map +1 -1
- package/types/testing.d.ts +8 -2
- package/types/testing.d.ts.map +1 -1
- package/types/transaction.d.ts +4 -0
- package/types/transaction.d.ts.map +1 -1
package/account/account.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
|
-
import { MultisigAccount, SigningAccount, TransactionSignerAccount } from '../types/account';
|
|
2
|
+
import { AccountAssetInformation, AccountInformation, MultisigAccount, SigningAccount, TransactionSignerAccount } from '../types/account';
|
|
3
3
|
import { AlgoAmount } from '../types/amount';
|
|
4
4
|
import { SendTransactionFrom } from '../types/transaction';
|
|
5
5
|
import Account = algosdk.Account;
|
|
@@ -78,4 +78,36 @@ export declare function getAccountAddressAsUint8Array(account: SendTransactionFr
|
|
|
78
78
|
* @param addressEncodedInB64 The base64 encoded version of the underlying byte array of the address public key
|
|
79
79
|
*/
|
|
80
80
|
export declare function getAccountAddressAsString(addressEncodedInB64: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the given sender account's current status, balance and spendable amounts.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
87
|
+
* const accountInfo = await account.getInformation(address, algod);
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
91
|
+
* @param sender The address of the sender/account to look up
|
|
92
|
+
* @param algod The algod instance
|
|
93
|
+
* @returns The account information
|
|
94
|
+
*/
|
|
95
|
+
export declare function getAccountInformation(sender: string | SendTransactionFrom, algod: Algodv2): Promise<AccountInformation>;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the given sender account's asset holding for a given asset.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
102
|
+
* const assetId = 123345;
|
|
103
|
+
* const accountInfo = await account.getAccountAssetInformation(address, assetId, algod);
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)
|
|
107
|
+
* @param sender The address of the sender/account to look up
|
|
108
|
+
* @param assetId The ID of the asset to return a holding for
|
|
109
|
+
* @param algod The algod instance
|
|
110
|
+
* @returns The account asset holding information
|
|
111
|
+
*/
|
|
112
|
+
export declare function getAccountAssetInformation(sender: string | SendTransactionFrom, assetId: number | bigint, algod: Algodv2): Promise<AccountAssetInformation>;
|
|
81
113
|
//# sourceMappingURL=account.d.ts.map
|
package/account/account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AACzI,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAi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AAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAuB7H;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,GAAG,mBAAmB,EACpC,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,uBAAuB,CAAC,CASlC"}
|
package/account/account.js
CHANGED
|
@@ -9,6 +9,7 @@ var types_account = require('../types/account.js');
|
|
|
9
9
|
var getAccountConfigFromEnvironment = require('./get-account-config-from-environment.js');
|
|
10
10
|
var mnemonicAccount = require('./mnemonic-account.js');
|
|
11
11
|
|
|
12
|
+
var AccountInformationModel = algosdk.modelsv2.Account;
|
|
12
13
|
/**
|
|
13
14
|
* Returns an account wrapper that supports partial or full multisig signing.
|
|
14
15
|
* @param multisigParams The parameters that define the multisig account
|
|
@@ -109,9 +110,71 @@ function getAccountAddressAsUint8Array(account) {
|
|
|
109
110
|
function getAccountAddressAsString(addressEncodedInB64) {
|
|
110
111
|
return algosdk.encodeAddress(Buffer.from(addressEncodedInB64, 'base64'));
|
|
111
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns the given sender account's current status, balance and spendable amounts.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
119
|
+
* const accountInfo = await account.getInformation(address, algod);
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
123
|
+
* @param sender The address of the sender/account to look up
|
|
124
|
+
* @param algod The algod instance
|
|
125
|
+
* @returns The account information
|
|
126
|
+
*/
|
|
127
|
+
async function getAccountInformation(sender, algod) {
|
|
128
|
+
const account = AccountInformationModel.from_obj_for_encoding(await algod.accountInformation(typeof sender === 'string' ? sender : transaction.getSenderAddress(sender)).do());
|
|
129
|
+
return {
|
|
130
|
+
...account,
|
|
131
|
+
// None of these can practically overflow 2^53
|
|
132
|
+
amount: Number(account.amount),
|
|
133
|
+
amountWithoutPendingRewards: Number(account.amountWithoutPendingRewards),
|
|
134
|
+
minBalance: Number(account.minBalance),
|
|
135
|
+
pendingRewards: Number(account.pendingRewards),
|
|
136
|
+
rewards: Number(account.rewards),
|
|
137
|
+
round: Number(account.round),
|
|
138
|
+
totalAppsOptedIn: Number(account.totalAppsOptedIn),
|
|
139
|
+
totalAssetsOptedIn: Number(account.totalAssetsOptedIn),
|
|
140
|
+
totalCreatedApps: Number(account.totalCreatedApps),
|
|
141
|
+
totalCreatedAssets: Number(account.totalCreatedAssets),
|
|
142
|
+
appsTotalExtraPages: account.appsTotalExtraPages ? Number(account.appsTotalExtraPages) : undefined,
|
|
143
|
+
rewardBase: account.rewardBase ? Number(account.rewardBase) : undefined,
|
|
144
|
+
totalBoxBytes: account.totalBoxBytes ? Number(account.totalBoxBytes) : undefined,
|
|
145
|
+
totalBoxes: account.totalBoxes ? Number(account.totalBoxes) : undefined,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Returns the given sender account's asset holding for a given asset.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
154
|
+
* const assetId = 123345;
|
|
155
|
+
* const accountInfo = await account.getAccountAssetInformation(address, assetId, algod);
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)
|
|
159
|
+
* @param sender The address of the sender/account to look up
|
|
160
|
+
* @param assetId The ID of the asset to return a holding for
|
|
161
|
+
* @param algod The algod instance
|
|
162
|
+
* @returns The account asset holding information
|
|
163
|
+
*/
|
|
164
|
+
async function getAccountAssetInformation(sender, assetId, algod) {
|
|
165
|
+
const info = await algod.accountAssetInformation(typeof sender === 'string' ? sender : transaction.getSenderAddress(sender), Number(assetId)).do();
|
|
166
|
+
return {
|
|
167
|
+
assetId: BigInt(assetId),
|
|
168
|
+
balance: BigInt(info['asset-holding']['amount']),
|
|
169
|
+
frozen: info['asset-holding']['is-frozen'] === 'true',
|
|
170
|
+
round: BigInt(info['round']),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
112
173
|
|
|
113
174
|
exports.getAccountAddressAsString = getAccountAddressAsString;
|
|
114
175
|
exports.getAccountAddressAsUint8Array = getAccountAddressAsUint8Array;
|
|
176
|
+
exports.getAccountAssetInformation = getAccountAssetInformation;
|
|
177
|
+
exports.getAccountInformation = getAccountInformation;
|
|
115
178
|
exports.mnemonicAccountFromEnvironment = mnemonicAccountFromEnvironment;
|
|
116
179
|
exports.multisigAccount = multisigAccount;
|
|
117
180
|
exports.randomAccount = randomAccount;
|
package/account/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sources":["../../src/account/account.ts"],"sourcesContent":[null],"names":["MultisigAccount","SigningAccount","config","getAccountConfigFromEnvironment","mnemonicAccount","Config","isLocalNet","getOrCreateKmdWalletAccount","getSenderAddress"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"account.js","sources":["../../src/account/account.ts"],"sourcesContent":[null],"names":["MultisigAccount","SigningAccount","config","getAccountConfigFromEnvironment","mnemonicAccount","Config","isLocalNet","getOrCreateKmdWalletAccount","getSenderAddress"],"mappings":";;;;;;;;;;;AAUA,IAAO,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;AAOzD;;;;;AAKG;AACa,SAAA,eAAe,CAAC,cAAgC,EAAE,eAA6C,EAAA;AAC7G,IAAA,OAAO,IAAIA,6BAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC7D,CAAC;AAED;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C,KAAK,MAAM;AACrD,QAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC7B,CAAA;AACH;;;;;;;;;;;;"}
|
package/account/account.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { MultisigAccount, SigningAccount } from '../types/account.mjs';
|
|
|
7
7
|
import { getAccountConfigFromEnvironment } from './get-account-config-from-environment.mjs';
|
|
8
8
|
import { mnemonicAccount } from './mnemonic-account.mjs';
|
|
9
9
|
|
|
10
|
+
var AccountInformationModel = algosdk.modelsv2.Account;
|
|
10
11
|
/**
|
|
11
12
|
* Returns an account wrapper that supports partial or full multisig signing.
|
|
12
13
|
* @param multisigParams The parameters that define the multisig account
|
|
@@ -107,6 +108,66 @@ function getAccountAddressAsUint8Array(account) {
|
|
|
107
108
|
function getAccountAddressAsString(addressEncodedInB64) {
|
|
108
109
|
return algosdk.encodeAddress(Buffer.from(addressEncodedInB64, 'base64'));
|
|
109
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Returns the given sender account's current status, balance and spendable amounts.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
117
|
+
* const accountInfo = await account.getInformation(address, algod);
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
121
|
+
* @param sender The address of the sender/account to look up
|
|
122
|
+
* @param algod The algod instance
|
|
123
|
+
* @returns The account information
|
|
124
|
+
*/
|
|
125
|
+
async function getAccountInformation(sender, algod) {
|
|
126
|
+
const account = AccountInformationModel.from_obj_for_encoding(await algod.accountInformation(typeof sender === 'string' ? sender : getSenderAddress(sender)).do());
|
|
127
|
+
return {
|
|
128
|
+
...account,
|
|
129
|
+
// None of these can practically overflow 2^53
|
|
130
|
+
amount: Number(account.amount),
|
|
131
|
+
amountWithoutPendingRewards: Number(account.amountWithoutPendingRewards),
|
|
132
|
+
minBalance: Number(account.minBalance),
|
|
133
|
+
pendingRewards: Number(account.pendingRewards),
|
|
134
|
+
rewards: Number(account.rewards),
|
|
135
|
+
round: Number(account.round),
|
|
136
|
+
totalAppsOptedIn: Number(account.totalAppsOptedIn),
|
|
137
|
+
totalAssetsOptedIn: Number(account.totalAssetsOptedIn),
|
|
138
|
+
totalCreatedApps: Number(account.totalCreatedApps),
|
|
139
|
+
totalCreatedAssets: Number(account.totalCreatedAssets),
|
|
140
|
+
appsTotalExtraPages: account.appsTotalExtraPages ? Number(account.appsTotalExtraPages) : undefined,
|
|
141
|
+
rewardBase: account.rewardBase ? Number(account.rewardBase) : undefined,
|
|
142
|
+
totalBoxBytes: account.totalBoxBytes ? Number(account.totalBoxBytes) : undefined,
|
|
143
|
+
totalBoxes: account.totalBoxes ? Number(account.totalBoxes) : undefined,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Returns the given sender account's asset holding for a given asset.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
152
|
+
* const assetId = 123345;
|
|
153
|
+
* const accountInfo = await account.getAccountAssetInformation(address, assetId, algod);
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)
|
|
157
|
+
* @param sender The address of the sender/account to look up
|
|
158
|
+
* @param assetId The ID of the asset to return a holding for
|
|
159
|
+
* @param algod The algod instance
|
|
160
|
+
* @returns The account asset holding information
|
|
161
|
+
*/
|
|
162
|
+
async function getAccountAssetInformation(sender, assetId, algod) {
|
|
163
|
+
const info = await algod.accountAssetInformation(typeof sender === 'string' ? sender : getSenderAddress(sender), Number(assetId)).do();
|
|
164
|
+
return {
|
|
165
|
+
assetId: BigInt(assetId),
|
|
166
|
+
balance: BigInt(info['asset-holding']['amount']),
|
|
167
|
+
frozen: info['asset-holding']['is-frozen'] === 'true',
|
|
168
|
+
round: BigInt(info['round']),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
110
171
|
|
|
111
|
-
export { getAccountAddressAsString, getAccountAddressAsUint8Array, mnemonicAccountFromEnvironment, multisigAccount, randomAccount, rekeyedAccount, transactionSignerAccount };
|
|
172
|
+
export { getAccountAddressAsString, getAccountAddressAsUint8Array, getAccountAssetInformation, getAccountInformation, mnemonicAccountFromEnvironment, multisigAccount, randomAccount, rekeyedAccount, transactionSignerAccount };
|
|
112
173
|
//# sourceMappingURL=account.mjs.map
|
package/account/account.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.mjs","sources":["../../src/account/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"account.mjs","sources":["../../src/account/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAUA,IAAO,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;AAOzD;;;;;AAKG;AACa,SAAA,eAAe,CAAC,cAAgC,EAAE,eAA6C,EAAA;AAC7G,IAAA,OAAO,IAAI,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;AAKG;AACa,SAAA,cAAc,CAAC,MAAe,EAAE,MAAc,EAAA;AAC5D,IAAA,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;AAKG;AACa,SAAA,wBAAwB,CAAC,MAAyB,EAAE,MAAc,EAAA;AAChF,IAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACjC,CAAC;AAED;;;;AAIG;SACa,aAAa,GAAA;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AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,yBAAyB,CAAA"}
|
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var config = require('./config.js');
|
|
|
9
9
|
var dispenserClient = require('./dispenser-client.js');
|
|
10
10
|
var indexerLookup = require('./indexer-lookup.js');
|
|
11
11
|
var networkClient = require('./network-client.js');
|
|
12
|
+
var types_algorandClient = require('./types/algorand-client.js');
|
|
12
13
|
var account = require('./account/account.js');
|
|
13
14
|
var getAccount = require('./account/get-account.js');
|
|
14
15
|
var getAccountConfigFromEnvironment = require('./account/get-account-config-from-environment.js');
|
|
@@ -70,6 +71,7 @@ exports.getTestNetDispenserApiClient = dispenserClient.getTestNetDispenserApiCli
|
|
|
70
71
|
exports.executePaginatedRequest = indexerLookup.executePaginatedRequest;
|
|
71
72
|
exports.lookupAccountByAddress = indexerLookup.lookupAccountByAddress;
|
|
72
73
|
exports.lookupAccountCreatedApplicationByAddress = indexerLookup.lookupAccountCreatedApplicationByAddress;
|
|
74
|
+
exports.lookupAssetHoldings = indexerLookup.lookupAssetHoldings;
|
|
73
75
|
exports.lookupTransactionById = indexerLookup.lookupTransactionById;
|
|
74
76
|
exports.searchTransactions = indexerLookup.searchTransactions;
|
|
75
77
|
exports.getAlgoClient = networkClient.getAlgoClient;
|
|
@@ -82,8 +84,11 @@ exports.getDefaultLocalNetConfig = networkClient.getDefaultLocalNetConfig;
|
|
|
82
84
|
exports.getIndexerConfigFromEnvironment = networkClient.getIndexerConfigFromEnvironment;
|
|
83
85
|
exports.isMainNet = networkClient.isMainNet;
|
|
84
86
|
exports.isTestNet = networkClient.isTestNet;
|
|
87
|
+
exports.AlgorandClient = types_algorandClient.AlgorandClient;
|
|
85
88
|
exports.getAccountAddressAsString = account.getAccountAddressAsString;
|
|
86
89
|
exports.getAccountAddressAsUint8Array = account.getAccountAddressAsUint8Array;
|
|
90
|
+
exports.getAccountAssetInformation = account.getAccountAssetInformation;
|
|
91
|
+
exports.getAccountInformation = account.getAccountInformation;
|
|
87
92
|
exports.mnemonicAccountFromEnvironment = account.mnemonicAccountFromEnvironment;
|
|
88
93
|
exports.multisigAccount = account.multisigAccount;
|
|
89
94
|
exports.randomAccount = account.randomAccount;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/index.mjs
CHANGED
|
@@ -5,9 +5,10 @@ export { deployApp, getAppDeploymentTransactionNote, getCreatorAppsByName, isSch
|
|
|
5
5
|
export { assetBulkOptIn, assetBulkOptOut, assetOptIn, assetOptOut, createAsset } from './asset.mjs';
|
|
6
6
|
export { Config } from './config.mjs';
|
|
7
7
|
export { getTestNetDispenserApiClient } from './dispenser-client.mjs';
|
|
8
|
-
export { executePaginatedRequest, lookupAccountByAddress, lookupAccountCreatedApplicationByAddress, lookupTransactionById, searchTransactions } from './indexer-lookup.mjs';
|
|
8
|
+
export { executePaginatedRequest, lookupAccountByAddress, lookupAccountCreatedApplicationByAddress, lookupAssetHoldings, lookupTransactionById, searchTransactions } from './indexer-lookup.mjs';
|
|
9
9
|
export { getAlgoClient, getAlgoIndexerClient, getAlgoKmdClient, getAlgoNodeConfig, getAlgodConfigFromEnvironment, getConfigFromEnvOrDefaults, getDefaultLocalNetConfig, getIndexerConfigFromEnvironment, isMainNet, isTestNet } from './network-client.mjs';
|
|
10
|
-
export {
|
|
10
|
+
export { AlgorandClient } from './types/algorand-client.mjs';
|
|
11
|
+
export { getAccountAddressAsString, getAccountAddressAsUint8Array, getAccountAssetInformation, getAccountInformation, mnemonicAccountFromEnvironment, multisigAccount, randomAccount, rekeyedAccount, transactionSignerAccount } from './account/account.mjs';
|
|
11
12
|
export { getAccount } from './account/get-account.mjs';
|
|
12
13
|
export { getAccountConfigFromEnvironment } from './account/get-account-config-from-environment.mjs';
|
|
13
14
|
export { getDispenserAccount } from './account/get-dispenser-account.mjs';
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/indexer-lookup.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
2
|
import type SearchForTransactions from 'algosdk/dist/types/client/v2/indexer/searchForTransactions';
|
|
3
|
-
import { AccountLookupResult, ApplicationResult, TransactionLookupResult, TransactionSearchResults } from './types/indexer';
|
|
3
|
+
import { AccountLookupResult, ApplicationResult, LookupAssetHoldingsOptions, MiniAssetHolding, TransactionLookupResult, TransactionSearchResults } from './types/indexer';
|
|
4
4
|
import Indexer = algosdk.Indexer;
|
|
5
5
|
/**
|
|
6
6
|
* Looks up a transaction by ID using Indexer.
|
|
@@ -17,7 +17,7 @@ export declare function lookupTransactionById(transactionId: string, indexer: In
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function lookupAccountByAddress(accountAddress: string, indexer: Indexer): Promise<AccountLookupResult>;
|
|
19
19
|
/**
|
|
20
|
-
* Looks up applications that were created by the given address.
|
|
20
|
+
* Looks up applications that were created by the given address; will automatically paginate through all data.
|
|
21
21
|
* @param indexer An indexer instance
|
|
22
22
|
* @param address The address of the creator to look up
|
|
23
23
|
* @param getAll Whether or not to include deleted applications
|
|
@@ -25,6 +25,15 @@ export declare function lookupAccountByAddress(accountAddress: string, indexer:
|
|
|
25
25
|
* @returns The list of application results
|
|
26
26
|
*/
|
|
27
27
|
export declare function lookupAccountCreatedApplicationByAddress(indexer: Indexer, address: string, getAll?: boolean | undefined, paginationLimit?: number): Promise<ApplicationResult[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Looks up asset holdings for the given asset; will automatically paginate through all data.
|
|
30
|
+
* @param indexer An indexer instance
|
|
31
|
+
* @param assetId The ID of the asset to look up holdings for
|
|
32
|
+
* @param options Optional options to control the lookup
|
|
33
|
+
* @param paginationLimit The number of records to return per paginated request, default 1000
|
|
34
|
+
* @returns The list of application results
|
|
35
|
+
*/
|
|
36
|
+
export declare function lookupAssetHoldings(indexer: Indexer, assetId: number | bigint, options?: LookupAssetHoldingsOptions, paginationLimit?: number): Promise<MiniAssetHolding[]>;
|
|
28
37
|
/**
|
|
29
38
|
* Allows transactions to be searched for the given criteria.
|
|
30
39
|
* @param indexer An indexer client
|
package/indexer-lookup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer-lookup.d.ts","sourceRoot":"","sources":["../src/indexer-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,qBAAqB,MAAM,4DAA4D,CAAA;AACnG,OAAO,EACL,mBAAmB,EAEnB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"indexer-lookup.d.ts","sourceRoot":"","sources":["../src/indexer-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,qBAAqB,MAAM,4DAA4D,CAAA;AACnG,OAAO,EACL,mBAAmB,EAEnB,iBAAiB,EAEjB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAIhC;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAErH;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAEnH;AAED;;;;;;;GAOG;AACH,wBAAsB,wCAAwC,CAC5D,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,OAAO,GAAG,SAAqB,EACvC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAmB9B;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,CAAC,EAAE,0BAA0B,EACpC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAyB7B;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,qBAAqB,EACnE,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,wBAAwB,CAAC,CA0BnC;AAID,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,QAAQ,SAAS;IAAE,EAAE,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,EAEhG,YAAY,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,OAAO,EAAE,EAC1C,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,QAAQ,GAC7C,OAAO,CAAC,OAAO,EAAE,CAAC,CAoBpB"}
|
package/indexer-lookup.js
CHANGED
|
@@ -20,7 +20,7 @@ async function lookupAccountByAddress(accountAddress, indexer) {
|
|
|
20
20
|
return (await indexer.lookupAccountByID(accountAddress).do());
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Looks up applications that were created by the given address.
|
|
23
|
+
* Looks up applications that were created by the given address; will automatically paginate through all data.
|
|
24
24
|
* @param indexer An indexer instance
|
|
25
25
|
* @param address The address of the creator to look up
|
|
26
26
|
* @param getAll Whether or not to include deleted applications
|
|
@@ -44,6 +44,37 @@ async function lookupAccountCreatedApplicationByAddress(indexer, address, getAll
|
|
|
44
44
|
return s;
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Looks up asset holdings for the given asset; will automatically paginate through all data.
|
|
49
|
+
* @param indexer An indexer instance
|
|
50
|
+
* @param assetId The ID of the asset to look up holdings for
|
|
51
|
+
* @param options Optional options to control the lookup
|
|
52
|
+
* @param paginationLimit The number of records to return per paginated request, default 1000
|
|
53
|
+
* @returns The list of application results
|
|
54
|
+
*/
|
|
55
|
+
async function lookupAssetHoldings(indexer, assetId, options, paginationLimit) {
|
|
56
|
+
return await executePaginatedRequest((response) => {
|
|
57
|
+
if ('message' in response) {
|
|
58
|
+
throw { status: 404, ...response };
|
|
59
|
+
}
|
|
60
|
+
return response.balances;
|
|
61
|
+
}, (nextToken) => {
|
|
62
|
+
let s = indexer.lookupAssetBalances(Number(assetId)).limit(paginationLimit ?? DEFAULT_INDEXER_MAX_API_RESOURCES_PER_ACCOUNT);
|
|
63
|
+
if (options?.currencyGreaterThan) {
|
|
64
|
+
s = s.currencyGreaterThan(options.currencyGreaterThan);
|
|
65
|
+
}
|
|
66
|
+
if (options?.currencyLessThan) {
|
|
67
|
+
s = s.currencyLessThan(options.currencyLessThan);
|
|
68
|
+
}
|
|
69
|
+
if (options?.includeAll) {
|
|
70
|
+
s = s.includeAll(options.includeAll);
|
|
71
|
+
}
|
|
72
|
+
if (nextToken) {
|
|
73
|
+
s = s.nextToken(nextToken);
|
|
74
|
+
}
|
|
75
|
+
return s;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
47
78
|
/**
|
|
48
79
|
* Allows transactions to be searched for the given criteria.
|
|
49
80
|
* @param indexer An indexer client
|
|
@@ -101,6 +132,7 @@ extractItems, buildRequest) {
|
|
|
101
132
|
exports.executePaginatedRequest = executePaginatedRequest;
|
|
102
133
|
exports.lookupAccountByAddress = lookupAccountByAddress;
|
|
103
134
|
exports.lookupAccountCreatedApplicationByAddress = lookupAccountCreatedApplicationByAddress;
|
|
135
|
+
exports.lookupAssetHoldings = lookupAssetHoldings;
|
|
104
136
|
exports.lookupTransactionById = lookupTransactionById;
|
|
105
137
|
exports.searchTransactions = searchTransactions;
|
|
106
138
|
//# sourceMappingURL=indexer-lookup.js.map
|
package/indexer-lookup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer-lookup.js","sources":["../src/indexer-lookup.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"indexer-lookup.js","sources":["../src/indexer-lookup.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAcA,MAAM,6CAA6C,GAAG,IAAI,CAAA;AAE1D;;;;;AAKG;AACI,eAAe,qB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AC,SAAS,KAAI;AACZ,QAAA,IAAI,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,IAAI,6CAA6C,CAAC,CAAA;QAC/H,IAAI,SAAS,EAAE;AACb,YAAA,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;SAC3B;AACD,QAAA,OAAO,CAAC,CAAA;AACV,KAAC,CACF,CAAA;IAED,OAAO;AACL,QAAA,eAAe,EAAE,YAAY;AAC7B,QAAA,YAAY,EAAE,EAAE;AAChB,QAAA,YAAY,EAAE,YAAY;KAC3B,CAAA;AACH,CAAC;AAED;AACA;AACO,eAAe,uBAAuB;AAC3C;AACA,YAA0C,EAC1C,YAA8C,EAAA;IAE9C,MAAM,OAAO,GAAG,EAAE,CAAA;IAElB,IAAI,SAAS,GAAuB,SAAS,CAAA;;IAE7C,OAAO,IAAI,EAAE;AACX,QAAA,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;AACvC,QAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,EAAE,EAAE,CAAA;AACnC,QAAA,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;QACpC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACvC,MAAK;SACN;AACD,QAAA,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;QAClC,IAAI,CAAC,SAAS,EAAE;YACd,MAAK;SACN;KACF;AAED,IAAA,OAAO,OAAO,CAAA;AAChB;;;;;;;;;"}
|
package/indexer-lookup.mjs
CHANGED
|
@@ -18,7 +18,7 @@ async function lookupAccountByAddress(accountAddress, indexer) {
|
|
|
18
18
|
return (await indexer.lookupAccountByID(accountAddress).do());
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Looks up applications that were created by the given address.
|
|
21
|
+
* Looks up applications that were created by the given address; will automatically paginate through all data.
|
|
22
22
|
* @param indexer An indexer instance
|
|
23
23
|
* @param address The address of the creator to look up
|
|
24
24
|
* @param getAll Whether or not to include deleted applications
|
|
@@ -42,6 +42,37 @@ async function lookupAccountCreatedApplicationByAddress(indexer, address, getAll
|
|
|
42
42
|
return s;
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Looks up asset holdings for the given asset; will automatically paginate through all data.
|
|
47
|
+
* @param indexer An indexer instance
|
|
48
|
+
* @param assetId The ID of the asset to look up holdings for
|
|
49
|
+
* @param options Optional options to control the lookup
|
|
50
|
+
* @param paginationLimit The number of records to return per paginated request, default 1000
|
|
51
|
+
* @returns The list of application results
|
|
52
|
+
*/
|
|
53
|
+
async function lookupAssetHoldings(indexer, assetId, options, paginationLimit) {
|
|
54
|
+
return await executePaginatedRequest((response) => {
|
|
55
|
+
if ('message' in response) {
|
|
56
|
+
throw { status: 404, ...response };
|
|
57
|
+
}
|
|
58
|
+
return response.balances;
|
|
59
|
+
}, (nextToken) => {
|
|
60
|
+
let s = indexer.lookupAssetBalances(Number(assetId)).limit(paginationLimit ?? DEFAULT_INDEXER_MAX_API_RESOURCES_PER_ACCOUNT);
|
|
61
|
+
if (options?.currencyGreaterThan) {
|
|
62
|
+
s = s.currencyGreaterThan(options.currencyGreaterThan);
|
|
63
|
+
}
|
|
64
|
+
if (options?.currencyLessThan) {
|
|
65
|
+
s = s.currencyLessThan(options.currencyLessThan);
|
|
66
|
+
}
|
|
67
|
+
if (options?.includeAll) {
|
|
68
|
+
s = s.includeAll(options.includeAll);
|
|
69
|
+
}
|
|
70
|
+
if (nextToken) {
|
|
71
|
+
s = s.nextToken(nextToken);
|
|
72
|
+
}
|
|
73
|
+
return s;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
45
76
|
/**
|
|
46
77
|
* Allows transactions to be searched for the given criteria.
|
|
47
78
|
* @param indexer An indexer client
|
|
@@ -96,5 +127,5 @@ extractItems, buildRequest) {
|
|
|
96
127
|
return results;
|
|
97
128
|
}
|
|
98
129
|
|
|
99
|
-
export { executePaginatedRequest, lookupAccountByAddress, lookupAccountCreatedApplicationByAddress, lookupTransactionById, searchTransactions };
|
|
130
|
+
export { executePaginatedRequest, lookupAccountByAddress, lookupAccountCreatedApplicationByAddress, lookupAssetHoldings, lookupTransactionById, searchTransactions };
|
|
100
131
|
//# sourceMappingURL=indexer-lookup.mjs.map
|
package/indexer-lookup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer-lookup.mjs","sources":["../src/indexer-lookup.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexer-lookup.mjs","sources":["../src/indexer-lookup.ts"],"sourcesContent":[null],"names":[],"mappings":"AAcA,MAAM,6CAA6C,GAAG,IAAI,CAAA;AAE1D;;;;;AAKG;AACI,eAAe,qBAAqB,CAAC,aAAqB,EAAE,OAAgB,EAAA;AACjF,IAAA,QAAQ,MAAM,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,EAAE,EAAE,EAA4B;AAC7F,CAAC;AAED;;;;;AAKG;AACI,eAAe,sBAAsB,CAAC,cAAsB,EAAE,OAAgB,EAAA;AACnF,IAAA,QAAQ,MAAM,OAAO,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,EAAE,EAAE,EAAwB;AACtF,CAAC;AAED;;;;;;;AAOG;AACI,eAAe,wCAAwC,CAC5D,OAAgB,EAChB,OAAe,EACf,MAAA,GAA8B,SAAS,EACvC,eAAwB,EAAA;AAExB,IAAA,OAAO,MAAM,uBAAuB,CAClC,CAAC,QAA8D,KAAI;AACjE,QAAA,IAAI,SAAS,IAAI,QAAQ,EAAE;YACzB,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAA;SACnC;QACD,OAAO,QAAQ,CAAC,Y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Y,CAAC,SAAS,CAAC,CAAA;AACvC,QAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,EAAE,EAAE,CAAA;AACnC,QAAA,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;QACpC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACvC,MAAK;SACN;AACD,QAAA,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;QAClC,IAAI,CAAC,SAAS,EAAE;YACd,MAAK;SACN;KACF;AAED,IAAA,OAAO,OAAO,CAAA;AAChB;;;;"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-utils",
|
|
9
|
-
"version": "6.0.0-beta.
|
|
9
|
+
"version": "6.0.0-beta.5",
|
|
10
10
|
"private": false,
|
|
11
11
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
12
12
|
"author": "Algorand Foundation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-fixture.d.ts","sourceRoot":"","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"algorand-fixture.d.ts","sourceRoot":"","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAuD,MAAM,qBAAqB,CAAA;AAKjI;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAAC,aAAa,CAAC,EAAE,qBAAqB,GAAG,eAAe,CAAA;AAEvF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,qBAAqB,GAAG,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,eAAe,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var types_algorandClient = require('../../types/algorand-client.js');
|
|
3
4
|
var account = require('../account.js');
|
|
4
5
|
var indexer = require('../indexer.js');
|
|
5
6
|
var transactionLogger = require('../transaction-logger.js');
|
|
@@ -37,16 +38,25 @@ function algorandFixture(fixtureConfig, config$1) {
|
|
|
37
38
|
const indexer$1 = fixtureConfig?.indexer ?? networkClient.getAlgoIndexerClient(config$1.indexerConfig);
|
|
38
39
|
const kmd = fixtureConfig?.kmd ?? networkClient.getAlgoKmdClient(config$1.kmdConfig);
|
|
39
40
|
let context;
|
|
41
|
+
let algorandClient;
|
|
40
42
|
const beforeEach = async () => {
|
|
41
43
|
config.Config.configure({ debug: true });
|
|
42
44
|
const transactionLogger$1 = new transactionLogger.TransactionLogger();
|
|
43
45
|
const transactionLoggerAlgod = transactionLogger$1.capture(algod);
|
|
46
|
+
const acc = await account.getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? amount.algos(10), suppressLog: true }, transactionLoggerAlgod, kmd);
|
|
47
|
+
algorandClient = algorandClient ?? types_algorandClient.AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer: indexer$1, kmd });
|
|
48
|
+
algorandClient.setSignerFromAccount(acc).setDefaultValidityWindow(1000).setSuggestedParamsTimeout(0);
|
|
49
|
+
const testAccount = { ...acc, signer: algorandClient.account.getSigner(acc.addr) };
|
|
44
50
|
context = {
|
|
45
51
|
algod: transactionLoggerAlgod,
|
|
46
52
|
indexer: indexer$1,
|
|
47
53
|
kmd: kmd,
|
|
48
|
-
testAccount
|
|
49
|
-
generateAccount: (params) =>
|
|
54
|
+
testAccount,
|
|
55
|
+
generateAccount: async (params) => {
|
|
56
|
+
const account$1 = await account.getTestAccount(params, transactionLoggerAlgod, kmd);
|
|
57
|
+
algorandClient.setSignerFromAccount(account$1);
|
|
58
|
+
return { ...account$1, signer: algorandClient.account.getSigner(account$1.addr) };
|
|
59
|
+
},
|
|
50
60
|
transactionLogger: transactionLogger$1,
|
|
51
61
|
waitForIndexer: () => transactionLogger$1.waitForIndexer(indexer$1),
|
|
52
62
|
waitForIndexerTransaction: (transactionId) => indexer.runWhenIndexerCaughtUp(() => indexerLookup.lookupTransactionById(transactionId, indexer$1)),
|
|
@@ -56,6 +66,9 @@ function algorandFixture(fixtureConfig, config$1) {
|
|
|
56
66
|
get context() {
|
|
57
67
|
return context;
|
|
58
68
|
},
|
|
69
|
+
get algorand() {
|
|
70
|
+
return algorandClient;
|
|
71
|
+
},
|
|
59
72
|
beforeEach,
|
|
60
73
|
};
|
|
61
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-fixture.js","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":[null],"names":["config","getConfigFromEnvOrDefaults","getAlgoClient","indexer","getAlgoIndexerClient","getAlgoKmdClient","Config","transactionLogger","TransactionLogger","getTestAccount","algos","runWhenIndexerCaughtUp","lookupTransactionById"],"mappings":"
|
|
1
|
+
{"version":3,"file":"algorand-fixture.js","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":[null],"names":["config","getConfigFromEnvOrDefaults","getAlgoClient","indexer","getAlgoIndexerClient","getAlgoKmdClient","Config","transactionLogger","TransactionLogger","getTestAccount","algos","AlgorandClient","account","runWhenIndexerCaughtUp","lookupTransactionById"],"mappings":";;;;;;;;;;;AAiEA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACa,SAAA,eAAe,CAAC,aAAqC,EAAEA,QAAmB,EAAA;AACxF,IAAAA,QAAM,GAAGA,QAAM,IAAIC,wCAA0B,EAAE,CAAA;AAE/C,IAAA,MAAM,KAAK,GAAG,aAAa,EAAE,KAAK,IAAIC,2BAAa,CAACF,QAAM,CAAC,WAAW,CAAC,CAA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,EAAE,OAAO,MAA4B,KAAI;gBACtD,MAAMS,SAAO,GAAG,MAAMH,sBAAc,CAAC,MAAM,EAAE,sBAAsB,EAAE,GAAG,CAAC,CAAA;AACzE,gBAAA,cAAc,CAAC,oBAAoB,CAACG,SAAO,CAAC,CAAA;AAC5C,gBAAA,OAAO,EAAE,GAAGA,SAAO,EAAE,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,SAAS,CAACA,SAAO,CAAC,IAAI,CAAC,EAAE,CAAA;aAC9E;AACD,YAAA,iBAAiB,EAAEL,mBAAiB;YACpC,cAAc,EAAE,MAAMA,mBAAiB,CAAC,cAAc,CAACJ,SAAO,CAAC;AAC/D,YAAA,yBAAyB,EAAE,CAAC,aAAqB,KAAKU,8BAAsB,CAAC,MAAMC,mCAAqB,CAAC,aAAa,EAAEX,SAAO,CAAC,CAAC;SAClI,CAAA;AACH,KAAC,CAAA;IAED,OAAO;AACL,QAAA,IAAI,OAAO,GAAA;AACT,YAAA,OAAO,OAAO,CAAA;SACf;AACD,QAAA,IAAI,QAAQ,GAAA;AACV,YAAA,OAAO,cAAc,CAAA;SACtB;QACD,UAAU;KACX,CAAA;AACH;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AlgorandClient } from '../../types/algorand-client.mjs';
|
|
1
2
|
import { getTestAccount } from '../account.mjs';
|
|
2
3
|
import { runWhenIndexerCaughtUp } from '../indexer.mjs';
|
|
3
4
|
import { TransactionLogger } from '../transaction-logger.mjs';
|
|
@@ -35,16 +36,25 @@ function algorandFixture(fixtureConfig, config) {
|
|
|
35
36
|
const indexer = fixtureConfig?.indexer ?? getAlgoIndexerClient(config.indexerConfig);
|
|
36
37
|
const kmd = fixtureConfig?.kmd ?? getAlgoKmdClient(config.kmdConfig);
|
|
37
38
|
let context;
|
|
39
|
+
let algorandClient;
|
|
38
40
|
const beforeEach = async () => {
|
|
39
41
|
Config.configure({ debug: true });
|
|
40
42
|
const transactionLogger = new TransactionLogger();
|
|
41
43
|
const transactionLoggerAlgod = transactionLogger.capture(algod);
|
|
44
|
+
const acc = await getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? algos(10), suppressLog: true }, transactionLoggerAlgod, kmd);
|
|
45
|
+
algorandClient = algorandClient ?? AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer, kmd });
|
|
46
|
+
algorandClient.setSignerFromAccount(acc).setDefaultValidityWindow(1000).setSuggestedParamsTimeout(0);
|
|
47
|
+
const testAccount = { ...acc, signer: algorandClient.account.getSigner(acc.addr) };
|
|
42
48
|
context = {
|
|
43
49
|
algod: transactionLoggerAlgod,
|
|
44
50
|
indexer: indexer,
|
|
45
51
|
kmd: kmd,
|
|
46
|
-
testAccount
|
|
47
|
-
generateAccount: (params) =>
|
|
52
|
+
testAccount,
|
|
53
|
+
generateAccount: async (params) => {
|
|
54
|
+
const account = await getTestAccount(params, transactionLoggerAlgod, kmd);
|
|
55
|
+
algorandClient.setSignerFromAccount(account);
|
|
56
|
+
return { ...account, signer: algorandClient.account.getSigner(account.addr) };
|
|
57
|
+
},
|
|
48
58
|
transactionLogger: transactionLogger,
|
|
49
59
|
waitForIndexer: () => transactionLogger.waitForIndexer(indexer),
|
|
50
60
|
waitForIndexerTransaction: (transactionId) => runWhenIndexerCaughtUp(() => lookupTransactionById(transactionId, indexer)),
|
|
@@ -54,6 +64,9 @@ function algorandFixture(fixtureConfig, config) {
|
|
|
54
64
|
get context() {
|
|
55
65
|
return context;
|
|
56
66
|
},
|
|
67
|
+
get algorand() {
|
|
68
|
+
return algorandClient;
|
|
69
|
+
},
|
|
57
70
|
beforeEach,
|
|
58
71
|
};
|
|
59
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-fixture.mjs","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"algorand-fixture.mjs","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesCont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