@algorandfoundation/algokit-utils 1.0.0-beta.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/account.d.ts +41 -36
- package/account.d.ts.map +1 -1
- package/account.js +59 -44
- package/account.js.map +1 -1
- package/amount.d.ts +20 -0
- package/amount.d.ts.map +1 -0
- package/amount.js +36 -0
- package/amount.js.map +1 -0
- 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/app-deploy.d.ts +95 -0
- package/app-deploy.d.ts.map +1 -0
- package/{deploy-app.js → app-deploy.js} +129 -119
- package/app-deploy.js.map +1 -0
- package/app.d.ts +112 -148
- package/app.d.ts.map +1 -1
- package/app.js +460 -143
- package/app.js.map +1 -1
- package/index.d.ts +6 -4
- package/index.d.ts.map +1 -1
- package/index.js +7 -4
- package/index.js.map +1 -1
- package/indexer-lookup.d.ts +11 -4
- package/indexer-lookup.d.ts.map +1 -1
- package/indexer-lookup.js +19 -9
- package/indexer-lookup.js.map +1 -1
- package/localnet.d.ts +10 -10
- package/localnet.d.ts.map +1 -1
- package/localnet.js +16 -16
- package/localnet.js.map +1 -1
- package/network-client.d.ts +15 -24
- package/network-client.d.ts.map +1 -1
- package/network-client.js +16 -16
- package/network-client.js.map +1 -1
- package/package.json +2 -2
- package/testing/account.d.ts +14 -0
- package/testing/account.d.ts.map +1 -0
- package/testing/account.js +31 -0
- package/testing/account.js.map +1 -0
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
- package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
- package/testing/fixtures/algokit-log-capture-fixture.js +43 -0
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
- package/testing/fixtures/algorand-fixture.d.ts +24 -0
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
- package/testing/fixtures/algorand-fixture.js +60 -0
- package/testing/fixtures/algorand-fixture.js.map +1 -0
- package/testing/fixtures/index.d.ts +3 -0
- package/testing/fixtures/index.d.ts.map +1 -0
- package/testing/fixtures/index.js +19 -0
- package/testing/fixtures/index.js.map +1 -0
- package/testing/index.d.ts +6 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/index.js +22 -0
- package/testing/index.js.map +1 -0
- package/testing/indexer.d.ts +12 -0
- package/testing/indexer.d.ts.map +1 -0
- package/testing/indexer.js +40 -0
- package/testing/indexer.js.map +1 -0
- package/testing/test-logger.d.ts +41 -0
- package/testing/test-logger.d.ts.map +1 -0
- package/testing/test-logger.js +71 -0
- package/testing/test-logger.js.map +1 -0
- package/testing/transaction-logger.d.ts +29 -0
- package/testing/transaction-logger.d.ts.map +1 -0
- package/testing/transaction-logger.js +71 -0
- package/testing/transaction-logger.js.map +1 -0
- package/transaction.d.ts +55 -91
- package/transaction.d.ts.map +1 -1
- package/transaction.js +213 -155
- package/transaction.js.map +1 -1
- package/transfer.d.ts +14 -16
- package/transfer.d.ts.map +1 -1
- package/transfer.js +38 -4
- package/transfer.js.map +1 -1
- package/types/account.d.ts +55 -0
- package/types/account.d.ts.map +1 -0
- package/types/account.js +91 -0
- package/types/account.js.map +1 -0
- package/types/algo-http-client-with-retry.d.ts.map +1 -0
- package/{algo-http-client-with-retry.js → types/algo-http-client-with-retry.js} +3 -3
- package/types/algo-http-client-with-retry.js.map +1 -0
- package/types/algod.d.ts +28 -15
- package/types/algod.d.ts.map +1 -1
- package/{algo-amount.d.ts → types/amount.d.ts} +9 -3
- package/types/amount.d.ts.map +1 -0
- package/{algo-amount.js → types/amount.js} +13 -3
- package/types/amount.js.map +1 -0
- package/types/app-client.d.ts +282 -0
- package/types/app-client.d.ts.map +1 -0
- package/types/app-client.js +529 -0
- package/types/app-client.js.map +1 -0
- package/types/app-spec.d.ts +141 -0
- package/types/app-spec.d.ts.map +1 -0
- package/types/{appspec.js → app-spec.js} +5 -7
- package/types/app-spec.js.map +1 -0
- package/types/app.d.ts +285 -0
- package/types/app.d.ts.map +1 -0
- package/types/app.js +32 -0
- package/types/app.js.map +1 -0
- package/types/config.d.ts +32 -0
- package/types/config.d.ts.map +1 -0
- package/types/config.js +53 -0
- package/types/config.js.map +1 -0
- package/types/indexer.d.ts +368 -58
- package/types/indexer.d.ts.map +1 -1
- package/types/indexer.js +9 -0
- package/types/indexer.js.map +1 -1
- package/{config.d.ts → types/logging.d.ts} +2 -16
- package/types/logging.d.ts.map +1 -0
- package/{config.js → types/logging.js} +5 -24
- package/types/logging.js.map +1 -0
- package/types/logic-error.d.ts +37 -0
- package/types/logic-error.d.ts.map +1 -0
- package/types/logic-error.js +50 -0
- package/types/logic-error.js.map +1 -0
- package/types/network-client.d.ts +11 -0
- package/types/network-client.d.ts.map +1 -0
- package/types/network-client.js +3 -0
- package/types/network-client.js.map +1 -0
- package/types/testing.d.ts +89 -0
- package/types/testing.d.ts.map +1 -0
- package/types/testing.js +3 -0
- package/types/testing.js.map +1 -0
- package/types/transaction.d.ts +112 -0
- package/types/transaction.d.ts.map +1 -0
- package/types/transaction.js +3 -0
- package/types/transaction.js.map +1 -0
- package/types/transfer.d.ts +32 -0
- package/types/transfer.d.ts.map +1 -0
- package/types/transfer.js +3 -0
- package/types/transfer.js.map +1 -0
- package/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
- package/types/urlTokenBaseHTTPClient.js.map +1 -0
- package/algo-amount.d.ts.map +0 -1
- package/algo-amount.js.map +0 -1
- package/algo-http-client-with-retry.d.ts.map +0 -1
- package/algo-http-client-with-retry.js.map +0 -1
- package/application-client.d.ts +0 -113
- package/application-client.d.ts.map +0 -1
- package/application-client.js +0 -258
- package/application-client.js.map +0 -1
- package/config.d.ts.map +0 -1
- package/config.js.map +0 -1
- package/deploy-app.d.ts +0 -164
- package/deploy-app.d.ts.map +0 -1
- package/deploy-app.js.map +0 -1
- package/types/appspec.d.ts +0 -78
- package/types/appspec.d.ts.map +0 -1
- package/types/appspec.js.map +0 -1
- package/urlTokenBaseHTTPClient.d.ts.map +0 -1
- package/urlTokenBaseHTTPClient.js.map +0 -1
- /package/{algo-http-client-with-retry.d.ts → types/algo-http-client-with-retry.d.ts} +0 -0
- /package/{urlTokenBaseHTTPClient.d.ts → types/urlTokenBaseHTTPClient.d.ts} +0 -0
- /package/{urlTokenBaseHTTPClient.js → types/urlTokenBaseHTTPClient.js} +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Algodv2, Indexer } from 'algosdk';
|
|
2
|
+
/**
|
|
3
|
+
* Allows you to keep track of Algorand transaction IDs by wrapping an `Algodv2` in a proxy.
|
|
4
|
+
* Useful for automated tests.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TransactionLogger {
|
|
7
|
+
private _sentTransactionIds;
|
|
8
|
+
/**
|
|
9
|
+
* The list of transaction IDs that has been logged thus far.
|
|
10
|
+
*/
|
|
11
|
+
get sentTransactionIds(): Readonly<string[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Clear all logged IDs.
|
|
14
|
+
*/
|
|
15
|
+
clear(): void;
|
|
16
|
+
/**
|
|
17
|
+
* The method that captures raw transactions and stores the transaction IDs.
|
|
18
|
+
*/
|
|
19
|
+
logRawTransaction(signedTransactions: Uint8Array | Uint8Array[]): void;
|
|
20
|
+
/** Return a proxy that wraps the given Algodv2 with this transaction logger.
|
|
21
|
+
*
|
|
22
|
+
* @param algod The `Algodv2` to wrap
|
|
23
|
+
* @returns The wrapped `Algodv2`, any transactions sent using this algod instance will be logged by this transaction logger
|
|
24
|
+
*/
|
|
25
|
+
capture(algod: Algodv2): Algodv2;
|
|
26
|
+
/** Wait until all logged transactions IDs appear in the given `Indexer`. */
|
|
27
|
+
waitForIndexer(indexer: Indexer): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=transaction-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-logger.d.ts","sourceRoot":"","sources":["../../src/testing/transaction-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,OAAO,EAAE,MAAM,SAAS,CAAA;AAGnE;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,mBAAmB,CAAe;IAE1C;;OAEG;IACH,IAAI,kBAAkB,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAE3C;IAED;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,UAAU,GAAG,UAAU,EAAE;IAY/D;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIhC,4EAA4E;IACtE,cAAc,CAAC,OAAO,EAAE,OAAO;CAGtC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionLogger = void 0;
|
|
4
|
+
const algosdk_1 = require("algosdk");
|
|
5
|
+
const _1 = require("./");
|
|
6
|
+
/**
|
|
7
|
+
* Allows you to keep track of Algorand transaction IDs by wrapping an `Algodv2` in a proxy.
|
|
8
|
+
* Useful for automated tests.
|
|
9
|
+
*/
|
|
10
|
+
class TransactionLogger {
|
|
11
|
+
constructor() {
|
|
12
|
+
this._sentTransactionIds = [];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The list of transaction IDs that has been logged thus far.
|
|
16
|
+
*/
|
|
17
|
+
get sentTransactionIds() {
|
|
18
|
+
return this._sentTransactionIds;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Clear all logged IDs.
|
|
22
|
+
*/
|
|
23
|
+
clear() {
|
|
24
|
+
this._sentTransactionIds = [];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The method that captures raw transactions and stores the transaction IDs.
|
|
28
|
+
*/
|
|
29
|
+
logRawTransaction(signedTransactions) {
|
|
30
|
+
if (Array.isArray(signedTransactions)) {
|
|
31
|
+
for (const stxn of signedTransactions) {
|
|
32
|
+
const decoded = (0, algosdk_1.decodeSignedTransaction)(stxn);
|
|
33
|
+
this._sentTransactionIds.push(decoded.txn.txID());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const decoded = (0, algosdk_1.decodeSignedTransaction)(signedTransactions);
|
|
38
|
+
this._sentTransactionIds.push(decoded.txn.txID());
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Return a proxy that wraps the given Algodv2 with this transaction logger.
|
|
42
|
+
*
|
|
43
|
+
* @param algod The `Algodv2` to wrap
|
|
44
|
+
* @returns The wrapped `Algodv2`, any transactions sent using this algod instance will be logged by this transaction logger
|
|
45
|
+
*/
|
|
46
|
+
capture(algod) {
|
|
47
|
+
return new Proxy(algod, new TransactionLoggingAlgodv2ProxyHandler(this));
|
|
48
|
+
}
|
|
49
|
+
/** Wait until all logged transactions IDs appear in the given `Indexer`. */
|
|
50
|
+
async waitForIndexer(indexer) {
|
|
51
|
+
await Promise.all(this._sentTransactionIds.map((txnId) => (0, _1.runWhenIndexerCaughtUp)(() => indexer.lookupTransactionByID(txnId).do())));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.TransactionLogger = TransactionLogger;
|
|
55
|
+
class TransactionLoggingAlgodv2ProxyHandler {
|
|
56
|
+
constructor(transactionLogger) {
|
|
57
|
+
this.transactionLogger = transactionLogger;
|
|
58
|
+
}
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
get(target, property, receiver) {
|
|
61
|
+
if (property === 'sendRawTransaction') {
|
|
62
|
+
return (stxOrStxs) => {
|
|
63
|
+
this.transactionLogger.logRawTransaction(stxOrStxs);
|
|
64
|
+
return target[property].call(receiver, stxOrStxs);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
+
return target[property];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=transaction-logger.js.map
|
|
@@ -0,0 +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,4EAA4E;IAC5E,KAAK,CAAC,cAAc,CAAC,OAAgB;QACnC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,yBAAsB,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IACrI,CAAC;CACF;AA7CD,8CA6CC;AAED,MAAM,qCAAqC;IAGzC,YAAY,iBAAoC;QAC9C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;IAC5C,CAAC;IAED,8DAA8D;IAC9D,GAAG,CAAC,MAAe,EAAE,QAAyB,EAAE,QAAa;QAC3D,IAAI,QAAQ,KAAK,oBAAoB,EAAE;YACrC,OAAO,CAAC,SAAoC,EAAE,EAAE;gBAC9C,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;gBACnD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;YACnD,CAAC,CAAA;SACF;QACD,8DAA8D;QAC9D,OAAQ,MAAc,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;CACF"}
|
package/transaction.d.ts
CHANGED
|
@@ -1,52 +1,7 @@
|
|
|
1
|
-
import algosdk, {
|
|
2
|
-
import { AlgoAmount } from './algo-amount';
|
|
1
|
+
import algosdk, { Algodv2, AtomicTransactionComposer, SuggestedParams, Transaction } from 'algosdk';
|
|
3
2
|
import { PendingTransactionResponse } from './types/algod';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
_params: algosdk.MultisigMetadata;
|
|
7
|
-
_signingAccounts: (algosdk.Account | SigningAccount)[];
|
|
8
|
-
_addr: string;
|
|
9
|
-
get params(): Readonly<algosdk.MultisigMetadata>;
|
|
10
|
-
get signingAccounts(): Readonly<(algosdk.Account | SigningAccount)[]>;
|
|
11
|
-
get addr(): Readonly<string>;
|
|
12
|
-
constructor(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]);
|
|
13
|
-
sign(transaction: Transaction | Uint8Array): Uint8Array;
|
|
14
|
-
}
|
|
15
|
-
/** Account wrapper that supports a rekeyed account */
|
|
16
|
-
export declare class SigningAccount implements Account {
|
|
17
|
-
private _account;
|
|
18
|
-
private _sender;
|
|
19
|
-
/**
|
|
20
|
-
* Algorand address of the sender
|
|
21
|
-
*/
|
|
22
|
-
get addr(): Readonly<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Secret key belonging to the signer
|
|
25
|
-
*/
|
|
26
|
-
get sk(): Readonly<Uint8Array>;
|
|
27
|
-
/**
|
|
28
|
-
* Algorand account of the underlying signing account
|
|
29
|
-
*/
|
|
30
|
-
get signer(): Account;
|
|
31
|
-
/**
|
|
32
|
-
* Algorand account of the sender address and signer private key
|
|
33
|
-
*/
|
|
34
|
-
get sender(): Account;
|
|
35
|
-
constructor(account: Account, sender: string | undefined);
|
|
36
|
-
}
|
|
37
|
-
/** A wrapper around @see {TransactionSigner} that also has the sender address. */
|
|
38
|
-
export interface TransactionSignerAccount {
|
|
39
|
-
addr: Readonly<string>;
|
|
40
|
-
signer: TransactionSigner;
|
|
41
|
-
}
|
|
42
|
-
export type TransactionNote = Uint8Array | TransactionNoteData | Arc2TransactionNote;
|
|
43
|
-
export type TransactionNoteData = string | null | undefined | number | any[] | Record<string, any>;
|
|
44
|
-
/** ARC-0002 compatible transaction note components, @see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md */
|
|
45
|
-
export type Arc2TransactionNote = {
|
|
46
|
-
dAppName: string;
|
|
47
|
-
format: 'm' | 'j' | 'b' | 'u';
|
|
48
|
-
data: string;
|
|
49
|
-
};
|
|
3
|
+
import { AlgoAmount } from './types/amount';
|
|
4
|
+
import { AtomicTransactionComposerToSend, SendAtomicTransactionComposerResults, SendTransactionFrom, SendTransactionParams, SendTransactionResult, TransactionGroupToSend, TransactionNote } from './types/transaction';
|
|
50
5
|
/** Encodes a transaction note into a byte array ready to be included in an Algorand transaction.
|
|
51
6
|
*
|
|
52
7
|
* @param note The transaction note
|
|
@@ -60,56 +15,57 @@ export type Arc2TransactionNote = {
|
|
|
60
15
|
* * Else: The object/value converted into a JSON string representation
|
|
61
16
|
*/
|
|
62
17
|
export declare function encodeTransactionNote(note?: TransactionNote): Uint8Array | undefined;
|
|
63
|
-
/** The sending configuration for a transaction */
|
|
64
|
-
export interface SendTransactionParams {
|
|
65
|
-
/** Whether to skip signing and sending the transaction to the chain (default: transaction signed and sent to chain)
|
|
66
|
-
* (and instead just return the raw transaction, e.g. so you can add it to a group of transactions) */
|
|
67
|
-
skipSending?: boolean;
|
|
68
|
-
/** Whether to skip waiting for the submitted transaction (only relevant if `skipSending` is `false` or unset) */
|
|
69
|
-
skipWaiting?: boolean;
|
|
70
|
-
/** Whether to suppress log messages from transaction send, default: do not suppress */
|
|
71
|
-
suppressLog?: boolean;
|
|
72
|
-
/** The maximum fee that you are happy to pay (default: unbounded) - if this is set it's possible the transaction could get rejected during network congestion */
|
|
73
|
-
maxFee?: AlgoAmount;
|
|
74
|
-
/** The maximum number of rounds to wait for confirmation, only applies if `skipWaiting` is `undefined` or `false`, default: wait up to 5 rounds */
|
|
75
|
-
maxRoundsToWaitForConfirmation?: number;
|
|
76
|
-
}
|
|
77
|
-
/** The result of sending a transaction */
|
|
78
|
-
export interface SendTransactionResult {
|
|
79
|
-
/** The transaction */
|
|
80
|
-
transaction: Transaction;
|
|
81
|
-
/** The response if the transaction was sent and waited for */
|
|
82
|
-
confirmation?: PendingTransactionResponse;
|
|
83
|
-
}
|
|
84
|
-
export type SendTransactionFrom = Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount;
|
|
85
18
|
/**
|
|
86
19
|
* Returns the public address of the given transaction sender.
|
|
87
20
|
* @param sender A transaction sender
|
|
88
21
|
* @returns The public address
|
|
89
22
|
*/
|
|
90
23
|
export declare const getSenderAddress: (sender: SendTransactionFrom) => string;
|
|
91
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Returns a `TransactionSigner` for the given transaction sender.
|
|
26
|
+
* This function has memoization, so will return the same transaction signer for a given sender.
|
|
27
|
+
* @param sender A transaction sender
|
|
28
|
+
* @returns A transaction signer
|
|
29
|
+
*/
|
|
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>;
|
|
38
|
+
/** Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
|
|
92
39
|
*
|
|
93
|
-
* @param send The details for the transaction to send, including:
|
|
40
|
+
* @param send The details for the transaction to prepare/send, including:
|
|
94
41
|
* * `transaction`: The unsigned transaction
|
|
95
42
|
* * `from`: The account to sign the transaction with: either an account with private key loaded or a logic signature account
|
|
96
43
|
* * `config`: The sending configuration for this transaction
|
|
97
44
|
* @param algod An algod client
|
|
98
45
|
*
|
|
99
|
-
* @returns An object with transaction (`transaction`) and (if `skipWaiting` is `false` or
|
|
46
|
+
* @returns An object with transaction (`transaction`) and (if `skipWaiting` is `false` or `undefined`) confirmation (`confirmation`)
|
|
100
47
|
*/
|
|
101
48
|
export declare const sendTransaction: (send: {
|
|
102
49
|
transaction: Transaction;
|
|
103
50
|
from: SendTransactionFrom;
|
|
104
51
|
sendParams?: SendTransactionParams;
|
|
105
52
|
}, algod: Algodv2) => Promise<SendTransactionResult>;
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.
|
|
55
|
+
* @param atcSend The parameters controlling the send, including:
|
|
56
|
+
* * `atc` The `AtomicTransactionComposer`
|
|
57
|
+
* * `sendParams` The parameters to control the send behaviour
|
|
58
|
+
* @param algod An algod client
|
|
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`)
|
|
60
|
+
*/
|
|
61
|
+
export declare const sendAtomicTransactionComposer: (atcSend: AtomicTransactionComposerToSend, algod: Algodv2) => Promise<SendAtomicTransactionComposerResults>;
|
|
62
|
+
/**
|
|
63
|
+
* Performs a dry run of the transactions loaded into the given AtomicTransactionComposer`
|
|
64
|
+
* @param atc The AtomicTransactionComposer` with transaction(s) loaded
|
|
65
|
+
* @param algod An Algod client
|
|
66
|
+
* @returns The dryrun result
|
|
67
|
+
*/
|
|
68
|
+
export declare function performAtomicTransactionComposerDryrun(atc: AtomicTransactionComposer, algod: Algodv2): Promise<algosdk.DryrunResult>;
|
|
113
69
|
/**
|
|
114
70
|
* Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#create-transactions) transactions to the chain
|
|
115
71
|
*
|
|
@@ -117,16 +73,9 @@ export interface TransactionToSign {
|
|
|
117
73
|
* * `transactions`: The array of transactions to send along with their signing account
|
|
118
74
|
* * `sendParams`: The parameters to dictate how the group is sent
|
|
119
75
|
* @param algod An algod client
|
|
120
|
-
* @returns An object with group transaction ID (`groupTransactionId`) and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
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`)
|
|
121
77
|
*/
|
|
122
|
-
export declare const sendGroupOfTransactions: (groupSend:
|
|
123
|
-
transactions: TransactionToSign[];
|
|
124
|
-
sendParams?: Omit<Omit<SendTransactionParams, 'maxFee'>, 'skipSending'>;
|
|
125
|
-
}, algod: Algodv2) => Promise<{
|
|
126
|
-
groupId: string;
|
|
127
|
-
confirmations: PendingTransactionResponse[] | undefined;
|
|
128
|
-
txIds: string[];
|
|
129
|
-
}>;
|
|
78
|
+
export declare const sendGroupOfTransactions: (groupSend: TransactionGroupToSend, algod: Algodv2) => Promise<Omit<SendAtomicTransactionComposerResults, "returns">>;
|
|
130
79
|
/**
|
|
131
80
|
* Wait until the transaction is confirmed or rejected, or until `timeout`
|
|
132
81
|
* number of rounds have passed.
|
|
@@ -143,10 +92,19 @@ export declare const waitForConfirmation: (transactionId: string, maxRoundsToWai
|
|
|
143
92
|
* Limit the acceptable fee to a defined amount of µALGOs.
|
|
144
93
|
* This also sets the transaction to be flatFee to ensure the transaction only succeeds at
|
|
145
94
|
* the estimated rate.
|
|
146
|
-
* @param transaction The transaction to cap
|
|
95
|
+
* @param transaction The transaction to cap or suggested params object about to be used to create a transaction
|
|
147
96
|
* @param maxAcceptableFee The maximum acceptable fee to pay
|
|
148
97
|
*/
|
|
149
|
-
export declare function capTransactionFee(transaction: algosdk.Transaction, maxAcceptableFee: AlgoAmount): void;
|
|
98
|
+
export declare function capTransactionFee(transaction: algosdk.Transaction | SuggestedParams, maxAcceptableFee: AlgoAmount): void;
|
|
99
|
+
/**
|
|
100
|
+
* Allows for control of fees on a `Transaction` or `SuggestedParams` object
|
|
101
|
+
* @param transaction The transaction or suggested params
|
|
102
|
+
* @param feeControl The fee control parameters
|
|
103
|
+
*/
|
|
104
|
+
export declare function controlFees<T extends SuggestedParams | Transaction>(transaction: T, feeControl: {
|
|
105
|
+
fee?: AlgoAmount;
|
|
106
|
+
maxFee?: AlgoAmount;
|
|
107
|
+
}): T;
|
|
150
108
|
/**
|
|
151
109
|
* Returns suggested transaction parameters from algod unless some are already provided.
|
|
152
110
|
* @param params Optionally provide parameters to use
|
|
@@ -154,4 +112,10 @@ export declare function capTransactionFee(transaction: algosdk.Transaction, maxA
|
|
|
154
112
|
* @returns The suggested transaction parameters
|
|
155
113
|
*/
|
|
156
114
|
export declare function getTransactionParams(params: SuggestedParams | undefined, algod: Algodv2): Promise<algosdk.SuggestedParams>;
|
|
115
|
+
/**
|
|
116
|
+
* Returns the array of transactions currently present in the given `AtomicTransactionComposer`
|
|
117
|
+
* @param atc The atomic transaction composer
|
|
118
|
+
* @returns The array of transactions with signers
|
|
119
|
+
*/
|
|
120
|
+
export declare function getAtomicTransactionComposerTransactions(atc: AtomicTransactionComposer): algosdk.TransactionWithSigner[];
|
|
157
121
|
//# sourceMappingURL=transaction.d.ts.map
|
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,
|
|
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"}
|