@algorandfoundation/algokit-utils 1.0.0-beta.2 → 1.0.0-beta.21
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/{dist/account.d.ts → account.d.ts} +29 -31
- package/account.d.ts.map +1 -0
- package/{dist/account.js → account.js} +43 -43
- package/account.js.map +1 -0
- package/amount.d.ts +8 -0
- package/amount.d.ts.map +1 -0
- package/amount.js +24 -0
- package/amount.js.map +1 -0
- package/app.d.ts +51 -0
- package/app.d.ts.map +1 -0
- package/app.js +288 -0
- package/app.js.map +1 -0
- package/application-client.d.ts +10 -0
- package/application-client.d.ts.map +1 -0
- package/application-client.js +15 -0
- package/application-client.js.map +1 -0
- package/deploy-app.d.ts +93 -0
- package/deploy-app.d.ts.map +1 -0
- package/{dist/deploy-app.js → deploy-app.js} +129 -137
- package/deploy-app.js.map +1 -0
- package/index.d.ts +14 -0
- package/index.d.ts.map +1 -0
- package/{dist/index.js → index.js} +6 -4
- package/index.js.map +1 -0
- package/{dist/indexer-lookup.d.ts → indexer-lookup.d.ts} +1 -1
- package/{dist/indexer-lookup.d.ts.map → indexer-lookup.d.ts.map} +1 -1
- package/{dist/localnet.d.ts → localnet.d.ts} +4 -4
- package/localnet.d.ts.map +1 -0
- package/{dist/localnet.js → localnet.js} +10 -10
- package/localnet.js.map +1 -0
- package/{dist/network-client.d.ts → network-client.d.ts} +11 -20
- package/network-client.d.ts.map +1 -0
- package/{dist/network-client.js → network-client.js} +11 -11
- package/{dist/network-client.js.map → network-client.js.map} +1 -1
- package/package.json +4 -92
- 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 +20 -0
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
- package/testing/fixtures/algorand-fixture.js +49 -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 +39 -0
- package/testing/indexer.js.map +1 -0
- package/testing/test-logger.d.ts +39 -0
- package/testing/test-logger.d.ts.map +1 -0
- package/testing/test-logger.js +69 -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 +80 -0
- package/transaction.d.ts.map +1 -0
- package/{dist/transaction.js → transaction.js} +88 -106
- package/transaction.js.map +1 -0
- package/transfer.d.ts +21 -0
- package/transfer.d.ts.map +1 -0
- package/transfer.js +65 -0
- package/transfer.js.map +1 -0
- package/types/account.d.ts +52 -0
- package/types/account.d.ts.map +1 -0
- package/types/account.js +86 -0
- package/types/account.js.map +1 -0
- package/types/algo-http-client-with-retry.d.ts.map +1 -0
- package/{dist → types}/algo-http-client-with-retry.js +2 -2
- package/types/algo-http-client-with-retry.js.map +1 -0
- package/{dist/algod-type.d.ts → types/algod.d.ts} +6 -7
- package/types/algod.d.ts.map +1 -0
- package/{dist/algod-type.js → types/algod.js} +1 -1
- package/types/algod.js.map +1 -0
- package/{dist/algo-amount.d.ts → types/amount.d.ts} +3 -1
- package/types/amount.d.ts.map +1 -0
- package/{dist/algo-amount.js → types/amount.js} +7 -1
- package/types/amount.js.map +1 -0
- package/types/app.d.ts +234 -0
- package/types/app.d.ts.map +1 -0
- package/types/app.js +32 -0
- package/types/app.js.map +1 -0
- package/types/application-client.d.ts +155 -0
- package/types/application-client.d.ts.map +1 -0
- package/types/application-client.js +348 -0
- package/types/application-client.js.map +1 -0
- package/types/appspec.d.ts +77 -0
- package/types/appspec.d.ts.map +1 -0
- package/types/appspec.js +15 -0
- package/types/appspec.js.map +1 -0
- package/types/config.d.ts +15 -0
- package/types/config.d.ts.map +1 -0
- package/types/config.js +27 -0
- package/types/config.js.map +1 -0
- package/{dist/indexer-type.d.ts → types/indexer.d.ts} +9 -10
- package/types/indexer.d.ts.map +1 -0
- package/{dist/indexer-type.js → types/indexer.js} +1 -1
- package/types/indexer.js.map +1 -0
- package/{dist/config.d.ts → types/logging.d.ts} +3 -15
- package/types/logging.d.ts.map +1 -0
- package/types/logging.js +27 -0
- package/types/logging.js.map +1 -0
- package/types/logic-error.d.ts +33 -0
- package/types/logic-error.d.ts.map +1 -0
- package/types/logic-error.js +46 -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 +67 -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/LICENSE +0 -21
- package/README.md +0 -31
- package/dist/account.d.ts.map +0 -1
- package/dist/account.js.map +0 -1
- package/dist/algo-amount.d.ts.map +0 -1
- package/dist/algo-amount.js.map +0 -1
- package/dist/algo-http-client-with-retry.d.ts.map +0 -1
- package/dist/algo-http-client-with-retry.js.map +0 -1
- package/dist/algod-type.d.ts.map +0 -1
- package/dist/algod-type.js.map +0 -1
- package/dist/app.d.ts +0 -150
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js +0 -160
- package/dist/app.js.map +0 -1
- package/dist/application-client.d.ts +0 -1
- package/dist/application-client.d.ts.map +0 -1
- package/dist/application-client.js +0 -69
- package/dist/application-client.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -28
- package/dist/config.js.map +0 -1
- package/dist/deploy-app.d.ts +0 -149
- package/dist/deploy-app.d.ts.map +0 -1
- package/dist/deploy-app.js.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/indexer-type.d.ts.map +0 -1
- package/dist/indexer-type.js.map +0 -1
- package/dist/localnet.d.ts.map +0 -1
- package/dist/localnet.js.map +0 -1
- package/dist/network-client.d.ts.map +0 -1
- package/dist/package.json +0 -20
- package/dist/transaction.d.ts +0 -147
- package/dist/transaction.d.ts.map +0 -1
- package/dist/transaction.js.map +0 -1
- package/dist/transfer.d.ts +0 -24
- package/dist/transfer.d.ts.map +0 -1
- package/dist/transfer.js +0 -33
- package/dist/transfer.js.map +0 -1
- package/dist/urlTokenBaseHTTPClient.d.ts.map +0 -1
- package/dist/urlTokenBaseHTTPClient.js.map +0 -1
- /package/{dist/indexer-lookup.js → indexer-lookup.js} +0 -0
- /package/{dist/indexer-lookup.js.map → indexer-lookup.js.map} +0 -0
- /package/{dist → types}/algo-http-client-with-retry.d.ts +0 -0
- /package/{dist → types}/urlTokenBaseHTTPClient.d.ts +0 -0
- /package/{dist → types}/urlTokenBaseHTTPClient.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algod.js","sourceRoot":"","sources":["../../src/types/algod.ts"],"names":[],"mappings":""}
|
|
@@ -10,9 +10,11 @@ export declare class AlgoAmount {
|
|
|
10
10
|
} | {
|
|
11
11
|
microAlgos: number;
|
|
12
12
|
});
|
|
13
|
+
toString(): string;
|
|
14
|
+
valueOf(): number;
|
|
13
15
|
/** Create a @see {AlgoAmount} object representing the given number of Algos */
|
|
14
16
|
static Algos(amount: number): AlgoAmount;
|
|
15
17
|
/** Create a @see {AlgoAmount} object representing the given number of µAlgos */
|
|
16
18
|
static MicroAlgos(amount: number): AlgoAmount;
|
|
17
19
|
}
|
|
18
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=amount.d.ts.map
|
|
@@ -0,0 +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,+EAA+E;IAC/E,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM;IAI3B,gFAAgF;IAChF,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;CAGjC"}
|
|
@@ -18,6 +18,12 @@ class AlgoAmount {
|
|
|
18
18
|
constructor(amount) {
|
|
19
19
|
this.amountInMicroAlgos = 'microAlgos' in amount ? amount.microAlgos : algosdk_1.default.algosToMicroalgos(amount.algos);
|
|
20
20
|
}
|
|
21
|
+
toString() {
|
|
22
|
+
return `${this.microAlgos.toLocaleString('en-US')} µALGO${this.microAlgos === 1 ? '' : 's'}`;
|
|
23
|
+
}
|
|
24
|
+
valueOf() {
|
|
25
|
+
return this.microAlgos;
|
|
26
|
+
}
|
|
21
27
|
/** Create a @see {AlgoAmount} object representing the given number of Algos */
|
|
22
28
|
static Algos(amount) {
|
|
23
29
|
return new AlgoAmount({ algos: amount });
|
|
@@ -28,4 +34,4 @@ class AlgoAmount {
|
|
|
28
34
|
}
|
|
29
35
|
}
|
|
30
36
|
exports.AlgoAmount = AlgoAmount;
|
|
31
|
-
//# sourceMappingURL=
|
|
37
|
+
//# sourceMappingURL=amount.js.map
|
|
@@ -0,0 +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,iBAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC3D,CAAC;IAED,YAAY,MAAkD;QAC5D,IAAI,CAAC,kBAAkB,GAAG,YAAY,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAChH,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;IAC9F,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED,+EAA+E;IAC/E,MAAM,CAAC,KAAK,CAAC,MAAc;QACzB,OAAO,IAAI,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IAC1C,CAAC;IAED,gFAAgF;IAChF,MAAM,CAAC,UAAU,CAAC,MAAc;QAC9B,OAAO,IAAI,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAA;IAC/C,CAAC;CACF;AAlCD,gCAkCC"}
|
package/types/app.d.ts
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { ABIArgument, ABIMethod, ABIMethodParams, ABIValue, Address, SourceMap, SuggestedParams, Transaction } from 'algosdk';
|
|
2
|
+
import { SendTransactionFrom, SendTransactionParams, SendTransactionResult, TransactionNote, TransactionToSign } from './transaction';
|
|
3
|
+
/** The name of the TEAL template variable for deploy-time immutability control */
|
|
4
|
+
export declare const UPDATABLE_TEMPLATE_NAME = "TMPL_UPDATABLE";
|
|
5
|
+
/** The name of the TEAL template variable for deploy-time permanence control */
|
|
6
|
+
export declare const DELETABLE_TEMPLATE_NAME = "TMPL_DELETABLE";
|
|
7
|
+
/** The app create/update ARC-2 transaction note prefix */
|
|
8
|
+
export declare const APP_DEPLOY_NOTE_DAPP = "ALGOKIT_DEPLOYER";
|
|
9
|
+
/** The maximum number of bytes in a single app code page */
|
|
10
|
+
export declare const APP_PAGE_MAX_SIZE = 2048;
|
|
11
|
+
/** First 4 bytes of SHA-512/256 hash of "return" for retrieving ABI return values */
|
|
12
|
+
export declare const ABI_RETURN_PREFIX: Uint8Array;
|
|
13
|
+
/** Information about an Algorand app */
|
|
14
|
+
export interface AppReference {
|
|
15
|
+
/** The id of the app */
|
|
16
|
+
appId: number;
|
|
17
|
+
/** The Algorand address of the account associated with the app */
|
|
18
|
+
appAddress: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A grouping of the app ID and name of the box in an Uint8Array
|
|
22
|
+
*/
|
|
23
|
+
export interface BoxReference {
|
|
24
|
+
/**
|
|
25
|
+
* A unique application id
|
|
26
|
+
*/
|
|
27
|
+
appId: number;
|
|
28
|
+
/**
|
|
29
|
+
* Name of box to reference
|
|
30
|
+
*/
|
|
31
|
+
name: Uint8Array | string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* App call args with raw values (minus some processing like encoding strings as binary)
|
|
35
|
+
*/
|
|
36
|
+
export interface RawAppCallArgs {
|
|
37
|
+
/** The address of any accounts to load in */
|
|
38
|
+
accounts?: (string | Address)[];
|
|
39
|
+
/** Any application arguments to pass through */
|
|
40
|
+
appArgs?: (Uint8Array | string)[];
|
|
41
|
+
/** Any box references to load */
|
|
42
|
+
boxes?: BoxReference[];
|
|
43
|
+
/** IDs of any apps to load into the foreignApps array */
|
|
44
|
+
apps?: number[];
|
|
45
|
+
/** IDs of any assets to load into the foreignAssets array */
|
|
46
|
+
assets?: number[];
|
|
47
|
+
/** The optional lease for the transaction */
|
|
48
|
+
lease?: string | Uint8Array;
|
|
49
|
+
}
|
|
50
|
+
export type ABIAppCallArg = ABIArgument | TransactionToSign | Transaction;
|
|
51
|
+
/**
|
|
52
|
+
* App call args for an ABI call
|
|
53
|
+
*/
|
|
54
|
+
export interface ABIAppCallArgs {
|
|
55
|
+
/** The ABI method to call, either:
|
|
56
|
+
* * `method_name` e.g. `hello`; or
|
|
57
|
+
* * `method_signature` e.g. `hello(string)string`
|
|
58
|
+
**/
|
|
59
|
+
method: ABIMethodParams | ABIMethod;
|
|
60
|
+
/** The ABI args to pass in */
|
|
61
|
+
args: ABIAppCallArg[];
|
|
62
|
+
/** The optional lease for the transaction */
|
|
63
|
+
lease?: string | Uint8Array;
|
|
64
|
+
/** Any box references to load */
|
|
65
|
+
boxes?: BoxReference[];
|
|
66
|
+
}
|
|
67
|
+
/** Arguments to pass to an app call either:
|
|
68
|
+
* * The raw app call values to pass through into the transaction (after processing); or
|
|
69
|
+
* * An ABI method definition (method and args)
|
|
70
|
+
**/
|
|
71
|
+
export type AppCallArgs = RawAppCallArgs | ABIAppCallArgs;
|
|
72
|
+
/** Base interface for common data passed to an app create or update. */
|
|
73
|
+
interface CreateOrUpdateAppParams extends SendTransactionParams {
|
|
74
|
+
/** The account (with private key loaded) that will send the µALGOs */
|
|
75
|
+
from: SendTransactionFrom;
|
|
76
|
+
/** The approval program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) */
|
|
77
|
+
approvalProgram: Uint8Array | string;
|
|
78
|
+
/** The clear state program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) */
|
|
79
|
+
clearStateProgram: Uint8Array | string;
|
|
80
|
+
/** Optional transaction parameters */
|
|
81
|
+
transactionParams?: SuggestedParams;
|
|
82
|
+
/** The (optional) transaction note */
|
|
83
|
+
note?: TransactionNote;
|
|
84
|
+
/** The arguments passed in to the app call */
|
|
85
|
+
args?: AppCallArgs;
|
|
86
|
+
}
|
|
87
|
+
/** Parameters that are passed in when creating an app. */
|
|
88
|
+
export interface CreateAppParams extends CreateOrUpdateAppParams {
|
|
89
|
+
/** The storage schema to request for the created app */
|
|
90
|
+
schema: AppStorageSchema;
|
|
91
|
+
}
|
|
92
|
+
/** Parameters that are passed in when updating an app. */
|
|
93
|
+
export interface UpdateAppParams extends CreateOrUpdateAppParams {
|
|
94
|
+
/** The id of the app to update */
|
|
95
|
+
appId: number;
|
|
96
|
+
}
|
|
97
|
+
export interface AppCallParams extends SendTransactionParams {
|
|
98
|
+
/** The id of the app to call */
|
|
99
|
+
appId: number;
|
|
100
|
+
/** The type of call, everything except create (@see createApp ) and update (@see updateApp ) */
|
|
101
|
+
callType: 'optin' | 'closeout' | 'clearstate' | 'delete' | 'normal';
|
|
102
|
+
/** The account to make the call from */
|
|
103
|
+
from: SendTransactionFrom;
|
|
104
|
+
/** Optional transaction parameters */
|
|
105
|
+
transactionParams?: SuggestedParams;
|
|
106
|
+
/** The (optional) transaction note */
|
|
107
|
+
note?: TransactionNote;
|
|
108
|
+
/** The arguments passed in to the app call */
|
|
109
|
+
args?: AppCallArgs;
|
|
110
|
+
}
|
|
111
|
+
/** Parameters representing the storage schema of an app. */
|
|
112
|
+
export interface AppStorageSchema {
|
|
113
|
+
/** Restricts number of ints in per-user local state */
|
|
114
|
+
localInts: number;
|
|
115
|
+
/** Restricts number of byte slices in per-user local state */
|
|
116
|
+
localByteSlices: number;
|
|
117
|
+
/** Restricts number of ints in global state */
|
|
118
|
+
globalInts: number;
|
|
119
|
+
/** Restricts number of byte slices in global state */
|
|
120
|
+
globalByteSlices: number;
|
|
121
|
+
/** Any extra pages that are needed for the smart contract; if left blank then the right number of pages will be calculated based on the teal code size */
|
|
122
|
+
extraPages?: number;
|
|
123
|
+
}
|
|
124
|
+
/** Information about a compiled teal program */
|
|
125
|
+
export interface CompiledTeal {
|
|
126
|
+
/** Original TEAL code */
|
|
127
|
+
teal: string;
|
|
128
|
+
/** The compiled code */
|
|
129
|
+
compiled: string;
|
|
130
|
+
/** The has returned by the compiler */
|
|
131
|
+
compiledHash: string;
|
|
132
|
+
/** The base64 encoded code as a byte array */
|
|
133
|
+
compiledBase64ToBytes: Uint8Array;
|
|
134
|
+
/** Source map from the compilation */
|
|
135
|
+
sourceMap: SourceMap;
|
|
136
|
+
}
|
|
137
|
+
/** Result from calling an app */
|
|
138
|
+
export interface AppCallTransactionResult extends SendTransactionResult {
|
|
139
|
+
/** If an ABI method was called the processed return value */
|
|
140
|
+
return?: ABIReturn;
|
|
141
|
+
}
|
|
142
|
+
/** The return value of an ABI method call */
|
|
143
|
+
export type ABIReturn = {
|
|
144
|
+
rawReturnValue: Uint8Array;
|
|
145
|
+
returnValue: ABIValue;
|
|
146
|
+
decodeError: undefined;
|
|
147
|
+
} | {
|
|
148
|
+
rawReturnValue: undefined;
|
|
149
|
+
returnValue: undefined;
|
|
150
|
+
decodeError: Error;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* The payload of the metadata to add to the transaction note when deploying an app, noting it will be prefixed with @see {APP_DEPLOY_NOTE_PREFIX}.
|
|
154
|
+
*/
|
|
155
|
+
export interface AppDeployMetadata {
|
|
156
|
+
/** The unique name identifier of the app within the creator account */
|
|
157
|
+
name: string;
|
|
158
|
+
/** The version of app that is / will be deployed */
|
|
159
|
+
version: string;
|
|
160
|
+
/** Whether or not the app is deletable / permanent / unspecified */
|
|
161
|
+
deletable?: boolean;
|
|
162
|
+
/** Whether or not the app is updatable / immutable / unspecified */
|
|
163
|
+
updatable?: boolean;
|
|
164
|
+
}
|
|
165
|
+
/** The metadata that can be collected about a deployed app */
|
|
166
|
+
export interface AppMetadata extends AppReference, AppDeployMetadata {
|
|
167
|
+
/** The round the app was created */
|
|
168
|
+
createdRound: number;
|
|
169
|
+
/** The last round that the app was updated */
|
|
170
|
+
updatedRound: number;
|
|
171
|
+
/** The metadata when the app was created */
|
|
172
|
+
createdMetadata: AppDeployMetadata;
|
|
173
|
+
/** Whether or not the app is deleted */
|
|
174
|
+
deleted: boolean;
|
|
175
|
+
}
|
|
176
|
+
/** A lookup of name -> Algorand app for a creator */
|
|
177
|
+
export interface AppLookup {
|
|
178
|
+
creator: Readonly<string>;
|
|
179
|
+
apps: Readonly<{
|
|
180
|
+
[name: string]: AppMetadata;
|
|
181
|
+
}>;
|
|
182
|
+
}
|
|
183
|
+
/** Dictionary of deploy-time parameters to replace in a teal template.
|
|
184
|
+
*
|
|
185
|
+
* Note: Looks for `TMPL_{parameter}` for template replacements i.e. you can leave out the `TMPL_`.
|
|
186
|
+
*
|
|
187
|
+
*/
|
|
188
|
+
export interface TealTemplateParameters {
|
|
189
|
+
[key: string]: string | bigint | number | Uint8Array;
|
|
190
|
+
}
|
|
191
|
+
/** What action to perform when deploying an app and an update is detected in the TEAL code */
|
|
192
|
+
export declare enum OnUpdate {
|
|
193
|
+
/** Fail the deployment */
|
|
194
|
+
Fail = 0,
|
|
195
|
+
/** Update the app */
|
|
196
|
+
UpdateApp = 1,
|
|
197
|
+
/** Delete the app and create a new one in its place */
|
|
198
|
+
ReplaceApp = 2
|
|
199
|
+
}
|
|
200
|
+
/** What action to perform when deploying an app and a breaking schema change is detected */
|
|
201
|
+
export declare enum OnSchemaBreak {
|
|
202
|
+
/** Fail the deployment */
|
|
203
|
+
Fail = 0,
|
|
204
|
+
/** Delete the app and create a new one in its place */
|
|
205
|
+
ReplaceApp = 1
|
|
206
|
+
}
|
|
207
|
+
/** The parameters to deploy an app */
|
|
208
|
+
export interface AppDeploymentParams extends Omit<CreateAppParams, 'args' | 'note' | 'skipSending' | 'skipWaiting'> {
|
|
209
|
+
/** The deployment metadata */
|
|
210
|
+
metadata: AppDeployMetadata;
|
|
211
|
+
/** Any deploy-time parameters to replace in the TEAL code */
|
|
212
|
+
deployTimeParameters?: TealTemplateParameters;
|
|
213
|
+
/** What action to perform if a schema break is detected */
|
|
214
|
+
onSchemaBreak?: 'replace' | 'fail' | OnSchemaBreak;
|
|
215
|
+
/** What action to perform if a TEAL update is detected */
|
|
216
|
+
onUpdate?: 'update' | 'replace' | 'fail' | OnUpdate;
|
|
217
|
+
/** Optional cached value of the existing apps for the given creator */
|
|
218
|
+
existingDeployments?: AppLookup;
|
|
219
|
+
/** Any args to pass to any create transaction that is issued as part of deployment */
|
|
220
|
+
createArgs?: AppCallArgs;
|
|
221
|
+
/** Any args to pass to any update transaction that is issued as part of deployment */
|
|
222
|
+
updateArgs?: AppCallArgs;
|
|
223
|
+
/** Any args to pass to any delete transaction that is issued as part of deployment */
|
|
224
|
+
deleteArgs?: AppCallArgs;
|
|
225
|
+
}
|
|
226
|
+
/** The result of compiling the approval and clear TEAL for an app */
|
|
227
|
+
export interface AppCompilationResult {
|
|
228
|
+
/** The compilation result of approval */
|
|
229
|
+
compiledApproval: CompiledTeal;
|
|
230
|
+
/** The compilation result of clear */
|
|
231
|
+
compiledClear: CompiledTeal;
|
|
232
|
+
}
|
|
233
|
+
export {};
|
|
234
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/types/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC7H,OAAO,EAAE,mBAAmB,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;IACxB,sFAAsF;IACtF,UAAU,CAAC,EAAE,WAAW,CAAA;IACxB,sFAAsF;IACtF,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB;AAED,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,gBAAgB,EAAE,YAAY,CAAA;IAC9B,sCAAsC;IACtC,aAAa,EAAE,YAAY,CAAA;CAC5B"}
|
package/types/app.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OnSchemaBreak = exports.OnUpdate = exports.ABI_RETURN_PREFIX = exports.APP_PAGE_MAX_SIZE = exports.APP_DEPLOY_NOTE_DAPP = exports.DELETABLE_TEMPLATE_NAME = exports.UPDATABLE_TEMPLATE_NAME = void 0;
|
|
4
|
+
/** The name of the TEAL template variable for deploy-time immutability control */
|
|
5
|
+
exports.UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE';
|
|
6
|
+
/** The name of the TEAL template variable for deploy-time permanence control */
|
|
7
|
+
exports.DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE';
|
|
8
|
+
/** The app create/update ARC-2 transaction note prefix */
|
|
9
|
+
exports.APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER';
|
|
10
|
+
/** The maximum number of bytes in a single app code page */
|
|
11
|
+
exports.APP_PAGE_MAX_SIZE = 2048;
|
|
12
|
+
/** First 4 bytes of SHA-512/256 hash of "return" for retrieving ABI return values */
|
|
13
|
+
exports.ABI_RETURN_PREFIX = new Uint8Array([21, 31, 124, 117]);
|
|
14
|
+
/** What action to perform when deploying an app and an update is detected in the TEAL code */
|
|
15
|
+
var OnUpdate;
|
|
16
|
+
(function (OnUpdate) {
|
|
17
|
+
/** Fail the deployment */
|
|
18
|
+
OnUpdate[OnUpdate["Fail"] = 0] = "Fail";
|
|
19
|
+
/** Update the app */
|
|
20
|
+
OnUpdate[OnUpdate["UpdateApp"] = 1] = "UpdateApp";
|
|
21
|
+
/** Delete the app and create a new one in its place */
|
|
22
|
+
OnUpdate[OnUpdate["ReplaceApp"] = 2] = "ReplaceApp";
|
|
23
|
+
})(OnUpdate = exports.OnUpdate || (exports.OnUpdate = {}));
|
|
24
|
+
/** What action to perform when deploying an app and a breaking schema change is detected */
|
|
25
|
+
var OnSchemaBreak;
|
|
26
|
+
(function (OnSchemaBreak) {
|
|
27
|
+
/** Fail the deployment */
|
|
28
|
+
OnSchemaBreak[OnSchemaBreak["Fail"] = 0] = "Fail";
|
|
29
|
+
/** Delete the app and create a new one in its place */
|
|
30
|
+
OnSchemaBreak[OnSchemaBreak["ReplaceApp"] = 1] = "ReplaceApp";
|
|
31
|
+
})(OnSchemaBreak = exports.OnSchemaBreak || (exports.OnSchemaBreak = {}));
|
|
32
|
+
//# sourceMappingURL=app.js.map
|
package/types/app.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/types/app.ts"],"names":[],"mappings":";;;AAGA,kFAAkF;AACrE,QAAA,uBAAuB,GAAG,gBAAgB,CAAA;AAEvD,gFAAgF;AACnE,QAAA,uBAAuB,GAAG,gBAAgB,CAAA;AAEvD,0DAA0D;AAC7C,QAAA,oBAAoB,GAAG,kBAAkB,CAAA;AAEtD,4DAA4D;AAC/C,QAAA,iBAAiB,GAAG,IAAI,CAAA;AAErC,qFAAqF;AACxE,QAAA,iBAAiB,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAoMnE,8FAA8F;AAC9F,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,0BAA0B;IAC1B,uCAAI,CAAA;IACJ,qBAAqB;IACrB,iDAAS,CAAA;IACT,uDAAuD;IACvD,mDAAU,CAAA;AACZ,CAAC,EAPW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAOnB;AAED,4FAA4F;AAC5F,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,0BAA0B;IAC1B,iDAAI,CAAA;IACJ,uDAAuD;IACvD,6DAAU,CAAA;AACZ,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { ABIMethodParams, Algodv2, Indexer, SuggestedParams } from 'algosdk';
|
|
2
|
+
import { ABIAppCallArg, ABIAppCallArgs, AppCallArgs, AppLookup, AppMetadata, AppReference, OnSchemaBreak, OnUpdate, RawAppCallArgs, TealTemplateParameters } from './app';
|
|
3
|
+
import { AppSpec } from './appspec';
|
|
4
|
+
import { SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction';
|
|
5
|
+
/** Configuration to resolve app by creator and name @see getCreatorAppsByName */
|
|
6
|
+
export type ResolveAppByCreatorAndName = {
|
|
7
|
+
/** The address of the app creator account to resolve the app by */
|
|
8
|
+
creatorAddress: string;
|
|
9
|
+
/** The optional name to resolve the app by within the creator account (default: uses the name in the ABI contract) */
|
|
10
|
+
name?: string;
|
|
11
|
+
} & ({
|
|
12
|
+
/** indexer An indexer instance to search the creator account apps */
|
|
13
|
+
indexer: Indexer;
|
|
14
|
+
} | {
|
|
15
|
+
/** Optional cached value of the existing apps for the given creator, @see getCreatorAppsByName */
|
|
16
|
+
existingDeployments: AppLookup;
|
|
17
|
+
});
|
|
18
|
+
/** Configuration to resolve app by ID */
|
|
19
|
+
export interface ResolveAppById {
|
|
20
|
+
/** The id of an existing app to call using this client, or 0 if the app hasn't been created yet */
|
|
21
|
+
id: number;
|
|
22
|
+
/** The optional name to use to mark the app when deploying @see ApplicationClient.deploy (default: uses the name in the ABI contract) */
|
|
23
|
+
name?: string;
|
|
24
|
+
}
|
|
25
|
+
/** The details of an ARC-0032 app spec specified app */
|
|
26
|
+
export type AppSpecAppDetails = {
|
|
27
|
+
/** The ARC-0032 application spec as either:
|
|
28
|
+
* * Parsed JSON @see {AppSpec}
|
|
29
|
+
* * Raw JSON string
|
|
30
|
+
*/
|
|
31
|
+
app: AppSpec | string;
|
|
32
|
+
/** Default sender to use for transactions issued by this application client */
|
|
33
|
+
sender?: SendTransactionFrom;
|
|
34
|
+
/** Default suggested params object to use */
|
|
35
|
+
params?: SuggestedParams;
|
|
36
|
+
} & (ResolveAppById | ResolveAppByCreatorAndName);
|
|
37
|
+
/** Parameters to pass into ApplicationClient.deploy */
|
|
38
|
+
export interface AppClientDeployParams {
|
|
39
|
+
/** The version of the contract, uses "1.0" by default */
|
|
40
|
+
version?: string;
|
|
41
|
+
/** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
|
|
42
|
+
sender?: SendTransactionFrom;
|
|
43
|
+
/** Whether or not to allow updates in the contract using the deploy-time updatability control if present in your contract.
|
|
44
|
+
* If this is not specified then it will automatically be determined based on the AppSpec definition
|
|
45
|
+
**/
|
|
46
|
+
allowUpdate?: boolean;
|
|
47
|
+
/** Whether or not to allow deletes in the contract using the deploy-time deletability control if present in your contract.
|
|
48
|
+
* If this is not specified then it will automatically be determined based on the AppSpec definition
|
|
49
|
+
**/
|
|
50
|
+
allowDelete?: boolean;
|
|
51
|
+
/** Parameters to control transaction sending */
|
|
52
|
+
sendParams?: Omit<SendTransactionParams, 'skipSending' | 'skipWaiting'>;
|
|
53
|
+
/** Any deploy-time parameters to replace in the TEAL code */
|
|
54
|
+
deployTimeParameters?: TealTemplateParameters;
|
|
55
|
+
/** What action to perform if a schema break is detected */
|
|
56
|
+
onSchemaBreak?: 'replace' | 'fail' | OnSchemaBreak;
|
|
57
|
+
/** What action to perform if a TEAL update is detected */
|
|
58
|
+
onUpdate?: 'update' | 'replace' | 'fail' | OnUpdate;
|
|
59
|
+
/** Any args to pass to any create transaction that is issued as part of deployment */
|
|
60
|
+
createArgs?: AppClientCallArgs;
|
|
61
|
+
/** Any args to pass to any update transaction that is issued as part of deployment */
|
|
62
|
+
updateArgs?: AppClientCallArgs;
|
|
63
|
+
/** Any args to pass to any delete transaction that is issued as part of deployment */
|
|
64
|
+
deleteArgs?: AppClientCallArgs;
|
|
65
|
+
}
|
|
66
|
+
/** The arguments to pass to an Application Client smart contract call */
|
|
67
|
+
export type AppClientCallArgs = {
|
|
68
|
+
/** Raw argument values to pass to the smart contract call */
|
|
69
|
+
args?: RawAppCallArgs;
|
|
70
|
+
} | {
|
|
71
|
+
/** If calling an ABI method then either the name of the method, or the ABI signature */
|
|
72
|
+
method: string;
|
|
73
|
+
/** Either the ABI arguments or an object with the ABI arguments and other parameters like boxes */
|
|
74
|
+
methodArgs: Omit<ABIAppCallArgs, 'method'> | ABIAppCallArg[];
|
|
75
|
+
};
|
|
76
|
+
/** Parameters to construct a ApplicationClient contract call */
|
|
77
|
+
export type AppClientCallParams = AppClientCallArgs & {
|
|
78
|
+
/** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
|
|
79
|
+
sender?: SendTransactionFrom;
|
|
80
|
+
/** The transaction note for the smart contract call */
|
|
81
|
+
note?: TransactionNote;
|
|
82
|
+
/** Parameters to control transaction sending */
|
|
83
|
+
sendParams?: SendTransactionParams;
|
|
84
|
+
};
|
|
85
|
+
/** Parameters for creating a contract using ApplicationClient */
|
|
86
|
+
export type AppClientCreateParams = AppClientCallParams & {
|
|
87
|
+
/** Any deploy-time parameters to replace in the TEAL code */
|
|
88
|
+
deployTimeParameters?: TealTemplateParameters;
|
|
89
|
+
updatable?: boolean;
|
|
90
|
+
deletable?: boolean;
|
|
91
|
+
};
|
|
92
|
+
/** Parameters for updating a contract using ApplicationClient */
|
|
93
|
+
export type AppClientUpdateParams = AppClientCreateParams;
|
|
94
|
+
/** Application client - a class that wraps an ARC-0032 app spec and provides high productivity methods to deploy and call the app */
|
|
95
|
+
export declare class ApplicationClient {
|
|
96
|
+
private algod;
|
|
97
|
+
private indexer?;
|
|
98
|
+
private appSpec;
|
|
99
|
+
private sender;
|
|
100
|
+
private params;
|
|
101
|
+
private existingDeployments;
|
|
102
|
+
private _appId;
|
|
103
|
+
private _appAddress;
|
|
104
|
+
private _creator;
|
|
105
|
+
private _appName;
|
|
106
|
+
private _approvalSourceMap;
|
|
107
|
+
private _clearSourceMap;
|
|
108
|
+
/**
|
|
109
|
+
* Create a new ApplicationClient instance
|
|
110
|
+
* @param appDetails The details of the app
|
|
111
|
+
* @param algod An algod instance
|
|
112
|
+
* @param indexer An indexer instance
|
|
113
|
+
*/
|
|
114
|
+
constructor(appDetails: AppSpecAppDetails, algod: Algodv2);
|
|
115
|
+
/**
|
|
116
|
+
* Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
|
|
117
|
+
*
|
|
118
|
+
* 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
|
|
119
|
+
*
|
|
120
|
+
* **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.
|
|
121
|
+
*
|
|
122
|
+
* **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.
|
|
123
|
+
* @param deploy Deployment details
|
|
124
|
+
* @returns The metadata and transaction result(s) of the deployment, or just the metadata if it didn't need to issue transactions
|
|
125
|
+
*/
|
|
126
|
+
deploy(deploy: AppClientDeployParams): Promise<(Partial<import("./app").AppCompilationResult> & import("./transaction").ConfirmedTransactionResult & AppMetadata & {
|
|
127
|
+
operationPerformed: "update" | "create";
|
|
128
|
+
}) | (Partial<import("./app").AppCompilationResult> & import("./transaction").ConfirmedTransactionResult & AppMetadata & {
|
|
129
|
+
deleteResult: import("./transaction").ConfirmedTransactionResult;
|
|
130
|
+
operationPerformed: "replace";
|
|
131
|
+
}) | (Partial<import("./app").AppCompilationResult> & AppMetadata & {
|
|
132
|
+
operationPerformed: "nothing";
|
|
133
|
+
})>;
|
|
134
|
+
create(create?: AppClientCreateParams): Promise<Partial<import("./app").AppCompilationResult> & import("./app").AppCallTransactionResult & AppReference>;
|
|
135
|
+
update(update?: AppClientUpdateParams): Promise<Partial<import("./app").AppCompilationResult> & import("./app").AppCallTransactionResult>;
|
|
136
|
+
call(call: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
137
|
+
optIn(call: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
138
|
+
closeOut(call: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
139
|
+
clearState(call: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
140
|
+
delete(call: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
141
|
+
private _call;
|
|
142
|
+
getCallArgs(args?: AppClientCallArgs): AppCallArgs | undefined;
|
|
143
|
+
getABIMethod(method: string): ABIMethodParams | undefined;
|
|
144
|
+
getAppReference(): Promise<AppMetadata | AppReference>;
|
|
145
|
+
/**
|
|
146
|
+
* 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.
|
|
147
|
+
* This is automatically used within @see ApplicationClient but if you pass `skipSending: true` e.g. if doing a group transaction
|
|
148
|
+
* then you can use this in a try/catch block to get better debugging information.
|
|
149
|
+
* @param e The error to parse
|
|
150
|
+
* @param isClear Whether or not the code was running the clear state program
|
|
151
|
+
* @returns The new error, or if there was no logic error or source map then the wrapped error with source details
|
|
152
|
+
*/
|
|
153
|
+
exposeLogicError(e: Error, isClear?: boolean): Error;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=application-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application-client.d.ts","sourceRoot":"","sources":["../../src/types/application-client.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,eAAe,EAAE,OAAO,EAAyB,OAAO,EAAa,eAAe,EAAE,MAAM,SAAS,CAAA;AAKvH,OAAO,EACL,aAAa,EACb,cAAc,EACd,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EAEZ,aAAa,EACb,QAAQ,E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