arc56-generated-srikanivas-algorack 1.4.2026072011
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 +62 -0
- package/dist/AlgorackMarket_332d497a.d.ts +471 -0
- package/dist/AlgorackMarket_332d497a.js +337 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +37 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# arc56-generated-srikanivas-algorack
|
|
2
|
+
|
|
3
|
+
Auto-generated typed Algorand smart-contract clients for **[Srikanivas/Algorack](https://github.com/Srikanivas/Algorack)**,
|
|
4
|
+
built from the [ARC-56](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0056.md)
|
|
5
|
+
specs listed below.
|
|
6
|
+
|
|
7
|
+
Generated by the [Arc56Registry](https://github.com/scholtz/Arc56Registry) pipeline,
|
|
8
|
+
using the [algorandfoundation/algokit-client-generator-ts](https://github.com/algorandfoundation/algokit-client-generator-ts)
|
|
9
|
+
ARC-56 client generator. Do not edit these files by hand — they are regenerated
|
|
10
|
+
automatically whenever the source ARC-56 spec changes.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install arc56-generated-srikanivas-algorack @algorandfoundation/algokit-utils algosdk
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Basic usage
|
|
19
|
+
|
|
20
|
+
Each contract in this package is re-exported under its own namespace (a hash of its
|
|
21
|
+
source URL is appended to keep multiple contracts in the same repository from
|
|
22
|
+
colliding), containing a typed `<Name>Client` for interacting with an already-deployed
|
|
23
|
+
instance of that contract, plus a `<Name>Factory` for deploying new instances.
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { AlgorandClient } from "@algorandfoundation/algokit-utils";
|
|
27
|
+
import { AlgorackMarket_332d497a } from "arc56-generated-srikanivas-algorack";
|
|
28
|
+
|
|
29
|
+
const algorand = AlgorandClient.mainNet();
|
|
30
|
+
const client = new AlgorackMarket_332d497a.AlgorackMarketClient({
|
|
31
|
+
algorand,
|
|
32
|
+
appId: 123456789n,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// call a contract method, e.g.:
|
|
36
|
+
// const result = await client.send.someMethod({ args: [...] });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### `full` vs `minimal` generator mode
|
|
40
|
+
|
|
41
|
+
Contracts in this package are generated with the client generator's `full` mode by
|
|
42
|
+
default, which emits both the typed `Client` and a deploy/create `Factory` class. A
|
|
43
|
+
small number of contracts' `full`-mode output has been observed to type-check against
|
|
44
|
+
non-exported internal shapes of `@algorandfoundation/algokit-utils`'s `AlgorandClient`
|
|
45
|
+
that break across algokit-utils versions the generator doesn't itself pin against - for
|
|
46
|
+
those specific contracts only, this package falls back to `minimal` mode (`Client`
|
|
47
|
+
only, no `Factory`) instead of failing outright. The contracts table below flags any
|
|
48
|
+
contract generated this way; every other contract includes a working `Factory`.
|
|
49
|
+
|
|
50
|
+
## Contracts included in this package
|
|
51
|
+
|
|
52
|
+
| Namespace | Client class | Source ARC-56 spec |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| `AlgorackMarket_332d497a` | `AlgorackMarketClient` | [https://raw.githubusercontent.com/Srikanivas/Algorack/HEAD/projects/Algorack-contracts/smart_contracts/artifacts/algo_rack/AlgorackMarket.arc56.json](https://raw.githubusercontent.com/Srikanivas/Algorack/HEAD/projects/Algorack-contracts/smart_contracts/artifacts/algo_rack/AlgorackMarket.arc56.json) |
|
|
55
|
+
|
|
56
|
+
## Versioning
|
|
57
|
+
|
|
58
|
+
This package uses `1.0.<increment>.<yyyyMMddHH>`-style versioning (expressed as valid
|
|
59
|
+
semver `1.<increment>.<yyyyMMddHH>`): a new version is published whenever any of the
|
|
60
|
+
contracts above change, or whenever the client generator itself is updated. See
|
|
61
|
+
[Arc56Registry](https://github.com/scholtz/Arc56Registry) for the full generation
|
|
62
|
+
pipeline and source ARC-56 registry.
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by @algorandfoundation/algokit-client-generator.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND.
|
|
4
|
+
* requires: @algorandfoundation/algokit-utils: ^7
|
|
5
|
+
*/
|
|
6
|
+
import { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client';
|
|
7
|
+
import { ABIReturn } from '@algorandfoundation/algokit-utils/types/app';
|
|
8
|
+
import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56';
|
|
9
|
+
import { AppClient as _AppClient, AppClientMethodCallParams, AppClientParams, AppClientBareCallParams, CallOnComplete, ResolveAppClientByCreatorAndName, ResolveAppClientByNetwork, CloneAppClientParams } from '@algorandfoundation/algokit-utils/types/app-client';
|
|
10
|
+
import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, RawSimulateOptions, SkipSignaturesSimulateOptions } from '@algorandfoundation/algokit-utils/types/composer';
|
|
11
|
+
import { SendParams, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction';
|
|
12
|
+
import { Address, modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk';
|
|
13
|
+
export declare const APP_SPEC: Arc56Contract;
|
|
14
|
+
/**
|
|
15
|
+
* A state record containing binary data
|
|
16
|
+
*/
|
|
17
|
+
export interface BinaryState {
|
|
18
|
+
/**
|
|
19
|
+
* Gets the state value as a Uint8Array
|
|
20
|
+
*/
|
|
21
|
+
asByteArray(): Uint8Array | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the state value as a string
|
|
24
|
+
*/
|
|
25
|
+
asString(): string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Expands types for IntelliSense so they are more human readable
|
|
29
|
+
* See https://stackoverflow.com/a/69288824
|
|
30
|
+
*/
|
|
31
|
+
export type Expand<T> = T extends (...args: infer A) => infer R ? (...args: Expand<A>) => Expand<R> : T extends infer O ? {
|
|
32
|
+
[K in keyof O]: O[K];
|
|
33
|
+
} : never;
|
|
34
|
+
/**
|
|
35
|
+
* The argument types for the AlgorackMarket contract
|
|
36
|
+
*/
|
|
37
|
+
export type AlgorackMarketArgs = {
|
|
38
|
+
/**
|
|
39
|
+
* The object representation of the arguments for each method
|
|
40
|
+
*/
|
|
41
|
+
obj: {
|
|
42
|
+
'create_application(asset,uint64)void': {
|
|
43
|
+
assetId: bigint;
|
|
44
|
+
unitaryPrice: bigint | number;
|
|
45
|
+
};
|
|
46
|
+
'set_price(uint64)void': {
|
|
47
|
+
unitaryPrice: bigint | number;
|
|
48
|
+
};
|
|
49
|
+
'opt_in_to_asset(pay)void': {
|
|
50
|
+
mbrpay: AppMethodCallTransactionArgument;
|
|
51
|
+
};
|
|
52
|
+
'buy(pay,uint64)void': {
|
|
53
|
+
buyerTxn: AppMethodCallTransactionArgument;
|
|
54
|
+
quantity: bigint | number;
|
|
55
|
+
};
|
|
56
|
+
'delete_application()void': Record<string, never>;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The tuple representation of the arguments for each method
|
|
60
|
+
*/
|
|
61
|
+
tuple: {
|
|
62
|
+
'create_application(asset,uint64)void': [assetId: bigint, unitaryPrice: bigint | number];
|
|
63
|
+
'set_price(uint64)void': [unitaryPrice: bigint | number];
|
|
64
|
+
'opt_in_to_asset(pay)void': [mbrpay: AppMethodCallTransactionArgument];
|
|
65
|
+
'buy(pay,uint64)void': [buyerTxn: AppMethodCallTransactionArgument, quantity: bigint | number];
|
|
66
|
+
'delete_application()void': [];
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The return type for each method
|
|
71
|
+
*/
|
|
72
|
+
export type AlgorackMarketReturns = {
|
|
73
|
+
'create_application(asset,uint64)void': void;
|
|
74
|
+
'set_price(uint64)void': void;
|
|
75
|
+
'opt_in_to_asset(pay)void': void;
|
|
76
|
+
'buy(pay,uint64)void': void;
|
|
77
|
+
'delete_application()void': void;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Defines the types of available calls and state of the AlgorackMarket smart contract.
|
|
81
|
+
*/
|
|
82
|
+
export type AlgorackMarketTypes = {
|
|
83
|
+
/**
|
|
84
|
+
* Maps method signatures / names to their argument and return types.
|
|
85
|
+
*/
|
|
86
|
+
methods: Record<'create_application(asset,uint64)void' | 'create_application', {
|
|
87
|
+
argsObj: AlgorackMarketArgs['obj']['create_application(asset,uint64)void'];
|
|
88
|
+
argsTuple: AlgorackMarketArgs['tuple']['create_application(asset,uint64)void'];
|
|
89
|
+
returns: AlgorackMarketReturns['create_application(asset,uint64)void'];
|
|
90
|
+
}> & Record<'set_price(uint64)void' | 'set_price', {
|
|
91
|
+
argsObj: AlgorackMarketArgs['obj']['set_price(uint64)void'];
|
|
92
|
+
argsTuple: AlgorackMarketArgs['tuple']['set_price(uint64)void'];
|
|
93
|
+
returns: AlgorackMarketReturns['set_price(uint64)void'];
|
|
94
|
+
}> & Record<'opt_in_to_asset(pay)void' | 'opt_in_to_asset', {
|
|
95
|
+
argsObj: AlgorackMarketArgs['obj']['opt_in_to_asset(pay)void'];
|
|
96
|
+
argsTuple: AlgorackMarketArgs['tuple']['opt_in_to_asset(pay)void'];
|
|
97
|
+
returns: AlgorackMarketReturns['opt_in_to_asset(pay)void'];
|
|
98
|
+
}> & Record<'buy(pay,uint64)void' | 'buy', {
|
|
99
|
+
argsObj: AlgorackMarketArgs['obj']['buy(pay,uint64)void'];
|
|
100
|
+
argsTuple: AlgorackMarketArgs['tuple']['buy(pay,uint64)void'];
|
|
101
|
+
returns: AlgorackMarketReturns['buy(pay,uint64)void'];
|
|
102
|
+
}> & Record<'delete_application()void' | 'delete_application', {
|
|
103
|
+
argsObj: AlgorackMarketArgs['obj']['delete_application()void'];
|
|
104
|
+
argsTuple: AlgorackMarketArgs['tuple']['delete_application()void'];
|
|
105
|
+
returns: AlgorackMarketReturns['delete_application()void'];
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Defines the shape of the state of the application.
|
|
109
|
+
*/
|
|
110
|
+
state: {
|
|
111
|
+
global: {
|
|
112
|
+
keys: {
|
|
113
|
+
assetid: bigint;
|
|
114
|
+
unitaryprice: bigint;
|
|
115
|
+
};
|
|
116
|
+
maps: {};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Defines the possible abi call signatures.
|
|
122
|
+
*/
|
|
123
|
+
export type AlgorackMarketSignatures = keyof AlgorackMarketTypes['methods'];
|
|
124
|
+
/**
|
|
125
|
+
* Defines an object containing all relevant parameters for a single call to the contract.
|
|
126
|
+
*/
|
|
127
|
+
export type CallParams<TArgs> = Expand<Omit<AppClientMethodCallParams, 'method' | 'args' | 'onComplete'> & {
|
|
128
|
+
/** The args for the ABI method call, either as an ordered array or an object */
|
|
129
|
+
args: Expand<TArgs>;
|
|
130
|
+
}>;
|
|
131
|
+
/**
|
|
132
|
+
* Maps a method signature from the AlgorackMarket smart contract to the method's arguments in either tuple or struct form
|
|
133
|
+
*/
|
|
134
|
+
export type MethodArgs<TSignature extends AlgorackMarketSignatures> = AlgorackMarketTypes['methods'][TSignature]['argsObj' | 'argsTuple'];
|
|
135
|
+
/**
|
|
136
|
+
* Maps a method signature from the AlgorackMarket smart contract to the method's return type
|
|
137
|
+
*/
|
|
138
|
+
export type MethodReturn<TSignature extends AlgorackMarketSignatures> = AlgorackMarketTypes['methods'][TSignature]['returns'];
|
|
139
|
+
/**
|
|
140
|
+
* Defines the shape of the keyed global state of the application.
|
|
141
|
+
*/
|
|
142
|
+
export type GlobalKeysState = AlgorackMarketTypes['state']['global']['keys'];
|
|
143
|
+
/**
|
|
144
|
+
* Exposes methods for constructing `AppClient` params objects for ABI calls to the AlgorackMarket smart contract
|
|
145
|
+
*/
|
|
146
|
+
export declare abstract class AlgorackMarketParamsFactory {
|
|
147
|
+
/**
|
|
148
|
+
* Constructs a no op call for the set_price(uint64)void ABI method
|
|
149
|
+
*
|
|
150
|
+
* @param params Parameters for the call
|
|
151
|
+
* @returns An `AppClientMethodCallParams` object for the call
|
|
152
|
+
*/
|
|
153
|
+
static setPrice(params: CallParams<AlgorackMarketArgs['obj']['set_price(uint64)void'] | AlgorackMarketArgs['tuple']['set_price(uint64)void']> & CallOnComplete): AppClientMethodCallParams & CallOnComplete;
|
|
154
|
+
/**
|
|
155
|
+
* Constructs a no op call for the opt_in_to_asset(pay)void ABI method
|
|
156
|
+
*
|
|
157
|
+
* @param params Parameters for the call
|
|
158
|
+
* @returns An `AppClientMethodCallParams` object for the call
|
|
159
|
+
*/
|
|
160
|
+
static optInToAsset(params: CallParams<AlgorackMarketArgs['obj']['opt_in_to_asset(pay)void'] | AlgorackMarketArgs['tuple']['opt_in_to_asset(pay)void']> & CallOnComplete): AppClientMethodCallParams & CallOnComplete;
|
|
161
|
+
/**
|
|
162
|
+
* Constructs a no op call for the buy(pay,uint64)void ABI method
|
|
163
|
+
*
|
|
164
|
+
* @param params Parameters for the call
|
|
165
|
+
* @returns An `AppClientMethodCallParams` object for the call
|
|
166
|
+
*/
|
|
167
|
+
static buy(params: CallParams<AlgorackMarketArgs['obj']['buy(pay,uint64)void'] | AlgorackMarketArgs['tuple']['buy(pay,uint64)void']> & CallOnComplete): AppClientMethodCallParams & CallOnComplete;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A client to make calls to the AlgorackMarket smart contract
|
|
171
|
+
*/
|
|
172
|
+
export declare class AlgorackMarketClient {
|
|
173
|
+
/**
|
|
174
|
+
* The underlying `AppClient` for when you want to have more flexibility
|
|
175
|
+
*/
|
|
176
|
+
readonly appClient: _AppClient;
|
|
177
|
+
/**
|
|
178
|
+
* Creates a new instance of `AlgorackMarketClient`
|
|
179
|
+
*
|
|
180
|
+
* @param appClient An `AppClient` instance which has been created with the AlgorackMarket app spec
|
|
181
|
+
*/
|
|
182
|
+
constructor(appClient: _AppClient);
|
|
183
|
+
/**
|
|
184
|
+
* Creates a new instance of `AlgorackMarketClient`
|
|
185
|
+
*
|
|
186
|
+
* @param params The parameters to initialise the app client with
|
|
187
|
+
*/
|
|
188
|
+
constructor(params: Omit<AppClientParams, 'appSpec'>);
|
|
189
|
+
/**
|
|
190
|
+
* Returns a new `AlgorackMarketClient` client, resolving the app by creator address and name
|
|
191
|
+
* using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
|
|
192
|
+
* @param params The parameters to create the app client
|
|
193
|
+
*/
|
|
194
|
+
static fromCreatorAndName(params: Omit<ResolveAppClientByCreatorAndName, 'appSpec'>): Promise<AlgorackMarketClient>;
|
|
195
|
+
/**
|
|
196
|
+
* Returns an `AlgorackMarketClient` instance for the current network based on
|
|
197
|
+
* pre-determined network-specific app IDs specified in the ARC-56 app spec.
|
|
198
|
+
*
|
|
199
|
+
* If no IDs are in the app spec or the network isn't recognised, an error is thrown.
|
|
200
|
+
* @param params The parameters to create the app client
|
|
201
|
+
*/
|
|
202
|
+
static fromNetwork(params: Omit<ResolveAppClientByNetwork, 'appSpec'>): Promise<AlgorackMarketClient>;
|
|
203
|
+
/** The ID of the app instance this client is linked to. */
|
|
204
|
+
get appId(): bigint;
|
|
205
|
+
/** The app address of the app instance this client is linked to. */
|
|
206
|
+
get appAddress(): Address;
|
|
207
|
+
/** The name of the app. */
|
|
208
|
+
get appName(): string;
|
|
209
|
+
/** The ARC-56 app spec being used */
|
|
210
|
+
get appSpec(): Arc56Contract;
|
|
211
|
+
/** A reference to the underlying `AlgorandClient` this app client is using. */
|
|
212
|
+
get algorand(): AlgorandClient;
|
|
213
|
+
/**
|
|
214
|
+
* Get parameters to create transactions for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.
|
|
215
|
+
*/
|
|
216
|
+
readonly params: {
|
|
217
|
+
/**
|
|
218
|
+
* Makes a clear_state call to an existing instance of the AlgorackMarket smart contract.
|
|
219
|
+
*
|
|
220
|
+
* @param params The params for the bare (raw) call
|
|
221
|
+
* @returns The clearState result
|
|
222
|
+
*/
|
|
223
|
+
clearState: (params?: Expand<AppClientBareCallParams>) => import("@algorandfoundation/algokit-utils/types/composer").AppCallParams;
|
|
224
|
+
/**
|
|
225
|
+
* Makes a call to the AlgorackMarket smart contract using the `set_price(uint64)void` ABI method.
|
|
226
|
+
*
|
|
227
|
+
* @param params The params for the smart contract call
|
|
228
|
+
* @returns The call params
|
|
229
|
+
*/
|
|
230
|
+
setPrice: (params: CallParams<AlgorackMarketArgs["obj"]["set_price(uint64)void"] | AlgorackMarketArgs["tuple"]["set_price(uint64)void"]> & {
|
|
231
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
232
|
+
}) => Promise<AppCallMethodCall>;
|
|
233
|
+
/**
|
|
234
|
+
* Makes a call to the AlgorackMarket smart contract using the `opt_in_to_asset(pay)void` ABI method.
|
|
235
|
+
*
|
|
236
|
+
* @param params The params for the smart contract call
|
|
237
|
+
* @returns The call params
|
|
238
|
+
*/
|
|
239
|
+
optInToAsset: (params: CallParams<AlgorackMarketArgs["obj"]["opt_in_to_asset(pay)void"] | AlgorackMarketArgs["tuple"]["opt_in_to_asset(pay)void"]> & {
|
|
240
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
241
|
+
}) => Promise<AppCallMethodCall>;
|
|
242
|
+
/**
|
|
243
|
+
* Makes a call to the AlgorackMarket smart contract using the `buy(pay,uint64)void` ABI method.
|
|
244
|
+
*
|
|
245
|
+
* @param params The params for the smart contract call
|
|
246
|
+
* @returns The call params
|
|
247
|
+
*/
|
|
248
|
+
buy: (params: CallParams<AlgorackMarketArgs["obj"]["buy(pay,uint64)void"] | AlgorackMarketArgs["tuple"]["buy(pay,uint64)void"]> & {
|
|
249
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
250
|
+
}) => Promise<AppCallMethodCall>;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Create transactions for the current app
|
|
254
|
+
*/
|
|
255
|
+
readonly createTransaction: {
|
|
256
|
+
/**
|
|
257
|
+
* Makes a clear_state call to an existing instance of the AlgorackMarket smart contract.
|
|
258
|
+
*
|
|
259
|
+
* @param params The params for the bare (raw) call
|
|
260
|
+
* @returns The clearState result
|
|
261
|
+
*/
|
|
262
|
+
clearState: (params?: Expand<AppClientBareCallParams>) => Promise<Transaction>;
|
|
263
|
+
/**
|
|
264
|
+
* Makes a call to the AlgorackMarket smart contract using the `set_price(uint64)void` ABI method.
|
|
265
|
+
*
|
|
266
|
+
* @param params The params for the smart contract call
|
|
267
|
+
* @returns The call transaction
|
|
268
|
+
*/
|
|
269
|
+
setPrice: (params: CallParams<AlgorackMarketArgs["obj"]["set_price(uint64)void"] | AlgorackMarketArgs["tuple"]["set_price(uint64)void"]> & {
|
|
270
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
271
|
+
}) => Promise<{
|
|
272
|
+
transactions: Transaction[];
|
|
273
|
+
methodCalls: Map<number, import("algosdk").ABIMethod>;
|
|
274
|
+
signers: Map<number, TransactionSigner>;
|
|
275
|
+
}>;
|
|
276
|
+
/**
|
|
277
|
+
* Makes a call to the AlgorackMarket smart contract using the `opt_in_to_asset(pay)void` ABI method.
|
|
278
|
+
*
|
|
279
|
+
* @param params The params for the smart contract call
|
|
280
|
+
* @returns The call transaction
|
|
281
|
+
*/
|
|
282
|
+
optInToAsset: (params: CallParams<AlgorackMarketArgs["obj"]["opt_in_to_asset(pay)void"] | AlgorackMarketArgs["tuple"]["opt_in_to_asset(pay)void"]> & {
|
|
283
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
284
|
+
}) => Promise<{
|
|
285
|
+
transactions: Transaction[];
|
|
286
|
+
methodCalls: Map<number, import("algosdk").ABIMethod>;
|
|
287
|
+
signers: Map<number, TransactionSigner>;
|
|
288
|
+
}>;
|
|
289
|
+
/**
|
|
290
|
+
* Makes a call to the AlgorackMarket smart contract using the `buy(pay,uint64)void` ABI method.
|
|
291
|
+
*
|
|
292
|
+
* @param params The params for the smart contract call
|
|
293
|
+
* @returns The call transaction
|
|
294
|
+
*/
|
|
295
|
+
buy: (params: CallParams<AlgorackMarketArgs["obj"]["buy(pay,uint64)void"] | AlgorackMarketArgs["tuple"]["buy(pay,uint64)void"]> & {
|
|
296
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
297
|
+
}) => Promise<{
|
|
298
|
+
transactions: Transaction[];
|
|
299
|
+
methodCalls: Map<number, import("algosdk").ABIMethod>;
|
|
300
|
+
signers: Map<number, TransactionSigner>;
|
|
301
|
+
}>;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Send calls to the current app
|
|
305
|
+
*/
|
|
306
|
+
readonly send: {
|
|
307
|
+
/**
|
|
308
|
+
* Makes a clear_state call to an existing instance of the AlgorackMarket smart contract.
|
|
309
|
+
*
|
|
310
|
+
* @param params The params for the bare (raw) call
|
|
311
|
+
* @returns The clearState result
|
|
312
|
+
*/
|
|
313
|
+
clearState: (params?: Expand<AppClientBareCallParams & SendParams>) => Promise<{
|
|
314
|
+
groupId: string;
|
|
315
|
+
txIds: string[];
|
|
316
|
+
returns?: ABIReturn[] | undefined;
|
|
317
|
+
confirmations: modelsv2.PendingTransactionResponse[];
|
|
318
|
+
transactions: Transaction[];
|
|
319
|
+
confirmation: modelsv2.PendingTransactionResponse;
|
|
320
|
+
transaction: Transaction;
|
|
321
|
+
return?: ABIReturn | undefined;
|
|
322
|
+
}>;
|
|
323
|
+
/**
|
|
324
|
+
* Makes a call to the AlgorackMarket smart contract using the `set_price(uint64)void` ABI method.
|
|
325
|
+
*
|
|
326
|
+
* @param params The params for the smart contract call
|
|
327
|
+
* @returns The call result
|
|
328
|
+
*/
|
|
329
|
+
setPrice: (params: CallParams<AlgorackMarketArgs["obj"]["set_price(uint64)void"] | AlgorackMarketArgs["tuple"]["set_price(uint64)void"]> & SendParams & {
|
|
330
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
331
|
+
}) => Promise<{
|
|
332
|
+
return: (undefined | AlgorackMarketReturns["set_price(uint64)void"]);
|
|
333
|
+
returns?: ABIReturn[] | undefined;
|
|
334
|
+
groupId: string;
|
|
335
|
+
txIds: string[];
|
|
336
|
+
confirmations: modelsv2.PendingTransactionResponse[];
|
|
337
|
+
transactions: Transaction[];
|
|
338
|
+
confirmation: modelsv2.PendingTransactionResponse;
|
|
339
|
+
transaction: Transaction;
|
|
340
|
+
}>;
|
|
341
|
+
/**
|
|
342
|
+
* Makes a call to the AlgorackMarket smart contract using the `opt_in_to_asset(pay)void` ABI method.
|
|
343
|
+
*
|
|
344
|
+
* @param params The params for the smart contract call
|
|
345
|
+
* @returns The call result
|
|
346
|
+
*/
|
|
347
|
+
optInToAsset: (params: CallParams<AlgorackMarketArgs["obj"]["opt_in_to_asset(pay)void"] | AlgorackMarketArgs["tuple"]["opt_in_to_asset(pay)void"]> & SendParams & {
|
|
348
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
349
|
+
}) => Promise<{
|
|
350
|
+
return: (undefined | AlgorackMarketReturns["opt_in_to_asset(pay)void"]);
|
|
351
|
+
returns?: ABIReturn[] | undefined;
|
|
352
|
+
groupId: string;
|
|
353
|
+
txIds: string[];
|
|
354
|
+
confirmations: modelsv2.PendingTransactionResponse[];
|
|
355
|
+
transactions: Transaction[];
|
|
356
|
+
confirmation: modelsv2.PendingTransactionResponse;
|
|
357
|
+
transaction: Transaction;
|
|
358
|
+
}>;
|
|
359
|
+
/**
|
|
360
|
+
* Makes a call to the AlgorackMarket smart contract using the `buy(pay,uint64)void` ABI method.
|
|
361
|
+
*
|
|
362
|
+
* @param params The params for the smart contract call
|
|
363
|
+
* @returns The call result
|
|
364
|
+
*/
|
|
365
|
+
buy: (params: CallParams<AlgorackMarketArgs["obj"]["buy(pay,uint64)void"] | AlgorackMarketArgs["tuple"]["buy(pay,uint64)void"]> & SendParams & {
|
|
366
|
+
onComplete?: OnApplicationComplete.NoOpOC;
|
|
367
|
+
}) => Promise<{
|
|
368
|
+
return: (undefined | AlgorackMarketReturns["buy(pay,uint64)void"]);
|
|
369
|
+
returns?: ABIReturn[] | undefined;
|
|
370
|
+
groupId: string;
|
|
371
|
+
txIds: string[];
|
|
372
|
+
confirmations: modelsv2.PendingTransactionResponse[];
|
|
373
|
+
transactions: Transaction[];
|
|
374
|
+
confirmation: modelsv2.PendingTransactionResponse;
|
|
375
|
+
transaction: Transaction;
|
|
376
|
+
}>;
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Clone this app client with different params
|
|
380
|
+
*
|
|
381
|
+
* @param params The params to use for the the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.
|
|
382
|
+
* @returns A new app client with the altered params
|
|
383
|
+
*/
|
|
384
|
+
clone(params: CloneAppClientParams): AlgorackMarketClient;
|
|
385
|
+
/**
|
|
386
|
+
* Methods to access state for the current AlgorackMarket app
|
|
387
|
+
*/
|
|
388
|
+
state: {
|
|
389
|
+
/**
|
|
390
|
+
* Methods to access global state for the current AlgorackMarket app
|
|
391
|
+
*/
|
|
392
|
+
global: {
|
|
393
|
+
/**
|
|
394
|
+
* Get all current keyed values from global state
|
|
395
|
+
*/
|
|
396
|
+
getAll: () => Promise<Partial<Expand<GlobalKeysState>>>;
|
|
397
|
+
/**
|
|
398
|
+
* Get the current value of the assetid key in global state
|
|
399
|
+
*/
|
|
400
|
+
assetid: () => Promise<bigint | undefined>;
|
|
401
|
+
/**
|
|
402
|
+
* Get the current value of the unitaryprice key in global state
|
|
403
|
+
*/
|
|
404
|
+
unitaryprice: () => Promise<bigint | undefined>;
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
newGroup(): AlgorackMarketComposer;
|
|
408
|
+
}
|
|
409
|
+
export type AlgorackMarketComposer<TReturns extends [...any[]] = []> = {
|
|
410
|
+
/**
|
|
411
|
+
* Calls the set_price(uint64)void ABI method.
|
|
412
|
+
*
|
|
413
|
+
* @param args The arguments for the contract call
|
|
414
|
+
* @param params Any additional parameters for the call
|
|
415
|
+
* @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions
|
|
416
|
+
*/
|
|
417
|
+
setPrice(params?: CallParams<AlgorackMarketArgs['obj']['set_price(uint64)void'] | AlgorackMarketArgs['tuple']['set_price(uint64)void']>): AlgorackMarketComposer<[...TReturns, AlgorackMarketReturns['set_price(uint64)void'] | undefined]>;
|
|
418
|
+
/**
|
|
419
|
+
* Calls the opt_in_to_asset(pay)void ABI method.
|
|
420
|
+
*
|
|
421
|
+
* @param args The arguments for the contract call
|
|
422
|
+
* @param params Any additional parameters for the call
|
|
423
|
+
* @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions
|
|
424
|
+
*/
|
|
425
|
+
optInToAsset(params?: CallParams<AlgorackMarketArgs['obj']['opt_in_to_asset(pay)void'] | AlgorackMarketArgs['tuple']['opt_in_to_asset(pay)void']>): AlgorackMarketComposer<[...TReturns, AlgorackMarketReturns['opt_in_to_asset(pay)void'] | undefined]>;
|
|
426
|
+
/**
|
|
427
|
+
* Calls the buy(pay,uint64)void ABI method.
|
|
428
|
+
*
|
|
429
|
+
* @param args The arguments for the contract call
|
|
430
|
+
* @param params Any additional parameters for the call
|
|
431
|
+
* @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions
|
|
432
|
+
*/
|
|
433
|
+
buy(params?: CallParams<AlgorackMarketArgs['obj']['buy(pay,uint64)void'] | AlgorackMarketArgs['tuple']['buy(pay,uint64)void']>): AlgorackMarketComposer<[...TReturns, AlgorackMarketReturns['buy(pay,uint64)void'] | undefined]>;
|
|
434
|
+
/**
|
|
435
|
+
* Makes a clear_state call to an existing instance of the AlgorackMarket smart contract.
|
|
436
|
+
*
|
|
437
|
+
* @param args The arguments for the bare call
|
|
438
|
+
* @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions
|
|
439
|
+
*/
|
|
440
|
+
clearState(params?: AppClientBareCallParams): AlgorackMarketComposer<[...TReturns, undefined]>;
|
|
441
|
+
/**
|
|
442
|
+
* Adds a transaction to the composer
|
|
443
|
+
*
|
|
444
|
+
* @param txn A transaction to add to the transaction group
|
|
445
|
+
* @param signer The optional signer to use when signing this transaction.
|
|
446
|
+
*/
|
|
447
|
+
addTransaction(txn: Transaction, signer?: TransactionSigner): AlgorackMarketComposer<TReturns>;
|
|
448
|
+
/**
|
|
449
|
+
* Returns the underlying AtomicTransactionComposer instance
|
|
450
|
+
*/
|
|
451
|
+
composer(): Promise<TransactionComposer>;
|
|
452
|
+
/**
|
|
453
|
+
* Simulates the transaction group and returns the result
|
|
454
|
+
*/
|
|
455
|
+
simulate(): Promise<AlgorackMarketComposerResults<TReturns> & {
|
|
456
|
+
simulateResponse: modelsv2.SimulateResponse;
|
|
457
|
+
}>;
|
|
458
|
+
simulate(options: SkipSignaturesSimulateOptions): Promise<AlgorackMarketComposerResults<TReturns> & {
|
|
459
|
+
simulateResponse: modelsv2.SimulateResponse;
|
|
460
|
+
}>;
|
|
461
|
+
simulate(options: RawSimulateOptions): Promise<AlgorackMarketComposerResults<TReturns> & {
|
|
462
|
+
simulateResponse: modelsv2.SimulateResponse;
|
|
463
|
+
}>;
|
|
464
|
+
/**
|
|
465
|
+
* Sends the transaction group to the network and returns the results
|
|
466
|
+
*/
|
|
467
|
+
send(params?: SendParams): Promise<AlgorackMarketComposerResults<TReturns>>;
|
|
468
|
+
};
|
|
469
|
+
export type AlgorackMarketComposerResults<TReturns extends [...any[]]> = Expand<SendAtomicTransactionComposerResults & {
|
|
470
|
+
returns: TReturns;
|
|
471
|
+
}>;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlgorackMarketClient = exports.AlgorackMarketParamsFactory = exports.APP_SPEC = void 0;
|
|
4
|
+
const app_client_1 = require("@algorandfoundation/algokit-utils/types/app-client");
|
|
5
|
+
exports.APP_SPEC = { "name": "AlgorackMarket", "structs": {}, "methods": [{ "name": "create_application", "args": [{ "type": "asset", "name": "asset_id" }, { "type": "uint64", "name": "unitary_price" }], "returns": { "type": "void" }, "actions": { "create": ["NoOp"], "call": [] }, "readonly": false, "events": [], "recommendations": {} }, { "name": "set_price", "args": [{ "type": "uint64", "name": "unitary_price" }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "events": [], "recommendations": {} }, { "name": "opt_in_to_asset", "args": [{ "type": "pay", "name": "mbrpay" }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "events": [], "recommendations": {} }, { "name": "buy", "args": [{ "type": "pay", "name": "buyerTxn" }, { "type": "uint64", "name": "quantity" }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "events": [], "recommendations": {} }, { "name": "delete_application", "args": [], "returns": { "type": "void" }, "actions": { "create": [], "call": ["DeleteApplication"] }, "readonly": false, "events": [], "recommendations": {} }], "arcs": [22, 28], "networks": {}, "state": { "schema": { "global": { "ints": 2, "bytes": 0 }, "local": { "ints": 0, "bytes": 0 } }, "keys": { "global": { "assetid": { "keyType": "AVMString", "valueType": "AVMUint64", "key": "YXNzZXRpZA==" }, "unitaryprice": { "keyType": "AVMString", "valueType": "AVMUint64", "key": "dW5pdGFyeXByaWNl" } }, "local": {}, "box": {} }, "maps": { "global": {}, "local": {}, "box": {} } }, "bareActions": { "create": [], "call": [] }, "sourceInfo": { "approval": { "sourceInfo": [{ "pc": [85], "errorMessage": "OnCompletion is not DeleteApplication" }, { "pc": [97, 123, 145, 161], "errorMessage": "OnCompletion is not NoOp" }, { "pc": [165], "errorMessage": "can only call when creating" }, { "pc": [88, 100, 126, 148], "errorMessage": "can only call when not creating" }, { "pc": [221, 251, 305, 334], "errorMessage": "check self.assetid exists" }, { "pc": [295], "errorMessage": "check self.unitaryprice exists" }, { "pc": [110, 136], "errorMessage": "transaction type is pay" }], "pcOffsetMethod": "none" }, "clear": { "sourceInfo": [], "pcOffsetMethod": "none" } }, "events": [] };
|
|
6
|
+
class BinaryStateValue {
|
|
7
|
+
constructor(value) {
|
|
8
|
+
this.value = value;
|
|
9
|
+
}
|
|
10
|
+
asByteArray() {
|
|
11
|
+
return this.value;
|
|
12
|
+
}
|
|
13
|
+
asString() {
|
|
14
|
+
return this.value !== undefined ? Buffer.from(this.value).toString('utf-8') : undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Exposes methods for constructing `AppClient` params objects for ABI calls to the AlgorackMarket smart contract
|
|
19
|
+
*/
|
|
20
|
+
class AlgorackMarketParamsFactory {
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a no op call for the set_price(uint64)void ABI method
|
|
23
|
+
*
|
|
24
|
+
* @param params Parameters for the call
|
|
25
|
+
* @returns An `AppClientMethodCallParams` object for the call
|
|
26
|
+
*/
|
|
27
|
+
static setPrice(params) {
|
|
28
|
+
return {
|
|
29
|
+
...params,
|
|
30
|
+
method: 'set_price(uint64)void',
|
|
31
|
+
args: Array.isArray(params.args) ? params.args : [params.args.unitaryPrice],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Constructs a no op call for the opt_in_to_asset(pay)void ABI method
|
|
36
|
+
*
|
|
37
|
+
* @param params Parameters for the call
|
|
38
|
+
* @returns An `AppClientMethodCallParams` object for the call
|
|
39
|
+
*/
|
|
40
|
+
static optInToAsset(params) {
|
|
41
|
+
return {
|
|
42
|
+
...params,
|
|
43
|
+
method: 'opt_in_to_asset(pay)void',
|
|
44
|
+
args: Array.isArray(params.args) ? params.args : [params.args.mbrpay],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Constructs a no op call for the buy(pay,uint64)void ABI method
|
|
49
|
+
*
|
|
50
|
+
* @param params Parameters for the call
|
|
51
|
+
* @returns An `AppClientMethodCallParams` object for the call
|
|
52
|
+
*/
|
|
53
|
+
static buy(params) {
|
|
54
|
+
return {
|
|
55
|
+
...params,
|
|
56
|
+
method: 'buy(pay,uint64)void',
|
|
57
|
+
args: Array.isArray(params.args) ? params.args : [params.args.buyerTxn, params.args.quantity],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.AlgorackMarketParamsFactory = AlgorackMarketParamsFactory;
|
|
62
|
+
/**
|
|
63
|
+
* A client to make calls to the AlgorackMarket smart contract
|
|
64
|
+
*/
|
|
65
|
+
class AlgorackMarketClient {
|
|
66
|
+
constructor(appClientOrParams) {
|
|
67
|
+
/**
|
|
68
|
+
* Get parameters to create transactions for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.
|
|
69
|
+
*/
|
|
70
|
+
this.params = {
|
|
71
|
+
/**
|
|
72
|
+
* Makes a clear_state call to an existing instance of the AlgorackMarket smart contract.
|
|
73
|
+
*
|
|
74
|
+
* @param params The params for the bare (raw) call
|
|
75
|
+
* @returns The clearState result
|
|
76
|
+
*/
|
|
77
|
+
clearState: (params) => {
|
|
78
|
+
return this.appClient.params.bare.clearState(params);
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Makes a call to the AlgorackMarket smart contract using the `set_price(uint64)void` ABI method.
|
|
82
|
+
*
|
|
83
|
+
* @param params The params for the smart contract call
|
|
84
|
+
* @returns The call params
|
|
85
|
+
*/
|
|
86
|
+
setPrice: (params) => {
|
|
87
|
+
return this.appClient.params.call(AlgorackMarketParamsFactory.setPrice(params));
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* Makes a call to the AlgorackMarket smart contract using the `opt_in_to_asset(pay)void` ABI method.
|
|
91
|
+
*
|
|
92
|
+
* @param params The params for the smart contract call
|
|
93
|
+
* @returns The call params
|
|
94
|
+
*/
|
|
95
|
+
optInToAsset: (params) => {
|
|
96
|
+
return this.appClient.params.call(AlgorackMarketParamsFactory.optInToAsset(params));
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Makes a call to the AlgorackMarket smart contract using the `buy(pay,uint64)void` ABI method.
|
|
100
|
+
*
|
|
101
|
+
* @param params The params for the smart contract call
|
|
102
|
+
* @returns The call params
|
|
103
|
+
*/
|
|
104
|
+
buy: (params) => {
|
|
105
|
+
return this.appClient.params.call(AlgorackMarketParamsFactory.buy(params));
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Create transactions for the current app
|
|
110
|
+
*/
|
|
111
|
+
this.createTransaction = {
|
|
112
|
+
/**
|
|
113
|
+
* Makes a clear_state call to an existing instance of the AlgorackMarket smart contract.
|
|
114
|
+
*
|
|
115
|
+
* @param params The params for the bare (raw) call
|
|
116
|
+
* @returns The clearState result
|
|
117
|
+
*/
|
|
118
|
+
clearState: (params) => {
|
|
119
|
+
return this.appClient.createTransaction.bare.clearState(params);
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* Makes a call to the AlgorackMarket smart contract using the `set_price(uint64)void` ABI method.
|
|
123
|
+
*
|
|
124
|
+
* @param params The params for the smart contract call
|
|
125
|
+
* @returns The call transaction
|
|
126
|
+
*/
|
|
127
|
+
setPrice: (params) => {
|
|
128
|
+
return this.appClient.createTransaction.call(AlgorackMarketParamsFactory.setPrice(params));
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
131
|
+
* Makes a call to the AlgorackMarket smart contract using the `opt_in_to_asset(pay)void` ABI method.
|
|
132
|
+
*
|
|
133
|
+
* @param params The params for the smart contract call
|
|
134
|
+
* @returns The call transaction
|
|
135
|
+
*/
|
|
136
|
+
optInToAsset: (params) => {
|
|
137
|
+
return this.appClient.createTransaction.call(AlgorackMarketParamsFactory.optInToAsset(params));
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* Makes a call to the AlgorackMarket smart contract using the `buy(pay,uint64)void` ABI method.
|
|
141
|
+
*
|
|
142
|
+
* @param params The params for the smart contract call
|
|
143
|
+
* @returns The call transaction
|
|
144
|
+
*/
|
|
145
|
+
buy: (params) => {
|
|
146
|
+
return this.appClient.createTransaction.call(AlgorackMarketParamsFactory.buy(params));
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Send calls to the current app
|
|
151
|
+
*/
|
|
152
|
+
this.send = {
|
|
153
|
+
/**
|
|
154
|
+
* Makes a clear_state call to an existing instance of the AlgorackMarket smart contract.
|
|
155
|
+
*
|
|
156
|
+
* @param params The params for the bare (raw) call
|
|
157
|
+
* @returns The clearState result
|
|
158
|
+
*/
|
|
159
|
+
clearState: (params) => {
|
|
160
|
+
return this.appClient.send.bare.clearState(params);
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* Makes a call to the AlgorackMarket smart contract using the `set_price(uint64)void` ABI method.
|
|
164
|
+
*
|
|
165
|
+
* @param params The params for the smart contract call
|
|
166
|
+
* @returns The call result
|
|
167
|
+
*/
|
|
168
|
+
setPrice: async (params) => {
|
|
169
|
+
const result = await this.appClient.send.call(AlgorackMarketParamsFactory.setPrice(params));
|
|
170
|
+
return { ...result, return: result.return };
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* Makes a call to the AlgorackMarket smart contract using the `opt_in_to_asset(pay)void` ABI method.
|
|
174
|
+
*
|
|
175
|
+
* @param params The params for the smart contract call
|
|
176
|
+
* @returns The call result
|
|
177
|
+
*/
|
|
178
|
+
optInToAsset: async (params) => {
|
|
179
|
+
const result = await this.appClient.send.call(AlgorackMarketParamsFactory.optInToAsset(params));
|
|
180
|
+
return { ...result, return: result.return };
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Makes a call to the AlgorackMarket smart contract using the `buy(pay,uint64)void` ABI method.
|
|
184
|
+
*
|
|
185
|
+
* @param params The params for the smart contract call
|
|
186
|
+
* @returns The call result
|
|
187
|
+
*/
|
|
188
|
+
buy: async (params) => {
|
|
189
|
+
const result = await this.appClient.send.call(AlgorackMarketParamsFactory.buy(params));
|
|
190
|
+
return { ...result, return: result.return };
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Methods to access state for the current AlgorackMarket app
|
|
195
|
+
*/
|
|
196
|
+
this.state = {
|
|
197
|
+
/**
|
|
198
|
+
* Methods to access global state for the current AlgorackMarket app
|
|
199
|
+
*/
|
|
200
|
+
global: {
|
|
201
|
+
/**
|
|
202
|
+
* Get all current keyed values from global state
|
|
203
|
+
*/
|
|
204
|
+
getAll: async () => {
|
|
205
|
+
const result = await this.appClient.state.global.getAll();
|
|
206
|
+
return {
|
|
207
|
+
assetid: result.assetid,
|
|
208
|
+
unitaryprice: result.unitaryprice,
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
/**
|
|
212
|
+
* Get the current value of the assetid key in global state
|
|
213
|
+
*/
|
|
214
|
+
assetid: async () => { return (await this.appClient.state.global.getValue("assetid")); },
|
|
215
|
+
/**
|
|
216
|
+
* Get the current value of the unitaryprice key in global state
|
|
217
|
+
*/
|
|
218
|
+
unitaryprice: async () => { return (await this.appClient.state.global.getValue("unitaryprice")); },
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
this.appClient = appClientOrParams instanceof app_client_1.AppClient ? appClientOrParams : new app_client_1.AppClient({
|
|
222
|
+
...appClientOrParams,
|
|
223
|
+
appSpec: exports.APP_SPEC,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Returns a new `AlgorackMarketClient` client, resolving the app by creator address and name
|
|
228
|
+
* using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
|
|
229
|
+
* @param params The parameters to create the app client
|
|
230
|
+
*/
|
|
231
|
+
static async fromCreatorAndName(params) {
|
|
232
|
+
return new AlgorackMarketClient(await app_client_1.AppClient.fromCreatorAndName({ ...params, appSpec: exports.APP_SPEC }));
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Returns an `AlgorackMarketClient` instance for the current network based on
|
|
236
|
+
* pre-determined network-specific app IDs specified in the ARC-56 app spec.
|
|
237
|
+
*
|
|
238
|
+
* If no IDs are in the app spec or the network isn't recognised, an error is thrown.
|
|
239
|
+
* @param params The parameters to create the app client
|
|
240
|
+
*/
|
|
241
|
+
static async fromNetwork(params) {
|
|
242
|
+
return new AlgorackMarketClient(await app_client_1.AppClient.fromNetwork({ ...params, appSpec: exports.APP_SPEC }));
|
|
243
|
+
}
|
|
244
|
+
/** The ID of the app instance this client is linked to. */
|
|
245
|
+
get appId() {
|
|
246
|
+
return this.appClient.appId;
|
|
247
|
+
}
|
|
248
|
+
/** The app address of the app instance this client is linked to. */
|
|
249
|
+
get appAddress() {
|
|
250
|
+
return this.appClient.appAddress;
|
|
251
|
+
}
|
|
252
|
+
/** The name of the app. */
|
|
253
|
+
get appName() {
|
|
254
|
+
return this.appClient.appName;
|
|
255
|
+
}
|
|
256
|
+
/** The ARC-56 app spec being used */
|
|
257
|
+
get appSpec() {
|
|
258
|
+
return this.appClient.appSpec;
|
|
259
|
+
}
|
|
260
|
+
/** A reference to the underlying `AlgorandClient` this app client is using. */
|
|
261
|
+
get algorand() {
|
|
262
|
+
return this.appClient.algorand;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Clone this app client with different params
|
|
266
|
+
*
|
|
267
|
+
* @param params The params to use for the the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.
|
|
268
|
+
* @returns A new app client with the altered params
|
|
269
|
+
*/
|
|
270
|
+
clone(params) {
|
|
271
|
+
return new AlgorackMarketClient(this.appClient.clone(params));
|
|
272
|
+
}
|
|
273
|
+
newGroup() {
|
|
274
|
+
const client = this;
|
|
275
|
+
const composer = this.algorand.newGroup();
|
|
276
|
+
let promiseChain = Promise.resolve();
|
|
277
|
+
const resultMappers = [];
|
|
278
|
+
return {
|
|
279
|
+
/**
|
|
280
|
+
* Add a set_price(uint64)void method call against the AlgorackMarket contract
|
|
281
|
+
*/
|
|
282
|
+
setPrice(params) {
|
|
283
|
+
promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.setPrice(params)));
|
|
284
|
+
resultMappers.push(undefined);
|
|
285
|
+
return this;
|
|
286
|
+
},
|
|
287
|
+
/**
|
|
288
|
+
* Add a opt_in_to_asset(pay)void method call against the AlgorackMarket contract
|
|
289
|
+
*/
|
|
290
|
+
optInToAsset(params) {
|
|
291
|
+
promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.optInToAsset(params)));
|
|
292
|
+
resultMappers.push(undefined);
|
|
293
|
+
return this;
|
|
294
|
+
},
|
|
295
|
+
/**
|
|
296
|
+
* Add a buy(pay,uint64)void method call against the AlgorackMarket contract
|
|
297
|
+
*/
|
|
298
|
+
buy(params) {
|
|
299
|
+
promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.buy(params)));
|
|
300
|
+
resultMappers.push(undefined);
|
|
301
|
+
return this;
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* Add a clear state call to the AlgorackMarket contract
|
|
305
|
+
*/
|
|
306
|
+
clearState(params) {
|
|
307
|
+
promiseChain = promiseChain.then(() => composer.addAppCall(client.params.clearState(params)));
|
|
308
|
+
return this;
|
|
309
|
+
},
|
|
310
|
+
addTransaction(txn, signer) {
|
|
311
|
+
promiseChain = promiseChain.then(() => composer.addTransaction(txn, signer));
|
|
312
|
+
return this;
|
|
313
|
+
},
|
|
314
|
+
async composer() {
|
|
315
|
+
await promiseChain;
|
|
316
|
+
return composer;
|
|
317
|
+
},
|
|
318
|
+
async simulate(options) {
|
|
319
|
+
await promiseChain;
|
|
320
|
+
const result = await (!options ? composer.simulate() : composer.simulate(options));
|
|
321
|
+
return {
|
|
322
|
+
...result,
|
|
323
|
+
returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i](val) : val.returnValue)
|
|
324
|
+
};
|
|
325
|
+
},
|
|
326
|
+
async send(params) {
|
|
327
|
+
await promiseChain;
|
|
328
|
+
const result = await composer.send(params);
|
|
329
|
+
return {
|
|
330
|
+
...result,
|
|
331
|
+
returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i](val) : val.returnValue)
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
exports.AlgorackMarketClient = AlgorackMarketClient;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as AlgorackMarket_332d497a from './AlgorackMarket_332d497a';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AlgorackMarket_332d497a = void 0;
|
|
37
|
+
exports.AlgorackMarket_332d497a = __importStar(require("./AlgorackMarket_332d497a"));
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "arc56-generated-srikanivas-algorack",
|
|
3
|
+
"version": "1.4.2026072011",
|
|
4
|
+
"description": "Generated ARC-56 Algorand smart-contract clients for Srikanivas/Algorack.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc -p tsconfig.json"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"algorand",
|
|
16
|
+
"arc56",
|
|
17
|
+
"avm",
|
|
18
|
+
"smart-contract",
|
|
19
|
+
"generated-client",
|
|
20
|
+
"Srikanivas",
|
|
21
|
+
"Algorack"
|
|
22
|
+
],
|
|
23
|
+
"author": "Srikanivas",
|
|
24
|
+
"homepage": "https://github.com/scholtz/Arc56Registry",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/scholtz/Arc56Registry.git"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@algorandfoundation/algokit-utils": "^9.2.0",
|
|
31
|
+
"algosdk": "^3.6.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"typescript": "^6.0.3",
|
|
35
|
+
"@types/node": "^26.1.1"
|
|
36
|
+
}
|
|
37
|
+
}
|