passkey-kit 0.5.0 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passkey-kit",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "A helper library for creating and using passkey accounts on the Stellar blockchain.",
5
5
  "author": "Tyler van der Hoeven",
6
6
  "license": "MIT",
@@ -12,8 +12,9 @@
12
12
  "@stellar/stellar-sdk": "12.1.0",
13
13
  "base64url": "^3.0.1",
14
14
  "buffer": "^6.0.3",
15
- "passkey-factory-sdk": "0.2.1",
16
- "passkey-kit-sdk": "0.2.1"
15
+ "sac-sdk": "0.1.0",
16
+ "passkey-kit-sdk": "0.2.1",
17
+ "passkey-factory-sdk": "0.2.1"
17
18
  },
18
19
  "devDependencies": {
19
20
  "@simplewebauthn/types": "^10.0.0",
@@ -45,8 +46,9 @@
45
46
  "homepage": "https://github.com/kalepail/passkey-kit/blob/main/README.md",
46
47
  "scripts": {
47
48
  "build:demo": "cd demo && pnpm --ignore-workspace install && pnpm run build",
49
+ "build:sac": "pnpm --filter ./packages/sac-sdk run build",
48
50
  "build:pfs": "pnpm --filter ./packages/passkey-factory-sdk run build",
49
51
  "build:pks": "pnpm --filter ./packages/passkey-kit-sdk run build",
50
- "build": "pnpm run build:pfs && pnpm run build:pks && tsc"
52
+ "build": "pnpm run build:sac && pnpm run build:pfs && pnpm run build:pks && tsc"
51
53
  }
52
54
  }
