@algorandfoundation/algokit-utils 1.0.0 → 1.1.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +38 -0
  2. package/account.d.ts +11 -10
  3. package/account.d.ts.map +1 -1
  4. package/account.js +13 -12
  5. package/account.js.map +1 -1
  6. package/amount.d.ts +15 -3
  7. package/amount.d.ts.map +1 -1
  8. package/amount.js +15 -3
  9. package/amount.js.map +1 -1
  10. package/app-client.d.ts +14 -0
  11. package/app-client.d.ts.map +1 -0
  12. package/app-client.js +19 -0
  13. package/app-client.js.map +1 -0
  14. package/{deploy-app.d.ts → app-deploy.d.ts} +16 -14
  15. package/app-deploy.d.ts.map +1 -0
  16. package/{deploy-app.js → app-deploy.js} +47 -28
  17. package/app-deploy.js.map +1 -0
  18. package/app.d.ts +53 -8
  19. package/app.d.ts.map +1 -1
  20. package/app.js +305 -146
  21. package/app.js.map +1 -1
  22. package/index.d.ts +2 -2
  23. package/index.d.ts.map +1 -1
  24. package/index.js +2 -2
  25. package/index.js.map +1 -1
  26. package/indexer-lookup.d.ts +11 -4
  27. package/indexer-lookup.d.ts.map +1 -1
  28. package/indexer-lookup.js +19 -9
  29. package/indexer-lookup.js.map +1 -1
  30. package/localnet.d.ts +7 -7
  31. package/localnet.js +7 -7
  32. package/network-client.d.ts +4 -4
  33. package/network-client.js +5 -5
  34. package/network-client.js.map +1 -1
  35. package/package.json +1 -1
  36. package/testing/account.d.ts +2 -2
  37. package/testing/account.js +2 -2
  38. package/testing/fixtures/algorand-fixture.d.ts +6 -2
  39. package/testing/fixtures/algorand-fixture.d.ts.map +1 -1
  40. package/testing/fixtures/algorand-fixture.js +19 -8
  41. package/testing/fixtures/algorand-fixture.js.map +1 -1
  42. package/testing/indexer.d.ts.map +1 -1
  43. package/testing/indexer.js +1 -0
  44. package/testing/indexer.js.map +1 -1
  45. package/testing/test-logger.d.ts +3 -1
  46. package/testing/test-logger.d.ts.map +1 -1
  47. package/testing/test-logger.js +4 -2
  48. package/testing/test-logger.js.map +1 -1
  49. package/testing/transaction-logger.d.ts +4 -4
  50. package/testing/transaction-logger.d.ts.map +1 -1
  51. package/testing/transaction-logger.js +4 -4
  52. package/testing/transaction-logger.js.map +1 -1
  53. package/transaction.d.ts +54 -13
  54. package/transaction.d.ts.map +1 -1
  55. package/transaction.js +201 -93
  56. package/transaction.js.map +1 -1
  57. package/transfer.d.ts +4 -3
  58. package/transfer.d.ts.map +1 -1
  59. package/transfer.js +10 -8
  60. package/transfer.js.map +1 -1
  61. package/types/account.d.ts +6 -3
  62. package/types/account.d.ts.map +1 -1
  63. package/types/account.js +7 -2
  64. package/types/account.js.map +1 -1
  65. package/types/algo-http-client-with-retry.js +1 -1
  66. package/types/algo-http-client-with-retry.js.map +1 -1
  67. package/types/algod.d.ts +6 -6
  68. package/types/algod.d.ts.map +1 -1
  69. package/types/amount.d.ts +6 -2
  70. package/types/amount.d.ts.map +1 -1
  71. package/types/amount.js +6 -2
  72. package/types/amount.js.map +1 -1
  73. package/types/{application-client.d.ts → app-client.d.ts} +75 -22
  74. package/types/app-client.d.ts.map +1 -0
  75. package/types/{application-client.js → app-client.js} +135 -56
  76. package/types/app-client.js.map +1 -0
  77. package/types/app-spec.d.ts +136 -0
  78. package/types/app-spec.d.ts.map +1 -0
  79. package/types/{appspec.js → app-spec.js} +5 -7
  80. package/types/app-spec.js.map +1 -0
  81. package/types/app.d.ts +23 -17
  82. package/types/app.d.ts.map +1 -1
  83. package/types/app.js.map +1 -1
  84. package/types/config.d.ts +19 -2
  85. package/types/config.d.ts.map +1 -1
  86. package/types/config.js +28 -2
  87. package/types/config.js.map +1 -1
  88. package/types/indexer.d.ts +360 -49
  89. package/types/indexer.d.ts.map +1 -1
  90. package/types/indexer.js +9 -0
  91. package/types/indexer.js.map +1 -1
  92. package/types/logic-error.d.ts +5 -1
  93. package/types/logic-error.d.ts.map +1 -1
  94. package/types/logic-error.js +6 -2
  95. package/types/logic-error.js.map +1 -1
  96. package/types/testing.d.ts +9 -9
  97. package/types/testing.d.ts.map +1 -1
  98. package/types/transaction.d.ts +54 -9
  99. package/types/transaction.d.ts.map +1 -1
  100. package/types/transfer.d.ts +7 -7
  101. package/types/transfer.d.ts.map +1 -1
  102. package/application-client.d.ts +0 -10
  103. package/application-client.d.ts.map +0 -1
  104. package/application-client.js +0 -15
  105. package/application-client.js.map +0 -1
  106. package/deploy-app.d.ts.map +0 -1
  107. package/deploy-app.js.map +0 -1
  108. package/types/application-client.d.ts.map +0 -1
  109. package/types/application-client.js.map +0 -1
  110. package/types/appspec.d.ts +0 -77
  111. package/types/appspec.d.ts.map +0 -1
  112. package/types/appspec.js.map +0 -1
