@moveindustries/ts-sdk 5.1.5 → 5.1.7
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 +241 -43
- package/dist/common/{accountAddress-DoqkxUqw.d.ts → accountAddress-CQEq9RVR.d.ts} +6 -2
- package/dist/common/chunk-56DGDNEY.js.map +1 -1
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +393 -55
- package/dist/common/index.js +32 -32
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.mjs +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/utils.mjs +1 -1
- package/dist/esm/api/account/abstraction.mjs +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +2 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/{ans.d.mts → mns.d.mts} +390 -52
- package/dist/esm/api/mns.mjs +2 -0
- package/dist/esm/api/movement.d.mts +4 -4
- package/dist/esm/api/movement.mjs +1 -1
- package/dist/esm/api/movementConfig.mjs +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-KPJGWDSQ.mjs → chunk-74X3LBZR.mjs} +1 -1
- package/dist/esm/{chunk-KPJGWDSQ.mjs.map → chunk-74X3LBZR.mjs.map} +1 -1
- package/dist/esm/{chunk-YFFYA5U3.mjs → chunk-7AJK3QMK.mjs} +2 -2
- package/dist/esm/{chunk-WVF47V5E.mjs → chunk-E3O3YOFD.mjs} +2 -2
- package/dist/esm/chunk-FPHA2UD2.mjs +2 -0
- package/dist/esm/chunk-FPHA2UD2.mjs.map +1 -0
- package/dist/esm/{chunk-O7XWQTYM.mjs → chunk-GTWNSTVB.mjs} +2 -2
- package/dist/esm/{chunk-ZGBIH6MJ.mjs → chunk-HX7XBUOY.mjs} +2 -2
- package/dist/esm/chunk-LVNME34X.mjs +4 -0
- package/dist/esm/chunk-LVNME34X.mjs.map +1 -0
- package/dist/esm/chunk-LZ24RPY3.mjs +2 -0
- package/dist/esm/{chunk-P6MFR7W6.mjs.map → chunk-LZ24RPY3.mjs.map} +1 -1
- package/dist/esm/{chunk-5KMDJLYM.mjs → chunk-POOO2OP5.mjs} +2 -2
- package/dist/esm/{chunk-SZG3ZZGN.mjs → chunk-Q2IJWWWU.mjs} +2 -2
- package/dist/esm/{chunk-3KNJ4VWA.mjs → chunk-Q55N5DU3.mjs} +2 -2
- package/dist/esm/{chunk-P7DJNENM.mjs → chunk-QMRVGJFC.mjs} +2 -2
- package/dist/esm/chunk-QMRVGJFC.mjs.map +1 -0
- package/dist/esm/{chunk-UVP74ONT.mjs → chunk-SLXLZU5N.mjs} +1 -1
- package/dist/esm/chunk-SLXLZU5N.mjs.map +1 -0
- package/dist/esm/{chunk-I6YGBK5S.mjs → chunk-SSTVXHYQ.mjs} +1 -1
- package/dist/esm/chunk-SSTVXHYQ.mjs.map +1 -0
- package/dist/esm/{chunk-46MDTYYN.mjs → chunk-YXS3R2MX.mjs} +2 -2
- package/dist/esm/{chunk-7KIJGBLL.mjs → chunk-ZUWARBWT.mjs} +2 -2
- package/dist/esm/{chunk-7KIJGBLL.mjs.map → chunk-ZUWARBWT.mjs.map} +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.mjs +1 -1
- package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/secp256r1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/index.d.mts +3 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/abstraction.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/{ans.d.mts → mns.d.mts} +237 -19
- package/dist/esm/internal/mns.mjs +2 -0
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/utils/index.mjs +1 -1
- package/dist/esm/internal/utils/utils.mjs +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/types/index.d.mts +1 -1
- package/dist/esm/types/indexer.d.mts +6 -2
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/account/SingleKeyAccount.ts +1 -1
- package/src/api/account/abstraction.ts +1 -1
- package/src/api/account.ts +3 -3
- package/src/api/coin.ts +1 -1
- package/src/api/digitalAsset.ts +1 -1
- package/src/api/faucet.ts +1 -1
- package/src/api/fungibleAsset.ts +1 -1
- package/src/api/index.ts +0 -1
- package/src/api/keyless.ts +1 -1
- package/src/api/{ans.ts → mns.ts} +438 -52
- package/src/api/movement.ts +18 -17
- package/src/api/movementConfig.ts +3 -3
- package/src/api/object.ts +1 -1
- package/src/api/staking.ts +1 -1
- package/src/api/transactionSubmission/build.ts +1 -4
- package/src/bcs/index.ts +0 -1
- package/src/bcs/serializable/moveStructs.ts +4 -2
- package/src/cli/localNode.ts +21 -3
- package/src/client/core.ts +9 -1
- package/src/client/index.ts +0 -1
- package/src/core/crypto/index.ts +0 -1
- package/src/core/crypto/multiEd25519.ts +2 -2
- package/src/core/crypto/multiKey.ts +2 -2
- package/src/core/crypto/singleKey.ts +1 -1
- package/src/core/index.ts +0 -1
- package/src/errors/index.ts +6 -4
- package/src/index.ts +0 -1
- package/src/internal/account.ts +9 -6
- package/src/internal/general.ts +3 -1
- package/src/internal/{ans.ts → mns.ts} +644 -86
- package/src/transactions/authenticator/index.ts +0 -1
- package/src/transactions/index.ts +0 -1
- package/src/transactions/instances/index.ts +0 -1
- package/src/transactions/instances/transactionArgument.ts +1 -1
- package/src/transactions/management/transactionWorker.ts +3 -1
- package/src/transactions/transactionBuilder/index.ts +0 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +11 -3
- package/src/transactions/typeTag/index.ts +3 -2
- package/src/types/indexer.ts +6 -1
- package/src/version.ts +1 -1
- package/dist/esm/api/ans.mjs +0 -2
- package/dist/esm/chunk-C5TXUD5K.mjs +0 -4
- package/dist/esm/chunk-C5TXUD5K.mjs.map +0 -1
- package/dist/esm/chunk-HL2JMZ7N.mjs +0 -2
- package/dist/esm/chunk-HL2JMZ7N.mjs.map +0 -1
- package/dist/esm/chunk-I6YGBK5S.mjs.map +0 -1
- package/dist/esm/chunk-P6MFR7W6.mjs +0 -2
- package/dist/esm/chunk-P7DJNENM.mjs.map +0 -1
- package/dist/esm/chunk-UVP74ONT.mjs.map +0 -1
- package/dist/esm/internal/ans.mjs +0 -2
- /package/dist/esm/api/{ans.mjs.map → mns.mjs.map} +0 -0
- /package/dist/esm/{chunk-YFFYA5U3.mjs.map → chunk-7AJK3QMK.mjs.map} +0 -0
- /package/dist/esm/{chunk-WVF47V5E.mjs.map → chunk-E3O3YOFD.mjs.map} +0 -0
- /package/dist/esm/{chunk-O7XWQTYM.mjs.map → chunk-GTWNSTVB.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZGBIH6MJ.mjs.map → chunk-HX7XBUOY.mjs.map} +0 -0
- /package/dist/esm/{chunk-5KMDJLYM.mjs.map → chunk-POOO2OP5.mjs.map} +0 -0
- /package/dist/esm/{chunk-SZG3ZZGN.mjs.map → chunk-Q2IJWWWU.mjs.map} +0 -0
- /package/dist/esm/{chunk-3KNJ4VWA.mjs.map → chunk-Q55N5DU3.mjs.map} +0 -0
- /package/dist/esm/{chunk-46MDTYYN.mjs.map → chunk-YXS3R2MX.mjs.map} +0 -0
- /package/dist/esm/internal/{ans.mjs.map → mns.mjs.map} +0 -0
|
@@ -22,17 +22,32 @@ import {
|
|
|
22
22
|
renewDomain,
|
|
23
23
|
setPrimaryName,
|
|
24
24
|
setTargetAddress,
|
|
25
|
-
|
|
25
|
+
// Subdomain key staking functions
|
|
26
|
+
getKeyBuyPrice,
|
|
27
|
+
getKeySellPrice,
|
|
28
|
+
buyAndStakeKeyForSubdomain,
|
|
29
|
+
stakeKeyForSubdomain,
|
|
30
|
+
unstakeKeyForSubdomain,
|
|
31
|
+
unstakeAndSellKeyForSubdomain,
|
|
32
|
+
// Additional router functions
|
|
33
|
+
canRegister,
|
|
34
|
+
isNameOwner,
|
|
35
|
+
getTokenAddress,
|
|
36
|
+
clearTargetAddress,
|
|
37
|
+
buyKeys,
|
|
38
|
+
sellKeys,
|
|
39
|
+
getDomainPrice,
|
|
40
|
+
} from "../internal/mns";
|
|
26
41
|
import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
|
|
27
42
|
import { InputGenerateTransactionOptions } from "../transactions/types";
|
|
28
|
-
import {
|
|
43
|
+
import { GetMNSNameResponse } from "../types";
|
|
29
44
|
import { MovementConfig } from "./movementConfig";
|
|
30
45
|
|
|
31
46
|
/**
|
|
32
|
-
* A class to handle all `
|
|
33
|
-
* @group
|
|
47
|
+
* A class to handle all `MNS` (Movement Name Service) operations.
|
|
48
|
+
* @group MNS
|
|
34
49
|
*/
|
|
35
|
-
export class
|
|
50
|
+
export class MNS {
|
|
36
51
|
/**
|
|
37
52
|
* Initializes a new instance of the Movement class with the provided configuration.
|
|
38
53
|
* This allows you to interact with the Movement blockchain using the specified network settings.
|
|
@@ -53,13 +68,13 @@ export class ANS {
|
|
|
53
68
|
* // Initialize the Movement client with the configuration
|
|
54
69
|
* const movement = new Movement(config);
|
|
55
70
|
*
|
|
56
|
-
* console.log("Movement client initialized:",
|
|
71
|
+
* console.log("Movement client initialized:", movement);
|
|
57
72
|
* }
|
|
58
73
|
* runExample().catch(console.error);
|
|
59
74
|
* ```
|
|
60
|
-
* @group
|
|
75
|
+
* @group MNS
|
|
61
76
|
*/
|
|
62
|
-
constructor(readonly config: MovementConfig) {
|
|
77
|
+
constructor(readonly config: MovementConfig) {}
|
|
63
78
|
|
|
64
79
|
/**
|
|
65
80
|
* Retrieve the owner address of a specified domain name or subdomain name from the contract.
|
|
@@ -77,13 +92,13 @@ export class ANS {
|
|
|
77
92
|
* const movement = new Movement(config);
|
|
78
93
|
*
|
|
79
94
|
* async function runExample() {
|
|
80
|
-
* // Retrieve the owner address of "test.
|
|
81
|
-
* const owner = await movement.getOwnerAddress({ name: "test.
|
|
95
|
+
* // Retrieve the owner address of "test.move"
|
|
96
|
+
* const owner = await movement.getOwnerAddress({ name: "test.move" });
|
|
82
97
|
* console.log(owner); // Logs the owner address or undefined if not owned
|
|
83
98
|
* }
|
|
84
99
|
* runExample().catch(console.error);
|
|
85
100
|
* ```
|
|
86
|
-
* @group
|
|
101
|
+
* @group MNS
|
|
87
102
|
*/
|
|
88
103
|
async getOwnerAddress(args: { name: string }): Promise<AccountAddress | undefined> {
|
|
89
104
|
return getOwnerAddress({ movementConfig: this.config, ...args });
|
|
@@ -105,15 +120,15 @@ export class ANS {
|
|
|
105
120
|
* const movement = new Movement(config);
|
|
106
121
|
*
|
|
107
122
|
* async function runExample() {
|
|
108
|
-
* // Get the expiration time for the domain "test.
|
|
109
|
-
* const exp = await movement.getExpiration({ name: "test.
|
|
123
|
+
* // Get the expiration time for the domain "test.move"
|
|
124
|
+
* const exp = await movement.getExpiration({ name: "test.move" });
|
|
110
125
|
*
|
|
111
126
|
* // Log the expiration date
|
|
112
127
|
* console.log(new Date(exp)); // Outputs the expiration date
|
|
113
128
|
* }
|
|
114
129
|
* runExample().catch(console.error);
|
|
115
130
|
* ```
|
|
116
|
-
* @group
|
|
131
|
+
* @group MNS
|
|
117
132
|
*/
|
|
118
133
|
async getExpiration(args: { name: string }): Promise<number | undefined> {
|
|
119
134
|
return getExpiration({ movementConfig: this.config, ...args });
|
|
@@ -125,7 +140,7 @@ export class ANS {
|
|
|
125
140
|
*
|
|
126
141
|
* @param args - The arguments for retrieving the target address.
|
|
127
142
|
* @param args.name - A string representing the name, which can be a primary name, a subdomain, or a combination (e.g.,
|
|
128
|
-
* "primary", "primary.
|
|
143
|
+
* "primary", "primary.move", "secondary.primary", "secondary.primary.move").
|
|
129
144
|
*
|
|
130
145
|
* @returns AccountAddress if the name has a target, undefined otherwise.
|
|
131
146
|
*
|
|
@@ -138,13 +153,13 @@ export class ANS {
|
|
|
138
153
|
*
|
|
139
154
|
* async function runExample() {
|
|
140
155
|
* // Retrieve the target address for the specified domain name
|
|
141
|
-
* const targetAddr = await movement.getTargetAddress({ name: "test.
|
|
156
|
+
* const targetAddr = await movement.getTargetAddress({ name: "test.move" });
|
|
142
157
|
*
|
|
143
158
|
* console.log(targetAddr); // Logs the target address, e.g., 0x123...
|
|
144
159
|
* }
|
|
145
160
|
* runExample().catch(console.error);
|
|
146
161
|
* ```
|
|
147
|
-
* @group
|
|
162
|
+
* @group MNS
|
|
148
163
|
*/
|
|
149
164
|
async getTargetAddress(args: { name: string }): Promise<AccountAddress | undefined> {
|
|
150
165
|
return getTargetAddress({ movementConfig: this.config, ...args });
|
|
@@ -156,7 +171,7 @@ export class ANS {
|
|
|
156
171
|
*
|
|
157
172
|
* @param args - The arguments for setting the target address.
|
|
158
173
|
* @param args.sender - The account initiating the transaction.
|
|
159
|
-
* @param args.name - A string representing the domain or subdomain name (e.g., "test.
|
|
174
|
+
* @param args.name - A string representing the domain or subdomain name (e.g., "test.move").
|
|
160
175
|
* @param args.address - The AccountAddressInput of the address to set the domain or subdomain to.
|
|
161
176
|
* @param args.options - Optional settings for generating the transaction.
|
|
162
177
|
*
|
|
@@ -176,16 +191,16 @@ export class ANS {
|
|
|
176
191
|
*
|
|
177
192
|
* await movement.setTargetAddress({
|
|
178
193
|
* sender: sender,
|
|
179
|
-
* name: "test.
|
|
194
|
+
* name: "test.move",
|
|
180
195
|
* address: address,
|
|
181
196
|
* });
|
|
182
197
|
*
|
|
183
|
-
* const targetAddress = await movement.getTargetAddress({ name: "test.
|
|
184
|
-
* console.log(targetAddress); // Should log the address set for "test.
|
|
198
|
+
* const targetAddress = await movement.getTargetAddress({ name: "test.move" });
|
|
199
|
+
* console.log(targetAddress); // Should log the address set for "test.move"
|
|
185
200
|
* }
|
|
186
201
|
* runExample().catch(console.error);
|
|
187
202
|
* ```
|
|
188
|
-
* @group
|
|
203
|
+
* @group MNS
|
|
189
204
|
*/
|
|
190
205
|
async setTargetAddress(args: {
|
|
191
206
|
sender: Account;
|
|
@@ -218,7 +233,7 @@ export class ANS {
|
|
|
218
233
|
* }
|
|
219
234
|
* runExample().catch(console.error);
|
|
220
235
|
* ```
|
|
221
|
-
* @group
|
|
236
|
+
* @group MNS
|
|
222
237
|
*/
|
|
223
238
|
async getPrimaryName(args: { address: AccountAddressInput }): Promise<string | undefined> {
|
|
224
239
|
return getPrimaryName({ movementConfig: this.config, ...args });
|
|
@@ -230,7 +245,7 @@ export class ANS {
|
|
|
230
245
|
*
|
|
231
246
|
* @param args - The arguments for setting the primary name.
|
|
232
247
|
* @param args.sender - The sender account.
|
|
233
|
-
* @param args.name - A string representing the name to set as primary (e.g., "test.
|
|
248
|
+
* @param args.name - A string representing the name to set as primary (e.g., "test.move").
|
|
234
249
|
* @param args.options - Optional transaction options.
|
|
235
250
|
*
|
|
236
251
|
* @returns SimpleTransaction
|
|
@@ -245,14 +260,14 @@ export class ANS {
|
|
|
245
260
|
* async function runExample() {
|
|
246
261
|
* // Set the primary name for the sender account
|
|
247
262
|
* const sender = Account.generate(); // replace with a real account
|
|
248
|
-
* await movement.setPrimaryName({ sender, name: "test.
|
|
263
|
+
* await movement.setPrimaryName({ sender, name: "test.move" });
|
|
249
264
|
*
|
|
250
265
|
* const primaryName = await movement.getPrimaryName({ address: sender.accountAddress });
|
|
251
|
-
* console.log("Primary Name:", primaryName); // Should log: "Primary Name: test.
|
|
266
|
+
* console.log("Primary Name:", primaryName); // Should log: "Primary Name: test.move"
|
|
252
267
|
* }
|
|
253
268
|
* runExample().catch(console.error);
|
|
254
269
|
* ```
|
|
255
|
-
* @group
|
|
270
|
+
* @group MNS
|
|
256
271
|
*/
|
|
257
272
|
async setPrimaryName(args: {
|
|
258
273
|
sender: Account;
|
|
@@ -268,8 +283,8 @@ export class ANS {
|
|
|
268
283
|
* This function allows you to register a domain or subdomain name with specific expiration policies and options.
|
|
269
284
|
*
|
|
270
285
|
* @param args.sender - The sender account.
|
|
271
|
-
* @param args.name - A string of the name to register. This can be inclusive or exclusive of the .
|
|
272
|
-
* "test", "test.
|
|
286
|
+
* @param args.name - A string of the name to register. This can be inclusive or exclusive of the .move suffix. Examples include:
|
|
287
|
+
* "test", "test.move", "test.movement.move", etc.
|
|
273
288
|
* @param args.expiration - An object with the expiration policy of the name.
|
|
274
289
|
* @param args.expiration.policy - 'domain' | 'subdomain:follow-domain' | 'subdomain:independent'.
|
|
275
290
|
* - domain: Years is required and the name will expire after the given number of years.
|
|
@@ -293,10 +308,10 @@ export class ANS {
|
|
|
293
308
|
* const movement = new Movement(config);
|
|
294
309
|
*
|
|
295
310
|
* async function runExample() {
|
|
296
|
-
* // Registering a subdomain name assuming def.
|
|
311
|
+
* // Registering a subdomain name assuming def.move is already registered and belongs to the sender alice.
|
|
297
312
|
* const txn = await movement.registerName({
|
|
298
313
|
* sender: "0x1", // replace with a real sender account
|
|
299
|
-
* name: "test.movement.
|
|
314
|
+
* name: "test.movement.move",
|
|
300
315
|
* expiration: {
|
|
301
316
|
* policy: "subdomain:independent",
|
|
302
317
|
* expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000, // expires in 30 days
|
|
@@ -307,7 +322,7 @@ export class ANS {
|
|
|
307
322
|
* }
|
|
308
323
|
* runExample().catch(console.error);
|
|
309
324
|
* ```
|
|
310
|
-
* @group
|
|
325
|
+
* @group MNS
|
|
311
326
|
*/
|
|
312
327
|
async registerName(args: Omit<RegisterNameParameters, "movementConfig">): Promise<SimpleTransaction> {
|
|
313
328
|
return registerName({ movementConfig: this.config, ...args });
|
|
@@ -343,7 +358,7 @@ export class ANS {
|
|
|
343
358
|
* }
|
|
344
359
|
* runExample().catch(console.error);
|
|
345
360
|
* ```
|
|
346
|
-
* @group
|
|
361
|
+
* @group MNS
|
|
347
362
|
*/
|
|
348
363
|
async renewDomain(args: {
|
|
349
364
|
sender: Account;
|
|
@@ -358,10 +373,10 @@ export class ANS {
|
|
|
358
373
|
* Fetches a single name from the indexer based on the provided name argument.
|
|
359
374
|
*
|
|
360
375
|
* @param args - The arguments for retrieving the name.
|
|
361
|
-
* @param args.name - A string of the name to retrieve, e.g. "test.movement.
|
|
362
|
-
* Can be inclusive or exclusive of the .
|
|
376
|
+
* @param args.name - A string of the name to retrieve, e.g. "test.movement.move" or "test.move" or "test".
|
|
377
|
+
* Can be inclusive or exclusive of the .move suffix and can be a subdomain.
|
|
363
378
|
*
|
|
364
|
-
* @returns A promise of an
|
|
379
|
+
* @returns A promise of an MNSName or undefined if the name is not active.
|
|
365
380
|
*
|
|
366
381
|
* @example
|
|
367
382
|
* ```typescript
|
|
@@ -372,14 +387,14 @@ export class ANS {
|
|
|
372
387
|
*
|
|
373
388
|
* async function runExample() {
|
|
374
389
|
* // Fetching a name from the indexer
|
|
375
|
-
* const name = await movement.getName({ name: "test.
|
|
390
|
+
* const name = await movement.getName({ name: "test.move" }); // replace with a real name
|
|
376
391
|
* console.log(name);
|
|
377
392
|
* }
|
|
378
393
|
* runExample().catch(console.error);
|
|
379
394
|
* ```
|
|
380
|
-
* @group
|
|
395
|
+
* @group MNS
|
|
381
396
|
*/
|
|
382
|
-
async getName(args: { name: string }): Promise<
|
|
397
|
+
async getName(args: { name: string }): Promise<GetMNSNameResponse[0] | undefined> {
|
|
383
398
|
return getName({ movementConfig: this.config, ...args });
|
|
384
399
|
}
|
|
385
400
|
|
|
@@ -394,7 +409,7 @@ export class ANS {
|
|
|
394
409
|
* @param args.options.orderBy - The order to sort the names by.
|
|
395
410
|
* @param args.options.where - Additional filters to apply to the query.
|
|
396
411
|
*
|
|
397
|
-
* @returns A promise of an array of
|
|
412
|
+
* @returns A promise of an array of MNSName.
|
|
398
413
|
*
|
|
399
414
|
* @example
|
|
400
415
|
* ```typescript
|
|
@@ -417,9 +432,9 @@ export class ANS {
|
|
|
417
432
|
* }
|
|
418
433
|
* runExample().catch(console.error);
|
|
419
434
|
* ```
|
|
420
|
-
* @group
|
|
435
|
+
* @group MNS
|
|
421
436
|
*/
|
|
422
|
-
async getAccountNames(args: GetAccountNamesArgs): Promise<
|
|
437
|
+
async getAccountNames(args: GetAccountNamesArgs): Promise<GetMNSNameResponse> {
|
|
423
438
|
return getAccountNames({ movementConfig: this.config, ...args });
|
|
424
439
|
}
|
|
425
440
|
|
|
@@ -433,7 +448,7 @@ export class ANS {
|
|
|
433
448
|
* @param args.options.orderBy - The order to sort the names by.
|
|
434
449
|
* @param args.options.where - Additional filters to apply to the query.
|
|
435
450
|
*
|
|
436
|
-
* @returns A promise of an array of
|
|
451
|
+
* @returns A promise of an array of MNSName.
|
|
437
452
|
*
|
|
438
453
|
* @example
|
|
439
454
|
* ```typescript
|
|
@@ -460,9 +475,9 @@ export class ANS {
|
|
|
460
475
|
* }
|
|
461
476
|
* runExample().catch(console.error);
|
|
462
477
|
* ```
|
|
463
|
-
* @group
|
|
478
|
+
* @group MNS
|
|
464
479
|
*/
|
|
465
|
-
async getAccountDomains(args: GetAccountDomainsArgs): Promise<
|
|
480
|
+
async getAccountDomains(args: GetAccountDomainsArgs): Promise<GetMNSNameResponse> {
|
|
466
481
|
return getAccountDomains({ movementConfig: this.config, ...args });
|
|
467
482
|
}
|
|
468
483
|
|
|
@@ -477,7 +492,7 @@ export class ANS {
|
|
|
477
492
|
* @param args.options.orderBy - The order to sort the names by.
|
|
478
493
|
* @param args.options.where - Additional filters to apply to the query.
|
|
479
494
|
*
|
|
480
|
-
* @returns A promise of an array of
|
|
495
|
+
* @returns A promise of an array of MNSName.
|
|
481
496
|
*
|
|
482
497
|
* @example
|
|
483
498
|
* ```typescript
|
|
@@ -501,9 +516,9 @@ export class ANS {
|
|
|
501
516
|
* }
|
|
502
517
|
* runExample().catch(console.error);
|
|
503
518
|
* ```
|
|
504
|
-
* @group
|
|
519
|
+
* @group MNS
|
|
505
520
|
*/
|
|
506
|
-
async getAccountSubdomains(args: GetAccountSubdomainsArgs): Promise<
|
|
521
|
+
async getAccountSubdomains(args: GetAccountSubdomainsArgs): Promise<GetMNSNameResponse> {
|
|
507
522
|
return getAccountSubdomains({ movementConfig: this.config, ...args });
|
|
508
523
|
}
|
|
509
524
|
|
|
@@ -511,14 +526,14 @@ export class ANS {
|
|
|
511
526
|
* Fetches all subdomain names for a given domain, excluding the domain itself.
|
|
512
527
|
*
|
|
513
528
|
* @param args - The arguments for fetching subdomains.
|
|
514
|
-
* @param args.domain - A string of the domain name, e.g., "test.
|
|
529
|
+
* @param args.domain - A string of the domain name, e.g., "test.move" or "test" (without the suffix of .move).
|
|
515
530
|
* @param args.options - Optional parameters for fetching subdomains.
|
|
516
531
|
* @param args.options.offset - Optional, the offset to start from when fetching names.
|
|
517
532
|
* @param args.options.limit - Optional, the number of names to fetch per request.
|
|
518
533
|
* @param args.options.orderBy - The order to sort the names by.
|
|
519
534
|
* @param args.options.where - Additional filters to apply to the query.
|
|
520
535
|
*
|
|
521
|
-
* @returns A promise that resolves to an array of
|
|
536
|
+
* @returns A promise that resolves to an array of MNSName.
|
|
522
537
|
*
|
|
523
538
|
* @example
|
|
524
539
|
* ```typescript
|
|
@@ -542,9 +557,380 @@ export class ANS {
|
|
|
542
557
|
* }
|
|
543
558
|
* runExample().catch(console.error);
|
|
544
559
|
* ```
|
|
545
|
-
* @group
|
|
560
|
+
* @group MNS
|
|
546
561
|
*/
|
|
547
|
-
async getDomainSubdomains(args: GetDomainSubdomainsArgs): Promise<
|
|
562
|
+
async getDomainSubdomains(args: GetDomainSubdomainsArgs): Promise<GetMNSNameResponse> {
|
|
548
563
|
return getDomainSubdomains({ movementConfig: this.config, ...args });
|
|
549
564
|
}
|
|
565
|
+
|
|
566
|
+
// ============================================================================
|
|
567
|
+
// Subdomain Key Staking Functions
|
|
568
|
+
// ============================================================================
|
|
569
|
+
// Movement MNS uses a bonding curve mechanism for subdomains where users must
|
|
570
|
+
// buy and stake "keys" to own subdomains.
|
|
571
|
+
// ============================================================================
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Get the price to buy keys for a domain. Each domain has tradeable keys that
|
|
575
|
+
* follow a bonding curve - price increases as more keys are bought.
|
|
576
|
+
*
|
|
577
|
+
* @param args - The arguments for the function.
|
|
578
|
+
* @param args.domainName - The domain name to get the key price for.
|
|
579
|
+
* @param args.amount - The number of keys to get the price for (default: 1).
|
|
580
|
+
*
|
|
581
|
+
* @returns The price in octas to buy the specified number of keys.
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
586
|
+
*
|
|
587
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
588
|
+
* const movement = new Movement(config);
|
|
589
|
+
*
|
|
590
|
+
* async function runExample() {
|
|
591
|
+
* // Get the price to buy 1 key for the "test" domain
|
|
592
|
+
* const price = await movement.getKeyBuyPrice({ domainName: "test" });
|
|
593
|
+
* console.log(`Price to buy 1 key: ${price} octas`);
|
|
594
|
+
* }
|
|
595
|
+
* runExample().catch(console.error);
|
|
596
|
+
* ```
|
|
597
|
+
* @group MNS
|
|
598
|
+
*/
|
|
599
|
+
async getKeyBuyPrice(args: { domainName: string; amount?: number }): Promise<bigint> {
|
|
600
|
+
return getKeyBuyPrice({ movementConfig: this.config, ...args });
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Get the price when selling keys for a domain.
|
|
605
|
+
*
|
|
606
|
+
* @param args - The arguments for the function.
|
|
607
|
+
* @param args.domainName - The domain name to get the sell price for.
|
|
608
|
+
* @param args.amount - The number of keys to get the price for (default: 1).
|
|
609
|
+
*
|
|
610
|
+
* @returns The price in octas received when selling the specified number of keys.
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* ```typescript
|
|
614
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
615
|
+
*
|
|
616
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
617
|
+
* const movement = new Movement(config);
|
|
618
|
+
*
|
|
619
|
+
* async function runExample() {
|
|
620
|
+
* // Get the price when selling 1 key for the "test" domain
|
|
621
|
+
* const price = await movement.getKeySellPrice({ domainName: "test" });
|
|
622
|
+
* console.log(`Price when selling 1 key: ${price} octas`);
|
|
623
|
+
* }
|
|
624
|
+
* runExample().catch(console.error);
|
|
625
|
+
* ```
|
|
626
|
+
* @group MNS
|
|
627
|
+
*/
|
|
628
|
+
async getKeySellPrice(args: { domainName: string; amount?: number }): Promise<bigint> {
|
|
629
|
+
return getKeySellPrice({ movementConfig: this.config, ...args });
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Buy a key for a domain and stake it to claim a subdomain in one transaction.
|
|
634
|
+
* This is the primary way to register a subdomain on Movement.
|
|
635
|
+
*
|
|
636
|
+
* The price follows a bonding curve - use getKeyBuyPrice() to check the current price.
|
|
637
|
+
*
|
|
638
|
+
* @param args - The arguments for the function.
|
|
639
|
+
* @param args.sender - The account buying and staking the key.
|
|
640
|
+
* @param args.domainName - The parent domain name (e.g., "test" for "sub.test.move").
|
|
641
|
+
* @param args.subdomainName - The subdomain to claim (e.g., "sub" for "sub.test.move").
|
|
642
|
+
* @param args.targetAddress - Optional address this subdomain will resolve to (defaults to sender).
|
|
643
|
+
* @param args.toAddress - Optional address that will own this subdomain (defaults to sender).
|
|
644
|
+
* @param args.referrer - Optional referrer address for fee sharing.
|
|
645
|
+
* @param args.options - Optional transaction options.
|
|
646
|
+
*
|
|
647
|
+
* @returns A transaction object to be signed and submitted.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```typescript
|
|
651
|
+
* import { Movement, MovementConfig, Network, Account } from "@moveindustries/ts-sdk";
|
|
652
|
+
*
|
|
653
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
654
|
+
* const movement = new Movement(config);
|
|
655
|
+
*
|
|
656
|
+
* async function runExample() {
|
|
657
|
+
* const alice = Account.generate();
|
|
658
|
+
* await movement.fundAccount({ accountAddress: alice.accountAddress, amount: 100_000_000 });
|
|
659
|
+
*
|
|
660
|
+
* // Buy a key and stake it to claim "mysubdomain.test.move"
|
|
661
|
+
* const txn = await movement.buyAndStakeKeyForSubdomain({
|
|
662
|
+
* sender: alice,
|
|
663
|
+
* domainName: "test",
|
|
664
|
+
* subdomainName: "mysubdomain",
|
|
665
|
+
* });
|
|
666
|
+
*
|
|
667
|
+
* const result = await movement.signAndSubmitTransaction({ signer: alice, transaction: txn });
|
|
668
|
+
* console.log("Subdomain claimed:", result.hash);
|
|
669
|
+
* }
|
|
670
|
+
* runExample().catch(console.error);
|
|
671
|
+
* ```
|
|
672
|
+
* @group MNS
|
|
673
|
+
*/
|
|
674
|
+
async buyAndStakeKeyForSubdomain(args: {
|
|
675
|
+
sender: Account;
|
|
676
|
+
domainName: string;
|
|
677
|
+
subdomainName: string;
|
|
678
|
+
targetAddress?: AccountAddressInput;
|
|
679
|
+
toAddress?: AccountAddressInput;
|
|
680
|
+
referrer?: AccountAddressInput;
|
|
681
|
+
options?: InputGenerateTransactionOptions;
|
|
682
|
+
}): Promise<SimpleTransaction> {
|
|
683
|
+
return buyAndStakeKeyForSubdomain({ movementConfig: this.config, ...args });
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Stake an existing key to claim a subdomain. You must already own a key for
|
|
688
|
+
* the parent domain.
|
|
689
|
+
*
|
|
690
|
+
* @param args - The arguments for the function.
|
|
691
|
+
* @param args.sender - The account staking the key.
|
|
692
|
+
* @param args.domainName - The parent domain name.
|
|
693
|
+
* @param args.subdomainName - The subdomain to claim.
|
|
694
|
+
* @param args.targetAddress - Optional address this subdomain will resolve to.
|
|
695
|
+
* @param args.toAddress - Optional address that will own this subdomain.
|
|
696
|
+
* @param args.options - Optional transaction options.
|
|
697
|
+
*
|
|
698
|
+
* @returns A transaction object to be signed and submitted.
|
|
699
|
+
* @group MNS
|
|
700
|
+
*/
|
|
701
|
+
async stakeKeyForSubdomain(args: {
|
|
702
|
+
sender: Account;
|
|
703
|
+
domainName: string;
|
|
704
|
+
subdomainName: string;
|
|
705
|
+
targetAddress?: AccountAddressInput;
|
|
706
|
+
toAddress?: AccountAddressInput;
|
|
707
|
+
options?: InputGenerateTransactionOptions;
|
|
708
|
+
}): Promise<SimpleTransaction> {
|
|
709
|
+
return stakeKeyForSubdomain({ movementConfig: this.config, ...args });
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Unstake a key from a subdomain, giving up ownership but keeping the key.
|
|
714
|
+
* You can sell the key later or stake it for a different subdomain.
|
|
715
|
+
*
|
|
716
|
+
* @param args - The arguments for the function.
|
|
717
|
+
* @param args.sender - The account unstaking the key.
|
|
718
|
+
* @param args.domainName - The parent domain name.
|
|
719
|
+
* @param args.subdomainName - The subdomain to release.
|
|
720
|
+
* @param args.options - Optional transaction options.
|
|
721
|
+
*
|
|
722
|
+
* @returns A transaction object to be signed and submitted.
|
|
723
|
+
* @group MNS
|
|
724
|
+
*/
|
|
725
|
+
async unstakeKeyForSubdomain(args: {
|
|
726
|
+
sender: Account;
|
|
727
|
+
domainName: string;
|
|
728
|
+
subdomainName: string;
|
|
729
|
+
options?: InputGenerateTransactionOptions;
|
|
730
|
+
}): Promise<SimpleTransaction> {
|
|
731
|
+
return unstakeKeyForSubdomain({ movementConfig: this.config, ...args });
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Unstake a key from a subdomain and sell it in one transaction.
|
|
736
|
+
* This gives up the subdomain and converts the key back to MOVE tokens.
|
|
737
|
+
*
|
|
738
|
+
* @param args - The arguments for the function.
|
|
739
|
+
* @param args.sender - The account unstaking and selling the key.
|
|
740
|
+
* @param args.domainName - The parent domain name.
|
|
741
|
+
* @param args.subdomainName - The subdomain to release.
|
|
742
|
+
* @param args.referrer - Optional referrer address for fee sharing.
|
|
743
|
+
* @param args.options - Optional transaction options.
|
|
744
|
+
*
|
|
745
|
+
* @returns A transaction object to be signed and submitted.
|
|
746
|
+
* @group MNS
|
|
747
|
+
*/
|
|
748
|
+
async unstakeAndSellKeyForSubdomain(args: {
|
|
749
|
+
sender: Account;
|
|
750
|
+
domainName: string;
|
|
751
|
+
subdomainName: string;
|
|
752
|
+
referrer?: AccountAddressInput;
|
|
753
|
+
options?: InputGenerateTransactionOptions;
|
|
754
|
+
}): Promise<SimpleTransaction> {
|
|
755
|
+
return unstakeAndSellKeyForSubdomain({ movementConfig: this.config, ...args });
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// ============================================================================
|
|
759
|
+
// Additional Router Functions
|
|
760
|
+
// ============================================================================
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Check if a name (domain or subdomain) is available for registration.
|
|
764
|
+
*
|
|
765
|
+
* @param args - The arguments for the function.
|
|
766
|
+
* @param args.name - The name to check (e.g., "test" or "sub.test").
|
|
767
|
+
* @param args.account - The account address that would register the name.
|
|
768
|
+
*
|
|
769
|
+
* @returns True if the name can be registered by the account, false otherwise.
|
|
770
|
+
*
|
|
771
|
+
* @example
|
|
772
|
+
* ```typescript
|
|
773
|
+
* const canReg = await movement.canRegister({
|
|
774
|
+
* name: "mynewdomain",
|
|
775
|
+
* account: alice.accountAddress,
|
|
776
|
+
* });
|
|
777
|
+
* console.log(canReg ? "Available!" : "Already taken");
|
|
778
|
+
* ```
|
|
779
|
+
* @group MNS
|
|
780
|
+
*/
|
|
781
|
+
async canRegister(args: { name: string; account: AccountAddressInput }): Promise<boolean> {
|
|
782
|
+
return canRegister({ movementConfig: this.config, ...args });
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Check if a specific address owns a name.
|
|
787
|
+
*
|
|
788
|
+
* @param args - The arguments for the function.
|
|
789
|
+
* @param args.name - The name to check ownership of.
|
|
790
|
+
* @param args.account - The account address to check.
|
|
791
|
+
*
|
|
792
|
+
* @returns True if the account owns the name, false otherwise.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```typescript
|
|
796
|
+
* const isOwner = await movement.isNameOwner({
|
|
797
|
+
* name: "test.move",
|
|
798
|
+
* account: alice.accountAddress,
|
|
799
|
+
* });
|
|
800
|
+
* ```
|
|
801
|
+
* @group MNS
|
|
802
|
+
*/
|
|
803
|
+
async isNameOwner(args: { name: string; account: AccountAddressInput }): Promise<boolean> {
|
|
804
|
+
return isNameOwner({ movementConfig: this.config, ...args });
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Get the NFT token address for a domain or subdomain.
|
|
809
|
+
*
|
|
810
|
+
* @param args - The arguments for the function.
|
|
811
|
+
* @param args.name - The name to get the token address for.
|
|
812
|
+
*
|
|
813
|
+
* @returns The token address, or undefined if the name doesn't exist.
|
|
814
|
+
* @group MNS
|
|
815
|
+
*/
|
|
816
|
+
async getTokenAddress(args: { name: string }): Promise<AccountAddress | undefined> {
|
|
817
|
+
return getTokenAddress({ movementConfig: this.config, ...args });
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Clear the target address for a domain or subdomain, stopping it from resolving.
|
|
822
|
+
*
|
|
823
|
+
* @param args - The arguments for the function.
|
|
824
|
+
* @param args.sender - The account that owns the name.
|
|
825
|
+
* @param args.name - The name to clear the target address for.
|
|
826
|
+
* @param args.options - Optional transaction options.
|
|
827
|
+
*
|
|
828
|
+
* @returns A transaction object to be signed and submitted.
|
|
829
|
+
*
|
|
830
|
+
* @example
|
|
831
|
+
* ```typescript
|
|
832
|
+
* // Stop "test.move" from resolving to any address
|
|
833
|
+
* const txn = await movement.clearTargetAddress({
|
|
834
|
+
* sender: alice,
|
|
835
|
+
* name: "test.move",
|
|
836
|
+
* });
|
|
837
|
+
* ```
|
|
838
|
+
* @group MNS
|
|
839
|
+
*/
|
|
840
|
+
async clearTargetAddress(args: {
|
|
841
|
+
sender: Account;
|
|
842
|
+
name: string;
|
|
843
|
+
options?: InputGenerateTransactionOptions;
|
|
844
|
+
}): Promise<SimpleTransaction> {
|
|
845
|
+
return clearTargetAddress({ movementConfig: this.config, ...args });
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Buy keys for a domain without staking them for a subdomain.
|
|
850
|
+
* Keys can be held for speculation or staked later via stakeKeyForSubdomain.
|
|
851
|
+
*
|
|
852
|
+
* @param args - The arguments for the function.
|
|
853
|
+
* @param args.sender - The account buying the keys.
|
|
854
|
+
* @param args.domainName - The domain to buy keys for.
|
|
855
|
+
* @param args.amount - The number of keys to buy.
|
|
856
|
+
* @param args.referrer - Optional referrer address for fee sharing.
|
|
857
|
+
* @param args.options - Optional transaction options.
|
|
858
|
+
*
|
|
859
|
+
* @returns A transaction object to be signed and submitted.
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* ```typescript
|
|
863
|
+
* // Buy 2 keys for speculation
|
|
864
|
+
* const txn = await movement.buyKeys({
|
|
865
|
+
* sender: alice,
|
|
866
|
+
* domainName: "popular-domain",
|
|
867
|
+
* amount: 2,
|
|
868
|
+
* });
|
|
869
|
+
* ```
|
|
870
|
+
* @group MNS
|
|
871
|
+
*/
|
|
872
|
+
async buyKeys(args: {
|
|
873
|
+
sender: Account;
|
|
874
|
+
domainName: string;
|
|
875
|
+
amount: number;
|
|
876
|
+
referrer?: AccountAddressInput;
|
|
877
|
+
options?: InputGenerateTransactionOptions;
|
|
878
|
+
}): Promise<SimpleTransaction> {
|
|
879
|
+
return buyKeys({ movementConfig: this.config, ...args });
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Sell keys for a domain back to the bonding curve.
|
|
884
|
+
*
|
|
885
|
+
* @param args - The arguments for the function.
|
|
886
|
+
* @param args.sender - The account selling the keys.
|
|
887
|
+
* @param args.domainName - The domain to sell keys for.
|
|
888
|
+
* @param args.amount - The number of keys to sell.
|
|
889
|
+
* @param args.referrer - Optional referrer address for fee sharing.
|
|
890
|
+
* @param args.options - Optional transaction options.
|
|
891
|
+
*
|
|
892
|
+
* @returns A transaction object to be signed and submitted.
|
|
893
|
+
*
|
|
894
|
+
* @example
|
|
895
|
+
* ```typescript
|
|
896
|
+
* // Sell 1 key back
|
|
897
|
+
* const txn = await movement.sellKeys({
|
|
898
|
+
* sender: alice,
|
|
899
|
+
* domainName: "popular-domain",
|
|
900
|
+
* amount: 1,
|
|
901
|
+
* });
|
|
902
|
+
* ```
|
|
903
|
+
* @group MNS
|
|
904
|
+
*/
|
|
905
|
+
async sellKeys(args: {
|
|
906
|
+
sender: Account;
|
|
907
|
+
domainName: string;
|
|
908
|
+
amount: number;
|
|
909
|
+
referrer?: AccountAddressInput;
|
|
910
|
+
options?: InputGenerateTransactionOptions;
|
|
911
|
+
}): Promise<SimpleTransaction> {
|
|
912
|
+
return sellKeys({ movementConfig: this.config, ...args });
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Get the registration price for a domain name.
|
|
917
|
+
* Price varies based on domain length and registration duration.
|
|
918
|
+
*
|
|
919
|
+
* @param args - The arguments for the function.
|
|
920
|
+
* @param args.name - The domain name to get the price for.
|
|
921
|
+
* @param args.years - Number of years to register (default: 1).
|
|
922
|
+
*
|
|
923
|
+
* @returns The price in octas to register the domain.
|
|
924
|
+
*
|
|
925
|
+
* @example
|
|
926
|
+
* ```typescript
|
|
927
|
+
* // Check price before registering
|
|
928
|
+
* const price = await movement.getDomainPrice({ name: "mynewdomain" });
|
|
929
|
+
* console.log(`Registration costs ${price} octas (${Number(price) / 1e8} MOVE)`);
|
|
930
|
+
* ```
|
|
931
|
+
* @group MNS
|
|
932
|
+
*/
|
|
933
|
+
async getDomainPrice(args: { name: string; years?: number }): Promise<bigint> {
|
|
934
|
+
return getDomainPrice({ movementConfig: this.config, ...args });
|
|
935
|
+
}
|
|
550
936
|
}
|