@@ -0,0 +1,54 @@
1
+ # sac-sdk JS
2
+
3
+ JS library for interacting with [Soroban](https://soroban.stellar.org/) smart contract `sac-sdk` via Soroban RPC.
4
+
5
+ This library was automatically generated by Soroban CLI using a command similar to:
6
+
7
+ ```bash
8
+ soroban contract bindings ts \
9
+ --rpc-url https://soroban-testnet.stellar.org \
10
+ --network-passphrase "Test SDF Network ; September 2015" \
11
+ --contract-id CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC \
12
+ --output-dir ./path/to/sac-sdk
13
+ ```
14
+
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.
16
+
17
+ # To publish or not to publish
18
+
19
+ This library is suitable for publishing to NPM. You can publish it to NPM using the `npm publish` command.
20
+
21
+ But you don't need to publish this library to NPM to use it. You can add it to your project's `package.json` using a file path:
22
+
23
+ ```json
24
+ "dependencies": {
25
+ "sac-sdk": "./path/to/this/folder"
26
+ }
27
+ ```
28
+
29
+ However, we've actually encountered [frustration](https://github.com/stellar/soroban-example-dapp/pull/117#discussion_r1232873560) using local libraries with NPM in this way. Though it seems a bit messy, we suggest generating the library directly to your `node_modules` folder automatically after each install by using a `postinstall` script. We've had the least trouble with this approach. NPM will automatically remove what it sees as erroneous directories during the `install` step, and then regenerate them when it gets to your `postinstall` step, which will keep the library up-to-date with your contract.
30
+
31
+ ```json
32
+ "scripts": {
33
+ "postinstall": "soroban contract bindings ts --rpc-url https://soroban-testnet.stellar.org --network-passphrase \"Test SDF Network ; September 2015\" --id CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC --name sac-sdk"
34
+ }
35
+ ```
36
+
37
+ Obviously you need to adjust the above command based on the actual command you used to generate the library.
38
+
39
+ # Use it
40
+
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
+
43
+ ```js
44
+ import { Contract, networks } from "sac-sdk"
45
+
46
+ const contract = new Contract({
47
+ ...networks.futurenet, // for example; check which networks this library exports
48
+ rpcUrl: '...', // use your own, or find one for testing at https://soroban.stellar.org/docs/reference/rpc#public-rpc-providers
49
+ })
50
+
51
+ contract.|
52
+ ```
53
+
54
+ As long as your editor is configured to show JavaScript/TypeScript documentation, you can pause your typing at that `|` to get a list of all exports and inline-documentation for each. It exports a separate [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function for each method in the smart contract, with documentation for each generated from the comments the contract's author included in the original source code.
@@ -0,0 +1,18 @@
1
+ {
2
+ "version": "0.1.0",
3
+ "name": "sac-sdk",
4
+ "type": "module",
5
+ "main": "src/index.ts",
6
+ "types": "types/index.d.ts",
7
+ "scripts": {
8
+ "prepublishOnly": "pnpm run build",
9
+ "build": "tsc"
10
+ },
11
+ "dependencies": {
12
+ "buffer": "6.0.3",
13
+ "@stellar/stellar-sdk": "12.1.0"
14
+ },
15
+ "devDependencies": {
16
+ "typescript": "5.5.3"
17
+ }
18
+ }
@@ -0,0 +1,573 @@
1
+ import { Buffer } from "buffer";
2
+ import {
3
+ AssembledTransaction,
4
+ Client as ContractClient,
5
+ ClientOptions as ContractClientOptions,
6
+ Spec as ContractSpec,
7
+ } from '@stellar/stellar-sdk/contract';
8
+ import type {
9
+ u32,
10
+ i128,
11
+ } from '@stellar/stellar-sdk/contract';
12
+
13
+ if (typeof window !== 'undefined') {
14
+ //@ts-ignore Buffer exists
15
+ window.Buffer = window.Buffer || Buffer;
16
+ }
17
+
18
+ export const networks = {
19
+ testnet: {
20
+ networkPassphrase: "Test SDF Network ; September 2015",
21
+ contractId: "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC",
22
+ }
23
+ } as const
24
+
25
+ export const Errors = {
26
+
27
+ }
28
+
29
+ export interface Client {
30
+ /**
31
+ * 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.
32
+ * Returns the allowance for `spender` to transfer from `from`.
33
+ *
34
+ * The amount returned is the amount that spender is allowed to transfer
35
+ * out of from's balance. When the spender transfers amounts, the allowance
36
+ * will be reduced by the amount transfered.
37
+ *
38
+ * # Arguments
39
+ *
40
+ * * `from` - The address holding the balance of tokens to be drawn from.
41
+ * * `spender` - The address spending the tokens held by `from`.
42
+ */
43
+ allowance: ({ from, spender }: { from: string, spender: string }, options?: {
44
+ /**
45
+ * The fee to pay for the transaction. Default: BASE_FEE
46
+ */
47
+ fee?: number;
48
+
49
+ /**
50
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
51
+ */
52
+ timeoutInSeconds?: number;
53
+
54
+ /**
55
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
56
+ */
57
+ simulate?: boolean;
58
+ }) => Promise<AssembledTransaction<i128>>
59
+
60
+ /**
61
+ * 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.
62
+ * Returns true if `id` is authorized to use its balance.
63
+ *
64
+ * # Arguments
65
+ *
66
+ * * `id` - The address for which token authorization is being checked.
67
+ */
68
+ authorized: ({ id }: { id: string }, options?: {
69
+ /**
70
+ * The fee to pay for the transaction. Default: BASE_FEE
71
+ */
72
+ fee?: number;
73
+
74
+ /**
75
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
76
+ */
77
+ timeoutInSeconds?: number;
78
+
79
+ /**
80
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
81
+ */
82
+ simulate?: boolean;
83
+ }) => Promise<AssembledTransaction<boolean>>
84
+
85
+ /**
86
+ * 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.
87
+ * Set the allowance by `amount` for `spender` to transfer/burn from
88
+ * `from`.
89
+ *
90
+ * The amount set is the amount that spender is approved to transfer out of
91
+ * from's balance. The spender will be allowed to transfer amounts, and
92
+ * when an amount is transferred the allowance will be reduced by the
93
+ * amount transfered.
94
+ *
95
+ * # Arguments
96
+ *
97
+ * * `from` - The address holding the balance of tokens to be drawn from.
98
+ * * `spender` - The address being authorized to spend the tokens held by
99
+ * `from`.
100
+ * * `amount` - The tokens to be made available to `spender`.
101
+ * * `expiration_ledger` - The ledger number where this allowance expires. Cannot
102
+ * be less than the current ledger number unless the amount is being set to 0.
103
+ * An expired entry (where expiration_ledger < the current ledger number)
104
+ * should be treated as a 0 amount allowance.
105
+ *
106
+ * # Events
107
+ *
108
+ * Emits an event with topics `["approve", from: Address,
109
+ * spender: Address], data = [amount: i128, expiration_ledger: u32]`
110
+ */
111
+ approve: ({ from, spender, amount, expiration_ledger }: { from: string, spender: string, amount: i128, expiration_ledger: u32 }, options?: {
112
+ /**
113
+ * The fee to pay for the transaction. Default: BASE_FEE
114
+ */
115
+ fee?: number;
116
+
117
+ /**
118
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
119
+ */
120
+ timeoutInSeconds?: number;
121
+
122
+ /**
123
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
124
+ */
125
+ simulate?: boolean;
126
+ }) => Promise<AssembledTransaction<null>>
127
+
128
+ /**
129
+ * 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.
130
+ * Returns the balance of `id`.
131
+ *
132
+ * # Arguments
133
+ *
134
+ * * `id` - The address for which a balance is being queried. If the
135
+ * address has no existing balance, returns 0.
136
+ */
137
+ balance: ({ id }: { id: string }, options?: {
138
+ /**
139
+ * The fee to pay for the transaction. Default: BASE_FEE
140
+ */
141
+ fee?: number;
142
+
143
+ /**
144
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
145
+ */
146
+ timeoutInSeconds?: number;
147
+
148
+ /**
149
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
150
+ */
151
+ simulate?: boolean;
152
+ }) => Promise<AssembledTransaction<i128>>
153
+
154
+ /**
155
+ * 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.
156
+ * Burn `amount` from `from`.
157
+ *
158
+ * Reduces from's balance by the amount, without transferring the balance
159
+ * to another holder's balance.
160
+ *
161
+ * # Arguments
162
+ *
163
+ * * `from` - The address holding the balance of tokens which will be
164
+ * burned from.
165
+ * * `amount` - The amount of tokens to be burned.
166
+ *
167
+ * # Events
168
+ *
169
+ * Emits an event with topics `["burn", from: Address], data = [amount:
170
+ * i128]`
171
+ */
172
+ burn: ({ from, amount }: { from: string, amount: i128 }, options?: {
173
+ /**
174
+ * The fee to pay for the transaction. Default: BASE_FEE
175
+ */
176
+ fee?: number;
177
+
178
+ /**
179
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
180
+ */
181
+ timeoutInSeconds?: number;
182
+
183
+ /**
184
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
185
+ */
186
+ simulate?: boolean;
187
+ }) => Promise<AssembledTransaction<null>>
188
+
189
+ /**
190
+ * 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.
191
+ * Burn `amount` from `from`, consuming the allowance of `spender`.
192
+ *
193
+ * Reduces from's balance by the amount, without transferring the balance
194
+ * to another holder's balance.
195
+ *
196
+ * The spender will be allowed to burn the amount from from's balance, if
197
+ * the amount is less than or equal to the allowance that the spender has
198
+ * on the from's balance. The spender's allowance on from's balance will be
199
+ * reduced by the amount.
200
+ *
201
+ * # Arguments
202
+ *
203
+ * * `spender` - The address authorizing the burn, and having its allowance
204
+ * consumed during the burn.
205
+ * * `from` - The address holding the balance of tokens which will be
206
+ * burned from.
207
+ * * `amount` - The amount of tokens to be burned.
208
+ *
209
+ * # Events
210
+ *
211
+ * Emits an event with topics `["burn", from: Address], data = [amount:
212
+ * i128]`
213
+ */
214
+ burn_from: ({ spender, from, amount }: { spender: string, from: string, amount: i128 }, options?: {
215
+ /**
216
+ * The fee to pay for the transaction. Default: BASE_FEE
217
+ */
218
+ fee?: number;
219
+
220
+ /**
221
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
222
+ */
223
+ timeoutInSeconds?: number;
224
+
225
+ /**
226
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
227
+ */
228
+ simulate?: boolean;
229
+ }) => Promise<AssembledTransaction<null>>
230
+
231
+ /**
232
+ * 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.
233
+ * Clawback `amount` from `from` account. `amount` is burned in the
234
+ * clawback process.
235
+ *
236
+ * # Arguments
237
+ *
238
+ * * `from` - The address holding the balance from which the clawback will
239
+ * take tokens.
240
+ * * `amount` - The amount of tokens to be clawed back.
241
+ *
242
+ * # Events
243
+ *
244
+ * Emits an event with topics `["clawback", admin: Address, to: Address],
245
+ * data = [amount: i128]`
246
+ */
247
+ clawback: ({ from, amount }: { from: string, amount: i128 }, options?: {
248
+ /**
249
+ * The fee to pay for the transaction. Default: BASE_FEE
250
+ */
251
+ fee?: number;
252
+
253
+ /**
254
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
255
+ */
256
+ timeoutInSeconds?: number;
257
+
258
+ /**
259
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
260
+ */
261
+ simulate?: boolean;
262
+ }) => Promise<AssembledTransaction<null>>
263
+
264
+ /**
265
+ * 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.
266
+ * Returns the number of decimals used to represent amounts of this token.
267
+ *
268
+ * # Panics
269
+ *
270
+ * If the contract has not yet been initialized.
271
+ */
272
+ decimals: (options?: {
273
+ /**
274
+ * The fee to pay for the transaction. Default: BASE_FEE
275
+ */
276
+ fee?: number;
277
+
278
+ /**
279
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
280
+ */
281
+ timeoutInSeconds?: number;
282
+
283
+ /**
284
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
285
+ */
286
+ simulate?: boolean;
287
+ }) => Promise<AssembledTransaction<u32>>
288
+
289
+ /**
290
+ * 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.
291
+ * Mints `amount` to `to`.
292
+ *
293
+ * # Arguments
294
+ *
295
+ * * `to` - The address which will receive the minted tokens.
296
+ * * `amount` - The amount of tokens to be minted.
297
+ *
298
+ * # Events
299
+ *
300
+ * Emits an event with topics `["mint", admin: Address, to: Address], data
301
+ * = [amount: i128]`
302
+ */
303
+ mint: ({ to, amount }: { to: string, amount: i128 }, options?: {
304
+ /**
305
+ * The fee to pay for the transaction. Default: BASE_FEE
306
+ */
307
+ fee?: number;
308
+
309
+ /**
310
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
311
+ */
312
+ timeoutInSeconds?: number;
313
+
314
+ /**
315
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
316
+ */
317
+ simulate?: boolean;
318
+ }) => Promise<AssembledTransaction<null>>
319
+
320
+ /**
321
+ * 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.
322
+ * Returns the name for this token.
323
+ *
324
+ * # Panics
325
+ *
326
+ * If the contract has not yet been initialized.
327
+ */
328
+ name: (options?: {
329
+ /**
330
+ * The fee to pay for the transaction. Default: BASE_FEE
331
+ */
332
+ fee?: number;
333
+
334
+ /**
335
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
336
+ */
337
+ timeoutInSeconds?: number;
338
+
339
+ /**
340
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
341
+ */
342
+ simulate?: boolean;
343
+ }) => Promise<AssembledTransaction<string>>
344
+
345
+ /**
346
+ * 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.
347
+ * Sets the administrator to the specified address `new_admin`.
348
+ *
349
+ * # Arguments
350
+ *
351
+ * * `new_admin` - The address which will henceforth be the administrator
352
+ * of this token contract.
353
+ *
354
+ * # Events
355
+ *
356
+ * Emits an event with topics `["set_admin", admin: Address], data =
357
+ * [new_admin: Address]`
358
+ */
359
+ set_admin: ({ new_admin }: { new_admin: string }, options?: {
360
+ /**
361
+ * The fee to pay for the transaction. Default: BASE_FEE
362
+ */
363
+ fee?: number;
364
+
365
+ /**
366
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
367
+ */
368
+ timeoutInSeconds?: number;
369
+
370
+ /**
371
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
372
+ */
373
+ simulate?: boolean;
374
+ }) => Promise<AssembledTransaction<null>>
375
+
376
+ /**
377
+ * 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.
378
+ * Returns the admin of the contract.
379
+ *
380
+ * # Panics
381
+ *
382
+ * If the admin is not set.
383
+ */
384
+ admin: (options?: {
385
+ /**
386
+ * The fee to pay for the transaction. Default: BASE_FEE
387
+ */
388
+ fee?: number;
389
+
390
+ /**
391
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
392
+ */
393
+ timeoutInSeconds?: number;
394
+
395
+ /**
396
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
397
+ */
398
+ simulate?: boolean;
399
+ }) => Promise<AssembledTransaction<string>>
400
+
401
+ /**
402
+ * 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.
403
+ * Sets whether the account is authorized to use its balance. If
404
+ * `authorized` is true, `id` should be able to use its balance.
405
+ *
406
+ * # Arguments
407
+ *
408
+ * * `id` - The address being (de-)authorized.
409
+ * * `authorize` - Whether or not `id` can use its balance.
410
+ *
411
+ * # Events
412
+ *
413
+ * Emits an event with topics `["set_authorized", id: Address], data =
414
+ * [authorize: bool]`
415
+ */
416
+ set_authorized: ({ id, authorize }: { id: string, authorize: boolean }, options?: {
417
+ /**
418
+ * The fee to pay for the transaction. Default: BASE_FEE
419
+ */
420
+ fee?: number;
421
+
422
+ /**
423
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
424
+ */
425
+ timeoutInSeconds?: number;
426
+
427
+ /**
428
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
429
+ */
430
+ simulate?: boolean;
431
+ }) => Promise<AssembledTransaction<null>>
432
+
433
+ /**
434
+ * 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.
435
+ * Returns the symbol for this token.
436
+ *
437
+ * # Panics
438
+ *
439
+ * If the contract has not yet been initialized.
440
+ */
441
+ symbol: (options?: {
442
+ /**
443
+ * The fee to pay for the transaction. Default: BASE_FEE
444
+ */
445
+ fee?: number;
446
+
447
+ /**
448
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
449
+ */
450
+ timeoutInSeconds?: number;
451
+
452
+ /**
453
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
454
+ */
455
+ simulate?: boolean;
456
+ }) => Promise<AssembledTransaction<string>>
457
+
458
+ /**
459
+ * 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.
460
+ * Transfer `amount` from `from` to `to`.
461
+ *
462
+ * # Arguments
463
+ *
464
+ * * `from` - The address holding the balance of tokens which will be
465
+ * withdrawn from.
466
+ * * `to` - The address which will receive the transferred tokens.
467
+ * * `amount` - The amount of tokens to be transferred.
468
+ *
469
+ * # Events
470
+ *
471
+ * Emits an event with topics `["transfer", from: Address, to: Address],
472
+ * data = [amount: i128]`
473
+ */
474
+ transfer: ({ from, to, amount }: { from: string, to: string, amount: i128 }, options?: {
475
+ /**
476
+ * The fee to pay for the transaction. Default: BASE_FEE
477
+ */
478
+ fee?: number;
479
+
480
+ /**
481
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
482
+ */
483
+ timeoutInSeconds?: number;
484
+
485
+ /**
486
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
487
+ */
488
+ simulate?: boolean;
489
+ }) => Promise<AssembledTransaction<null>>
490
+
491
+ /**
492
+ * 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.
493
+ * Transfer `amount` from `from` to `to`, consuming the allowance that
494
+ * `spender` has on `from`'s balance. Authorized by spender
495
+ * (`spender.require_auth()`).
496
+ *
497
+ * The spender will be allowed to transfer the amount from from's balance
498
+ * if the amount is less than or equal to the allowance that the spender
499
+ * has on the from's balance. The spender's allowance on from's balance
500
+ * will be reduced by the amount.
501
+ *
502
+ * # Arguments
503
+ *
504
+ * * `spender` - The address authorizing the transfer, and having its
505
+ * allowance consumed during the transfer.
506
+ * * `from` - The address holding the balance of tokens which will be
507
+ * withdrawn from.
508
+ * * `to` - The address which will receive the transferred tokens.
509
+ * * `amount` - The amount of tokens to be transferred.
510
+ *
511
+ * # Events
512
+ *
513
+ * Emits an event with topics `["transfer", from: Address, to: Address],
514
+ * data = [amount: i128]`
515
+ */
516
+ transfer_from: ({ spender, from, to, amount }: { spender: string, from: string, to: string, amount: i128 }, options?: {
517
+ /**
518
+ * The fee to pay for the transaction. Default: BASE_FEE
519
+ */
520
+ fee?: number;
521
+
522
+ /**
523
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
524
+ */
525
+ timeoutInSeconds?: number;
526
+
527
+ /**
528
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
529
+ */
530
+ simulate?: boolean;
531
+ }) => Promise<AssembledTransaction<null>>
532
+ }
533
+ export class Client extends ContractClient {
534
+ constructor(public readonly options: ContractClientOptions) {
535
+ super(
536
+ new ContractSpec(["AAAAAAAAAYlSZXR1cm5zIHRoZSBhbGxvd2FuY2UgZm9yIGBzcGVuZGVyYCB0byB0cmFuc2ZlciBmcm9tIGBmcm9tYC4KClRoZSBhbW91bnQgcmV0dXJuZWQgaXMgdGhlIGFtb3VudCB0aGF0IHNwZW5kZXIgaXMgYWxsb3dlZCB0byB0cmFuc2ZlcgpvdXQgb2YgZnJvbSdzIGJhbGFuY2UuIFdoZW4gdGhlIHNwZW5kZXIgdHJhbnNmZXJzIGFtb3VudHMsIHRoZSBhbGxvd2FuY2UKd2lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQgdHJhbnNmZXJlZC4KCiMgQXJndW1lbnRzCgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHRvIGJlIGRyYXduIGZyb20uCiogYHNwZW5kZXJgIC0gVGhlIGFkZHJlc3Mgc3BlbmRpbmcgdGhlIHRva2VucyBoZWxkIGJ5IGBmcm9tYC4AAAAAAAAJYWxsb3dhbmNlAAAAAAAAAgAAAAAAAAAEZnJvbQAAABMAAAAAAAAAB3NwZW5kZXIAAAAAEwAAAAEAAAAL",
537
+ "AAAAAAAAAIlSZXR1cm5zIHRydWUgaWYgYGlkYCBpcyBhdXRob3JpemVkIHRvIHVzZSBpdHMgYmFsYW5jZS4KCiMgQXJndW1lbnRzCgoqIGBpZGAgLSBUaGUgYWRkcmVzcyBmb3Igd2hpY2ggdG9rZW4gYXV0aG9yaXphdGlvbiBpcyBiZWluZyBjaGVja2VkLgAAAAAAAAphdXRob3JpemVkAAAAAAABAAAAAAAAAAJ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CAtIFRoZSBhZGRyZXNzIHdoaWNoIHdpbGwgcmVjZWl2ZSB0aGUgdHJhbnNmZXJyZWQgdG9rZW5zLgoqIGBhbW91bnRgIC0gVGhlIGFtb3VudCBvZiB0b2tlbnMgdG8gYmUgdHJhbnNmZXJyZWQuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsidHJhbnNmZXIiLCBmcm9tOiBBZGRyZXNzLCB0bzogQWRkcmVzc10sCmRhdGEgPSBbYW1vdW50OiBpMTI4XWAAAAAADXRyYW5zZmVyX2Zyb20AAAAAAAAEAAAAAAAAAAdzcGVuZGVyAAAAABMAAAAAAAAABGZyb20AAAATAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA=="]),
552
+ options
553
+ )
554
+ }
555
+ public readonly fromJSON = {
556
+ allowance: this.txFromJSON<i128>,
557
+ authorized: this.txFromJSON<boolean>,
558
+ approve: this.txFromJSON<null>,
559
+ balance: this.txFromJSON<i128>,
560
+ burn: this.txFromJSON<null>,
561
+ burn_from: this.txFromJSON<null>,
562
+ clawback: this.txFromJSON<null>,
563
+ decimals: this.txFromJSON<u32>,
564
+ mint: this.txFromJSON<null>,
565
+ name: this.txFromJSON<string>,
566
+ set_admin: this.txFromJSON<null>,
567
+ admin: this.txFromJSON<string>,
568
+ set_authorized: this.txFromJSON<null>,
569
+ symbol: this.txFromJSON<string>,
570
+ transfer: this.txFromJSON<null>,
571
+ transfer_from: this.txFromJSON<null>
572
+ }
573
+ }