@algorandfoundation/algokit-utils 6.2.1-beta.1 → 6.3.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/account/account.d.ts +13 -5
- package/account/account.d.ts.map +1 -1
- package/account/account.js +26 -6
- package/account/account.js.map +1 -1
- package/account/account.mjs +26 -6
- package/account/account.mjs.map +1 -1
- package/account/get-account.d.ts +4 -4
- package/account/get-account.js +2 -2
- package/account/get-account.mjs +2 -2
- package/amount.d.ts +28 -6
- package/amount.d.ts.map +1 -1
- package/amount.js +31 -11
- package/amount.js.map +1 -1
- package/amount.mjs +30 -12
- package/amount.mjs.map +1 -1
- package/asset.d.ts +10 -0
- package/asset.d.ts.map +1 -1
- package/asset.js +71 -198
- package/asset.js.map +1 -1
- package/asset.mjs +72 -199
- package/asset.mjs.map +1 -1
- package/dispenser-client.d.ts +1 -1
- package/dispenser-client.js +2 -2
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs +2 -2
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +4 -3
- package/index.d.ts.map +1 -1
- package/index.js +11 -8
- package/index.js.map +1 -1
- package/index.mjs +6 -4
- package/index.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.d.ts +1 -1
- package/localnet/get-or-create-kmd-wallet-account.js +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs +1 -1
- package/package.json +3 -2
- package/testing/_asset.d.ts +2 -4
- package/testing/_asset.d.ts.map +1 -1
- package/testing/account.js +8 -2
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +8 -2
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +1 -1
- package/testing/fixtures/algorand-fixture.js +7 -2
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +7 -2
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/transaction/legacy-bridge.d.ts +10 -0
- package/transaction/legacy-bridge.d.ts.map +1 -0
- package/transaction/legacy-bridge.js +35 -0
- package/transaction/legacy-bridge.js.map +1 -0
- package/transaction/legacy-bridge.mjs +33 -0
- package/transaction/legacy-bridge.mjs.map +1 -0
- package/transaction/transaction.d.ts +1 -1
- package/transaction/transaction.js +5 -5
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +5 -5
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/transfer-algos.d.ts +4 -2
- package/transfer/transfer-algos.d.ts.map +1 -1
- package/transfer/transfer-algos.js +13 -22
- package/transfer/transfer-algos.js.map +1 -1
- package/transfer/transfer-algos.mjs +14 -23
- package/transfer/transfer-algos.mjs.map +1 -1
- package/transfer/transfer.d.ts +8 -1
- package/transfer/transfer.d.ts.map +1 -1
- package/transfer/transfer.js +57 -94
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs +58 -95
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +141 -24
- package/types/account-manager.d.ts.map +1 -1
- package/types/account-manager.js +217 -44
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +216 -43
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +122 -7
- 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-transaction-creator.d.ts +289 -0
- package/types/algorand-client-transaction-creator.d.ts.map +1 -0
- package/types/algorand-client-transaction-creator.js +299 -0
- package/types/algorand-client-transaction-creator.js.map +1 -0
- package/types/algorand-client-transaction-creator.mjs +297 -0
- package/types/algorand-client-transaction-creator.mjs.map +1 -0
- package/types/algorand-client-transaction-sender.d.ts +433 -0
- package/types/algorand-client-transaction-sender.d.ts.map +1 -0
- package/types/algorand-client-transaction-sender.js +422 -0
- package/types/algorand-client-transaction-sender.js.map +1 -0
- package/types/algorand-client-transaction-sender.mjs +420 -0
- package/types/algorand-client-transaction-sender.mjs.map +1 -0
- package/types/algorand-client.d.ts +28 -78
- package/types/algorand-client.d.ts.map +1 -1
- package/types/algorand-client.js +33 -122
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +34 -123
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.d.ts +18 -6
- package/types/amount.d.ts.map +1 -1
- package/types/amount.js +33 -10
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +33 -10
- package/types/amount.mjs.map +1 -1
- package/types/app-client.d.ts +3 -3
- package/types/app-client.d.ts.map +1 -1
- package/types/app-client.js +7 -10
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +8 -11
- package/types/app-client.mjs.map +1 -1
- package/types/asset-manager.d.ts +205 -0
- package/types/asset-manager.d.ts.map +1 -0
- package/types/asset-manager.js +180 -0
- package/types/asset-manager.js.map +1 -0
- package/types/asset-manager.mjs +178 -0
- package/types/asset-manager.mjs.map +1 -0
- package/types/asset.d.ts +4 -4
- package/types/asset.d.ts.map +1 -1
- package/types/client-manager.d.ts +40 -2
- package/types/client-manager.d.ts.map +1 -1
- package/types/client-manager.js +44 -3
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +44 -3
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +226 -68
- package/types/composer.d.ts.map +1 -1
- package/types/composer.js +78 -64
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +75 -64
- package/types/composer.mjs.map +1 -1
- package/types/dispenser-client.d.ts +12 -4
- package/types/dispenser-client.d.ts.map +1 -1
- package/types/dispenser-client.js +9 -9
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs +9 -9
- package/types/dispenser-client.mjs.map +1 -1
- package/types/indexer.d.ts +7 -7
- package/types/indexer.d.ts.map +1 -1
- package/types/kmd-account-manager.d.ts +3 -3
- package/types/kmd-account-manager.js +6 -6
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +7 -7
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/network-client.d.ts +7 -1
- package/types/network-client.d.ts.map +1 -1
- package/types/network-client.js +10 -0
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs +9 -0
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +1 -1
- package/types/testing.d.ts.map +1 -1
- package/types/transfer.d.ts +8 -7
- package/types/transfer.d.ts.map +1 -1
- package/util.d.ts +13 -0
- package/util.d.ts.map +1 -1
- package/util.js +25 -0
- package/util.js.map +1 -1
- package/util.mjs +24 -1
- package/util.mjs.map +1 -1
package/account/account.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
|
-
import { AccountAssetInformation,
|
|
2
|
+
import { AccountAssetInformation, 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;
|
|
@@ -7,6 +7,7 @@ import Algodv2 = algosdk.Algodv2;
|
|
|
7
7
|
import Kmd = algosdk.Kmd;
|
|
8
8
|
import MultisigMetadata = algosdk.MultisigMetadata;
|
|
9
9
|
import TransactionSigner = algosdk.TransactionSigner;
|
|
10
|
+
import AccountInformationModel = algosdk.modelsv2.Account;
|
|
10
11
|
/**
|
|
11
12
|
* @deprecated Use `algorandClient.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead.
|
|
12
13
|
*
|
|
@@ -17,7 +18,7 @@ import TransactionSigner = algosdk.TransactionSigner;
|
|
|
17
18
|
*/
|
|
18
19
|
export declare function multisigAccount(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]): MultisigAccount;
|
|
19
20
|
/**
|
|
20
|
-
* @deprecated Use `algorandClient.account.rekeyed(
|
|
21
|
+
* @deprecated Use `algorandClient.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead.
|
|
21
22
|
*
|
|
22
23
|
* Returns an account wrapper that supports a rekeyed account.
|
|
23
24
|
* @param signer The account, with private key loaded, that is signing
|
|
@@ -65,12 +66,12 @@ export declare function randomAccount(): Account;
|
|
|
65
66
|
* const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)
|
|
66
67
|
* ```
|
|
67
68
|
*
|
|
68
|
-
* If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default)
|
|
69
|
+
* If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
|
|
69
70
|
* If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.
|
|
70
71
|
*
|
|
71
72
|
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
72
73
|
* * `name`: string: The name identifier of the account
|
|
73
|
-
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000
|
|
74
|
+
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
|
|
74
75
|
* @param algod An algod client
|
|
75
76
|
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
76
77
|
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
@@ -95,6 +96,12 @@ export declare function getAccountAddressAsUint8Array(account: SendTransactionFr
|
|
|
95
96
|
* @param addressEncodedInB64 The base64 encoded version of the underlying byte array of the address public key
|
|
96
97
|
*/
|
|
97
98
|
export declare function getAccountAddressAsString(addressEncodedInB64: string): string;
|
|
99
|
+
type NumberConverter<T extends AccountInformationModel> = {
|
|
100
|
+
[key in keyof T]: ToNumberIfExtends<T[key], number | bigint>;
|
|
101
|
+
};
|
|
102
|
+
type ToNumberIfExtends<K, E> = K extends E ? number : K;
|
|
103
|
+
/** @deprecated Account information at a given round. */
|
|
104
|
+
export type AccountInformation = Omit<NumberConverter<AccountInformationModel>, 'get_obj_for_encoding'>;
|
|
98
105
|
/**
|
|
99
106
|
* @deprecated Use `algorandClient.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead.
|
|
100
107
|
*
|
|
@@ -113,7 +120,7 @@ export declare function getAccountAddressAsString(addressEncodedInB64: string):
|
|
|
113
120
|
*/
|
|
114
121
|
export declare function getAccountInformation(sender: string | SendTransactionFrom, algod: Algodv2): Promise<AccountInformation>;
|
|
115
122
|
/**
|
|
116
|
-
* @deprecated Use `algorandClient.
|
|
123
|
+
* @deprecated Use `algorandClient.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead.
|
|
117
124
|
*
|
|
118
125
|
* Returns the given sender account's asset holding for a given asset.
|
|
119
126
|
*
|
|
@@ -131,4 +138,5 @@ export declare function getAccountInformation(sender: string | SendTransactionFr
|
|
|
131
138
|
* @returns The account asset holding information
|
|
132
139
|
*/
|
|
133
140
|
export declare function getAccountAssetInformation(sender: string | SendTransactionFrom, assetId: number | bigint, algod: Algodv2): Promise<AccountAssetInformation>;
|
|
141
|
+
export {};
|
|
134
142
|
//# 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;AAE7B,OAAO,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAGrH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAA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AAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAAE,CAAA;AAC1H,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,GAAG,CAAC,CAAA;AACvD,wDAAwD;AACxD,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,CAAC,uBAAuB,CAAC,EAAE,sBAAsB,CAAC,CAAA;AAEvG;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAqB7H;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,GAAG,mBAAmB,EACpC,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,uBAAuB,CAAC,CAElC"}
|
package/account/account.js
CHANGED
|
@@ -4,8 +4,10 @@ var algosdk = require('algosdk');
|
|
|
4
4
|
var transaction = require('../transaction/transaction.js');
|
|
5
5
|
var types_account = require('../types/account.js');
|
|
6
6
|
var types_accountManager = require('../types/account-manager.js');
|
|
7
|
+
var types_algorandClient = require('../types/algorand-client.js');
|
|
7
8
|
var types_clientManager = require('../types/client-manager.js');
|
|
8
9
|
|
|
10
|
+
var AccountInformationModel = algosdk.modelsv2.Account;
|
|
9
11
|
/**
|
|
10
12
|
* @deprecated Use `algorandClient.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead.
|
|
11
13
|
*
|
|
@@ -18,7 +20,7 @@ function multisigAccount(multisigParams, signingAccounts) {
|
|
|
18
20
|
return new types_account.MultisigAccount(multisigParams, signingAccounts);
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
|
-
* @deprecated Use `algorandClient.account.rekeyed(
|
|
23
|
+
* @deprecated Use `algorandClient.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead.
|
|
22
24
|
*
|
|
23
25
|
* Returns an account wrapper that supports a rekeyed account.
|
|
24
26
|
* @param signer The account, with private key loaded, that is signing
|
|
@@ -73,12 +75,12 @@ function randomAccount() {
|
|
|
73
75
|
* const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)
|
|
74
76
|
* ```
|
|
75
77
|
*
|
|
76
|
-
* If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default)
|
|
78
|
+
* If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
|
|
77
79
|
* If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.
|
|
78
80
|
*
|
|
79
81
|
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
80
82
|
* * `name`: string: The name identifier of the account
|
|
81
|
-
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000
|
|
83
|
+
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
|
|
82
84
|
* @param algod An algod client
|
|
83
85
|
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
84
86
|
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
@@ -123,10 +125,28 @@ function getAccountAddressAsString(addressEncodedInB64) {
|
|
|
123
125
|
* @returns The account information
|
|
124
126
|
*/
|
|
125
127
|
async function getAccountInformation(sender, algod) {
|
|
126
|
-
|
|
128
|
+
const account = AccountInformationModel.from_obj_for_encoding(await algod.accountInformation(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
|
+
};
|
|
127
147
|
}
|
|
128
148
|
/**
|
|
129
|
-
* @deprecated Use `algorandClient.
|
|
149
|
+
* @deprecated Use `algorandClient.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead.
|
|
130
150
|
*
|
|
131
151
|
* Returns the given sender account's asset holding for a given asset.
|
|
132
152
|
*
|
|
@@ -144,7 +164,7 @@ async function getAccountInformation(sender, algod) {
|
|
|
144
164
|
* @returns The account asset holding information
|
|
145
165
|
*/
|
|
146
166
|
async function getAccountAssetInformation(sender, assetId, algod) {
|
|
147
|
-
return
|
|
167
|
+
return types_algorandClient.AlgorandClient.fromClients({ algod }).asset.getAccountInformation(transaction.getSenderAddress(sender), BigInt(assetId));
|
|
148
168
|
}
|
|
149
169
|
|
|
150
170
|
exports.getAccountAddressAsString = getAccountAddressAsString;
|
package/account/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sources":["../../src/account/account.ts"],"sourcesContent":[null],"names":["MultisigAccount","SigningAccount","AccountManager","ClientManager","getSenderAddress"],"mappings":"
|
|
1
|
+
{"version":3,"file":"account.js","sources":["../../src/account/account.ts"],"sourcesContent":[null],"names":["MultisigAccount","SigningAccount","AccountManager","ClientManager","getSenderAddress","AlgorandClient"],"mappings":";;;;;;;;;AAaA,IAAO,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;AAEzD;;;;;;;AAOG;AACa,SAAA,eAAe,CAAC,cAAgC,EAAE,eAA6C,EAAA;AAC7G,IAAA,OAAO,IAAIA,6BAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,cAAc,CAAC,MAAe,EAAE,MAAc,EAAA;AAC5D,IAAA,OAAO,IAAIC,4BAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,wBAAwB,CAAC,MAAyB,EAAE,MAAc,EAAA;AAChF,IAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACjC,CAAC;AAED;;;;;;;AAOG;SACa,aAAa,GAAA;;AAE3B,IAAA,OAAO,OAAO,CAAC,eAAe,EAAE,CAAA;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACI,eAAe,8BAA8B,CAClD,OAAyD,EACzD,KAAc,EACd,SAAe,EAAA;IAEf,OAAO,CACL,MAAM,IAAIC,mCAAc,CAAC,IAAIC,iCAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CACpF,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,EACpD,OAAO,OAAO,KAAK,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,QAAQ,CAC3D,EACD,OAAO,CAAA;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AkB,EAAE,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;AACtD,QAAA,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS;AAClG,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;AACvE,QAAA,aAAa,EAAE,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS;AAChF,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;KACxE,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;AAiBG;AACI,eAAe,0BAA0B,CAC9C,MAAoC,EACpC,OAAwB,EACxB,KAAc,EAAA;IAEd,OAAOC,mCAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAACD,4BAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;AACrH;;;;;;;;;;;;"}
|
package/account/account.mjs
CHANGED
|
@@ -2,8 +2,10 @@ import algosdk from 'algosdk';
|
|
|
2
2
|
import { getSenderAddress } from '../transaction/transaction.mjs';
|
|
3
3
|
import { MultisigAccount, SigningAccount } from '../types/account.mjs';
|
|
4
4
|
import { AccountManager } from '../types/account-manager.mjs';
|
|
5
|
+
import { AlgorandClient } from '../types/algorand-client.mjs';
|
|
5
6
|
import { ClientManager } from '../types/client-manager.mjs';
|
|
6
7
|
|
|
8
|
+
var AccountInformationModel = algosdk.modelsv2.Account;
|
|
7
9
|
/**
|
|
8
10
|
* @deprecated Use `algorandClient.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead.
|
|
9
11
|
*
|
|
@@ -16,7 +18,7 @@ function multisigAccount(multisigParams, signingAccounts) {
|
|
|
16
18
|
return new MultisigAccount(multisigParams, signingAccounts);
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
|
-
* @deprecated Use `algorandClient.account.rekeyed(
|
|
21
|
+
* @deprecated Use `algorandClient.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead.
|
|
20
22
|
*
|
|
21
23
|
* Returns an account wrapper that supports a rekeyed account.
|
|
22
24
|
* @param signer The account, with private key loaded, that is signing
|
|
@@ -71,12 +73,12 @@ function randomAccount() {
|
|
|
71
73
|
* const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)
|
|
72
74
|
* ```
|
|
73
75
|
*
|
|
74
|
-
* If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default)
|
|
76
|
+
* If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
|
|
75
77
|
* If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.
|
|
76
78
|
*
|
|
77
79
|
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
78
80
|
* * `name`: string: The name identifier of the account
|
|
79
|
-
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000
|
|
81
|
+
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
|
|
80
82
|
* @param algod An algod client
|
|
81
83
|
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
82
84
|
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
@@ -121,10 +123,28 @@ function getAccountAddressAsString(addressEncodedInB64) {
|
|
|
121
123
|
* @returns The account information
|
|
122
124
|
*/
|
|
123
125
|
async function getAccountInformation(sender, algod) {
|
|
124
|
-
|
|
126
|
+
const account = AccountInformationModel.from_obj_for_encoding(await algod.accountInformation(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
|
+
};
|
|
125
145
|
}
|
|
126
146
|
/**
|
|
127
|
-
* @deprecated Use `algorandClient.
|
|
147
|
+
* @deprecated Use `algorandClient.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead.
|
|
128
148
|
*
|
|
129
149
|
* Returns the given sender account's asset holding for a given asset.
|
|
130
150
|
*
|
|
@@ -142,7 +162,7 @@ async function getAccountInformation(sender, algod) {
|
|
|
142
162
|
* @returns The account asset holding information
|
|
143
163
|
*/
|
|
144
164
|
async function getAccountAssetInformation(sender, assetId, algod) {
|
|
145
|
-
return
|
|
165
|
+
return AlgorandClient.fromClients({ algod }).asset.getAccountInformation(getSenderAddress(sender), BigInt(assetId));
|
|
146
166
|
}
|
|
147
167
|
|
|
148
168
|
export { getAccountAddressAsString, getAccountAddressAsUint8Array, getAccountAssetInformation, getAccountInformation, mnemonicAccountFromEnvironment, multisigAccount, randomAccount, rekeyedAccount, transactionSignerAccount };
|
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":";;;;;;;AAaA,IAAO,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;AAEzD;;;;;;;AAOG;AACa,SAAA,eAAe,CAAC,cAAgC,EAAE,eAA6C,EAAA;AAC7G,IAAA,OAAO,IAAI,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,cAAc,CAAC,MAAe,EAAE,MAAc,EAAA;AAC5D,IAAA,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,wBAAwB,CAAC,MAAyB,EAAE,MAAc,EAAA;AAChF,IAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACjC,CAAC;AAED;;;;;;;AAOG;SACa,aAAa,GAAA;;AAE3B,IAAA,OAAO,OAAO,CAAC,eAAe,EAAE,CAAA;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACI,eAAe,8BAA8B,CAClD,OAAyD,EACzD,KAAc,EACd,SAAe,EAAA;IAEf,OAAO,CACL,MAAM,IAAI,cAAc,CAAC,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CACpF,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI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AAkB,CAAC;AACtD,QAAA,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;AAClD,QAAA,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;AACtD,QAAA,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS;AAClG,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;AACvE,QAAA,aAAa,EAAE,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS;AAChF,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;KACxE,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;AAiBG;AACI,eAAe,0BAA0B,CAC9C,MAAoC,EACpC,OAAwB,EACxB,KAAc,EAAA;IAEd,OAAO,cAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;AACrH;;;;"}
|
package/account/get-account.d.ts
CHANGED
|
@@ -25,11 +25,11 @@ import Kmd = algosdk.Kmd;
|
|
|
25
25
|
* const account = await getAccount('ACCOUNT', algod)
|
|
26
26
|
* ```
|
|
27
27
|
*
|
|
28
|
-
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default)
|
|
28
|
+
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
|
|
29
29
|
*
|
|
30
30
|
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
31
31
|
* * `name`: The name identifier of the account
|
|
32
|
-
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000
|
|
32
|
+
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
|
|
33
33
|
* @param algod An algod client
|
|
34
34
|
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
35
35
|
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
@@ -50,11 +50,11 @@ export declare function getAccount(account: {
|
|
|
50
50
|
* const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)
|
|
51
51
|
* ```
|
|
52
52
|
*
|
|
53
|
-
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default)
|
|
53
|
+
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
|
|
54
54
|
*
|
|
55
55
|
* @param account The details of the account to get, an object with:
|
|
56
56
|
* * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName)
|
|
57
|
-
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000
|
|
57
|
+
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
|
|
58
58
|
* @param algod An algod client
|
|
59
59
|
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
60
60
|
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
package/account/get-account.js
CHANGED
|
@@ -24,13 +24,13 @@ var getAccountConfigFromEnvironment = require('./get-account-config-from-environ
|
|
|
24
24
|
* const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)
|
|
25
25
|
* ```
|
|
26
26
|
*
|
|
27
|
-
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default)
|
|
27
|
+
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
|
|
28
28
|
*
|
|
29
29
|
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
30
30
|
* * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName) OR
|
|
31
31
|
* * `name`: string: The name identifier of the account (deprecated)
|
|
32
32
|
* And optionally
|
|
33
|
-
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000
|
|
33
|
+
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
|
|
34
34
|
* @param algod An algod client
|
|
35
35
|
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
36
36
|
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
package/account/get-account.mjs
CHANGED
|
@@ -22,13 +22,13 @@ import { getAccountConfigFromEnvironment } from './get-account-config-from-envir
|
|
|
22
22
|
* const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default)
|
|
25
|
+
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
|
|
26
26
|
*
|
|
27
27
|
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
28
28
|
* * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName) OR
|
|
29
29
|
* * `name`: string: The name identifier of the account (deprecated)
|
|
30
30
|
* And optionally
|
|
31
|
-
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000
|
|
31
|
+
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
|
|
32
32
|
* @param algod An algod client
|
|
33
33
|
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
34
34
|
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
package/amount.d.ts
CHANGED
|
@@ -1,20 +1,42 @@
|
|
|
1
1
|
import { AlgoAmount } from './types/amount';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Number {
|
|
4
|
+
/**
|
|
5
|
+
* Returns an `AlgoAmount` using this number of microAlgo.
|
|
6
|
+
*/
|
|
4
7
|
microAlgos(this: number): AlgoAmount;
|
|
8
|
+
/**
|
|
9
|
+
* Returns an `AlgoAmount` using this number of Algo.
|
|
10
|
+
*/
|
|
5
11
|
algos(this: number): AlgoAmount;
|
|
12
|
+
/**
|
|
13
|
+
* Returns an `AlgoAmount` using this number of microAlgo.
|
|
14
|
+
*/
|
|
15
|
+
microAlgo(this: number): AlgoAmount;
|
|
16
|
+
/**
|
|
17
|
+
* Returns an `AlgoAmount` using this number of Algo.
|
|
18
|
+
*/
|
|
19
|
+
algo(this: number): AlgoAmount;
|
|
6
20
|
}
|
|
7
21
|
}
|
|
8
|
-
/** Returns an amount of
|
|
9
|
-
* @param algos The amount
|
|
22
|
+
/** Returns an amount of Algo using AlgoAmount
|
|
23
|
+
* @param algos The amount of Algo
|
|
10
24
|
*/
|
|
11
25
|
export declare const algos: (algos: number) => AlgoAmount;
|
|
12
|
-
/** Returns an amount of
|
|
13
|
-
* @param
|
|
26
|
+
/** Returns an amount of Algo using AlgoAmount
|
|
27
|
+
* @param algos The amount of Algo
|
|
28
|
+
*/
|
|
29
|
+
export declare const algo: (algos: number) => AlgoAmount;
|
|
30
|
+
/** Returns an amount of µAlgo using AlgoAmount
|
|
31
|
+
* @param microAlgos The amount of µAlgo
|
|
14
32
|
*/
|
|
15
33
|
export declare const microAlgos: (microAlgos: number) => AlgoAmount;
|
|
16
|
-
/** Returns an amount of µ
|
|
17
|
-
* @param
|
|
34
|
+
/** Returns an amount of µAlgo using AlgoAmount
|
|
35
|
+
* @param microAlgos The amount of µAlgo
|
|
36
|
+
*/
|
|
37
|
+
export declare const microAlgo: (microAlgos: number) => AlgoAmount;
|
|
38
|
+
/** Returns an amount of µAlgo to cover standard fees for the given number of transactions using AlgoAmount
|
|
39
|
+
* @param numberOfTransactions The of standard transaction fees to return the amount of Algo
|
|
18
40
|
*/
|
|
19
41
|
export declare const transactionFees: (numberOfTransactions: number) => AlgoAmount;
|
|
20
42
|
//# sourceMappingURL=amount.d.ts.map
|
package/amount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../src/amount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;QACpC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../src/amount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd;;WAEG;QACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;QACpC;;WAEG;QACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;QAC/B;;WAEG;QACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;QACnC;;WAEG;QACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;KAC/B;CACF;AAkBD;;GAEG;AACH,eAAO,MAAM,KAAK,UAAW,MAAM,eAElC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,UAAW,MAAM,eAEjC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,eAAgB,MAAM,eAE5C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,eAAgB,MAAM,eAE3C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,yBAA0B,MAAM,eAE3D,CAAA"}
|
package/amount.js
CHANGED
|
@@ -4,31 +4,51 @@ var algosdk = require('algosdk');
|
|
|
4
4
|
var types_amount = require('./types/amount.js');
|
|
5
5
|
|
|
6
6
|
Number.prototype.microAlgos = function () {
|
|
7
|
-
return types_amount.AlgoAmount.
|
|
7
|
+
return types_amount.AlgoAmount.MicroAlgo(this);
|
|
8
8
|
};
|
|
9
9
|
Number.prototype.algos = function () {
|
|
10
|
-
return types_amount.AlgoAmount.
|
|
10
|
+
return types_amount.AlgoAmount.Algo(this);
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
Number.prototype.microAlgo = function () {
|
|
13
|
+
return types_amount.AlgoAmount.MicroAlgo(this);
|
|
14
|
+
};
|
|
15
|
+
Number.prototype.algo = function () {
|
|
16
|
+
return types_amount.AlgoAmount.Algo(this);
|
|
17
|
+
};
|
|
18
|
+
/** Returns an amount of Algo using AlgoAmount
|
|
19
|
+
* @param algos The amount of Algo
|
|
14
20
|
*/
|
|
15
21
|
const algos = (algos) => {
|
|
16
|
-
return types_amount.AlgoAmount.
|
|
22
|
+
return types_amount.AlgoAmount.Algo(algos);
|
|
23
|
+
};
|
|
24
|
+
/** Returns an amount of Algo using AlgoAmount
|
|
25
|
+
* @param algos The amount of Algo
|
|
26
|
+
*/
|
|
27
|
+
const algo = (algos) => {
|
|
28
|
+
return types_amount.AlgoAmount.Algo(algos);
|
|
17
29
|
};
|
|
18
|
-
/** Returns an amount of µ
|
|
19
|
-
* @param microAlgos The amount
|
|
30
|
+
/** Returns an amount of µAlgo using AlgoAmount
|
|
31
|
+
* @param microAlgos The amount of µAlgo
|
|
20
32
|
*/
|
|
21
33
|
const microAlgos = (microAlgos) => {
|
|
22
|
-
return types_amount.AlgoAmount.
|
|
34
|
+
return types_amount.AlgoAmount.MicroAlgo(microAlgos);
|
|
35
|
+
};
|
|
36
|
+
/** Returns an amount of µAlgo using AlgoAmount
|
|
37
|
+
* @param microAlgos The amount of µAlgo
|
|
38
|
+
*/
|
|
39
|
+
const microAlgo = (microAlgos) => {
|
|
40
|
+
return types_amount.AlgoAmount.MicroAlgo(microAlgos);
|
|
23
41
|
};
|
|
24
|
-
/** Returns an amount of µ
|
|
25
|
-
* @param numberOfTransactions The of standard transaction fees to return the amount of
|
|
42
|
+
/** Returns an amount of µAlgo to cover standard fees for the given number of transactions using AlgoAmount
|
|
43
|
+
* @param numberOfTransactions The of standard transaction fees to return the amount of Algo
|
|
26
44
|
*/
|
|
27
45
|
const transactionFees = (numberOfTransactions) => {
|
|
28
|
-
return types_amount.AlgoAmount.
|
|
46
|
+
return types_amount.AlgoAmount.MicroAlgo(numberOfTransactions * algosdk.ALGORAND_MIN_TX_FEE);
|
|
29
47
|
};
|
|
30
48
|
|
|
49
|
+
exports.algo = algo;
|
|
31
50
|
exports.algos = algos;
|
|
51
|
+
exports.microAlgo = microAlgo;
|
|
32
52
|
exports.microAlgos = microAlgos;
|
|
33
53
|
exports.transactionFees = transactionFees;
|
|
34
54
|
//# sourceMappingURL=amount.js.map
|
package/amount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.js","sources":["../src/amount.ts"],"sourcesContent":[null],"names":["AlgoAmount"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"amount.js","sources":["../src/amount.ts"],"sourcesContent":[null],"names":["AlgoAmount"],"mappings":";;;;;AAwBA,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG,YAAA;AAC5B,IAAA,OAAOA,uBAAU,CAAC,SAAS,CA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ototype.microAlgos = function () {
|
|
5
|
-
return AlgoAmount.
|
|
5
|
+
return AlgoAmount.MicroAlgo(this);
|
|
6
6
|
};
|
|
7
7
|
Number.prototype.algos = function () {
|
|
8
|
-
return AlgoAmount.
|
|
8
|
+
return AlgoAmount.Algo(this);
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Number.prototype.microAlgo = function () {
|
|
11
|
+
return AlgoAmount.MicroAlgo(this);
|
|
12
|
+
};
|
|
13
|
+
Number.prototype.algo = function () {
|
|
14
|
+
return AlgoAmount.Algo(this);
|
|
15
|
+
};
|
|
16
|
+
/** Returns an amount of Algo using AlgoAmount
|
|
17
|
+
* @param algos The amount of Algo
|
|
12
18
|
*/
|
|
13
19
|
const algos = (algos) => {
|
|
14
|
-
return AlgoAmount.
|
|
20
|
+
return AlgoAmount.Algo(algos);
|
|
21
|
+
};
|
|
22
|
+
/** Returns an amount of Algo using AlgoAmount
|
|
23
|
+
* @param algos The amount of Algo
|
|
24
|
+
*/
|
|
25
|
+
const algo = (algos) => {
|
|
26
|
+
return AlgoAmount.Algo(algos);
|
|
15
27
|
};
|
|
16
|
-
/** Returns an amount of µ
|
|
17
|
-
* @param microAlgos The amount
|
|
28
|
+
/** Returns an amount of µAlgo using AlgoAmount
|
|
29
|
+
* @param microAlgos The amount of µAlgo
|
|
18
30
|
*/
|
|
19
31
|
const microAlgos = (microAlgos) => {
|
|
20
|
-
return AlgoAmount.
|
|
32
|
+
return AlgoAmount.MicroAlgo(microAlgos);
|
|
33
|
+
};
|
|
34
|
+
/** Returns an amount of µAlgo using AlgoAmount
|
|
35
|
+
* @param microAlgos The amount of µAlgo
|
|
36
|
+
*/
|
|
37
|
+
const microAlgo = (microAlgos) => {
|
|
38
|
+
return AlgoAmount.MicroAlgo(microAlgos);
|
|
21
39
|
};
|
|
22
|
-
/** Returns an amount of µ
|
|
23
|
-
* @param numberOfTransactions The of standard transaction fees to return the amount of
|
|
40
|
+
/** Returns an amount of µAlgo to cover standard fees for the given number of transactions using AlgoAmount
|
|
41
|
+
* @param numberOfTransactions The of standard transaction fees to return the amount of Algo
|
|
24
42
|
*/
|
|
25
43
|
const transactionFees = (numberOfTransactions) => {
|
|
26
|
-
return AlgoAmount.
|
|
44
|
+
return AlgoAmount.MicroAlgo(numberOfTransactions * algosdk.ALGORAND_MIN_TX_FEE);
|
|
27
45
|
};
|
|
28
46
|
|
|
29
|
-
export { algos, microAlgos, transactionFees };
|
|
47
|
+
export { algo, algos, microAlgo, microAlgos, transactionFees };
|
|
30
48
|
//# sourceMappingURL=amount.mjs.map
|
package/amount.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.mjs","sources":["../src/amount.ts"],"sourcesContent":[null],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"amount.mjs","sources":["../src/amount.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAwBA,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG,YAAA;AAC5B,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,YAAA;AACvB,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,YAAA;AAC3B,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,YAAA;AACtB,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC,CAAA;AAED;;AAEG;AACU,MAAA,KAAK,GAAG,CAAC,KAAa,KAAI;AACrC,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC/B,EAAC;AAED;;AAEG;AACU,MAAA,IAAI,GAAG,CAAC,KAAa,KAAI;AACpC,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC/B,EAAC;AAED;;AAEG;AACU,MAAA,UAAU,GAAG,CAAC,UAAkB,KAAI;AAC/C,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AACzC,EAAC;AAED;;AAEG;AACU,MAAA,SAAS,GAAG,CAAC,UAAkB,KAAI;AAC9C,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AACzC,EAAC;AAED;;AAEG;AACU,MAAA,eAAe,GAAG,CAAC,oBAA4B,KAAI;IAC9D,OAAO,UAAU,CAAC,SAAS,CAAC,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AACjF;;;;"}
|
package/asset.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { AssetBulkOptInOutParams, AssetOptInParams, AssetOptOutParams, CreateAss
|
|
|
3
3
|
import { SendTransactionResult } from './types/transaction';
|
|
4
4
|
import Algodv2 = algosdk.Algodv2;
|
|
5
5
|
/**
|
|
6
|
+
* @deprecated use `algorandClient.send.assetCreate()` / `algorandClient.transaction.assetCreate()` instead
|
|
7
|
+
*
|
|
6
8
|
* Create an Algorand Standard Asset (ASA).
|
|
7
9
|
* @param create The asset creation definition
|
|
8
10
|
* @param algod An algod client
|
|
@@ -19,6 +21,8 @@ export declare function createAsset(create: CreateAssetParams, algod: Algodv2):
|
|
|
19
21
|
};
|
|
20
22
|
}>;
|
|
21
23
|
/**
|
|
24
|
+
* @deprecated use `algorandClient.send.assetOptIn()` / `algorandClient.transaction.assetOptIn()` instead
|
|
25
|
+
*
|
|
22
26
|
* Opt-in an account to an asset.
|
|
23
27
|
* @param optIn The opt-in definition
|
|
24
28
|
* @param algod An algod client
|
|
@@ -31,6 +35,8 @@ export declare function createAsset(create: CreateAssetParams, algod: Algodv2):
|
|
|
31
35
|
*/
|
|
32
36
|
export declare function assetOptIn(optIn: AssetOptInParams, algod: Algodv2): Promise<SendTransactionResult>;
|
|
33
37
|
/**
|
|
38
|
+
* @deprecated use `algorandClient.send.assetOptOut()` / `algorandClient.transaction.assetOptOut()` instead
|
|
39
|
+
*
|
|
34
40
|
* Opt-out an account from an asset.
|
|
35
41
|
* @param optOut The opt-in definition
|
|
36
42
|
* @param algod An algod client
|
|
@@ -43,6 +49,8 @@ export declare function assetOptIn(optIn: AssetOptInParams, algod: Algodv2): Pro
|
|
|
43
49
|
*/
|
|
44
50
|
export declare function assetOptOut(optOut: AssetOptOutParams, algod: Algodv2): Promise<SendTransactionResult>;
|
|
45
51
|
/**
|
|
52
|
+
* @deprecated use `algorandClient.asset.bulkOptIn()` instead
|
|
53
|
+
*
|
|
46
54
|
* Opt in to a list of assets on the Algorand blockchain.
|
|
47
55
|
*
|
|
48
56
|
* @param optIn - The bulk opt-in request.
|
|
@@ -53,6 +61,8 @@ export declare function assetOptOut(optOut: AssetOptOutParams, algod: Algodv2):
|
|
|
53
61
|
*/
|
|
54
62
|
export declare function assetBulkOptIn(optIn: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>>;
|
|
55
63
|
/**
|
|
64
|
+
* @deprecated use `algorandClient.asset.bulkOptOut()` instead
|
|
65
|
+
*
|
|
56
66
|
* Opt out of multiple assets in Algorand blockchain.
|
|
57
67
|
*
|
|
58
68
|
* @param optOut The bulk opt-out request.
|
package/asset.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../src/asset.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../src/asset.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAG/G,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAEhC;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,qBAAqB,GAAG;IAAE,YAAY,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,CA0BrF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAgBxG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAmB3G;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAepH;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgBtH"}
|