package/app.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import algosdk, { ABIValue, Algodv2 } from 'algosdk';
1
+ import algosdk, { ABIMethod, ABIMethodParams, ABIValue, Algodv2 } from 'algosdk';
2
2
  import { ApplicationResponse, EvalDelta, PendingTransactionResponse, TealValue } from './types/algod';
3
- import { ABIReturn, AppCallArgs, AppCallParams, AppCallTransactionResult, AppCompilationResult, AppReference, AppState, BoxName, BoxValueRequestParams, BoxValuesRequestParams, CompiledTeal, CreateAppParams, UpdateAppParams } from './types/app';
3
+ import { ABIAppCallArgs, ABIReturn, AppCallArgs, AppCallParams, AppCallTransactionResult, AppCompilationResult, AppReference, AppState, BoxIdentifier, BoxName, BoxReference, BoxValueRequestParams, BoxValuesRequestParams, CompiledTeal, CreateAppParams, RawAppCallArgs, UpdateAppParams } from './types/app';
4
4
  import { SendTransactionFrom } from './types/transaction';
5
5
  /**
6
6
  * Creates a smart contract app, returns the details of the created app.
@@ -23,6 +23,12 @@ export declare function updateApp(update: UpdateAppParams, algod: Algodv2): Prom
23
23
  * @returns The result of the call
24
24
  */
25
25
  export declare function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult>;
26
+ /**
27
+ * Returns any ABI return values for the given app call arguments and transaction confirmation.
28
+ * @param args The arguments that were used for the call
29
+ * @param confirmation The transaction confirmation from algod
30
+ * @returns The return value for the method call
31
+ */
26
32
  export declare function getABIReturn(args?: AppCallArgs, confirmation?: PendingTransactionResponse): ABIReturn | undefined;
27
33
  /**
28
34
  * Returns the current global state values for the given app ID
@@ -49,7 +55,7 @@ export declare function getAppBoxNames(appId: number, algod: Algodv2): Promise<B
49
55
  /**
50
56
  * Returns the value of the given box name for the given app.
51
57
  * @param appId The ID of the app return box names for
52
- * @param boxName The name of the box to return either as a string, binary array or @see BoxName
58
+ * @param boxName The name of the box to return either as a string, binary array or `BoxName`
53
59
  * @param algod An algod client instance
54
60
  * @returns The current box value as a byte array
55
61
  */
