@huma-finance/soroban-sep41 0.0.17-beta.65 → 0.0.17
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 +7 -7
- package/dist/cjs/index.d.ts +298 -112
- package/dist/cjs/index.js +43 -44
- package/dist/index.d.ts +298 -112
- package/dist/index.js +43 -44
- package/package.json +4 -4
- package/src/index.ts +350 -139
- package/tsconfig.json +93 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/scripts/build.mjs +0 -37
- package/scripts/tsconfig.cjs.json +0 -7
- package/scripts/tsconfig.esm.json +0 -7
- package/scripts/tsconfig.types.json +0 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# underlyingToken JS
|
|
1
|
+
# tb-underlyingToken JS
|
|
2
2
|
|
|
3
|
-
JS library for interacting with [Soroban](https://soroban.stellar.org/) smart contract `underlyingToken` via Soroban RPC.
|
|
3
|
+
JS library for interacting with [Soroban](https://soroban.stellar.org/) smart contract `tb-underlyingToken` via Soroban RPC.
|
|
4
4
|
|
|
5
5
|
This library was automatically generated by Soroban CLI using a command similar to:
|
|
6
6
|
|
|
@@ -8,8 +8,8 @@ This library was automatically generated by Soroban CLI using a command similar
|
|
|
8
8
|
soroban contract bindings ts \
|
|
9
9
|
--rpc-url https://soroban-testnet.stellar.org \
|
|
10
10
|
--network-passphrase "Test SDF Network ; September 2015" \
|
|
11
|
-
--contract-id
|
|
12
|
-
--output-dir ./path/to/underlyingToken
|
|
11
|
+
--contract-id CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA \
|
|
12
|
+
--output-dir ./path/to/tb-underlyingToken
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
The network passphrase and contract ID are exported from [index.ts](./src/index.ts) in the `networks` constant. If you are the one who generated this library and you know that this contract is also deployed to other networks, feel free to update `networks` with other valid options. This will help your contract consumers use this library more easily.
|
|
@@ -22,7 +22,7 @@ But you don't need to publish this library to NPM to use it. You can add it to y
|
|
|
22
22
|
|
|
23
23
|
```json
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"underlyingToken": "./path/to/this/folder"
|
|
25
|
+
"tb-underlyingToken": "./path/to/this/folder"
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ However, we've actually encountered [frustration](https://github.com/stellar/sor
|
|
|
30
30
|
|
|
31
31
|
```json
|
|
32
32
|
"scripts": {
|
|
33
|
-
"postinstall": "soroban contract bindings ts --rpc-url https://soroban-testnet.stellar.org --network-passphrase \"Test SDF Network ; September 2015\" --id
|
|
33
|
+
"postinstall": "soroban contract bindings ts --rpc-url https://soroban-testnet.stellar.org --network-passphrase \"Test SDF Network ; September 2015\" --id CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA --name tb-underlyingToken"
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
@@ -41,7 +41,7 @@ Obviously you need to adjust the above command based on the actual command you u
|
|
|
41
41
|
Now that you have your library up-to-date and added to your project, you can import it in a file and see inline documentation for all of its exported methods:
|
|
42
42
|
|
|
43
43
|
```js
|
|
44
|
-
import { Contract, networks } from "underlyingToken"
|
|
44
|
+
import { Contract, networks } from "tb-underlyingToken"
|
|
45
45
|
|
|
46
46
|
const contract = new Contract({
|
|
47
47
|
...networks.futurenet, // for example; check which networks this library exports
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -6,73 +6,27 @@ export * as rpc from "@stellar/stellar-sdk/rpc";
|
|
|
6
6
|
export declare const networks: {
|
|
7
7
|
readonly testnet: {
|
|
8
8
|
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
9
|
-
readonly contractId: "
|
|
9
|
+
readonly contractId: "CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA";
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
* The error codes for the contract.
|
|
14
|
-
*/
|
|
15
|
-
export declare const Errors: {
|
|
16
|
-
1: {
|
|
17
|
-
message: string;
|
|
18
|
-
};
|
|
19
|
-
2: {
|
|
20
|
-
message: string;
|
|
21
|
-
};
|
|
22
|
-
3: {
|
|
23
|
-
message: string;
|
|
24
|
-
};
|
|
25
|
-
4: {
|
|
26
|
-
message: string;
|
|
27
|
-
};
|
|
28
|
-
8: {
|
|
29
|
-
message: string;
|
|
30
|
-
};
|
|
31
|
-
9: {
|
|
32
|
-
message: string;
|
|
33
|
-
};
|
|
34
|
-
10: {
|
|
35
|
-
message: string;
|
|
36
|
-
};
|
|
37
|
-
12: {
|
|
38
|
-
message: string;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
export interface TokenMetadata {
|
|
42
|
-
decimal: u32;
|
|
43
|
-
name: string;
|
|
44
|
-
symbol: string;
|
|
45
|
-
}
|
|
46
|
-
export interface AllowanceDataKey {
|
|
47
|
-
from: string;
|
|
48
|
-
spender: string;
|
|
49
|
-
}
|
|
50
|
-
export interface AllowanceValue {
|
|
51
|
-
amount: i128;
|
|
52
|
-
expiration_ledger: u32;
|
|
53
|
-
}
|
|
54
|
-
export type DataKey = {
|
|
55
|
-
tag: "Allowance";
|
|
56
|
-
values: readonly [AllowanceDataKey];
|
|
57
|
-
} | {
|
|
58
|
-
tag: "Balance";
|
|
59
|
-
values: readonly [string];
|
|
60
|
-
} | {
|
|
61
|
-
tag: "Nonce";
|
|
62
|
-
values: readonly [string];
|
|
63
|
-
} | {
|
|
64
|
-
tag: "State";
|
|
65
|
-
values: readonly [string];
|
|
66
|
-
};
|
|
12
|
+
export declare const Errors: {};
|
|
67
13
|
export interface Client {
|
|
68
14
|
/**
|
|
69
|
-
* Construct and simulate a
|
|
15
|
+
* Construct and simulate a allowance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
16
|
+
* Returns the allowance for `spender` to transfer from `from`.
|
|
17
|
+
*
|
|
18
|
+
* The amount returned is the amount that spender is allowed to transfer
|
|
19
|
+
* out of from's balance. When the spender transfers amounts, the allowance
|
|
20
|
+
* will be reduced by the amount transferred.
|
|
21
|
+
*
|
|
22
|
+
* # Arguments
|
|
23
|
+
*
|
|
24
|
+
* * `from` - The address holding the balance of tokens to be drawn from.
|
|
25
|
+
* * `spender` - The address spending the tokens held by `from`.
|
|
70
26
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
name: string;
|
|
75
|
-
symbol: string;
|
|
27
|
+
allowance: ({ from, spender }: {
|
|
28
|
+
from: string;
|
|
29
|
+
spender: string;
|
|
76
30
|
}, options?: {
|
|
77
31
|
/**
|
|
78
32
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -86,13 +40,17 @@ export interface Client {
|
|
|
86
40
|
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
87
41
|
*/
|
|
88
42
|
simulate?: boolean;
|
|
89
|
-
}) => Promise<AssembledTransaction<
|
|
43
|
+
}) => Promise<AssembledTransaction<i128>>;
|
|
90
44
|
/**
|
|
91
|
-
* Construct and simulate a
|
|
45
|
+
* Construct and simulate a authorized transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
46
|
+
* Returns true if `id` is authorized to use its balance.
|
|
47
|
+
*
|
|
48
|
+
* # Arguments
|
|
49
|
+
*
|
|
50
|
+
* * `id` - The address for which token authorization is being checked.
|
|
92
51
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
amount: i128;
|
|
52
|
+
authorized: ({ id }: {
|
|
53
|
+
id: string;
|
|
96
54
|
}, options?: {
|
|
97
55
|
/**
|
|
98
56
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -106,12 +64,38 @@ export interface Client {
|
|
|
106
64
|
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
107
65
|
*/
|
|
108
66
|
simulate?: boolean;
|
|
109
|
-
}) => Promise<AssembledTransaction<
|
|
67
|
+
}) => Promise<AssembledTransaction<boolean>>;
|
|
110
68
|
/**
|
|
111
|
-
* Construct and simulate a
|
|
69
|
+
* Construct and simulate a approve transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
70
|
+
* Set the allowance by `amount` for `spender` to transfer/burn from
|
|
71
|
+
* `from`.
|
|
72
|
+
*
|
|
73
|
+
* The amount set is the amount that spender is approved to transfer out of
|
|
74
|
+
* from's balance. The spender will be allowed to transfer amounts, and
|
|
75
|
+
* when an amount is transferred the allowance will be reduced by the
|
|
76
|
+
* amount transferred.
|
|
77
|
+
*
|
|
78
|
+
* # Arguments
|
|
79
|
+
*
|
|
80
|
+
* * `from` - The address holding the balance of tokens to be drawn from.
|
|
81
|
+
* * `spender` - The address being authorized to spend the tokens held by
|
|
82
|
+
* `from`.
|
|
83
|
+
* * `amount` - The tokens to be made available to `spender`.
|
|
84
|
+
* * `expiration_ledger` - The ledger number where this allowance expires. Cannot
|
|
85
|
+
* be less than the current ledger number unless the amount is being set to 0.
|
|
86
|
+
* An expired entry (where expiration_ledger < the current ledger number)
|
|
87
|
+
* should be treated as a 0 amount allowance.
|
|
88
|
+
*
|
|
89
|
+
* # Events
|
|
90
|
+
*
|
|
91
|
+
* Emits an event with topics `["approve", from: Address,
|
|
92
|
+
* spender: Address], data = [amount: i128, expiration_ledger: u32]`
|
|
112
93
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
94
|
+
approve: ({ from, spender, amount, expiration_ledger, }: {
|
|
95
|
+
from: string;
|
|
96
|
+
spender: string;
|
|
97
|
+
amount: i128;
|
|
98
|
+
expiration_ledger: u32;
|
|
115
99
|
}, options?: {
|
|
116
100
|
/**
|
|
117
101
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -127,11 +111,16 @@ export interface Client {
|
|
|
127
111
|
simulate?: boolean;
|
|
128
112
|
}) => Promise<AssembledTransaction<null>>;
|
|
129
113
|
/**
|
|
130
|
-
* Construct and simulate a
|
|
114
|
+
* Construct and simulate a balance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
115
|
+
* Returns the balance of `id`.
|
|
116
|
+
*
|
|
117
|
+
* # Arguments
|
|
118
|
+
*
|
|
119
|
+
* * `id` - The address for which a balance is being queried. If the
|
|
120
|
+
* address has no existing balance, returns 0.
|
|
131
121
|
*/
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
spender: string;
|
|
122
|
+
balance: ({ id }: {
|
|
123
|
+
id: string;
|
|
135
124
|
}, options?: {
|
|
136
125
|
/**
|
|
137
126
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -147,13 +136,26 @@ export interface Client {
|
|
|
147
136
|
simulate?: boolean;
|
|
148
137
|
}) => Promise<AssembledTransaction<i128>>;
|
|
149
138
|
/**
|
|
150
|
-
* Construct and simulate a
|
|
139
|
+
* Construct and simulate a burn transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
140
|
+
* Burn `amount` from `from`.
|
|
141
|
+
*
|
|
142
|
+
* Reduces from's balance by the amount, without transferring the balance
|
|
143
|
+
* to another holder's balance.
|
|
144
|
+
*
|
|
145
|
+
* # Arguments
|
|
146
|
+
*
|
|
147
|
+
* * `from` - The address holding the balance of tokens which will be
|
|
148
|
+
* burned from.
|
|
149
|
+
* * `amount` - The amount of tokens to be burned.
|
|
150
|
+
*
|
|
151
|
+
* # Events
|
|
152
|
+
*
|
|
153
|
+
* Emits an event with topics `["burn", from: Address], data = amount:
|
|
154
|
+
* i128`
|
|
151
155
|
*/
|
|
152
|
-
|
|
156
|
+
burn: ({ from, amount }: {
|
|
153
157
|
from: string;
|
|
154
|
-
spender: string;
|
|
155
158
|
amount: i128;
|
|
156
|
-
expiration_ledger: u32;
|
|
157
159
|
}, options?: {
|
|
158
160
|
/**
|
|
159
161
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -169,10 +171,34 @@ export interface Client {
|
|
|
169
171
|
simulate?: boolean;
|
|
170
172
|
}) => Promise<AssembledTransaction<null>>;
|
|
171
173
|
/**
|
|
172
|
-
* Construct and simulate a
|
|
174
|
+
* Construct and simulate a burn_from transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
175
|
+
* Burn `amount` from `from`, consuming the allowance of `spender`.
|
|
176
|
+
*
|
|
177
|
+
* Reduces from's balance by the amount, without transferring the balance
|
|
178
|
+
* to another holder's balance.
|
|
179
|
+
*
|
|
180
|
+
* The spender will be allowed to burn the amount from from's balance, if
|
|
181
|
+
* the amount is less than or equal to the allowance that the spender has
|
|
182
|
+
* on the from's balance. The spender's allowance on from's balance will be
|
|
183
|
+
* reduced by the amount.
|
|
184
|
+
*
|
|
185
|
+
* # Arguments
|
|
186
|
+
*
|
|
187
|
+
* * `spender` - The address authorizing the burn, and having its allowance
|
|
188
|
+
* consumed during the burn.
|
|
189
|
+
* * `from` - The address holding the balance of tokens which will be
|
|
190
|
+
* burned from.
|
|
191
|
+
* * `amount` - The amount of tokens to be burned.
|
|
192
|
+
*
|
|
193
|
+
* # Events
|
|
194
|
+
*
|
|
195
|
+
* Emits an event with topics `["burn", from: Address], data = amount:
|
|
196
|
+
* i128`
|
|
173
197
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
198
|
+
burn_from: ({ spender, from, amount }: {
|
|
199
|
+
spender: string;
|
|
200
|
+
from: string;
|
|
201
|
+
amount: i128;
|
|
176
202
|
}, options?: {
|
|
177
203
|
/**
|
|
178
204
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -186,13 +212,25 @@ export interface Client {
|
|
|
186
212
|
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
187
213
|
*/
|
|
188
214
|
simulate?: boolean;
|
|
189
|
-
}) => Promise<AssembledTransaction<
|
|
215
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
190
216
|
/**
|
|
191
|
-
* Construct and simulate a
|
|
217
|
+
* Construct and simulate a clawback transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
218
|
+
* Clawback `amount` from `from` account. `amount` is burned in the
|
|
219
|
+
* clawback process.
|
|
220
|
+
*
|
|
221
|
+
* # Arguments
|
|
222
|
+
*
|
|
223
|
+
* * `from` - The address holding the balance from which the clawback will
|
|
224
|
+
* take tokens.
|
|
225
|
+
* * `amount` - The amount of tokens to be clawed back.
|
|
226
|
+
*
|
|
227
|
+
* # Events
|
|
228
|
+
*
|
|
229
|
+
* Emits an event with topics `["clawback", admin: Address, to: Address],
|
|
230
|
+
* data = amount: i128`
|
|
192
231
|
*/
|
|
193
|
-
|
|
232
|
+
clawback: ({ from, amount }: {
|
|
194
233
|
from: string;
|
|
195
|
-
to: string;
|
|
196
234
|
amount: i128;
|
|
197
235
|
}, options?: {
|
|
198
236
|
/**
|
|
@@ -209,11 +247,42 @@ export interface Client {
|
|
|
209
247
|
simulate?: boolean;
|
|
210
248
|
}) => Promise<AssembledTransaction<null>>;
|
|
211
249
|
/**
|
|
212
|
-
* Construct and simulate a
|
|
250
|
+
* Construct and simulate a decimals transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
251
|
+
* Returns the number of decimals used to represent amounts of this token.
|
|
252
|
+
*
|
|
253
|
+
* # Panics
|
|
254
|
+
*
|
|
255
|
+
* If the contract has not yet been initialized.
|
|
213
256
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
257
|
+
decimals: (options?: {
|
|
258
|
+
/**
|
|
259
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
260
|
+
*/
|
|
261
|
+
fee?: number;
|
|
262
|
+
/**
|
|
263
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
264
|
+
*/
|
|
265
|
+
timeoutInSeconds?: number;
|
|
266
|
+
/**
|
|
267
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
268
|
+
*/
|
|
269
|
+
simulate?: boolean;
|
|
270
|
+
}) => Promise<AssembledTransaction<u32>>;
|
|
271
|
+
/**
|
|
272
|
+
* Construct and simulate a mint transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
273
|
+
* Mints `amount` to `to`.
|
|
274
|
+
*
|
|
275
|
+
* # Arguments
|
|
276
|
+
*
|
|
277
|
+
* * `to` - The address which will receive the minted tokens.
|
|
278
|
+
* * `amount` - The amount of tokens to be minted.
|
|
279
|
+
*
|
|
280
|
+
* # Events
|
|
281
|
+
*
|
|
282
|
+
* Emits an event with topics `["mint", admin: Address, to: Address], data
|
|
283
|
+
* = amount: i128`
|
|
284
|
+
*/
|
|
285
|
+
mint: ({ to, amount }: {
|
|
217
286
|
to: string;
|
|
218
287
|
amount: i128;
|
|
219
288
|
}, options?: {
|
|
@@ -231,12 +300,14 @@ export interface Client {
|
|
|
231
300
|
simulate?: boolean;
|
|
232
301
|
}) => Promise<AssembledTransaction<null>>;
|
|
233
302
|
/**
|
|
234
|
-
* Construct and simulate a
|
|
303
|
+
* Construct and simulate a name transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
304
|
+
* Returns the name for this token.
|
|
305
|
+
*
|
|
306
|
+
* # Panics
|
|
307
|
+
*
|
|
308
|
+
* If the contract has not yet been initialized.
|
|
235
309
|
*/
|
|
236
|
-
|
|
237
|
-
from: string;
|
|
238
|
-
amount: i128;
|
|
239
|
-
}, options?: {
|
|
310
|
+
name: (options?: {
|
|
240
311
|
/**
|
|
241
312
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
242
313
|
*/
|
|
@@ -249,14 +320,23 @@ export interface Client {
|
|
|
249
320
|
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
250
321
|
*/
|
|
251
322
|
simulate?: boolean;
|
|
252
|
-
}) => Promise<AssembledTransaction<
|
|
323
|
+
}) => Promise<AssembledTransaction<string>>;
|
|
253
324
|
/**
|
|
254
|
-
* Construct and simulate a
|
|
325
|
+
* Construct and simulate a set_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
326
|
+
* Sets the administrator to the specified address `new_admin`.
|
|
327
|
+
*
|
|
328
|
+
* # Arguments
|
|
329
|
+
*
|
|
330
|
+
* * `new_admin` - The address which will henceforth be the administrator
|
|
331
|
+
* of this token contract.
|
|
332
|
+
*
|
|
333
|
+
* # Events
|
|
334
|
+
*
|
|
335
|
+
* Emits an event with topics `["set_admin", admin: Address], data =
|
|
336
|
+
* [new_admin: Address]`
|
|
255
337
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
from: string;
|
|
259
|
-
amount: i128;
|
|
338
|
+
set_admin: ({ new_admin }: {
|
|
339
|
+
new_admin: string;
|
|
260
340
|
}, options?: {
|
|
261
341
|
/**
|
|
262
342
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -272,9 +352,14 @@ export interface Client {
|
|
|
272
352
|
simulate?: boolean;
|
|
273
353
|
}) => Promise<AssembledTransaction<null>>;
|
|
274
354
|
/**
|
|
275
|
-
* Construct and simulate a
|
|
355
|
+
* Construct and simulate a admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
356
|
+
* Returns the admin of the contract.
|
|
357
|
+
*
|
|
358
|
+
* # Panics
|
|
359
|
+
*
|
|
360
|
+
* If the admin is not set.
|
|
276
361
|
*/
|
|
277
|
-
|
|
362
|
+
admin: (options?: {
|
|
278
363
|
/**
|
|
279
364
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
280
365
|
*/
|
|
@@ -287,11 +372,26 @@ export interface Client {
|
|
|
287
372
|
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
288
373
|
*/
|
|
289
374
|
simulate?: boolean;
|
|
290
|
-
}) => Promise<AssembledTransaction<
|
|
375
|
+
}) => Promise<AssembledTransaction<string>>;
|
|
291
376
|
/**
|
|
292
|
-
* Construct and simulate a
|
|
377
|
+
* Construct and simulate a set_authorized transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
378
|
+
* Sets whether the account is authorized to use its balance. If
|
|
379
|
+
* `authorized` is true, `id` should be able to use its balance.
|
|
380
|
+
*
|
|
381
|
+
* # Arguments
|
|
382
|
+
*
|
|
383
|
+
* * `id` - The address being (de-)authorized.
|
|
384
|
+
* * `authorize` - Whether or not `id` can use its balance.
|
|
385
|
+
*
|
|
386
|
+
* # Events
|
|
387
|
+
*
|
|
388
|
+
* Emits an event with topics `["set_authorized", id: Address], data =
|
|
389
|
+
* [authorize: bool]`
|
|
293
390
|
*/
|
|
294
|
-
|
|
391
|
+
set_authorized: ({ id, authorize }: {
|
|
392
|
+
id: string;
|
|
393
|
+
authorize: boolean;
|
|
394
|
+
}, options?: {
|
|
295
395
|
/**
|
|
296
396
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
297
397
|
*/
|
|
@@ -304,9 +404,14 @@ export interface Client {
|
|
|
304
404
|
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
305
405
|
*/
|
|
306
406
|
simulate?: boolean;
|
|
307
|
-
}) => Promise<AssembledTransaction<
|
|
407
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
308
408
|
/**
|
|
309
409
|
* Construct and simulate a symbol transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
410
|
+
* Returns the symbol for this token.
|
|
411
|
+
*
|
|
412
|
+
* # Panics
|
|
413
|
+
*
|
|
414
|
+
* If the contract has not yet been initialized.
|
|
310
415
|
*/
|
|
311
416
|
symbol: (options?: {
|
|
312
417
|
/**
|
|
@@ -322,23 +427,104 @@ export interface Client {
|
|
|
322
427
|
*/
|
|
323
428
|
simulate?: boolean;
|
|
324
429
|
}) => Promise<AssembledTransaction<string>>;
|
|
430
|
+
/**
|
|
431
|
+
* Construct and simulate a transfer transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
432
|
+
* Transfer `amount` from `from` to `to`.
|
|
433
|
+
*
|
|
434
|
+
* # Arguments
|
|
435
|
+
*
|
|
436
|
+
* * `from` - The address holding the balance of tokens which will be
|
|
437
|
+
* withdrawn from.
|
|
438
|
+
* * `to` - The address which will receive the transferred tokens.
|
|
439
|
+
* * `amount` - The amount of tokens to be transferred.
|
|
440
|
+
*
|
|
441
|
+
* # Events
|
|
442
|
+
*
|
|
443
|
+
* Emits an event with topics `["transfer", from: Address, to: Address],
|
|
444
|
+
* data = amount: i128`
|
|
445
|
+
*/
|
|
446
|
+
transfer: ({ from, to, amount }: {
|
|
447
|
+
from: string;
|
|
448
|
+
to: string;
|
|
449
|
+
amount: i128;
|
|
450
|
+
}, options?: {
|
|
451
|
+
/**
|
|
452
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
453
|
+
*/
|
|
454
|
+
fee?: number;
|
|
455
|
+
/**
|
|
456
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
457
|
+
*/
|
|
458
|
+
timeoutInSeconds?: number;
|
|
459
|
+
/**
|
|
460
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
461
|
+
*/
|
|
462
|
+
simulate?: boolean;
|
|
463
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
464
|
+
/**
|
|
465
|
+
* Construct and simulate a transfer_from transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
466
|
+
* Transfer `amount` from `from` to `to`, consuming the allowance that
|
|
467
|
+
* `spender` has on `from`'s balance. Authorized by spender
|
|
468
|
+
* (`spender.require_auth()`).
|
|
469
|
+
*
|
|
470
|
+
* The spender will be allowed to transfer the amount from from's balance
|
|
471
|
+
* if the amount is less than or equal to the allowance that the spender
|
|
472
|
+
* has on the from's balance. The spender's allowance on from's balance
|
|
473
|
+
* will be reduced by the amount.
|
|
474
|
+
*
|
|
475
|
+
* # Arguments
|
|
476
|
+
*
|
|
477
|
+
* * `spender` - The address authorizing the transfer, and having its
|
|
478
|
+
* allowance consumed during the transfer.
|
|
479
|
+
* * `from` - The address holding the balance of tokens which will be
|
|
480
|
+
* withdrawn from.
|
|
481
|
+
* * `to` - The address which will receive the transferred tokens.
|
|
482
|
+
* * `amount` - The amount of tokens to be transferred.
|
|
483
|
+
*
|
|
484
|
+
* # Events
|
|
485
|
+
*
|
|
486
|
+
* Emits an event with topics `["transfer", from: Address, to: Address],
|
|
487
|
+
* data = amount: i128`
|
|
488
|
+
*/
|
|
489
|
+
transfer_from: ({ spender, from, to, amount, }: {
|
|
490
|
+
spender: string;
|
|
491
|
+
from: string;
|
|
492
|
+
to: string;
|
|
493
|
+
amount: i128;
|
|
494
|
+
}, options?: {
|
|
495
|
+
/**
|
|
496
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
497
|
+
*/
|
|
498
|
+
fee?: number;
|
|
499
|
+
/**
|
|
500
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
501
|
+
*/
|
|
502
|
+
timeoutInSeconds?: number;
|
|
503
|
+
/**
|
|
504
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
505
|
+
*/
|
|
506
|
+
simulate?: boolean;
|
|
507
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
325
508
|
}
|
|
326
509
|
export declare class Client extends ContractClient {
|
|
327
510
|
readonly options: ContractClientOptions;
|
|
328
511
|
constructor(options: ContractClientOptions);
|
|
329
512
|
readonly fromJSON: {
|
|
330
|
-
initialize: (json: string) => AssembledTransaction<null>;
|
|
331
|
-
mint: (json: string) => AssembledTransaction<null>;
|
|
332
|
-
set_admin: (json: string) => AssembledTransaction<null>;
|
|
333
513
|
allowance: (json: string) => AssembledTransaction<bigint>;
|
|
514
|
+
authorized: (json: string) => AssembledTransaction<boolean>;
|
|
334
515
|
approve: (json: string) => AssembledTransaction<null>;
|
|
335
516
|
balance: (json: string) => AssembledTransaction<bigint>;
|
|
336
|
-
transfer: (json: string) => AssembledTransaction<null>;
|
|
337
|
-
transfer_from: (json: string) => AssembledTransaction<null>;
|
|
338
517
|
burn: (json: string) => AssembledTransaction<null>;
|
|
339
518
|
burn_from: (json: string) => AssembledTransaction<null>;
|
|
519
|
+
clawback: (json: string) => AssembledTransaction<null>;
|
|
340
520
|
decimals: (json: string) => AssembledTransaction<number>;
|
|
521
|
+
mint: (json: string) => AssembledTransaction<null>;
|
|
341
522
|
name: (json: string) => AssembledTransaction<string>;
|
|
523
|
+
set_admin: (json: string) => AssembledTransaction<null>;
|
|
524
|
+
admin: (json: string) => AssembledTransaction<string>;
|
|
525
|
+
set_authorized: (json: string) => AssembledTransaction<null>;
|
|
342
526
|
symbol: (json: string) => AssembledTransaction<string>;
|
|
527
|
+
transfer: (json: string) => AssembledTransaction<null>;
|
|
528
|
+
transfer_from: (json: string) => AssembledTransaction<null>;
|
|
343
529
|
};
|
|
344
530
|
}
|