@aptos-labs/ts-sdk 7.3.0 → 7.5.0
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/LICENSE +43 -43
- package/README.md +19 -20
- package/dist/api/account/abstraction.d.ts +10 -0
- package/dist/api/account/abstraction.d.ts.map +1 -1
- package/dist/api/account/abstraction.js +19 -6
- package/dist/api/account/abstraction.js.map +1 -1
- package/dist/api/ans.d.ts +9 -0
- package/dist/api/ans.d.ts.map +1 -1
- package/dist/api/ans.js +5 -0
- package/dist/api/ans.js.map +1 -1
- package/dist/api/coin.d.ts +2 -0
- package/dist/api/coin.d.ts.map +1 -1
- package/dist/api/coin.js +1 -0
- package/dist/api/coin.js.map +1 -1
- package/dist/api/digitalAsset.d.ts +30 -0
- package/dist/api/digitalAsset.d.ts.map +1 -1
- package/dist/api/digitalAsset.js +15 -0
- package/dist/api/digitalAsset.js.map +1 -1
- package/dist/api/fungibleAsset.d.ts +4 -0
- package/dist/api/fungibleAsset.d.ts.map +1 -1
- package/dist/api/fungibleAsset.js +2 -0
- package/dist/api/fungibleAsset.js.map +1 -1
- package/dist/api/keyless.d.ts +38 -1
- package/dist/api/keyless.d.ts.map +1 -1
- package/dist/api/keyless.js +29 -1
- package/dist/api/keyless.js.map +1 -1
- package/dist/api/transaction.d.ts +41 -1
- package/dist/api/transaction.d.ts.map +1 -1
- package/dist/api/transaction.js +42 -2
- package/dist/api/transaction.js.map +1 -1
- package/dist/api/transactionSubmission/build.d.ts +7 -5
- package/dist/api/transactionSubmission/build.d.ts.map +1 -1
- package/dist/api/transactionSubmission/build.js +13 -5
- package/dist/api/transactionSubmission/build.js.map +1 -1
- package/dist/api/transactionSubmission/simulate.d.ts +7 -3
- package/dist/api/transactionSubmission/simulate.d.ts.map +1 -1
- package/dist/api/transactionSubmission/simulate.js +7 -3
- package/dist/api/transactionSubmission/simulate.js.map +1 -1
- package/dist/bcs/serializable/moveStructs.d.ts +72 -28
- package/dist/bcs/serializable/moveStructs.d.ts.map +1 -1
- package/dist/bcs/serializable/moveStructs.js +76 -28
- package/dist/bcs/serializable/moveStructs.js.map +1 -1
- package/dist/functions/keyless.d.ts +1 -1
- package/dist/functions/keyless.d.ts.map +1 -1
- package/dist/functions/keyless.js +1 -1
- package/dist/functions/keyless.js.map +1 -1
- package/dist/functions/transaction.d.ts +1 -1
- package/dist/functions/transaction.d.ts.map +1 -1
- package/dist/functions/transaction.js +1 -1
- package/dist/functions/transaction.js.map +1 -1
- package/dist/internal/abstraction.d.ts +35 -0
- package/dist/internal/abstraction.d.ts.map +1 -1
- package/dist/internal/abstraction.js +38 -3
- package/dist/internal/abstraction.js.map +1 -1
- package/dist/internal/account.d.ts +6 -0
- package/dist/internal/account.d.ts.map +1 -1
- package/dist/internal/account.js +55 -37
- package/dist/internal/account.js.map +1 -1
- package/dist/internal/ans.d.ts +11 -0
- package/dist/internal/ans.d.ts.map +1 -1
- package/dist/internal/ans.js +19 -7
- package/dist/internal/ans.js.map +1 -1
- package/dist/internal/coin.d.ts +2 -0
- package/dist/internal/coin.d.ts.map +1 -1
- package/dist/internal/coin.js +3 -1
- package/dist/internal/coin.js.map +1 -1
- package/dist/internal/digitalAsset.d.ts +30 -0
- package/dist/internal/digitalAsset.d.ts.map +1 -1
- package/dist/internal/digitalAsset.js +45 -15
- package/dist/internal/digitalAsset.js.map +1 -1
- package/dist/internal/fungibleAsset.d.ts +4 -0
- package/dist/internal/fungibleAsset.d.ts.map +1 -1
- package/dist/internal/fungibleAsset.js +6 -2
- package/dist/internal/fungibleAsset.js.map +1 -1
- package/dist/internal/keyless.d.ts +39 -1
- package/dist/internal/keyless.d.ts.map +1 -1
- package/dist/internal/keyless.js +71 -13
- package/dist/internal/keyless.js.map +1 -1
- package/dist/internal/transaction.d.ts +24 -1
- package/dist/internal/transaction.d.ts.map +1 -1
- package/dist/internal/transaction.js +125 -4
- package/dist/internal/transaction.js.map +1 -1
- package/dist/internal/transactionSubmission.d.ts +2 -0
- package/dist/internal/transactionSubmission.d.ts.map +1 -1
- package/dist/internal/transactionSubmission.js +3 -1
- package/dist/internal/transactionSubmission.js.map +1 -1
- package/dist/transactions/management/transactionWorker.d.ts +10 -6
- package/dist/transactions/management/transactionWorker.d.ts.map +1 -1
- package/dist/transactions/management/transactionWorker.js +28 -24
- package/dist/transactions/management/transactionWorker.js.map +1 -1
- package/dist/transactions/transactionBuilder/index.d.ts +1 -0
- package/dist/transactions/transactionBuilder/index.d.ts.map +1 -1
- package/dist/transactions/transactionBuilder/index.js +1 -0
- package/dist/transactions/transactionBuilder/index.js.map +1 -1
- package/dist/transactions/transactionBuilder/scriptAbi.d.ts +10 -0
- package/dist/transactions/transactionBuilder/scriptAbi.d.ts.map +1 -0
- package/dist/transactions/transactionBuilder/scriptAbi.js +863 -0
- package/dist/transactions/transactionBuilder/scriptAbi.js.map +1 -0
- package/dist/transactions/transactionBuilder/transactionBuilder.d.ts.map +1 -1
- package/dist/transactions/transactionBuilder/transactionBuilder.js +65 -1
- package/dist/transactions/transactionBuilder/transactionBuilder.js.map +1 -1
- package/dist/transactions/types.d.ts +9 -4
- package/dist/transactions/types.d.ts.map +1 -1
- package/dist/types/keyless.d.ts +2 -2
- package/dist/types/keyless.d.ts.map +1 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/utils/const.d.ts +11 -0
- package/dist/utils/const.d.ts.map +1 -1
- package/dist/utils/const.js +11 -0
- package/dist/utils/const.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +26 -25
- package/src/api/account/abstraction.ts +23 -6
- package/src/api/ans.ts +9 -0
- package/src/api/coin.ts +2 -0
- package/src/api/digitalAsset.ts +30 -0
- package/src/api/fungibleAsset.ts +4 -0
- package/src/api/keyless.ts +39 -1
- package/src/api/transaction.ts +48 -1
- package/src/api/transactionSubmission/build.ts +16 -6
- package/src/api/transactionSubmission/simulate.ts +7 -3
- package/src/bcs/serializable/moveStructs.ts +80 -28
- package/src/functions/keyless.ts +1 -0
- package/src/functions/transaction.ts +1 -0
- package/src/internal/abstraction.ts +41 -3
- package/src/internal/account.ts +60 -38
- package/src/internal/ans.ts +25 -7
- package/src/internal/coin.ts +4 -1
- package/src/internal/digitalAsset.ts +60 -9
- package/src/internal/fungibleAsset.ts +8 -2
- package/src/internal/keyless.ts +91 -14
- package/src/internal/transaction.ts +154 -4
- package/src/internal/transactionSubmission.ts +4 -1
- package/src/transactions/management/transactionWorker.ts +35 -23
- package/src/transactions/transactionBuilder/index.ts +1 -0
- package/src/transactions/transactionBuilder/scriptAbi.ts +1145 -0
- package/src/transactions/transactionBuilder/transactionBuilder.ts +91 -6
- package/src/transactions/types.ts +10 -4
- package/src/types/keyless.ts +2 -2
- package/src/types/types.ts +2 -2
- package/src/utils/const.ts +12 -0
- package/src/version.ts +1 -1
|
@@ -58,7 +58,7 @@ import { SimpleTransaction } from "../transactions/instances/simpleTransaction.j
|
|
|
58
58
|
*
|
|
59
59
|
* // Send a transaction from Alice's account to Bob's account
|
|
60
60
|
* const txn = await aptos.transaction.build.simple({
|
|
61
|
-
* sender: alice
|
|
61
|
+
* sender: alice,
|
|
62
62
|
* data: {
|
|
63
63
|
* // All transactions on Aptos are implemented via smart contracts.
|
|
64
64
|
* function: "0x1::aptos_account::transfer",
|
|
@@ -215,6 +215,38 @@ export declare class Transaction {
|
|
|
215
215
|
getTransactionByHash(args: {
|
|
216
216
|
transactionHash: HexInput;
|
|
217
217
|
}): Promise<TransactionResponse>;
|
|
218
|
+
/**
|
|
219
|
+
* Populates missing decoded data on write and delete table-item changes in a
|
|
220
|
+
* committed transaction response.
|
|
221
|
+
*
|
|
222
|
+
* Fullnodes generally return `null` for table item `data`. This method queries
|
|
223
|
+
* the indexer for the decoded rows and table metadata, then mutates and returns
|
|
224
|
+
* the supplied transaction. Already-decoded changes are preserved.
|
|
225
|
+
*
|
|
226
|
+
* @param args - The arguments for enriching the transaction.
|
|
227
|
+
* @param args.transaction - The committed transaction response to enrich.
|
|
228
|
+
* @returns The supplied transaction with available table item data populated.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```typescript
|
|
232
|
+
* import { Aptos, AptosConfig, Network, isUserTransactionResponse } from "@aptos-labs/ts-sdk";
|
|
233
|
+
*
|
|
234
|
+
* const aptos = new Aptos(new AptosConfig({ network: Network.MAINNET }));
|
|
235
|
+
*
|
|
236
|
+
* async function runExample() {
|
|
237
|
+
* const transaction = await aptos.getTransactionByVersion({ ledgerVersion: 563060087 });
|
|
238
|
+
* if (isUserTransactionResponse(transaction)) {
|
|
239
|
+
* await aptos.enrichTransactionWithTableItemData({ transaction });
|
|
240
|
+
* console.log(transaction.changes);
|
|
241
|
+
* }
|
|
242
|
+
* }
|
|
243
|
+
* runExample();
|
|
244
|
+
* ```
|
|
245
|
+
* @group Transaction
|
|
246
|
+
*/
|
|
247
|
+
enrichTransactionWithTableItemData<T extends CommittedTransactionResponse>(args: {
|
|
248
|
+
transaction: T;
|
|
249
|
+
}): Promise<T>;
|
|
218
250
|
/**
|
|
219
251
|
* Defines if the specified transaction is currently in a pending state.
|
|
220
252
|
* This function helps you determine the status of a transaction using its hash.
|
|
@@ -361,6 +393,7 @@ export declare class Transaction {
|
|
|
361
393
|
* @param args.account The publisher account.
|
|
362
394
|
* @param args.metadataBytes The package metadata bytes.
|
|
363
395
|
* @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order.
|
|
396
|
+
* @param args.withFeePayer Whether to build a sponsored transaction.
|
|
364
397
|
* @param args.options Optional settings for generating the transaction.
|
|
365
398
|
*
|
|
366
399
|
* @returns A SimpleTransaction that can be simulated or submitted to the chain.
|
|
@@ -394,6 +427,7 @@ export declare class Transaction {
|
|
|
394
427
|
account: AccountAddressInput;
|
|
395
428
|
metadataBytes: HexInput;
|
|
396
429
|
moduleBytecode: Array<HexInput>;
|
|
430
|
+
withFeePayer?: boolean;
|
|
397
431
|
options?: InputGenerateTransactionOptions;
|
|
398
432
|
}): Promise<SimpleTransaction>;
|
|
399
433
|
/**
|
|
@@ -404,6 +438,8 @@ export declare class Transaction {
|
|
|
404
438
|
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
405
439
|
* @param args.toAccount - (Optional) The target account to rotate to. Required if not using toNewPrivateKey.
|
|
406
440
|
* @param args.toNewPrivateKey - (Optional) The new private key to rotate to. Required if not using toAccount.
|
|
441
|
+
* @param args.withFeePayer - Whether to build a sponsored transaction.
|
|
442
|
+
* @param args.options - Optional settings for generating the transaction.
|
|
407
443
|
*
|
|
408
444
|
* @remarks
|
|
409
445
|
* This function supports three modes of rotation:
|
|
@@ -434,6 +470,7 @@ export declare class Transaction {
|
|
|
434
470
|
*/
|
|
435
471
|
rotateAuthKey(args: {
|
|
436
472
|
fromAccount: Account;
|
|
473
|
+
withFeePayer?: boolean;
|
|
437
474
|
options?: InputGenerateTransactionOptions;
|
|
438
475
|
} & ({
|
|
439
476
|
toAccount: Ed25519Account | MultiEd25519Account;
|
|
@@ -450,6 +487,8 @@ export declare class Transaction {
|
|
|
450
487
|
* @param args - The arguments for rotating the authentication key.
|
|
451
488
|
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
452
489
|
* @param args.toNewPublicKey - The new public key to rotate to.
|
|
490
|
+
* @param args.withFeePayer - Whether to build a sponsored transaction.
|
|
491
|
+
* @param args.options - Optional settings for generating the transaction.
|
|
453
492
|
*
|
|
454
493
|
* @returns A simple transaction object that can be submitted to the network.
|
|
455
494
|
*
|
|
@@ -471,6 +510,7 @@ export declare class Transaction {
|
|
|
471
510
|
*/
|
|
472
511
|
rotateAuthKeyUnverified(args: {
|
|
473
512
|
fromAccount: Account;
|
|
513
|
+
withFeePayer?: boolean;
|
|
474
514
|
options?: InputGenerateTransactionOptions;
|
|
475
515
|
toNewPublicKey: AccountPublicKey;
|
|
476
516
|
}): Promise<SimpleTransaction>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAU/C,OAAO,EACL,SAAS,EACT,4BAA4B,EAC5B,aAAa,EACb,QAAQ,EACR,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wCAAwC,EAOzC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,+BAA+B,EAC/B,mCAAmC,EACnC,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,qBAAa,WAAW;IACtB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAEtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE5B,QAA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AAE,GAAG,oBAAoB,CAIpF;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IAEH,cAAc,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,iBAAiB,CAAA;KAAE,GAAG,oBAAoB,CAI9F;IAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACG,iCAAiC,CAAC,IAAI,EAAE;QAC5C,MAAM,EAAE,OAAO,CAAC;QAChB,IAAI,EAAE,mCAAmC,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,IAAI,CAAC,+BAA+B,EAAE,uBAAuB,CAAC,CAAC;KAC1E,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACG,wBAAwB,CAC5B,IAAI,EAAE,wCAAwC,GAAG;QAC/C,MAAM,EAAE,OAAO,CAAC;QAChB,WAAW,EAAE,iBAAiB,CAAC;KAChC,GAAG,0BAA0B,GAC7B,OAAO,CAAC,0BAA0B,CAAC,CAKrC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,uBAAuB,CAC3B,IAAI,EAAE;QACJ,QAAQ,EAAE,OAAO,CAAC;QAClB,mBAAmB,EAAE,oBAAoB,CAAC;QAC1C,WAAW,EAAE,iBAAiB,CAAC;KAChC,GAAG,0BAA0B,GAC7B,OAAO,CAAC,0BAA0B,CAAC,CAKrC;CACF"}
|
package/dist/api/transaction.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { getGasPriceEstimation, getTransactionByHash, getTransactionByVersion, getTransactions, isTransactionPending, waitForTransaction, } from "../internal/transaction.js";
|
|
3
|
+
import { enrichTransactionWithTableItemData, getGasPriceEstimation, getTransactionByHash, getTransactionByVersion, getTransactions, isTransactionPending, waitForTransaction, } from "../internal/transaction.js";
|
|
4
4
|
import { getSigningMessage, publicPackageTransaction, signAndSubmitAsFeePayer, signAndSubmitTransaction, signAsFeePayer, signTransaction, } from "../internal/transactionSubmission.js";
|
|
5
5
|
import { Build } from "./transactionSubmission/build.js";
|
|
6
6
|
import { Simulate } from "./transactionSubmission/simulate.js";
|
|
@@ -56,7 +56,7 @@ import { rotateAuthKey, rotateAuthKeyUnverified } from "../internal/account.js";
|
|
|
56
56
|
*
|
|
57
57
|
* // Send a transaction from Alice's account to Bob's account
|
|
58
58
|
* const txn = await aptos.transaction.build.simple({
|
|
59
|
-
* sender: alice
|
|
59
|
+
* sender: alice,
|
|
60
60
|
* data: {
|
|
61
61
|
* // All transactions on Aptos are implemented via smart contracts.
|
|
62
62
|
* function: "0x1::aptos_account::transfer",
|
|
@@ -228,6 +228,41 @@ export class Transaction {
|
|
|
228
228
|
...args,
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Populates missing decoded data on write and delete table-item changes in a
|
|
233
|
+
* committed transaction response.
|
|
234
|
+
*
|
|
235
|
+
* Fullnodes generally return `null` for table item `data`. This method queries
|
|
236
|
+
* the indexer for the decoded rows and table metadata, then mutates and returns
|
|
237
|
+
* the supplied transaction. Already-decoded changes are preserved.
|
|
238
|
+
*
|
|
239
|
+
* @param args - The arguments for enriching the transaction.
|
|
240
|
+
* @param args.transaction - The committed transaction response to enrich.
|
|
241
|
+
* @returns The supplied transaction with available table item data populated.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* import { Aptos, AptosConfig, Network, isUserTransactionResponse } from "@aptos-labs/ts-sdk";
|
|
246
|
+
*
|
|
247
|
+
* const aptos = new Aptos(new AptosConfig({ network: Network.MAINNET }));
|
|
248
|
+
*
|
|
249
|
+
* async function runExample() {
|
|
250
|
+
* const transaction = await aptos.getTransactionByVersion({ ledgerVersion: 563060087 });
|
|
251
|
+
* if (isUserTransactionResponse(transaction)) {
|
|
252
|
+
* await aptos.enrichTransactionWithTableItemData({ transaction });
|
|
253
|
+
* console.log(transaction.changes);
|
|
254
|
+
* }
|
|
255
|
+
* }
|
|
256
|
+
* runExample();
|
|
257
|
+
* ```
|
|
258
|
+
* @group Transaction
|
|
259
|
+
*/
|
|
260
|
+
async enrichTransactionWithTableItemData(args) {
|
|
261
|
+
return enrichTransactionWithTableItemData({
|
|
262
|
+
aptosConfig: this.config,
|
|
263
|
+
...args,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
231
266
|
/**
|
|
232
267
|
* Defines if the specified transaction is currently in a pending state.
|
|
233
268
|
* This function helps you determine the status of a transaction using its hash.
|
|
@@ -383,6 +418,7 @@ export class Transaction {
|
|
|
383
418
|
* @param args.account The publisher account.
|
|
384
419
|
* @param args.metadataBytes The package metadata bytes.
|
|
385
420
|
* @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order.
|
|
421
|
+
* @param args.withFeePayer Whether to build a sponsored transaction.
|
|
386
422
|
* @param args.options Optional settings for generating the transaction.
|
|
387
423
|
*
|
|
388
424
|
* @returns A SimpleTransaction that can be simulated or submitted to the chain.
|
|
@@ -423,6 +459,8 @@ export class Transaction {
|
|
|
423
459
|
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
424
460
|
* @param args.toAccount - (Optional) The target account to rotate to. Required if not using toNewPrivateKey.
|
|
425
461
|
* @param args.toNewPrivateKey - (Optional) The new private key to rotate to. Required if not using toAccount.
|
|
462
|
+
* @param args.withFeePayer - Whether to build a sponsored transaction.
|
|
463
|
+
* @param args.options - Optional settings for generating the transaction.
|
|
426
464
|
*
|
|
427
465
|
* @remarks
|
|
428
466
|
* This function supports three modes of rotation:
|
|
@@ -464,6 +502,8 @@ export class Transaction {
|
|
|
464
502
|
* @param args - The arguments for rotating the authentication key.
|
|
465
503
|
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
466
504
|
* @param args.toNewPublicKey - The new public key to rotate to.
|
|
505
|
+
* @param args.withFeePayer - Whether to build a sponsored transaction.
|
|
506
|
+
* @param args.options - Optional settings for generating the transaction.
|
|
467
507
|
*
|
|
468
508
|
* @returns A simple transaction object that can be submitted to the network.
|
|
469
509
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,sCAAsC;AAGtC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAWpC,OAAO,EAEL,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAU9C,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,MAAM,OAAO,WAAW;IACb,MAAM,CAAc;IAEpB,KAAK,CAAQ;IAEb,QAAQ,CAAW;IAEnB,MAAM,CAAS;IAEf,KAAK,CAAwB;IAEtC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG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AC;YACrB,GAAG,IAAI;SACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IAEH,cAAc,CAAC,IAAyD;QACtE,OAAO,cAAc,CAAC;YACpB,GAAG,IAAI;SACR,CAAC,CAAC;IACL,CAAC;IAED,4BAA4B;IAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,KAAK,CAAC,iCAAiC,CAAC,IAIvC;QACC,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;YACvC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,6CAA6C,KAAK,EAAE,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,KAAK,CAAC,wBAAwB,CAC5B,IAG8B;QAE9B,OAAO,wBAAwB,CAAC;YAC9B,WAAW,EAAE,IAAI,CAAC,MAAM;YACxB,GAAG,IAAI;SACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,uBAAuB,CAC3B,IAI8B;QAE9B,OAAO,uBAAuB,CAAC;YAC7B,WAAW,EAAE,IAAI,CAAC,MAAM;YACxB,GAAG,IAAI;SACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Account } from "../../account/index.js";
|
|
1
2
|
import { AccountAddressInput } from "../../core/index.js";
|
|
2
3
|
import { InputGenerateTransactionPayloadData, InputGenerateTransactionOptions } from "../../transactions/index.js";
|
|
3
4
|
import { MultiAgentTransaction } from "../../transactions/instances/multiAgentTransaction.js";
|
|
@@ -44,7 +45,7 @@ export declare class Build {
|
|
|
44
45
|
*
|
|
45
46
|
* This function allows you to create a transaction with specified sender and data.
|
|
46
47
|
*
|
|
47
|
-
* @param args.sender - The sender account address.
|
|
48
|
+
* @param args.sender - The sender account or account address.
|
|
48
49
|
* @param args.data - The transaction data.
|
|
49
50
|
* @param args.options - Optional transaction configurations.
|
|
50
51
|
* @param args.withFeePayer - Whether there is a fee payer for the transaction.
|
|
@@ -53,15 +54,16 @@ export declare class Build {
|
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* ```typescript
|
|
56
|
-
* import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
57
|
+
* import { Account, Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
57
58
|
*
|
|
58
59
|
* const config = new AptosConfig({ network: Network.TESTNET });
|
|
59
60
|
* const aptos = new Aptos(config);
|
|
61
|
+
* const sender = Account.generate();
|
|
60
62
|
*
|
|
61
63
|
* async function runExample() {
|
|
62
64
|
* // Build a simple transaction
|
|
63
|
-
* const transaction = await aptos.transaction.simple({
|
|
64
|
-
* sender
|
|
65
|
+
* const transaction = await aptos.transaction.build.simple({
|
|
66
|
+
* sender,
|
|
65
67
|
* data: {
|
|
66
68
|
* function: "0x1::aptos_account::transfer",
|
|
67
69
|
* functionArguments: ["0x2", 100], // replace with a real destination account address
|
|
@@ -79,7 +81,7 @@ export declare class Build {
|
|
|
79
81
|
* @group Implementation
|
|
80
82
|
*/
|
|
81
83
|
simple(args: {
|
|
82
|
-
sender: AccountAddressInput;
|
|
84
|
+
sender: Account | AccountAddressInput;
|
|
83
85
|
data: InputGenerateTransactionPayloadData;
|
|
84
86
|
options?: InputGenerateTransactionOptions;
|
|
85
87
|
withFeePayer?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/api/transactionSubmission/build.ts"],"names":[],"mappings":"AAGA,OAA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B,MAAM,EAAE,mBAAmB,CAAC;QAC5B,IAAI,EAAE,mCAAmC,CAAC;QAC1C,wBAAwB,EAAE,mBAAmB,EAAE,CAAC;QAChD,OAAO,CAAC,EAAE,+BAA+B,CAAC;QAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAEjC;CACF"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { generateTransaction } from "../../internal/transactionSubmission.js";
|
|
4
|
+
function accountAddressInput(input) {
|
|
5
|
+
return typeof input === "object" && "accountAddress" in input ? input.accountAddress : input;
|
|
6
|
+
}
|
|
4
7
|
/**
|
|
5
8
|
* A class to handle all `Build` transaction operations.
|
|
6
9
|
* @group Implementation
|
|
@@ -44,7 +47,7 @@ export class Build {
|
|
|
44
47
|
*
|
|
45
48
|
* This function allows you to create a transaction with specified sender and data.
|
|
46
49
|
*
|
|
47
|
-
* @param args.sender - The sender account address.
|
|
50
|
+
* @param args.sender - The sender account or account address.
|
|
48
51
|
* @param args.data - The transaction data.
|
|
49
52
|
* @param args.options - Optional transaction configurations.
|
|
50
53
|
* @param args.withFeePayer - Whether there is a fee payer for the transaction.
|
|
@@ -53,15 +56,16 @@ export class Build {
|
|
|
53
56
|
*
|
|
54
57
|
* @example
|
|
55
58
|
* ```typescript
|
|
56
|
-
* import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
59
|
+
* import { Account, Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
57
60
|
*
|
|
58
61
|
* const config = new AptosConfig({ network: Network.TESTNET });
|
|
59
62
|
* const aptos = new Aptos(config);
|
|
63
|
+
* const sender = Account.generate();
|
|
60
64
|
*
|
|
61
65
|
* async function runExample() {
|
|
62
66
|
* // Build a simple transaction
|
|
63
|
-
* const transaction = await aptos.transaction.simple({
|
|
64
|
-
* sender
|
|
67
|
+
* const transaction = await aptos.transaction.build.simple({
|
|
68
|
+
* sender,
|
|
65
69
|
* data: {
|
|
66
70
|
* function: "0x1::aptos_account::transfer",
|
|
67
71
|
* functionArguments: ["0x2", 100], // replace with a real destination account address
|
|
@@ -79,7 +83,11 @@ export class Build {
|
|
|
79
83
|
* @group Implementation
|
|
80
84
|
*/
|
|
81
85
|
async simple(args) {
|
|
82
|
-
return generateTransaction({
|
|
86
|
+
return generateTransaction({
|
|
87
|
+
aptosConfig: this.config,
|
|
88
|
+
...args,
|
|
89
|
+
sender: accountAddressInput(args.sender),
|
|
90
|
+
});
|
|
83
91
|
}
|
|
84
92
|
/**
|
|
85
93
|
* Build a multi-agent transaction that allows multiple signers to authorize a transaction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/api/transactionSubmission/build.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,sCAAsC;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/api/transactionSubmission/build.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,sCAAsC;AAItC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAM9E,SAAS,mBAAmB,CAAC,KAAoC;IAC/D,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,gBAAgB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/F,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,KAAK;IACP,MAAM,CAAc;IAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,KAAK,CAAC,MAAM,CAAC,IAKZ;QACC,OAAO,mBAAmB,CAAC;YACzB,WAAW,EAAE,IAAI,CAAC,MAAM;YACxB,GAAG,IAAI;YACP,MAAM,EAAE,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC;SACzC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,KAAK,CAAC,UAAU,CAAC,IAMhB;QACC,OAAO,mBAAmB,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -38,8 +38,13 @@ export declare class Simulate {
|
|
|
38
38
|
* Simulates a transaction based on the provided parameters and returns the result.
|
|
39
39
|
* This function helps you understand the outcome of a transaction before executing it on the blockchain.
|
|
40
40
|
*
|
|
41
|
+
* To pre-check a multisig proposal, build its entry function directly with the multisig address as sender and
|
|
42
|
+
* `withFeePayer: true`, then omit `signerPublicKey` and `feePayerPublicKey`. The simulation uses no-account
|
|
43
|
+
* authenticators to skip authentication-key validation, so the proposal does not need to exist on-chain.
|
|
44
|
+
*
|
|
41
45
|
* @param args - The parameters for simulating the transaction.
|
|
42
|
-
* @param args.signerPublicKey -
|
|
46
|
+
* @param args.signerPublicKey - Optional public key used to validate the signer's authentication key.
|
|
47
|
+
* Omit it to simulate with the sender address already embedded in the transaction.
|
|
43
48
|
* @param args.transaction - The raw transaction data to simulate.
|
|
44
49
|
* @param args.feePayerPublicKey - The public key of the fee payer (optional).
|
|
45
50
|
* @param args.options - Additional options for simulating the transaction (optional).
|
|
@@ -68,7 +73,7 @@ export declare class Simulate {
|
|
|
68
73
|
*
|
|
69
74
|
* // 1. Build the transaction to preview the impact of it
|
|
70
75
|
* const transaction = await aptos.transaction.build.simple({
|
|
71
|
-
* sender
|
|
76
|
+
* sender,
|
|
72
77
|
* data: {
|
|
73
78
|
* // All transactions on Aptos are implemented via smart contracts.
|
|
74
79
|
* function: "0x1::aptos_account::transfer",
|
|
@@ -78,7 +83,6 @@ export declare class Simulate {
|
|
|
78
83
|
*
|
|
79
84
|
* // 2. Simulate to see what would happen if we execute this transaction
|
|
80
85
|
* const [userTransactionResponse] = await aptos.transaction.simulate.simple({
|
|
81
|
-
* signerPublicKey: sender.publicKey,
|
|
82
86
|
* transaction,
|
|
83
87
|
* });
|
|
84
88
|
* console.log(userTransactionResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../../src/api/transactionSubmission/simulate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;GAGG;AACH,qBAAa,QAAQ;IACnB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,YAAY,MAAM,EAAE,WAAW,EAE9B;IAED
|
|
1
|
+
{"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../../src/api/transactionSubmission/simulate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;GAGG;AACH,qBAAa,QAAQ;IACnB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,YAAY,MAAM,EAAE,WAAW,EAE9B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4DG;IAEG,MAAM,CAAC,IAAI,EAAE;QACjB,eAAe,CAAC,EAAE,SAAS,CAAC;QAC5B,WAAW,EAAE,iBAAiB,CAAC;QAC/B,iBAAiB,CAAC,EAAE,SAAS,CAAC;QAC9B,OAAO,CAAC,EAAE,+BAA+B,CAAC;KAC3C,GAAG,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAE1C;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmEG;IAEG,UAAU,CAAC,IAAI,EAAE;QACrB,eAAe,CAAC,EAAE,SAAS,CAAC;QAC5B,WAAW,EAAE,iBAAiB,CAAC;QAC/B,0BAA0B,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;QAC1D,iBAAiB,CAAC,EAAE,SAAS,CAAC;QAC9B,OAAO,CAAC,EAAE,+BAA+B,CAAC;KAC3C,GAAG,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAE1C;CACF"}
|
|
@@ -46,8 +46,13 @@ export class Simulate {
|
|
|
46
46
|
* Simulates a transaction based on the provided parameters and returns the result.
|
|
47
47
|
* This function helps you understand the outcome of a transaction before executing it on the blockchain.
|
|
48
48
|
*
|
|
49
|
+
* To pre-check a multisig proposal, build its entry function directly with the multisig address as sender and
|
|
50
|
+
* `withFeePayer: true`, then omit `signerPublicKey` and `feePayerPublicKey`. The simulation uses no-account
|
|
51
|
+
* authenticators to skip authentication-key validation, so the proposal does not need to exist on-chain.
|
|
52
|
+
*
|
|
49
53
|
* @param args - The parameters for simulating the transaction.
|
|
50
|
-
* @param args.signerPublicKey -
|
|
54
|
+
* @param args.signerPublicKey - Optional public key used to validate the signer's authentication key.
|
|
55
|
+
* Omit it to simulate with the sender address already embedded in the transaction.
|
|
51
56
|
* @param args.transaction - The raw transaction data to simulate.
|
|
52
57
|
* @param args.feePayerPublicKey - The public key of the fee payer (optional).
|
|
53
58
|
* @param args.options - Additional options for simulating the transaction (optional).
|
|
@@ -76,7 +81,7 @@ export class Simulate {
|
|
|
76
81
|
*
|
|
77
82
|
* // 1. Build the transaction to preview the impact of it
|
|
78
83
|
* const transaction = await aptos.transaction.build.simple({
|
|
79
|
-
* sender
|
|
84
|
+
* sender,
|
|
80
85
|
* data: {
|
|
81
86
|
* // All transactions on Aptos are implemented via smart contracts.
|
|
82
87
|
* function: "0x1::aptos_account::transfer",
|
|
@@ -86,7 +91,6 @@ export class Simulate {
|
|
|
86
91
|
*
|
|
87
92
|
* // 2. Simulate to see what would happen if we execute this transaction
|
|
88
93
|
* const [userTransactionResponse] = await aptos.transaction.simulate.simple({
|
|
89
|
-
* signerPublicKey: sender.publicKey,
|
|
90
94
|
* transaction,
|
|
91
95
|
* });
|
|
92
96
|
* console.log(userTransactionResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulate.js","sourceRoot":"","sources":["../../../src/api/transactionSubmission/simulate.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,sCAAsC;;;;;;;AAGtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAI9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AAEhE;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACV,MAAM,CAAc;IAE7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"simulate.js","sourceRoot":"","sources":["../../../src/api/transactionSubmission/simulate.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,sCAAsC;;;;;;;AAGtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAI9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AAE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