@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
package/src/internal/account.ts
CHANGED
|
@@ -951,48 +951,41 @@ async function doesAccountExistAtAddress(args: {
|
|
|
951
951
|
}): Promise<boolean> {
|
|
952
952
|
const { aptosConfig, accountAddress, options } = args;
|
|
953
953
|
try {
|
|
954
|
-
//
|
|
955
|
-
//
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
getAccountOwnedObjects({
|
|
963
|
-
aptosConfig,
|
|
964
|
-
accountAddress,
|
|
965
|
-
options: {
|
|
966
|
-
limit: 1,
|
|
967
|
-
},
|
|
968
|
-
}),
|
|
969
|
-
]);
|
|
954
|
+
// Check the account resource first. For standard accounts this is sufficient proof of
|
|
955
|
+
// existence, and querying owned objects in parallel used to fail the whole check when
|
|
956
|
+
// the indexer `current_objects` query timed out.
|
|
957
|
+
const accountResource = await getResourceFallible<{ authentication_key: string }>({
|
|
958
|
+
aptosConfig,
|
|
959
|
+
accountAddress,
|
|
960
|
+
resourceType: "0x1::account::Account",
|
|
961
|
+
});
|
|
970
962
|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
963
|
+
if (accountResource) {
|
|
964
|
+
if (!options?.withAuthKey) {
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
return accountResource.authentication_key === options.withAuthKey.toString();
|
|
974
968
|
}
|
|
975
969
|
|
|
976
|
-
//
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
970
|
+
// No account resource: still treat light accounts (objects but no resource) as existing.
|
|
971
|
+
const ownedObjects = await getAccountOwnedObjects({
|
|
972
|
+
aptosConfig,
|
|
973
|
+
accountAddress,
|
|
974
|
+
options: {
|
|
975
|
+
limit: 1,
|
|
976
|
+
},
|
|
977
|
+
});
|
|
980
978
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
let authKey;
|
|
984
|
-
if (accountResource) {
|
|
985
|
-
authKey = accountResource.authentication_key;
|
|
986
|
-
} else {
|
|
987
|
-
authKey = accountAddress.toStringLong();
|
|
979
|
+
if (ownedObjects.length === 0) {
|
|
980
|
+
return false;
|
|
988
981
|
}
|
|
989
982
|
|
|
990
|
-
if (
|
|
991
|
-
return
|
|
983
|
+
if (!options?.withAuthKey) {
|
|
984
|
+
return true;
|
|
992
985
|
}
|
|
993
986
|
|
|
994
|
-
//
|
|
995
|
-
return
|
|
987
|
+
// Light accounts have no resource, so the auth key is the account address by convention.
|
|
988
|
+
return accountAddress.toStringLong() === options.withAuthKey.toString();
|
|
996
989
|
} catch (error: any) {
|
|
997
990
|
throw new Error(`Error while checking if account exists at ${accountAddress.toString()}: ${error}`);
|
|
998
991
|
}
|
|
@@ -1028,6 +1021,8 @@ function rotateAuthKeyAbi(): EntryFunctionABI {
|
|
|
1028
1021
|
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
1029
1022
|
* @param args.toAccount - (Optional) The target account to rotate to. Required if not using toNewPrivateKey.
|
|
1030
1023
|
* @param args.toNewPrivateKey - (Optional) The new private key to rotate to. Required if not using toAccount.
|
|
1024
|
+
* @param args.withFeePayer - Whether to build a sponsored transaction.
|
|
1025
|
+
* @param args.options - Optional settings for generating the transaction.
|
|
1031
1026
|
*
|
|
1032
1027
|
* @remarks
|
|
1033
1028
|
* This function supports three modes of rotation:
|
|
@@ -1043,15 +1038,17 @@ export async function rotateAuthKey(
|
|
|
1043
1038
|
args: {
|
|
1044
1039
|
aptosConfig: AptosConfig;
|
|
1045
1040
|
fromAccount: Account;
|
|
1041
|
+
withFeePayer?: boolean;
|
|
1046
1042
|
options?: InputGenerateTransactionOptions;
|
|
1047
1043
|
} & ({ toAccount: Ed25519Account | MultiEd25519Account } | { toNewPrivateKey: Ed25519PrivateKey }),
|
|
1048
1044
|
): Promise<SimpleTransaction> {
|
|
1049
|
-
const { aptosConfig, fromAccount, options } = args;
|
|
1045
|
+
const { aptosConfig, fromAccount, withFeePayer, options } = args;
|
|
1050
1046
|
if ("toNewPrivateKey" in args) {
|
|
1051
1047
|
return rotateAuthKeyWithChallenge({
|
|
1052
1048
|
aptosConfig,
|
|
1053
1049
|
fromAccount,
|
|
1054
1050
|
toNewPrivateKey: args.toNewPrivateKey,
|
|
1051
|
+
withFeePayer,
|
|
1055
1052
|
options,
|
|
1056
1053
|
});
|
|
1057
1054
|
}
|
|
@@ -1061,22 +1058,42 @@ export async function rotateAuthKey(
|
|
|
1061
1058
|
aptosConfig,
|
|
1062
1059
|
fromAccount,
|
|
1063
1060
|
toNewPrivateKey: args.toAccount.privateKey,
|
|
1061
|
+
withFeePayer,
|
|
1064
1062
|
options,
|
|
1065
1063
|
});
|
|
1066
1064
|
}
|
|
1067
|
-
return rotateAuthKeyWithChallenge({
|
|
1065
|
+
return rotateAuthKeyWithChallenge({
|
|
1066
|
+
aptosConfig,
|
|
1067
|
+
fromAccount,
|
|
1068
|
+
toAccount: args.toAccount,
|
|
1069
|
+
withFeePayer,
|
|
1070
|
+
options,
|
|
1071
|
+
});
|
|
1068
1072
|
}
|
|
1069
1073
|
throw new Error("Invalid arguments");
|
|
1070
1074
|
}
|
|
1071
1075
|
|
|
1076
|
+
/**
|
|
1077
|
+
* Builds a challenge-based authentication-key rotation transaction.
|
|
1078
|
+
*
|
|
1079
|
+
* @param args - The arguments for the challenge-based rotation.
|
|
1080
|
+
* @param args.aptosConfig - The configuration settings for the Aptos network.
|
|
1081
|
+
* @param args.fromAccount - The account whose authentication key will be rotated.
|
|
1082
|
+
* @param args.toAccount - The optional target multi-signature account.
|
|
1083
|
+
* @param args.toNewPrivateKey - The optional target private key.
|
|
1084
|
+
* @param args.withFeePayer - Whether to build a sponsored transaction.
|
|
1085
|
+
* @param args.options - Optional settings for generating the transaction.
|
|
1086
|
+
* @returns A transaction that rotates the authentication key.
|
|
1087
|
+
*/
|
|
1072
1088
|
async function rotateAuthKeyWithChallenge(
|
|
1073
1089
|
args: {
|
|
1074
1090
|
aptosConfig: AptosConfig;
|
|
1075
1091
|
fromAccount: Account;
|
|
1092
|
+
withFeePayer?: boolean;
|
|
1076
1093
|
options?: InputGenerateTransactionOptions;
|
|
1077
1094
|
} & ({ toNewPrivateKey: Ed25519PrivateKey } | { toAccount: MultiEd25519Account }),
|
|
1078
1095
|
): Promise<SimpleTransaction> {
|
|
1079
|
-
const { aptosConfig, fromAccount, options } = args;
|
|
1096
|
+
const { aptosConfig, fromAccount, withFeePayer, options } = args;
|
|
1080
1097
|
const accountInfo = await getInfo({
|
|
1081
1098
|
aptosConfig,
|
|
1082
1099
|
accountAddress: fromAccount.accountAddress,
|
|
@@ -1105,6 +1122,7 @@ async function rotateAuthKeyWithChallenge(
|
|
|
1105
1122
|
return generateTransaction({
|
|
1106
1123
|
aptosConfig,
|
|
1107
1124
|
sender: fromAccount.accountAddress,
|
|
1125
|
+
withFeePayer,
|
|
1108
1126
|
data: {
|
|
1109
1127
|
function: "0x1::account::rotate_authentication_key",
|
|
1110
1128
|
functionArguments: [
|
|
@@ -1139,6 +1157,8 @@ function rotateAuthKeyUnverifiedAbi(): EntryFunctionABI {
|
|
|
1139
1157
|
* @param args.aptosConfig - The configuration settings for the Aptos network.
|
|
1140
1158
|
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
1141
1159
|
* @param args.toNewPublicKey - The new public key to rotate to.
|
|
1160
|
+
* @param args.withFeePayer - Whether to build a sponsored transaction.
|
|
1161
|
+
* @param args.options - Optional settings for generating the transaction.
|
|
1142
1162
|
* @returns A simple transaction object that can be submitted to the network.
|
|
1143
1163
|
* @throws Error if the rotation fails or verification fails.
|
|
1144
1164
|
*
|
|
@@ -1148,13 +1168,15 @@ export async function rotateAuthKeyUnverified(args: {
|
|
|
1148
1168
|
aptosConfig: AptosConfig;
|
|
1149
1169
|
fromAccount: Account;
|
|
1150
1170
|
toNewPublicKey: AccountPublicKey;
|
|
1171
|
+
withFeePayer?: boolean;
|
|
1151
1172
|
options?: InputGenerateTransactionOptions;
|
|
1152
1173
|
}): Promise<SimpleTransaction> {
|
|
1153
|
-
const { aptosConfig, fromAccount, toNewPublicKey, options } = args;
|
|
1174
|
+
const { aptosConfig, fromAccount, toNewPublicKey, withFeePayer, options } = args;
|
|
1154
1175
|
|
|
1155
1176
|
return generateTransaction({
|
|
1156
1177
|
aptosConfig,
|
|
1157
1178
|
sender: fromAccount.accountAddress,
|
|
1179
|
+
withFeePayer,
|
|
1158
1180
|
data: {
|
|
1159
1181
|
function: "0x1::account::rotate_authentication_key_from_public_key",
|
|
1160
1182
|
functionArguments: [
|
package/src/internal/ans.ts
CHANGED
|
@@ -141,7 +141,7 @@ export const LOCAL_ANS_ACCOUNT_ADDRESS =
|
|
|
141
141
|
getEnvVar("ANS_TEST_ACCOUNT_ADDRESS") ?? "0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82";
|
|
142
142
|
|
|
143
143
|
const NetworkToAnsContract: Record<Network, string | null> = {
|
|
144
|
-
[Network.TESTNET]: "
|
|
144
|
+
[Network.TESTNET]: "0xb1ae61606dfbe0ea5b5c45ffdb4fb08da0dba18c5125182ff63ab280a450ecf4",
|
|
145
145
|
[Network.MAINNET]: "0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",
|
|
146
146
|
[Network.LOCAL]: LOCAL_ANS_ACCOUNT_ADDRESS,
|
|
147
147
|
[Network.CUSTOM]: null,
|
|
@@ -166,7 +166,7 @@ function getRouterAddress(aptosConfig: AptosConfig): string {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
const unwrapOption = <T>(option: any): T | undefined => {
|
|
169
|
-
if (
|
|
169
|
+
if (option && typeof option === "object" && "vec" in option && Array.isArray(option.vec)) {
|
|
170
170
|
return option.vec[0];
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -213,6 +213,7 @@ export async function getOwnerAddress(args: {
|
|
|
213
213
|
* @param transferable - Whether the name can be transferred to another owner.
|
|
214
214
|
* @param toAddress - The address that will be set as the owner_address of the name.
|
|
215
215
|
* @param targetAddress - The address that this name will resolve to.
|
|
216
|
+
* @param withFeePayer - Whether to build a fee-payer transaction.
|
|
216
217
|
* @group Implementation
|
|
217
218
|
*/
|
|
218
219
|
export interface RegisterNameParameters {
|
|
@@ -226,6 +227,7 @@ export interface RegisterNameParameters {
|
|
|
226
227
|
transferable?: boolean;
|
|
227
228
|
toAddress?: AccountAddressInput;
|
|
228
229
|
targetAddress?: AccountAddressInput;
|
|
230
|
+
withFeePayer?: boolean;
|
|
229
231
|
options?: InputGenerateTransactionOptions;
|
|
230
232
|
}
|
|
231
233
|
|
|
@@ -240,6 +242,7 @@ export interface RegisterNameParameters {
|
|
|
240
242
|
* @param args.sender - The account details of the sender initiating the registration.
|
|
241
243
|
* @param args.targetAddress - The target address for the registration, which is the address the name will resolve to.
|
|
242
244
|
* @param args.toAddress - The address that will be set as the owner_address in records, defaults to sender if not provided.
|
|
245
|
+
* @param args.withFeePayer - Whether to build a fee-payer transaction.
|
|
243
246
|
* @param args.options - Additional options for the registration process.
|
|
244
247
|
* @param args.transferable - Indicates whether the registered name is transferable to another account.
|
|
245
248
|
*
|
|
@@ -253,7 +256,7 @@ export interface RegisterNameParameters {
|
|
|
253
256
|
export async function registerName(
|
|
254
257
|
args: RegisterNameParameters,
|
|
255
258
|
): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData }> {
|
|
256
|
-
const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options, transferable } = args;
|
|
259
|
+
const { aptosConfig, expiration, name, sender, targetAddress, toAddress, withFeePayer, options, transferable } = args;
|
|
257
260
|
const routerAddress = getRouterAddress(aptosConfig);
|
|
258
261
|
const { domainName, subdomainName } = isValidANSName(name);
|
|
259
262
|
|
|
@@ -288,6 +291,7 @@ export async function registerName(
|
|
|
288
291
|
aptosConfig,
|
|
289
292
|
sender: AccountAddress.from(sender).toString(),
|
|
290
293
|
data,
|
|
294
|
+
withFeePayer,
|
|
291
295
|
options,
|
|
292
296
|
});
|
|
293
297
|
|
|
@@ -331,6 +335,7 @@ export async function registerName(
|
|
|
331
335
|
aptosConfig,
|
|
332
336
|
sender: AccountAddress.from(sender).toString(),
|
|
333
337
|
data,
|
|
338
|
+
withFeePayer,
|
|
334
339
|
options,
|
|
335
340
|
});
|
|
336
341
|
|
|
@@ -411,6 +416,7 @@ export async function getPrimaryName(args: {
|
|
|
411
416
|
* @param args.aptosConfig - The Aptos configuration object.
|
|
412
417
|
* @param args.sender - The account that is sending the transaction.
|
|
413
418
|
* @param args.name - The name to set as the primary name. If omitted, the function will clear the primary name.
|
|
419
|
+
* @param args.withFeePayer - Whether to build a fee-payer transaction.
|
|
414
420
|
* @param args.options - Optional transaction generation options.
|
|
415
421
|
* @returns A transaction object representing the operation.
|
|
416
422
|
* @group Implementation
|
|
@@ -419,9 +425,10 @@ export async function setPrimaryName(args: {
|
|
|
419
425
|
aptosConfig: AptosConfig;
|
|
420
426
|
sender: AccountAddressInput;
|
|
421
427
|
name?: string;
|
|
428
|
+
withFeePayer?: boolean;
|
|
422
429
|
options?: InputGenerateTransactionOptions;
|
|
423
430
|
}): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData }> {
|
|
424
|
-
const { aptosConfig, sender, name, options } = args;
|
|
431
|
+
const { aptosConfig, sender, name, withFeePayer, options } = args;
|
|
425
432
|
const routerAddress = getRouterAddress(aptosConfig);
|
|
426
433
|
|
|
427
434
|
if (!name) {
|
|
@@ -434,6 +441,7 @@ export async function setPrimaryName(args: {
|
|
|
434
441
|
aptosConfig,
|
|
435
442
|
sender: AccountAddress.from(sender).toString(),
|
|
436
443
|
data,
|
|
444
|
+
withFeePayer,
|
|
437
445
|
options,
|
|
438
446
|
});
|
|
439
447
|
|
|
@@ -454,6 +462,7 @@ export async function setPrimaryName(args: {
|
|
|
454
462
|
aptosConfig,
|
|
455
463
|
sender: AccountAddress.from(sender).toString(),
|
|
456
464
|
data,
|
|
465
|
+
withFeePayer,
|
|
457
466
|
options,
|
|
458
467
|
});
|
|
459
468
|
|
|
@@ -503,6 +512,7 @@ export async function getTargetAddress(args: {
|
|
|
503
512
|
* @param args.sender - The account that is sending the transaction.
|
|
504
513
|
* @param args.name - The name of the domain or subdomain to be set.
|
|
505
514
|
* @param args.address - The address to be associated with the domain or subdomain.
|
|
515
|
+
* @param args.withFeePayer - Whether to build a fee-payer transaction.
|
|
506
516
|
* @param args.options - Optional parameters for generating the transaction.
|
|
507
517
|
*
|
|
508
518
|
* @returns A transaction object representing the set target address operation.
|
|
@@ -513,9 +523,10 @@ export async function setTargetAddress(args: {
|
|
|
513
523
|
sender: AccountAddressInput;
|
|
514
524
|
name: string;
|
|
515
525
|
address: AccountAddressInput;
|
|
526
|
+
withFeePayer?: boolean;
|
|
516
527
|
options?: InputGenerateTransactionOptions;
|
|
517
528
|
}): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData }> {
|
|
518
|
-
const { aptosConfig, sender, name, address, options } = args;
|
|
529
|
+
const { aptosConfig, sender, name, address, withFeePayer, options } = args;
|
|
519
530
|
const routerAddress = getRouterAddress(aptosConfig);
|
|
520
531
|
const { domainName, subdomainName } = isValidANSName(name);
|
|
521
532
|
|
|
@@ -528,6 +539,7 @@ export async function setTargetAddress(args: {
|
|
|
528
539
|
aptosConfig,
|
|
529
540
|
sender: AccountAddress.from(sender).toString(),
|
|
530
541
|
data,
|
|
542
|
+
withFeePayer,
|
|
531
543
|
options,
|
|
532
544
|
});
|
|
533
545
|
|
|
@@ -545,6 +557,7 @@ export async function setTargetAddress(args: {
|
|
|
545
557
|
* @param args.aptosConfig - The configuration settings for the Aptos network.
|
|
546
558
|
* @param args.sender - The account that is sending the transaction.
|
|
547
559
|
* @param args.name - The name of the domain or subdomain to clear the target address for.
|
|
560
|
+
* @param args.withFeePayer - Whether to build a fee-payer transaction.
|
|
548
561
|
* @param args.options - Optional parameters for generating the transaction.
|
|
549
562
|
*
|
|
550
563
|
* @returns A transaction object representing the clear target address operation.
|
|
@@ -554,9 +567,10 @@ export async function clearTargetAddress(args: {
|
|
|
554
567
|
aptosConfig: AptosConfig;
|
|
555
568
|
sender: AccountAddressInput;
|
|
556
569
|
name: string;
|
|
570
|
+
withFeePayer?: boolean;
|
|
557
571
|
options?: InputGenerateTransactionOptions;
|
|
558
572
|
}): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData }> {
|
|
559
|
-
const { aptosConfig, sender, name, options } = args;
|
|
573
|
+
const { aptosConfig, sender, name, withFeePayer, options } = args;
|
|
560
574
|
const routerAddress = getRouterAddress(aptosConfig);
|
|
561
575
|
const { domainName, subdomainName } = isValidANSName(name);
|
|
562
576
|
|
|
@@ -569,6 +583,7 @@ export async function clearTargetAddress(args: {
|
|
|
569
583
|
aptosConfig,
|
|
570
584
|
sender: AccountAddress.from(sender).toString(),
|
|
571
585
|
data,
|
|
586
|
+
withFeePayer,
|
|
572
587
|
options,
|
|
573
588
|
});
|
|
574
589
|
|
|
@@ -920,6 +935,7 @@ export async function getANSGracePeriod(args: { aptosConfig: AptosConfig }): Pro
|
|
|
920
935
|
* @param args.sender - The account that is sending the renewal transaction.
|
|
921
936
|
* @param args.name - The name of the domain to renew.
|
|
922
937
|
* @param args.years - The number of years to renew the domain for. Currently, only 1 year renewals are supported. (optional, default is 1)
|
|
938
|
+
* @param args.withFeePayer - Whether to build a fee-payer transaction.
|
|
923
939
|
* @param args.options - Additional options for generating the transaction. (optional)
|
|
924
940
|
* @throws Error if the name contains a subdomain or if the years parameter is not equal to 1.
|
|
925
941
|
* @group Implementation
|
|
@@ -929,9 +945,10 @@ export async function renewDomain(args: {
|
|
|
929
945
|
sender: AccountAddressInput;
|
|
930
946
|
name: string;
|
|
931
947
|
years?: 1;
|
|
948
|
+
withFeePayer?: boolean;
|
|
932
949
|
options?: InputGenerateTransactionOptions;
|
|
933
950
|
}): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData }> {
|
|
934
|
-
const { aptosConfig, sender, name, years = 1, options } = args;
|
|
951
|
+
const { aptosConfig, sender, name, years = 1, withFeePayer, options } = args;
|
|
935
952
|
const routerAddress = getRouterAddress(aptosConfig);
|
|
936
953
|
const renewalDuration = years * 31536000;
|
|
937
954
|
const { domainName, subdomainName } = isValidANSName(name);
|
|
@@ -953,6 +970,7 @@ export async function renewDomain(args: {
|
|
|
953
970
|
aptosConfig,
|
|
954
971
|
sender: AccountAddress.from(sender).toString(),
|
|
955
972
|
data,
|
|
973
|
+
withFeePayer,
|
|
956
974
|
options,
|
|
957
975
|
});
|
|
958
976
|
|
package/src/internal/coin.ts
CHANGED
|
@@ -22,6 +22,7 @@ const coinTransferAbi: EntryFunctionABI = {
|
|
|
22
22
|
* @param args.recipient - The address of the account receiving the coins.
|
|
23
23
|
* @param args.amount - The amount of coins to transfer.
|
|
24
24
|
* @param args.coinType - (Optional) The type of coin to transfer, defaults to Aptos Coin if not specified.
|
|
25
|
+
* @param args.withFeePayer - Whether to build a fee-payer transaction.
|
|
25
26
|
* @param args.options - (Optional) Options for generating the transaction.
|
|
26
27
|
* @group Implementation
|
|
27
28
|
*/
|
|
@@ -31,9 +32,10 @@ export async function transferCoinTransaction(args: {
|
|
|
31
32
|
recipient: AccountAddressInput;
|
|
32
33
|
amount: AnyNumber;
|
|
33
34
|
coinType?: MoveStructId;
|
|
35
|
+
withFeePayer?: boolean;
|
|
34
36
|
options?: InputGenerateTransactionOptions;
|
|
35
37
|
}): Promise<SimpleTransaction> {
|
|
36
|
-
const { aptosConfig, sender, recipient, amount, coinType, options } = args;
|
|
38
|
+
const { aptosConfig, sender, recipient, amount, coinType, withFeePayer, options } = args;
|
|
37
39
|
const coinStructType = coinType ?? APTOS_COIN;
|
|
38
40
|
return generateTransaction({
|
|
39
41
|
aptosConfig,
|
|
@@ -44,6 +46,7 @@ export async function transferCoinTransaction(args: {
|
|
|
44
46
|
functionArguments: [recipient, amount],
|
|
45
47
|
abi: coinTransferAbi,
|
|
46
48
|
},
|
|
49
|
+
withFeePayer,
|
|
47
50
|
options,
|
|
48
51
|
});
|
|
49
52
|
}
|