@algorandfoundation/algokit-utils 1.0.0-beta.39 → 1.0.0-beta.40
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 +8 -1
- package/account.d.ts +10 -9
- package/account.d.ts.map +1 -1
- package/account.js +11 -10
- package/account.js.map +1 -1
- package/amount.d.ts +3 -3
- package/amount.js +3 -3
- package/app-client.d.ts +14 -0
- package/app-client.d.ts.map +1 -0
- package/app-client.js +19 -0
- package/app-client.js.map +1 -0
- package/{deploy-app.d.ts → app-deploy.d.ts} +8 -5
- package/{deploy-app.d.ts.map → app-deploy.d.ts.map} +1 -1
- package/{deploy-app.js → app-deploy.js} +12 -9
- package/app-deploy.js.map +1 -0
- package/app.d.ts +32 -9
- package/app.d.ts.map +1 -1
- package/app.js +37 -13
- package/app.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/indexer-lookup.d.ts +2 -2
- package/indexer-lookup.js +4 -4
- package/indexer-lookup.js.map +1 -1
- package/localnet.d.ts +5 -5
- package/localnet.js +5 -5
- package/package.json +1 -1
- package/testing/account.d.ts +2 -2
- package/testing/account.js +2 -2
- package/testing/fixtures/algorand-fixture.d.ts +6 -2
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -1
- package/testing/fixtures/algorand-fixture.js +14 -5
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/test-logger.d.ts +3 -1
- package/testing/test-logger.d.ts.map +1 -1
- package/testing/test-logger.js +3 -1
- package/testing/test-logger.js.map +1 -1
- package/testing/transaction-logger.d.ts +4 -4
- package/testing/transaction-logger.d.ts.map +1 -1
- package/testing/transaction-logger.js +4 -4
- package/testing/transaction-logger.js.map +1 -1
- package/transaction.d.ts +17 -23
- package/transaction.d.ts.map +1 -1
- package/transaction.js +26 -16
- package/transaction.js.map +1 -1
- package/transfer.d.ts +4 -3
- package/transfer.d.ts.map +1 -1
- package/transfer.js +10 -8
- package/transfer.js.map +1 -1
- package/types/account.d.ts +1 -1
- package/types/account.d.ts.map +1 -1
- package/types/algod.d.ts +6 -6
- package/types/algod.d.ts.map +1 -1
- package/types/amount.d.ts +6 -2
- package/types/amount.d.ts.map +1 -1
- package/types/amount.js +6 -2
- package/types/amount.js.map +1 -1
- package/types/{application-client.d.ts → app-client.d.ts} +25 -20
- package/types/app-client.d.ts.map +1 -0
- package/types/{application-client.js → app-client.js} +17 -15
- package/types/app-client.js.map +1 -0
- package/types/{appspec.d.ts → app-spec.d.ts} +4 -4
- package/types/app-spec.d.ts.map +1 -0
- package/types/{appspec.js → app-spec.js} +2 -2
- package/types/app-spec.js.map +1 -0
- package/types/app.d.ts +15 -23
- package/types/app.d.ts.map +1 -1
- package/types/app.js.map +1 -1
- package/types/indexer.d.ts +41 -41
- package/types/indexer.d.ts.map +1 -1
- package/types/indexer.js +1 -1
- package/types/indexer.js.map +1 -1
- package/types/testing.d.ts +9 -9
- package/types/testing.d.ts.map +1 -1
- package/types/transaction.d.ts +37 -10
- package/types/transaction.d.ts.map +1 -1
- package/types/transfer.d.ts +7 -7
- package/types/transfer.d.ts.map +1 -1
- package/application-client.d.ts +0 -10
- package/application-client.d.ts.map +0 -1
- package/application-client.js +0 -15
- package/application-client.js.map +0 -1
- package/deploy-app.js.map +0 -1
- package/types/application-client.d.ts.map +0 -1
- package/types/application-client.js.map +0 -1
- package/types/appspec.d.ts.map +0 -1
- package/types/appspec.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-logger.js","sourceRoot":"","sources":["../../src/testing/transaction-logger.ts"],"names":[],"mappings":";;;AAAA,qCAAmE;AACnE,yBAA2C;AAE3C;;;GAGG;AACH,MAAa,iBAAiB;IAA9B;QACU,wBAAmB,GAAa,EAAE,CAAA;IA4C5C,CAAC;IA1CC;;OAEG;IACH,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAA;IACjC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,kBAA6C;QAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;YACrC,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE;gBACrC,MAAM,OAAO,GAAG,IAAA,iCAAuB,EAAC,IAAI,CAAC,CAAA;gBAC7C,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;aAClD;SACF;aAAM;YACL,MAAM,OAAO,GAAG,IAAA,iCAAuB,EAAC,kBAAkB,CAAC,CAAA;YAC3D,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;SAClD;IACH,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,KAAc;QACpB,OAAO,IAAI,KAAK,CAAU,KAAK,EAAE,IAAI,qCAAqC,CAAC,IAAI,CAAC,CAAC,CAAA;IACnF,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"transaction-logger.js","sourceRoot":"","sources":["../../src/testing/transaction-logger.ts"],"names":[],"mappings":";;;AAAA,qCAAmE;AACnE,yBAA2C;AAE3C;;;GAGG;AACH,MAAa,iBAAiB;IAA9B;QACU,wBAAmB,GAAa,EAAE,CAAA;IA4C5C,CAAC;IA1CC;;OAEG;IACH,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAA;IACjC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,kBAA6C;QAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;YACrC,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE;gBACrC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AAQ,MAAc,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;CACF"}
|
package/transaction.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import algosdk, { Algodv2, AtomicTransactionComposer, SuggestedParams, Transaction } from 'algosdk';
|
|
2
2
|
import { PendingTransactionResponse } from './types/algod';
|
|
3
3
|
import { AlgoAmount } from './types/amount';
|
|
4
|
-
import {
|
|
5
|
-
import { AtomicTransactionComposerToSend, SendTransactionFrom, SendTransactionParams, SendTransactionResult, TransactionGroupToSend, TransactionNote } from './types/transaction';
|
|
4
|
+
import { AtomicTransactionComposerToSend, SendAtomicTransactionComposerResults, SendTransactionFrom, SendTransactionParams, SendTransactionResult, TransactionGroupToSend, TransactionNote } from './types/transaction';
|
|
6
5
|
/** Encodes a transaction note into a byte array ready to be included in an Algorand transaction.
|
|
7
6
|
*
|
|
8
7
|
* @param note The transaction note
|
|
@@ -23,12 +22,19 @@ export declare function encodeTransactionNote(note?: TransactionNote): Uint8Arra
|
|
|
23
22
|
*/
|
|
24
23
|
export declare const getSenderAddress: (sender: SendTransactionFrom) => string;
|
|
25
24
|
/**
|
|
26
|
-
* Returns a
|
|
25
|
+
* Returns a `TransactionSigner` for the given transaction sender.
|
|
27
26
|
* This function has memoization, so will return the same transaction signer for a given sender.
|
|
28
27
|
* @param sender A transaction sender
|
|
29
28
|
* @returns A transaction signer
|
|
30
29
|
*/
|
|
31
30
|
export declare const getSenderTransactionSigner: (val: SendTransactionFrom) => algosdk.TransactionSigner;
|
|
31
|
+
/**
|
|
32
|
+
* Signs a single transaction by the given signer.
|
|
33
|
+
* @param transaction The transaction to sign
|
|
34
|
+
* @param signer The signer to sign
|
|
35
|
+
* @returns The signed transaction as a `Uint8Array`
|
|
36
|
+
*/
|
|
37
|
+
export declare const signTransaction: (transaction: Transaction, signer: SendTransactionFrom) => Promise<Uint8Array>;
|
|
32
38
|
/** Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
|
|
33
39
|
*
|
|
34
40
|
* @param send The details for the transaction to prepare/send, including:
|
|
@@ -45,23 +51,17 @@ export declare const sendTransaction: (send: {
|
|
|
45
51
|
sendParams?: SendTransactionParams;
|
|
46
52
|
}, algod: Algodv2) => Promise<SendTransactionResult>;
|
|
47
53
|
/**
|
|
48
|
-
* Signs and sends transactions that have been collected by an
|
|
54
|
+
* Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.
|
|
49
55
|
* @param atcSend The parameters controlling the send, including:
|
|
50
|
-
* * `atc` The
|
|
56
|
+
* * `atc` The `AtomicTransactionComposer`
|
|
51
57
|
* * `sendParams` The parameters to control the send behaviour
|
|
52
58
|
* @param algod An algod client
|
|
53
59
|
* @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
54
60
|
*/
|
|
55
|
-
export declare const sendAtomicTransactionComposer: (atcSend: AtomicTransactionComposerToSend, algod: Algodv2) => Promise<
|
|
56
|
-
groupId: string | undefined;
|
|
57
|
-
confirmations: PendingTransactionResponse[] | undefined;
|
|
58
|
-
txIds: string[];
|
|
59
|
-
transactions: algosdk.Transaction[];
|
|
60
|
-
returns: ABIReturn[];
|
|
61
|
-
}>;
|
|
61
|
+
export declare const sendAtomicTransactionComposer: (atcSend: AtomicTransactionComposerToSend, algod: Algodv2) => Promise<SendAtomicTransactionComposerResults>;
|
|
62
62
|
/**
|
|
63
|
-
* Performs a dry run of the transactions loaded into the given
|
|
64
|
-
* @param atc The
|
|
63
|
+
* Performs a dry run of the transactions loaded into the given AtomicTransactionComposer`
|
|
64
|
+
* @param atc The AtomicTransactionComposer` with transaction(s) loaded
|
|
65
65
|
* @param algod An Algod client
|
|
66
66
|
* @returns The dryrun result
|
|
67
67
|
*/
|
|
@@ -75,13 +75,7 @@ export declare function performAtomicTransactionComposerDryrun(atc: AtomicTransa
|
|
|
75
75
|
* @param algod An algod client
|
|
76
76
|
* @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
77
77
|
*/
|
|
78
|
-
export declare const sendGroupOfTransactions: (groupSend: TransactionGroupToSend, algod: Algodv2) => Promise<
|
|
79
|
-
groupId: string | undefined;
|
|
80
|
-
confirmations: PendingTransactionResponse[] | undefined;
|
|
81
|
-
txIds: string[];
|
|
82
|
-
transactions: algosdk.Transaction[];
|
|
83
|
-
returns: ABIReturn[];
|
|
84
|
-
}>;
|
|
78
|
+
export declare const sendGroupOfTransactions: (groupSend: TransactionGroupToSend, algod: Algodv2) => Promise<Omit<SendAtomicTransactionComposerResults, "returns">>;
|
|
85
79
|
/**
|
|
86
80
|
* Wait until the transaction is confirmed or rejected, or until `timeout`
|
|
87
81
|
* number of rounds have passed.
|
|
@@ -103,7 +97,7 @@ export declare const waitForConfirmation: (transactionId: string, maxRoundsToWai
|
|
|
103
97
|
*/
|
|
104
98
|
export declare function capTransactionFee(transaction: algosdk.Transaction | SuggestedParams, maxAcceptableFee: AlgoAmount): void;
|
|
105
99
|
/**
|
|
106
|
-
* Allows for control of fees on a
|
|
100
|
+
* Allows for control of fees on a `Transaction` or `SuggestedParams` object
|
|
107
101
|
* @param transaction The transaction or suggested params
|
|
108
102
|
* @param feeControl The fee control parameters
|
|
109
103
|
*/
|
|
@@ -119,7 +113,7 @@ export declare function controlFees<T extends SuggestedParams | Transaction>(tra
|
|
|
119
113
|
*/
|
|
120
114
|
export declare function getTransactionParams(params: SuggestedParams | undefined, algod: Algodv2): Promise<algosdk.SuggestedParams>;
|
|
121
115
|
/**
|
|
122
|
-
* Returns the array of transactions currently present in the given
|
|
116
|
+
* Returns the array of transactions currently present in the given `AtomicTransactionComposer`
|
|
123
117
|
* @param atc The atomic transaction composer
|
|
124
118
|
* @returns The array of transactions with signers
|
|
125
119
|
*/
|
package/transaction.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAA;AAGtH,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAA;AAGtH,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,EACL,+BAA+B,EAC/B,oCAAoC,EACpC,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,UAAU,GAAG,SAAS,CAcpF;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,WAAqB,mBAAmB,WAEpE,CAAA;AAWD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,yDAMrC,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,gBAAuB,WAAW,UAAU,mBAAmB,wBAQ1F,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,SACpB;IACJ,WAAW,EAAE,WAAW,CAAA;IACxB,IAAI,EAAE,mBAAmB,CAAA;IACzB,UAAU,CAAC,EAAE,qBAAqB,CAAA;CACnC,SACM,OAAO,KACb,QAAQ,qBAAqB,CA2B/B,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,YAA4B,+BAA+B,SAAS,OAAO,kDA+EpH,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,sCAAsC,CAAC,GAAG,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,iCAO1G;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,cAA8B,sBAAsB,SAAS,OAAO,mEAgCvG,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,kBACf,MAAM,mBACJ,MAAM,SAChB,OAAO,KACb,QAAQ,0BAA0B,CAkCpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,GAAG,eAAe,EAAE,gBAAgB,EAAE,UAAU,QAgBjH;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,WAAW,EACjE,WAAW,EAAE,CAAC,EACd,UAAU,EAAE;IAAE,GAAG,CAAC,EAAE,UAAU,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,KAatD;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,oCAE7F;AAED;;;;GAIG;AACH,wBAAgB,wCAAwC,CAAC,GAAG,EAAE,yBAAyB,mCAMtF"}
|
package/transaction.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getAtomicTransactionComposerTransactions = exports.getTransactionParams = exports.controlFees = exports.capTransactionFee = exports.waitForConfirmation = exports.sendGroupOfTransactions = exports.performAtomicTransactionComposerDryrun = exports.sendAtomicTransactionComposer = exports.sendTransaction = exports.getSenderTransactionSigner = exports.getSenderAddress = exports.encodeTransactionNote = void 0;
|
|
26
|
+
exports.getAtomicTransactionComposerTransactions = exports.getTransactionParams = exports.controlFees = exports.capTransactionFee = exports.waitForConfirmation = exports.sendGroupOfTransactions = exports.performAtomicTransactionComposerDryrun = exports.sendAtomicTransactionComposer = exports.sendTransaction = exports.signTransaction = exports.getSenderTransactionSigner = exports.getSenderAddress = exports.encodeTransactionNote = void 0;
|
|
27
27
|
const algosdk_1 = __importStar(require("algosdk"));
|
|
28
28
|
const buffer_1 = require("buffer");
|
|
29
29
|
const _1 = require("./");
|
|
@@ -76,7 +76,7 @@ const memoize = (fn) => {
|
|
|
76
76
|
return cached;
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
|
-
* Returns a
|
|
79
|
+
* Returns a `TransactionSigner` for the given transaction sender.
|
|
80
80
|
* This function has memoization, so will return the same transaction signer for a given sender.
|
|
81
81
|
* @param sender A transaction sender
|
|
82
82
|
* @returns A transaction signer
|
|
@@ -88,6 +88,22 @@ exports.getSenderTransactionSigner = memoize(function (sender) {
|
|
|
88
88
|
? algosdk_1.default.makeLogicSigAccountTransactionSigner(sender)
|
|
89
89
|
: algosdk_1.default.makeBasicAccountTransactionSigner(sender);
|
|
90
90
|
});
|
|
91
|
+
/**
|
|
92
|
+
* Signs a single transaction by the given signer.
|
|
93
|
+
* @param transaction The transaction to sign
|
|
94
|
+
* @param signer The signer to sign
|
|
95
|
+
* @returns The signed transaction as a `Uint8Array`
|
|
96
|
+
*/
|
|
97
|
+
const signTransaction = async (transaction, signer) => {
|
|
98
|
+
return 'sk' in signer
|
|
99
|
+
? transaction.signTxn(signer.sk)
|
|
100
|
+
: 'lsig' in signer
|
|
101
|
+
? algosdk_1.default.signLogicSigTransactionObject(transaction, signer).blob
|
|
102
|
+
: 'sign' in signer
|
|
103
|
+
? signer.sign(transaction)
|
|
104
|
+
: (await signer.signer([transaction], [0]))[0];
|
|
105
|
+
};
|
|
106
|
+
exports.signTransaction = signTransaction;
|
|
91
107
|
/** Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
|
|
92
108
|
*
|
|
93
109
|
* @param send The details for the transaction to prepare/send, including:
|
|
@@ -109,13 +125,7 @@ const sendTransaction = async function (send, algod) {
|
|
|
109
125
|
if (skipSending) {
|
|
110
126
|
return { transaction };
|
|
111
127
|
}
|
|
112
|
-
const signedTransaction =
|
|
113
|
-
? transaction.signTxn(from.sk)
|
|
114
|
-
: 'lsig' in from
|
|
115
|
-
? algosdk_1.default.signLogicSigTransactionObject(transaction, from).blob
|
|
116
|
-
: 'sign' in from
|
|
117
|
-
? from.sign(transaction)
|
|
118
|
-
: (await from.signer([transaction], [0]))[0];
|
|
128
|
+
const signedTransaction = await (0, exports.signTransaction)(transaction, from);
|
|
119
129
|
await algod.sendRawTransaction(signedTransaction).do();
|
|
120
130
|
_1.Config.getLogger(suppressLog).info(`Sent transaction ID ${transaction.txID()} ${transaction.type} from ${(0, exports.getSenderAddress)(from)}`);
|
|
121
131
|
let confirmation = undefined;
|
|
@@ -126,9 +136,9 @@ const sendTransaction = async function (send, algod) {
|
|
|
126
136
|
};
|
|
127
137
|
exports.sendTransaction = sendTransaction;
|
|
128
138
|
/**
|
|
129
|
-
* Signs and sends transactions that have been collected by an
|
|
139
|
+
* Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.
|
|
130
140
|
* @param atcSend The parameters controlling the send, including:
|
|
131
|
-
* * `atc` The
|
|
141
|
+
* * `atc` The `AtomicTransactionComposer`
|
|
132
142
|
* * `sendParams` The parameters to control the send behaviour
|
|
133
143
|
* @param algod An algod client
|
|
134
144
|
* @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
@@ -194,8 +204,8 @@ const sendAtomicTransactionComposer = async function (atcSend, algod) {
|
|
|
194
204
|
};
|
|
195
205
|
exports.sendAtomicTransactionComposer = sendAtomicTransactionComposer;
|
|
196
206
|
/**
|
|
197
|
-
* Performs a dry run of the transactions loaded into the given
|
|
198
|
-
* @param atc The
|
|
207
|
+
* Performs a dry run of the transactions loaded into the given AtomicTransactionComposer`
|
|
208
|
+
* @param atc The AtomicTransactionComposer` with transaction(s) loaded
|
|
199
209
|
* @param algod An Algod client
|
|
200
210
|
* @returns The dryrun result
|
|
201
211
|
*/
|
|
@@ -240,7 +250,7 @@ const sendGroupOfTransactions = async function (groupSend, algod) {
|
|
|
240
250
|
}));
|
|
241
251
|
const atc = new algosdk_1.AtomicTransactionComposer();
|
|
242
252
|
transactionsWithSigner.forEach((txn) => atc.addTransaction(txn));
|
|
243
|
-
return await (0, exports.sendAtomicTransactionComposer)({ atc, sendParams }, algod);
|
|
253
|
+
return (await (0, exports.sendAtomicTransactionComposer)({ atc, sendParams }, algod));
|
|
244
254
|
};
|
|
245
255
|
exports.sendGroupOfTransactions = sendGroupOfTransactions;
|
|
246
256
|
/**
|
|
@@ -311,7 +321,7 @@ function capTransactionFee(transaction, maxAcceptableFee) {
|
|
|
311
321
|
}
|
|
312
322
|
exports.capTransactionFee = capTransactionFee;
|
|
313
323
|
/**
|
|
314
|
-
* Allows for control of fees on a
|
|
324
|
+
* Allows for control of fees on a `Transaction` or `SuggestedParams` object
|
|
315
325
|
* @param transaction The transaction or suggested params
|
|
316
326
|
* @param feeControl The fee control parameters
|
|
317
327
|
*/
|
|
@@ -338,7 +348,7 @@ async function getTransactionParams(params, algod) {
|
|
|
338
348
|
}
|
|
339
349
|
exports.getTransactionParams = getTransactionParams;
|
|
340
350
|
/**
|
|
341
|
-
* Returns the array of transactions currently present in the given
|
|
351
|
+
* Returns the array of transactions currently present in the given `AtomicTransactionComposer`
|
|
342
352
|
* @param atc The atomic transaction composer
|
|
343
353
|
* @returns The array of transactions with signers
|
|
344
354
|
*/
|
package/transaction.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsH;AACtH,mCAA+B;AAC/B,y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GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAA;AACzE,CAAC;AAFD,oDAEC;AAED;;;;GAIG;AACH,SAAgB,wCAAwC,CAAC,GAA8B;IACrF,IAAI;QACF,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,CAAA;KAChC;IAAC,MAAM;QACN,OAAO,EAAE,CAAA;KACV;AACH,CAAC;AAND,4FAMC"}
|
package/transfer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Algodv2 } from 'algosdk';
|
|
1
|
+
import { Algodv2, Kmd } from 'algosdk';
|
|
2
2
|
import { SendTransactionResult } from './types/transaction';
|
|
3
3
|
import { AlgoTransferParams, EnsureFundedParams } from './types/transfer';
|
|
4
4
|
/**
|
|
@@ -11,11 +11,12 @@ export declare function transferAlgos(transfer: AlgoTransferParams, algod: Algod
|
|
|
11
11
|
/**
|
|
12
12
|
* Funds a given account using a funding source such that it has a certain amount of algos free to spend (accounting for ALGOs locked in minimum balance requirement).
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* https://developer.algorand.org/docs/get-details/accounts/#minimum-balance
|
|
15
15
|
*
|
|
16
16
|
* @param funding The funding configuration
|
|
17
17
|
* @param algod An algod client
|
|
18
|
+
* @param kmd An optional kmd client
|
|
18
19
|
* @returns undefined if nothing was needed or the transaction send result
|
|
19
20
|
*/
|
|
20
|
-
export declare function ensureFunded(funding: EnsureFundedParams, algod: Algodv2): Promise<SendTransactionResult | undefined>;
|
|
21
|
+
export declare function ensureFunded(funding: EnsureFundedParams, algod: Algodv2, kmd?: Kmd): Promise<SendTransactionResult | undefined>;
|
|
21
22
|
//# sourceMappingURL=transfer.d.ts.map
|
package/transfer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../src/transfer.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../src/transfer.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAG/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAEzE;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkBhH;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAiCrI"}
|
package/transfer.js
CHANGED
|
@@ -17,7 +17,7 @@ async function transferAlgos(transfer, algod) {
|
|
|
17
17
|
const { from, to, amount, note, transactionParams, ...sendParams } = transfer;
|
|
18
18
|
const transaction = algosdk_1.default.makePaymentTxnWithSuggestedParamsFromObject({
|
|
19
19
|
from: (0, transaction_1.getSenderAddress)(from),
|
|
20
|
-
to: to,
|
|
20
|
+
to: typeof to === 'string' ? to : (0, transaction_1.getSenderAddress)(to),
|
|
21
21
|
amount: amount.microAlgos,
|
|
22
22
|
note: (0, transaction_1.encodeTransactionNote)(note),
|
|
23
23
|
suggestedParams: await (0, transaction_1.getTransactionParams)(transactionParams, algod),
|
|
@@ -33,25 +33,27 @@ exports.transferAlgos = transferAlgos;
|
|
|
33
33
|
/**
|
|
34
34
|
* Funds a given account using a funding source such that it has a certain amount of algos free to spend (accounting for ALGOs locked in minimum balance requirement).
|
|
35
35
|
*
|
|
36
|
-
*
|
|
36
|
+
* https://developer.algorand.org/docs/get-details/accounts/#minimum-balance
|
|
37
37
|
*
|
|
38
38
|
* @param funding The funding configuration
|
|
39
39
|
* @param algod An algod client
|
|
40
|
+
* @param kmd An optional kmd client
|
|
40
41
|
* @returns undefined if nothing was needed or the transaction send result
|
|
41
42
|
*/
|
|
42
|
-
async function ensureFunded(funding, algod) {
|
|
43
|
+
async function ensureFunded(funding, algod, kmd) {
|
|
43
44
|
const { accountToFund, fundingSource, minSpendingBalance, minFundingIncrement, transactionParams, note, ...sendParams } = funding;
|
|
44
45
|
const addressToFund = typeof accountToFund === 'string' ? accountToFund : (0, transaction_1.getSenderAddress)(accountToFund);
|
|
45
46
|
const accountInfo = await algod.accountInformation(addressToFund).do();
|
|
46
47
|
const balance = Number(accountInfo.amount);
|
|
47
48
|
const minimumBalanceRequirement = (0, _1.microAlgos)(Number(accountInfo['min-balance']));
|
|
48
|
-
const currentSpendingBalance = (0, _1.microAlgos)(balance -
|
|
49
|
+
const currentSpendingBalance = (0, _1.microAlgos)(balance - minimumBalanceRequirement.microAlgos);
|
|
49
50
|
if (minSpendingBalance > currentSpendingBalance) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const from = fundingSource ?? (await (0, _1.getDispenserAccount)(algod, kmd));
|
|
52
|
+
const minFundAmount = (0, _1.microAlgos)(minSpendingBalance.microAlgos - currentSpendingBalance.microAlgos);
|
|
53
|
+
const fundAmount = (0, _1.microAlgos)(Math.max(minFundAmount.microAlgos, minFundingIncrement?.microAlgos ?? 0));
|
|
54
|
+
_1.Config.getLogger(sendParams.suppressLog).info(`Funding ${addressToFund} ${fundAmount} from ${(0, transaction_1.getSenderAddress)(from)} to reach minimum spend amount of ${minSpendingBalance} (balance = ${balance}, min_balance_req = ${minimumBalanceRequirement})`);
|
|
53
55
|
return await transferAlgos({
|
|
54
|
-
from
|
|
56
|
+
from,
|
|
55
57
|
to: addressToFund,
|
|
56
58
|
note: note ?? 'Funding account to meet minimum requirement',
|
|
57
59
|
amount: fundAmount,
|
package/transfer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../src/transfer.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../src/transfer.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA+C;AAC/C,yBAA4D;AAC5D,+CAA8G;AAI9G;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAAC,QAA4B,EAAE,KAAc;IAC9E,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,UAAU,EAAE,GAAG,QAAQ,CAAA;IAE7E,MAAM,WAAW,GAAG,iBAAO,CAAC,2CAA2C,CAAC;QACtE,IAAI,EAAE,IAAA,8BAAgB,EAAC,IAAI,CAAC;QAC5B,EAAE,EAAE,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,8BAAgB,EAAC,EAAE,CAAC;QACtD,MAAM,EAAE,MAAM,CAAC,UAAU;QACzB,IAAI,EAAE,IAAA,mCAAqB,EAAC,IAAI,CAAC;QACjC,eAAe,EAAE,MAAM,IAAA,kCAAoB,EAAC,iBAAiB,EAAE,KAAK,CAAC;QACrE,gBAAgB,EAAE,SAAS;QAC3B,OAAO,EAAE,SAAS;KACnB,CAAC,CAAA;IAEF,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE;QAC3B,SAAM,CAAC,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,gBAAgB,MAAM,CAAC,UAAU,eAAe,IAAA,8BAAgB,EAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;KAClI;IAED,OAAO,IAAA,6BAAe,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,CAAC,CAAA;AAClE,CAAC;AAlBD,sCAkBC;AAED;;;;;;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AAO,uBAAuB,yBAAyB,GAAG,CAClI,CAAA;QACD,OAAO,MAAM,aAAa,CACxB;YACE,IAAI;YACJ,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,IAAI,IAAI,6CAA6C;YAC3D,MAAM,EAAE,UAAU;YAClB,iBAAiB;YACjB,GAAG,UAAU;SACd,EACD,KAAK,CACN,CAAA;KACF;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AAjCD,oCAiCC"}
|
package/types/account.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare class SigningAccount implements Account {
|
|
|
47
47
|
get sender(): Account;
|
|
48
48
|
constructor(account: Account, sender: string | undefined);
|
|
49
49
|
}
|
|
50
|
-
/** A wrapper around
|
|
50
|
+
/** A wrapper around `TransactionSigner` that also has the sender address. */
|
|
51
51
|
export interface TransactionSignerAccount {
|
|
52
52
|
addr: Readonly<string>;
|
|
53
53
|
signer: TransactionSigner;
|
package/types/account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/types/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE5F;;GAEG;AACH,eAAO,MAAM,iBAAiB,cAAc,CAAA;AAE5C,sEAAsE;AACtE,qBAAa,eAAe;IAC1B,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAA;IACjC,gBAAgB,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE,CAAA;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,iBAAiB,CAAA;IAE1B,8CAA8C;IAC9C,IAAI,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAE/C;IAED,oDAAoD;IACpD,IAAI,eAAe,IAAI,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,GAAG,c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M,IAAI,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAE/C;IAED,oDAAoD;IACpD,IAAI,eAAe,IAAI,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE,CAAC,CAEpE;IAED,0CAA0C;IAC1C,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE3B;IAED,IAAI,MAAM,IAAI,iBAAiB,CAE9B;gBAEW,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE;IAU3F;;;;OAIG;IACI,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU;CAY/D;AAED,sDAAsD;AACtD,qBAAa,cAAe,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,OAAO,CAAQ;IAEvB;;OAEG;IACH,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE3B;IAED;;OAEG;IACH,IAAI,EAAE,IAAI,QAAQ,CAAC,UAAU,CAAC,CAE7B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,iBAAiB,CAE9B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAKpB;gBAEW,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS;CAKzD;AAED,6EAA6E;AAC7E,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACtB,MAAM,EAAE,iBAAiB,CAAA;CAC1B"}
|
package/types/algod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EncodedSignedTransaction } from 'algosdk';
|
|
2
|
-
/** The response from the pending transaction API
|
|
2
|
+
/** The response from the pending transaction API https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2transactionspendingtxid */
|
|
3
3
|
export interface PendingTransactionResponse {
|
|
4
4
|
/**
|
|
5
5
|
* The application id if the transaction was found and it created an
|
|
@@ -60,7 +60,7 @@ export interface PendingTransactionResponse {
|
|
|
60
60
|
*/
|
|
61
61
|
txn: EncodedSignedTransaction;
|
|
62
62
|
}
|
|
63
|
-
/** Represents a TEAL value delta
|
|
63
|
+
/** Represents a TEAL value delta https://developer.algorand.org/docs/rest-apis/algod/v2/#evaldelta */
|
|
64
64
|
export type EvalDelta = {
|
|
65
65
|
/**
|
|
66
66
|
* Value `1` refers to **bytes**, value `2` refers to **uint**
|
|
@@ -80,12 +80,12 @@ export type EvalDelta = {
|
|
|
80
80
|
*/
|
|
81
81
|
uint: number | bigint;
|
|
82
82
|
};
|
|
83
|
-
/** The response from the application API
|
|
83
|
+
/** The response from the application API https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2applicationsapplication-id */
|
|
84
84
|
export interface ApplicationResponse {
|
|
85
85
|
id: number;
|
|
86
86
|
params: ApplicationParams;
|
|
87
87
|
}
|
|
88
|
-
/** Stores the global information associated with an application
|
|
88
|
+
/** Stores the global information associated with an application https://developer.algorand.org/docs/rest-apis/algod/v2/#applicationparams */
|
|
89
89
|
export interface ApplicationParams {
|
|
90
90
|
/** Address of the account that created the app */
|
|
91
91
|
creator: string;
|
|
@@ -106,7 +106,7 @@ export interface ApplicationParams {
|
|
|
106
106
|
'local-state-schema'?: ApplicationStateSchema;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* Represents a TEAL value
|
|
109
|
+
* Represents a TEAL value https://developer.algorand.org/docs/rest-apis/algod/v2/#tealvalue
|
|
110
110
|
*/
|
|
111
111
|
export type TealValue = {
|
|
112
112
|
/**
|
|
@@ -127,7 +127,7 @@ export type TealValue = {
|
|
|
127
127
|
*/
|
|
128
128
|
uint: number | bigint;
|
|
129
129
|
};
|
|
130
|
-
/** Specifies maximums on the number of each type that may be stored
|
|
130
|
+
/** Specifies maximums on the number of each type that may be stored https://developer.algorand.org/docs/rest-apis/algod/v2/#applicationstateschema */
|
|
131
131
|
export interface ApplicationStateSchema {
|
|
132
132
|
/** [nbs] num of byte slices */
|
|
133
133
|
'num-byte-slice': number;
|
package/types/algod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algod.d.ts","sourceRoot":"","sources":["../../src/types/algod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAElD
|
|
1
|
+
{"version":3,"file":"algod.d.ts","sourceRoot":"","sources":["../../src/types/algod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAElD,0IAA0I;AAC1I,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAA;IAClD;;OAEG;IACH,YAAY,CAAC,EAAE,0BAA0B,EAAE,CAAA;IAC3C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAA;IACjD;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,EAAE,CAAA;IACnB;4GACwG;IACxG,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,GAAG,EAAE,wBAAwB,C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d.ts
CHANGED
|
@@ -11,10 +11,14 @@ export declare class AlgoAmount {
|
|
|
11
11
|
microAlgos: number;
|
|
12
12
|
});
|
|
13
13
|
toString(): string;
|
|
14
|
+
/** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,
|
|
15
|
+
* but it's not recommended to use this to convert to a number, it's much safer to explicitly call
|
|
16
|
+
* the algos or microAlgos properties
|
|
17
|
+
*/
|
|
14
18
|
valueOf(): number;
|
|
15
|
-
/** Create a
|
|
19
|
+
/** Create a `AlgoAmount` object representing the given number of Algos */
|
|
16
20
|
static Algos(amount: number): AlgoAmount;
|
|
17
|
-
/** Create a
|
|
21
|
+
/** Create a `AlgoAmount` object representing the given number of µAlgos */
|
|
18
22
|
static MicroAlgos(amount: number): AlgoAmount;
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=amount.d.ts.map
|
package/types/amount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../src/types/amount.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,qBAAa,UAAU;IACrB,OAAO,CAAC,kBAAkB,CAAA;IAE1B,8CAA8C;IAC9C,IAAI,UAAU,WAEb;IAED,6CAA6C;IAC7C,IAAI,KAAK,WAER;gBAEW,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;IAI9D,QAAQ,IAAI,MAAM;IAIlB,OAAO,IAAI,MAAM;IAIjB
|
|
1
|
+
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../src/types/amount.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,qBAAa,UAAU;IACrB,OAAO,CAAC,kBAAkB,CAAA;IAE1B,8CAA8C;IAC9C,IAAI,UAAU,WAEb;IAED,6CAA6C;IAC7C,IAAI,KAAK,WAER;gBAEW,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;IAI9D,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB,0EAA0E;IAC1E,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM;IAI3B,2EAA2E;IAC3E,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;CAGjC"}
|
package/types/amount.js
CHANGED
|
@@ -21,14 +21,18 @@ class AlgoAmount {
|
|
|
21
21
|
toString() {
|
|
22
22
|
return `${this.microAlgos.toLocaleString('en-US')} µALGO${this.microAlgos === 1 ? '' : 's'}`;
|
|
23
23
|
}
|
|
24
|
+
/** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,
|
|
25
|
+
* but it's not recommended to use this to convert to a number, it's much safer to explicitly call
|
|
26
|
+
* the algos or microAlgos properties
|
|
27
|
+
*/
|
|
24
28
|
valueOf() {
|
|
25
29
|
return this.microAlgos;
|
|
26
30
|
}
|
|
27
|
-
/** Create a
|
|
31
|
+
/** Create a `AlgoAmount` object representing the given number of Algos */
|
|
28
32
|
static Algos(amount) {
|
|
29
33
|
return new AlgoAmount({ algos: amount });
|
|
30
34
|
}
|
|
31
|
-
/** Create a
|
|
35
|
+
/** Create a `AlgoAmount` object representing the given number of µAlgos */
|
|
32
36
|
static MicroAlgos(amount) {
|
|
33
37
|
return new AlgoAmount({ microAlgos: amount });
|
|
34
38
|
}
|
package/types/amount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/types/amount.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAE7B,0FAA0F;AAC1F,MAAa,UAAU;IAGrB,8CAA8C;IAC9C,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAChC,CAAC;IAED,6CAA6C;IAC7C,IAAI,KAAK;QACP,OAAO,iBAAO,CAAC,iBA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AO;QACL,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED,0EAA0E;IAC1E,MAAM,CAAC,KAAK,CAAC,MAAc;QACzB,OAAO,IAAI,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IAC1C,CAAC;IAED,2EAA2E;IAC3E,MAAM,CAAC,UAAU,CAAC,MAAc;QAC9B,OAAO,IAAI,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAA;IAC/C,CAAC;CACF;AAtCD,gCAsCC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ABIMethod, ABIMethodParams, ABIType, ABIValue, Algodv2, Indexer, SuggestedParams } from 'algosdk';
|
|
2
2
|
import { AlgoAmount } from './amount';
|
|
3
3
|
import { ABIAppCallArg, ABIAppCallArgs, AppCallArgs, AppLookup, AppMetadata, AppReference, AppState, BoxName, OnSchemaBreak, OnUpdate, RawAppCallArgs, TealTemplateParams } from './app';
|
|
4
|
-
import { AppSpec } from './
|
|
4
|
+
import { AppSpec } from './app-spec';
|
|
5
5
|
import { SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction';
|
|
6
|
-
/** Configuration to resolve app by creator and name
|
|
6
|
+
/** Configuration to resolve app by creator and name `getCreatorAppsByName` */
|
|
7
7
|
export type ResolveAppByCreatorAndName = {
|
|
8
8
|
/** The address of the app creator account to resolve the app by */
|
|
9
9
|
creatorAddress: string;
|
|
@@ -13,20 +13,20 @@ export type ResolveAppByCreatorAndName = {
|
|
|
13
13
|
/** indexer An indexer instance to search the creator account apps */
|
|
14
14
|
indexer: Indexer;
|
|
15
15
|
} | {
|
|
16
|
-
/** Optional cached value of the existing apps for the given creator,
|
|
16
|
+
/** Optional cached value of the existing apps for the given creator, `getCreatorAppsByName` */
|
|
17
17
|
existingDeployments: AppLookup;
|
|
18
18
|
});
|
|
19
19
|
/** Configuration to resolve app by ID */
|
|
20
20
|
export interface ResolveAppById {
|
|
21
21
|
/** The id of an existing app to call using this client, or 0 if the app hasn't been created yet */
|
|
22
22
|
id: number;
|
|
23
|
-
/** The optional name to use to mark the app when deploying
|
|
23
|
+
/** The optional name to use to mark the app when deploying `ApplicationClient.deploy` (default: uses the name in the ABI contract) */
|
|
24
24
|
name?: string;
|
|
25
25
|
}
|
|
26
26
|
/** The details of an ARC-0032 app spec specified app */
|
|
27
27
|
export type AppSpecAppDetails = {
|
|
28
28
|
/** The ARC-0032 application spec as either:
|
|
29
|
-
* * Parsed JSON
|
|
29
|
+
* * Parsed JSON `AppSpec`
|
|
30
30
|
* * Raw JSON string
|
|
31
31
|
*/
|
|
32
32
|
app: AppSpec | string;
|
|
@@ -41,6 +41,10 @@ export interface AppClientDeployParams {
|
|
|
41
41
|
version?: string;
|
|
42
42
|
/** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
|
|
43
43
|
sender?: SendTransactionFrom;
|
|
44
|
+
/** Parameters to control transaction sending */
|
|
45
|
+
sendParams?: Omit<SendTransactionParams, 'skipSending' | 'skipWaiting'>;
|
|
46
|
+
/** Any deploy-time parameters to replace in the TEAL code */
|
|
47
|
+
deployTimeParams?: TealTemplateParams;
|
|
44
48
|
/** Whether or not to allow updates in the contract using the deploy-time updatability control if present in your contract.
|
|
45
49
|
* If this is not specified then it will automatically be determined based on the AppSpec definition
|
|
46
50
|
**/
|
|
@@ -49,10 +53,6 @@ export interface AppClientDeployParams {
|
|
|
49
53
|
* If this is not specified then it will automatically be determined based on the AppSpec definition
|
|
50
54
|
**/
|
|
51
55
|
allowDelete?: boolean;
|
|
52
|
-
/** Parameters to control transaction sending */
|
|
53
|
-
sendParams?: Omit<SendTransactionParams, 'skipSending' | 'skipWaiting'>;
|
|
54
|
-
/** Any deploy-time parameters to replace in the TEAL code */
|
|
55
|
-
deployTimeParams?: TealTemplateParams;
|
|
56
56
|
/** What action to perform if a schema break is detected */
|
|
57
57
|
onSchemaBreak?: 'replace' | 'fail' | OnSchemaBreak;
|
|
58
58
|
/** What action to perform if a TEAL update is detected */
|
|
@@ -159,7 +159,7 @@ export declare class ApplicationClient {
|
|
|
159
159
|
/**
|
|
160
160
|
* Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
|
|
161
161
|
*
|
|
162
|
-
* To understand the architecture decisions behind this functionality please
|
|
162
|
+
* To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md
|
|
163
163
|
*
|
|
164
164
|
* **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.
|
|
165
165
|
*
|
|
@@ -180,11 +180,11 @@ export declare class ApplicationClient {
|
|
|
180
180
|
})>;
|
|
181
181
|
create(create?: AppClientCreateParams): Promise<Partial<import("./app").AppCompilationResult> & import("./app").AppCallTransactionResult & AppReference>;
|
|
182
182
|
update(update?: AppClientUpdateParams): Promise<Partial<import("./app").AppCompilationResult> & import("./app").AppCallTransactionResult>;
|
|
183
|
-
call(call
|
|
184
|
-
optIn(call
|
|
185
|
-
closeOut(call
|
|
186
|
-
clearState(call
|
|
187
|
-
delete(call
|
|
183
|
+
call(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
184
|
+
optIn(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
185
|
+
closeOut(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
186
|
+
clearState(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
187
|
+
delete(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
188
188
|
private _call;
|
|
189
189
|
/**
|
|
190
190
|
* Funds ALGOs into the app account for this app.
|
|
@@ -209,16 +209,16 @@ export declare class ApplicationClient {
|
|
|
209
209
|
getBoxNames(): Promise<BoxName[]>;
|
|
210
210
|
/**
|
|
211
211
|
* Returns the value of the given box for the current app.
|
|
212
|
-
* @param name The name of the box to return either as a string, binary array or
|
|
212
|
+
* @param name The name of the box to return either as a string, binary array or `BoxName`
|
|
213
213
|
* @returns The current box value as a byte array
|
|
214
214
|
*/
|
|
215
215
|
getBoxValue(name: BoxName | string | Uint8Array): Promise<Uint8Array>;
|
|
216
216
|
/**
|
|
217
217
|
* Returns the value of the given box for the current app.
|
|
218
|
-
* @param name The name of the box to return either as a string, binary array or
|
|
218
|
+
* @param name The name of the box to return either as a string, binary array or `BoxName`
|
|
219
219
|
* @returns The current box value as a byte array
|
|
220
220
|
*/
|
|
221
|
-
|
|
221
|
+
getBoxValueFromABIType(name: BoxName | string | Uint8Array, type: ABIType): Promise<ABIValue>;
|
|
222
222
|
/**
|
|
223
223
|
* Returns the values of all current boxes for the current app.
|
|
224
224
|
* Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
|
|
@@ -236,6 +236,11 @@ export declare class ApplicationClient {
|
|
|
236
236
|
* @param filter Optional filter to filter which boxes' values are returned
|
|
237
237
|
* @returns The (name, value) pair of the boxes with values as the ABI Value
|
|
238
238
|
*/
|
|
239
|
+
getBoxValuesFromABIType(type: ABIType, filter?: (name: BoxName) => boolean): Promise<{
|
|
240
|
+
name: BoxName;
|
|
241
|
+
value: ABIValue;
|
|
242
|
+
}[]>;
|
|
243
|
+
/** @deprecated Use `getBoxValuesFromABIType` instead */
|
|
239
244
|
getBoxValuesAsABIType(type: ABIType, filter?: (name: BoxName) => boolean): Promise<{
|
|
240
245
|
name: BoxName;
|
|
241
246
|
value: ABIValue;
|
|
@@ -266,7 +271,7 @@ export declare class ApplicationClient {
|
|
|
266
271
|
getAppReference(): Promise<AppMetadata | AppReference>;
|
|
267
272
|
/**
|
|
268
273
|
* Takes an error that may include a logic error from a smart contract call and re-exposes the error to include source code information via the source map.
|
|
269
|
-
* This is automatically used within
|
|
274
|
+
* This is automatically used within `ApplicationClient` but if you pass `skipSending: true` e.g. if doing a group transaction
|
|
270
275
|
* then you can use this in a try/catch block to get better debugging information.
|
|
271
276
|
* @param e The error to parse
|
|
272
277
|
* @param isClear Whether or not the code was running the clear state program
|
|
@@ -274,4 +279,4 @@ export declare class ApplicationClient {
|
|
|
274
279
|
*/
|
|
275
280
|
exposeLogicError(e: Error, isClear?: boolean): Error;
|
|
276
281
|
}
|
|
277
|
-
//# sourceMappingURL=
|
|
282
|
+
//# sourceMappingURL=app-client.d.ts.map
|