@@ -57,7 +63,7 @@ export declare function getAppBoxValue(appId: number, boxName: string | Uint8Arr
57
63
  /**
58
64
  * Returns the value of the given box names for the given app.
59
65
  * @param appId The ID of the app return box names for
60
- * @param boxNames The names of the boxes to return either as a string, binary array or @see BoxName
66
+ * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`
61
67
  * @param algod An algod client instance
62
68
  * @returns The current box values as a byte array in the same order as the passed in box names
63
69
  */
@@ -76,12 +82,22 @@ export declare function getAppBoxValueFromABIType(request: BoxValueRequestParams
76
82
  * @returns The current box values as an ABI value in the same order as the passed in box names
77
83
  */
78
84
  export declare function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]>;
85
+ /**
86
+ * Converts an array of global/local state values from the algod api to a more friendly
87
+ * generic object keyed by the UTF-8 value of the key.
88
+ * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`
89
+ * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values
90
+ */
79
91
  export declare function decodeAppState(state: {
80
92
  key: string;
81
93
  value: TealValue | EvalDelta;
82
94
  }[]): AppState;
83
- /** Returns the app args ready to load onto an app @see {Transaction} object */
84
- export declare function getAppArgsForTransaction(args?: AppCallArgs): {
95
+ /**
96
+ * Returns the app args ready to load onto an app `Transaction` object
97
+ * @param args The app call args
98
+ * @returns The args ready to load into a `Transaction`
99
+ */
100
+ export declare function getAppArgsForTransaction(args?: RawAppCallArgs): {
85
101
  accounts: string[] | undefined;
86
102
  appArgs: Uint8Array[] | undefined;
87
103
  boxes: algosdk.BoxReference[] | undefined;
@@ -89,6 +105,27 @@ export declare function getAppArgsForTransaction(args?: AppCallArgs): {
89
105
  foreignAssets: number[] | undefined;
90
106
  lease: Uint8Array | undefined;
91
107
  } | undefined;
108
+ /**
109
+ * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`
110
+ * @param args The ABI app call args
111
+ * @param from The transaction signer
112
+ * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer
113
+ */
114
+ export declare function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom): Promise<{
115
+ method: algosdk.ABIMethod;
116
+ sender: string;
117
+ signer: algosdk.TransactionSigner;
118
+ boxes: algosdk.BoxReference[] | undefined;
119
+ lease: Uint8Array | undefined;
120
+ methodArgs: (string | number | bigint | boolean | Uint8Array | algosdk.ABIValue[] | algosdk.TransactionWithSigner)[];
121
+ rekeyTo: undefined;
122
+ }>;
123
+ /**
124
+ * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.
125
+ * @param box The box to return a reference for
126
+ * @returns The box reference ready to pass into a `Transaction`
127
+ */
128
+ export declare function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference;
92
129
  /**
93
130
  * Gets the current data for the given app from algod.
94
131
  *
@@ -96,13 +133,21 @@ export declare function getAppArgsForTransaction(args?: AppCallArgs): {
96
133
  * @param algod An algod client
97
134
  * @returns The data about the app
98
135
  */
99
- export declare function getAppByIndex(appId: number, algod: Algodv2): Promise<ApplicationResponse>;
136
+ export declare function getAppById(appId: number, algod: Algodv2): Promise<ApplicationResponse>;
137
+ /** @deprecated Use `algokit.getAppById` instead. */
138
+ export declare const getAppByIndex: typeof getAppById;
100
139
  /**
101
- * Compiles the given TEAL using algod and returns the result.
140
+ * Compiles the given TEAL using algod and returns the result, including source map.
102
141
  *
103
142
  * @param algod An algod client
104
143
  * @param tealCode The TEAL code
105
144
  * @returns The information about the compiled file
106
145
  */
107
146
  export declare function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal>;
147
+ /**
148
+ * Returns the encoded ABI spec for a given ABI Method
149
+ * @param method The method to return a signature for
150
+ * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`
151
+ */
152
+ export declare const getABIMethodSignature: (method: ABIMethodParams | ABIMethod) => string;
108
153
  //# sourceMappingURL=app.d.ts.map
package/app.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAEd,QAAQ,EACR,OAAO,EAMR,MAAM,SAAS,CAAA;AAIhB,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,0BAA0B,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACrG,OAAO,EACL,SAAS,EAET,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,EACZ,QAAQ,EAER,OAAO,EACP,qBAAqB,EACrB,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,wBAAwB,GAAG,YAAY,CAAC,CA2ClF;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,wBAAwB,CAAC,CA6BnE;AAED;;;;;GAKG;AAC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