@ar.io/sdk 3.17.1 → 3.18.0-alpha.1
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 +13 -1
- package/bundles/web.bundle.min.js +38 -38
- package/lib/cjs/cli/cli.js +6 -0
- package/lib/cjs/cli/commands/arnsPurchaseCommands.js +16 -3
- package/lib/cjs/common/io.js +81 -0
- package/lib/cjs/utils/ao.js +3 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +7 -1
- package/lib/esm/cli/commands/arnsPurchaseCommands.js +15 -3
- package/lib/esm/common/io.js +81 -0
- package/lib/esm/utils/ao.js +3 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +4 -1
- package/lib/types/common/io.d.ts +10 -4
- package/lib/types/types/common.d.ts +23 -1
- package/lib/types/types/io.d.ts +3 -2
- package/lib/types/utils/ao.d.ts +1 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/cli/cli.js
CHANGED
|
@@ -438,6 +438,12 @@ const utils_js_1 = require("./utils.js");
|
|
|
438
438
|
options: options_js_1.arnsPurchaseOptions,
|
|
439
439
|
action: arnsPurchaseCommands_js_1.requestPrimaryNameCLICommand,
|
|
440
440
|
});
|
|
441
|
+
(0, utils_js_1.makeCommand)({
|
|
442
|
+
name: 'set-primary-name',
|
|
443
|
+
description: 'Set an ArNS name you own as your primary name',
|
|
444
|
+
options: options_js_1.arnsPurchaseOptions,
|
|
445
|
+
action: arnsPurchaseCommands_js_1.setPrimaryNameCLICommand,
|
|
446
|
+
});
|
|
441
447
|
// # ANT Registry
|
|
442
448
|
(0, utils_js_1.makeCommand)({
|
|
443
449
|
name: 'get-ants-for-address',
|
|
@@ -5,6 +5,7 @@ exports.upgradeRecordCLICommand = upgradeRecordCLICommand;
|
|
|
5
5
|
exports.extendLeaseCLICommand = extendLeaseCLICommand;
|
|
6
6
|
exports.increaseUndernameLimitCLICommand = increaseUndernameLimitCLICommand;
|
|
7
7
|
exports.requestPrimaryNameCLICommand = requestPrimaryNameCLICommand;
|
|
8
|
+
exports.setPrimaryNameCLICommand = setPrimaryNameCLICommand;
|
|
8
9
|
/**
|
|
9
10
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
10
11
|
*
|
|
@@ -176,8 +177,6 @@ async function requestPrimaryNameCLICommand(o) {
|
|
|
176
177
|
const referrer = (0, utils_js_1.referrerFromOptions)(o);
|
|
177
178
|
const name = (0, utils_js_1.requiredStringFromOptions)(o, 'name');
|
|
178
179
|
if (!o.skipConfirmation) {
|
|
179
|
-
// TODO: Assert name requested is not already owned?
|
|
180
|
-
// TODO: More assertions?
|
|
181
180
|
await (0, utils_js_1.assertEnoughBalanceForArNSPurchase)({
|
|
182
181
|
ario,
|
|
183
182
|
address: signerAddress,
|
|
@@ -190,10 +189,24 @@ async function requestPrimaryNameCLICommand(o) {
|
|
|
190
189
|
});
|
|
191
190
|
await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to request the primary name ${name}?`, o);
|
|
192
191
|
}
|
|
193
|
-
|
|
192
|
+
const { result } = await ario.requestPrimaryName({
|
|
194
193
|
name,
|
|
195
194
|
fundFrom,
|
|
196
195
|
paidBy: (0, utils_js_1.stringArrayFromOptions)(o, 'paidBy'),
|
|
197
196
|
referrer,
|
|
198
197
|
}, (0, utils_js_1.customTagsFromOptions)(o));
|
|
198
|
+
if (result?.request === undefined) {
|
|
199
|
+
throw new Error('Failed to request primary name for name ' + name);
|
|
200
|
+
}
|
|
201
|
+
return result.request;
|
|
202
|
+
}
|
|
203
|
+
async function setPrimaryNameCLICommand(o) {
|
|
204
|
+
const { ario, signerAddress } = (0, utils_js_1.writeARIOFromOptions)(o);
|
|
205
|
+
const name = (0, utils_js_1.requiredStringFromOptions)(o, 'name');
|
|
206
|
+
const fundFrom = (0, utils_js_1.fundFromFromOptions)(o);
|
|
207
|
+
const referrer = (0, utils_js_1.referrerFromOptions)(o);
|
|
208
|
+
if (!o.skipConfirmation) {
|
|
209
|
+
await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to set the primary name ${name} for address ${signerAddress}?`, o);
|
|
210
|
+
}
|
|
211
|
+
return ario.setPrimaryName({ name, fundFrom, referrer });
|
|
199
212
|
}
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -101,10 +101,12 @@ class ARIOReadable {
|
|
|
101
101
|
process;
|
|
102
102
|
epochSettings;
|
|
103
103
|
arweave;
|
|
104
|
+
hyperbeamUrl;
|
|
104
105
|
paymentProvider; // TODO: this could be an array/map of payment providers
|
|
105
106
|
logger = logger_js_1.Logger.default;
|
|
106
107
|
constructor(config) {
|
|
107
108
|
this.arweave = config?.arweave ?? arweave_js_2.defaultArweave;
|
|
109
|
+
this.hyperbeamUrl = config?.hyperbeamUrl;
|
|
108
110
|
if (config === undefined || Object.keys(config).length === 0) {
|
|
109
111
|
this.process = new ao_process_js_1.AOProcess({
|
|
110
112
|
processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
|
|
@@ -684,6 +686,7 @@ class ARIOReadable {
|
|
|
684
686
|
async getArNSRecordsForAddress(params) {
|
|
685
687
|
const { antRegistryId = constants_js_1.ANT_REGISTRY_ID, address } = params;
|
|
686
688
|
const antRegistry = ant_registry_js_1.ANTRegistry.init({
|
|
689
|
+
hyperbeamUrl: this.hyperbeamUrl,
|
|
687
690
|
process: new ao_process_js_1.AOProcess({
|
|
688
691
|
ao: this.process.ao,
|
|
689
692
|
processId: antRegistryId,
|
|
@@ -1194,6 +1197,84 @@ class ARIOWriteable extends ARIOReadable {
|
|
|
1194
1197
|
tags: (0, arweave_js_1.pruneTags)(allTags),
|
|
1195
1198
|
});
|
|
1196
1199
|
}
|
|
1200
|
+
async setPrimaryName(params, options) {
|
|
1201
|
+
options?.onSigningProgress?.('requesting-primary-name', {
|
|
1202
|
+
name: params.name,
|
|
1203
|
+
fundFrom: params.fundFrom,
|
|
1204
|
+
referrer: params.referrer,
|
|
1205
|
+
});
|
|
1206
|
+
// create the primary name request, if it already exists, get the request and base name owner
|
|
1207
|
+
const requestResult = await this.requestPrimaryName(params, options).catch(async (error) => {
|
|
1208
|
+
// check for the error message, it may be due to the request already being made
|
|
1209
|
+
if (error.message.includes('already exists')) {
|
|
1210
|
+
// parse out the initiator from the error message ` "Primary name request by '" .. initiator .. "' for '" .. name .. "' already exists"
|
|
1211
|
+
const initiator = error.message.match(/by '([^']+)'/)?.[1];
|
|
1212
|
+
if (initiator === undefined) {
|
|
1213
|
+
throw error;
|
|
1214
|
+
}
|
|
1215
|
+
options?.onSigningProgress?.('request-already-exists', {
|
|
1216
|
+
name: params.name,
|
|
1217
|
+
initiator,
|
|
1218
|
+
});
|
|
1219
|
+
// get the primary name request
|
|
1220
|
+
const primaryNameRequest = await this.getPrimaryNameRequest({
|
|
1221
|
+
initiator,
|
|
1222
|
+
});
|
|
1223
|
+
// check the name exists
|
|
1224
|
+
const arnsRecord = await this.getArNSRecord({ name: params.name });
|
|
1225
|
+
if (arnsRecord === undefined) {
|
|
1226
|
+
throw new Error(`ARNS name '${params.name}' does not exist`);
|
|
1227
|
+
}
|
|
1228
|
+
if (primaryNameRequest.initiator !== initiator) {
|
|
1229
|
+
throw new Error(`Primary name request for name '${params.name}' was not approved`);
|
|
1230
|
+
}
|
|
1231
|
+
return {
|
|
1232
|
+
id: 'stub-id', // stub-id to indicate that the request already exists
|
|
1233
|
+
result: {
|
|
1234
|
+
// this is a partial stub of the AoCreatePrimaryNameRequest result
|
|
1235
|
+
// we only need the request and base name owner for the approval
|
|
1236
|
+
request: primaryNameRequest,
|
|
1237
|
+
baseNameOwner: arnsRecord.processId,
|
|
1238
|
+
fundingPlan: {
|
|
1239
|
+
address: initiator,
|
|
1240
|
+
},
|
|
1241
|
+
},
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
// throw any other errors from the contract
|
|
1245
|
+
throw error;
|
|
1246
|
+
});
|
|
1247
|
+
// the result is either a new primary name request or an existing one
|
|
1248
|
+
// for new primary name requests the result includes the request, funding plan, and base name owner
|
|
1249
|
+
// for existing primary name requests the result includes just the request and base name owner (see above)
|
|
1250
|
+
const primaryNameRequest = requestResult.result;
|
|
1251
|
+
const antProcessId = primaryNameRequest?.baseNameOwner;
|
|
1252
|
+
const initiator = primaryNameRequest?.fundingPlan?.address;
|
|
1253
|
+
if (primaryNameRequest === undefined ||
|
|
1254
|
+
initiator === undefined ||
|
|
1255
|
+
antProcessId === undefined) {
|
|
1256
|
+
throw new Error(`Failed to request primary name ${params.name} for ${initiator} owned by ${antProcessId} process`);
|
|
1257
|
+
}
|
|
1258
|
+
options?.onSigningProgress?.('approving-request', {
|
|
1259
|
+
name: params.name,
|
|
1260
|
+
processId: antProcessId,
|
|
1261
|
+
request: primaryNameRequest.request,
|
|
1262
|
+
});
|
|
1263
|
+
const antClient = ant_js_1.ANT.init({
|
|
1264
|
+
process: new ao_process_js_1.AOProcess({
|
|
1265
|
+
processId: antProcessId,
|
|
1266
|
+
ao: this.process.ao,
|
|
1267
|
+
}),
|
|
1268
|
+
signer: this.signer,
|
|
1269
|
+
});
|
|
1270
|
+
// approve the primary name request with the ant
|
|
1271
|
+
const approveResult = await antClient.approvePrimaryNameRequest({
|
|
1272
|
+
name: params.name,
|
|
1273
|
+
address: initiator,
|
|
1274
|
+
arioProcessId: this.process.processId,
|
|
1275
|
+
}, options);
|
|
1276
|
+
return approveResult;
|
|
1277
|
+
}
|
|
1197
1278
|
/**
|
|
1198
1279
|
* Redelegate stake from one gateway to another gateway.
|
|
1199
1280
|
*
|
package/lib/cjs/utils/ao.js
CHANGED
|
@@ -362,9 +362,11 @@ function errorMessageFromOutput(output) {
|
|
|
362
362
|
const error = errorData ??
|
|
363
363
|
output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')?.value;
|
|
364
364
|
if (error !== undefined) {
|
|
365
|
+
const errorStackTrace = output.Messages?.[0]?.Data;
|
|
366
|
+
const errorMessage = errorStackTrace ?? error;
|
|
365
367
|
// Regex to match AO error messages like: [string ".src.main"]:5111: Primary name data not found
|
|
366
368
|
// or [string "aos"]:128: some error
|
|
367
|
-
const match =
|
|
369
|
+
const match = errorMessage?.match(/\[string "(.+)"\]:(\d+):\s*(.*)/);
|
|
368
370
|
if (match) {
|
|
369
371
|
// The first group is the src file, the second is the line number, and the third is the error message
|
|
370
372
|
const [, , lineNumber, errorMessage] = match;
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/cli/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ import { AOProcess, spawnANT } from '../node/index.js';
|
|
|
20
20
|
import { mARIOToken } from '../types/token.js';
|
|
21
21
|
import { version } from '../version.js';
|
|
22
22
|
import { setAntBaseNameCLICommand, setAntRecordCLICommand, } from './commands/antCommands.js';
|
|
23
|
-
import { buyRecordCLICommand, extendLeaseCLICommand, increaseUndernameLimitCLICommand, requestPrimaryNameCLICommand, upgradeRecordCLICommand, } from './commands/arnsPurchaseCommands.js';
|
|
23
|
+
import { buyRecordCLICommand, extendLeaseCLICommand, increaseUndernameLimitCLICommand, requestPrimaryNameCLICommand, setPrimaryNameCLICommand, upgradeRecordCLICommand, } from './commands/arnsPurchaseCommands.js';
|
|
24
24
|
import { cancelWithdrawal, decreaseDelegateStake, decreaseOperatorStake, delegateStake, increaseOperatorStake, instantWithdrawal, joinNetwork, leaveNetwork, redelegateStake, saveObservations, updateGatewaySettings, } from './commands/gatewayWriteCommands.js';
|
|
25
25
|
import { getAllGatewayVaults, getAllowedDelegates, getArNSRecord, getArNSReservedName, getArNSReturnedName, getCostDetails, getDelegations, getEpoch, getGateway, getGatewayDelegates, getGatewayVaults, getPrescribedNames, getPrescribedObservers, getPrimaryName, getTokenCost, getVault, listAllDelegatesCLICommand, listAntsForAddress, listArNSRecords, listArNSRecordsForAddress, listArNSReservedNames, listArNSReturnedNames, listGateways, resolveArNSName, } from './commands/readCommands.js';
|
|
26
26
|
import { createVaultCLICommand, extendVaultCLICommand, increaseVaultCLICommand, revokeVaultCLICommand, transferCLICommand, vaultedTransferCLICommand, } from './commands/transfer.js';
|
|
@@ -436,6 +436,12 @@ makeCommand({
|
|
|
436
436
|
options: arnsPurchaseOptions,
|
|
437
437
|
action: requestPrimaryNameCLICommand,
|
|
438
438
|
});
|
|
439
|
+
makeCommand({
|
|
440
|
+
name: 'set-primary-name',
|
|
441
|
+
description: 'Set an ArNS name you own as your primary name',
|
|
442
|
+
options: arnsPurchaseOptions,
|
|
443
|
+
action: setPrimaryNameCLICommand,
|
|
444
|
+
});
|
|
439
445
|
// # ANT Registry
|
|
440
446
|
makeCommand({
|
|
441
447
|
name: 'get-ants-for-address',
|
|
@@ -169,8 +169,6 @@ export async function requestPrimaryNameCLICommand(o) {
|
|
|
169
169
|
const referrer = referrerFromOptions(o);
|
|
170
170
|
const name = requiredStringFromOptions(o, 'name');
|
|
171
171
|
if (!o.skipConfirmation) {
|
|
172
|
-
// TODO: Assert name requested is not already owned?
|
|
173
|
-
// TODO: More assertions?
|
|
174
172
|
await assertEnoughBalanceForArNSPurchase({
|
|
175
173
|
ario,
|
|
176
174
|
address: signerAddress,
|
|
@@ -183,10 +181,24 @@ export async function requestPrimaryNameCLICommand(o) {
|
|
|
183
181
|
});
|
|
184
182
|
await assertConfirmationPrompt(`Are you sure you want to request the primary name ${name}?`, o);
|
|
185
183
|
}
|
|
186
|
-
|
|
184
|
+
const { result } = await ario.requestPrimaryName({
|
|
187
185
|
name,
|
|
188
186
|
fundFrom,
|
|
189
187
|
paidBy: stringArrayFromOptions(o, 'paidBy'),
|
|
190
188
|
referrer,
|
|
191
189
|
}, customTagsFromOptions(o));
|
|
190
|
+
if (result?.request === undefined) {
|
|
191
|
+
throw new Error('Failed to request primary name for name ' + name);
|
|
192
|
+
}
|
|
193
|
+
return result.request;
|
|
194
|
+
}
|
|
195
|
+
export async function setPrimaryNameCLICommand(o) {
|
|
196
|
+
const { ario, signerAddress } = writeARIOFromOptions(o);
|
|
197
|
+
const name = requiredStringFromOptions(o, 'name');
|
|
198
|
+
const fundFrom = fundFromFromOptions(o);
|
|
199
|
+
const referrer = referrerFromOptions(o);
|
|
200
|
+
if (!o.skipConfirmation) {
|
|
201
|
+
await assertConfirmationPrompt(`Are you sure you want to set the primary name ${name} for address ${signerAddress}?`, o);
|
|
202
|
+
}
|
|
203
|
+
return ario.setPrimaryName({ name, fundFrom, referrer });
|
|
192
204
|
}
|
package/lib/esm/common/io.js
CHANGED
|
@@ -97,10 +97,12 @@ export class ARIOReadable {
|
|
|
97
97
|
process;
|
|
98
98
|
epochSettings;
|
|
99
99
|
arweave;
|
|
100
|
+
hyperbeamUrl;
|
|
100
101
|
paymentProvider; // TODO: this could be an array/map of payment providers
|
|
101
102
|
logger = Logger.default;
|
|
102
103
|
constructor(config) {
|
|
103
104
|
this.arweave = config?.arweave ?? defaultArweave;
|
|
105
|
+
this.hyperbeamUrl = config?.hyperbeamUrl;
|
|
104
106
|
if (config === undefined || Object.keys(config).length === 0) {
|
|
105
107
|
this.process = new AOProcess({
|
|
106
108
|
processId: ARIO_MAINNET_PROCESS_ID,
|
|
@@ -680,6 +682,7 @@ export class ARIOReadable {
|
|
|
680
682
|
async getArNSRecordsForAddress(params) {
|
|
681
683
|
const { antRegistryId = ANT_REGISTRY_ID, address } = params;
|
|
682
684
|
const antRegistry = ANTRegistry.init({
|
|
685
|
+
hyperbeamUrl: this.hyperbeamUrl,
|
|
683
686
|
process: new AOProcess({
|
|
684
687
|
ao: this.process.ao,
|
|
685
688
|
processId: antRegistryId,
|
|
@@ -1189,6 +1192,84 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
1189
1192
|
tags: pruneTags(allTags),
|
|
1190
1193
|
});
|
|
1191
1194
|
}
|
|
1195
|
+
async setPrimaryName(params, options) {
|
|
1196
|
+
options?.onSigningProgress?.('requesting-primary-name', {
|
|
1197
|
+
name: params.name,
|
|
1198
|
+
fundFrom: params.fundFrom,
|
|
1199
|
+
referrer: params.referrer,
|
|
1200
|
+
});
|
|
1201
|
+
// create the primary name request, if it already exists, get the request and base name owner
|
|
1202
|
+
const requestResult = await this.requestPrimaryName(params, options).catch(async (error) => {
|
|
1203
|
+
// check for the error message, it may be due to the request already being made
|
|
1204
|
+
if (error.message.includes('already exists')) {
|
|
1205
|
+
// parse out the initiator from the error message ` "Primary name request by '" .. initiator .. "' for '" .. name .. "' already exists"
|
|
1206
|
+
const initiator = error.message.match(/by '([^']+)'/)?.[1];
|
|
1207
|
+
if (initiator === undefined) {
|
|
1208
|
+
throw error;
|
|
1209
|
+
}
|
|
1210
|
+
options?.onSigningProgress?.('request-already-exists', {
|
|
1211
|
+
name: params.name,
|
|
1212
|
+
initiator,
|
|
1213
|
+
});
|
|
1214
|
+
// get the primary name request
|
|
1215
|
+
const primaryNameRequest = await this.getPrimaryNameRequest({
|
|
1216
|
+
initiator,
|
|
1217
|
+
});
|
|
1218
|
+
// check the name exists
|
|
1219
|
+
const arnsRecord = await this.getArNSRecord({ name: params.name });
|
|
1220
|
+
if (arnsRecord === undefined) {
|
|
1221
|
+
throw new Error(`ARNS name '${params.name}' does not exist`);
|
|
1222
|
+
}
|
|
1223
|
+
if (primaryNameRequest.initiator !== initiator) {
|
|
1224
|
+
throw new Error(`Primary name request for name '${params.name}' was not approved`);
|
|
1225
|
+
}
|
|
1226
|
+
return {
|
|
1227
|
+
id: 'stub-id', // stub-id to indicate that the request already exists
|
|
1228
|
+
result: {
|
|
1229
|
+
// this is a partial stub of the AoCreatePrimaryNameRequest result
|
|
1230
|
+
// we only need the request and base name owner for the approval
|
|
1231
|
+
request: primaryNameRequest,
|
|
1232
|
+
baseNameOwner: arnsRecord.processId,
|
|
1233
|
+
fundingPlan: {
|
|
1234
|
+
address: initiator,
|
|
1235
|
+
},
|
|
1236
|
+
},
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
// throw any other errors from the contract
|
|
1240
|
+
throw error;
|
|
1241
|
+
});
|
|
1242
|
+
// the result is either a new primary name request or an existing one
|
|
1243
|
+
// for new primary name requests the result includes the request, funding plan, and base name owner
|
|
1244
|
+
// for existing primary name requests the result includes just the request and base name owner (see above)
|
|
1245
|
+
const primaryNameRequest = requestResult.result;
|
|
1246
|
+
const antProcessId = primaryNameRequest?.baseNameOwner;
|
|
1247
|
+
const initiator = primaryNameRequest?.fundingPlan?.address;
|
|
1248
|
+
if (primaryNameRequest === undefined ||
|
|
1249
|
+
initiator === undefined ||
|
|
1250
|
+
antProcessId === undefined) {
|
|
1251
|
+
throw new Error(`Failed to request primary name ${params.name} for ${initiator} owned by ${antProcessId} process`);
|
|
1252
|
+
}
|
|
1253
|
+
options?.onSigningProgress?.('approving-request', {
|
|
1254
|
+
name: params.name,
|
|
1255
|
+
processId: antProcessId,
|
|
1256
|
+
request: primaryNameRequest.request,
|
|
1257
|
+
});
|
|
1258
|
+
const antClient = ANT.init({
|
|
1259
|
+
process: new AOProcess({
|
|
1260
|
+
processId: antProcessId,
|
|
1261
|
+
ao: this.process.ao,
|
|
1262
|
+
}),
|
|
1263
|
+
signer: this.signer,
|
|
1264
|
+
});
|
|
1265
|
+
// approve the primary name request with the ant
|
|
1266
|
+
const approveResult = await antClient.approvePrimaryNameRequest({
|
|
1267
|
+
name: params.name,
|
|
1268
|
+
address: initiator,
|
|
1269
|
+
arioProcessId: this.process.processId,
|
|
1270
|
+
}, options);
|
|
1271
|
+
return approveResult;
|
|
1272
|
+
}
|
|
1192
1273
|
/**
|
|
1193
1274
|
* Redelegate stake from one gateway to another gateway.
|
|
1194
1275
|
*
|
package/lib/esm/utils/ao.js
CHANGED
|
@@ -351,9 +351,11 @@ export function errorMessageFromOutput(output) {
|
|
|
351
351
|
const error = errorData ??
|
|
352
352
|
output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')?.value;
|
|
353
353
|
if (error !== undefined) {
|
|
354
|
+
const errorStackTrace = output.Messages?.[0]?.Data;
|
|
355
|
+
const errorMessage = errorStackTrace ?? error;
|
|
354
356
|
// Regex to match AO error messages like: [string ".src.main"]:5111: Primary name data not found
|
|
355
357
|
// or [string "aos"]:128: some error
|
|
356
|
-
const match =
|
|
358
|
+
const match = errorMessage?.match(/\[string "(.+)"\]:(\d+):\s*(.*)/);
|
|
357
359
|
if (match) {
|
|
358
360
|
// The first group is the src file, the second is the line number, and the third is the error message
|
|
359
361
|
const [, , lineNumber, errorMessage] = match;
|
package/lib/esm/version.js
CHANGED
|
@@ -4,4 +4,7 @@ export declare function buyRecordCLICommand(o: CLIWriteOptionsFromAoParams<AoBuy
|
|
|
4
4
|
export declare function upgradeRecordCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
5
5
|
export declare function extendLeaseCLICommand(o: CLIWriteOptionsFromAoParams<AoExtendLeaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
6
6
|
export declare function increaseUndernameLimitCLICommand(o: CLIWriteOptionsFromAoParams<AoIncreaseUndernameLimitParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
7
|
-
export declare function requestPrimaryNameCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").
|
|
7
|
+
export declare function requestPrimaryNameCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<Omit<import("../../types/common.js").AoPrimaryNameRequest, "initiator"> & {
|
|
8
|
+
initiator: import("../../types/common.js").WalletAddress;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function setPrimaryNameCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import Arweave from 'arweave';
|
|
2
|
-
import { ARIOWithFaucet, AoARIORead, AoARIOWrite, AoAllDelegates, AoAllGatewayVaults, AoArNSNameData, AoArNSNameDataWithName, AoArNSPurchaseParams, AoArNSReservedNameData, AoArNSReservedNameDataWithName, AoBalanceWithAddress, AoBuyRecordParams, AoCreateVaultParams, AoDelegation, AoEligibleDistribution, AoEpochData, AoEpochDistributed, AoEpochDistributionData, AoEpochDistributionTotalsData, AoEpochObservationData, AoEpochSettings, AoExtendLeaseParams, AoExtendVaultParams, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoGatewayWithAddress, AoGetCostDetailsParams, AoIncreaseUndernameLimitParams, AoIncreaseVaultParams, AoJoinNetworkParams, AoMessageResult, AoPaginatedAddressParams, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoRegistrationFees, AoReturnedName, AoRevokeVaultParams, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoVaultData, AoVaultedTransferParams, AoWalletVault, AoWeightedObserver, ArNSNameResolutionData, ArNSNameResolver, BuyArNSNameProgressEvents, CostDetailsResult, DemandFactorSettings, EpochInput, OptionalArweave, OptionalPaymentUrl, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions, mARIOToken } from '../types/index.js';
|
|
2
|
+
import { ARIOWithFaucet, AoARIORead, AoARIOWrite, AoAllDelegates, AoAllGatewayVaults, AoArNSNameData, AoArNSNameDataWithName, AoArNSPurchaseParams, AoArNSReservedNameData, AoArNSReservedNameDataWithName, AoBalanceWithAddress, AoBuyRecordParams, AoCreatePrimaryNameRequest, AoCreateVaultParams, AoDelegation, AoEligibleDistribution, AoEpochData, AoEpochDistributed, AoEpochDistributionData, AoEpochDistributionTotalsData, AoEpochObservationData, AoEpochSettings, AoExtendLeaseParams, AoExtendVaultParams, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoGatewayWithAddress, AoGetCostDetailsParams, AoIncreaseUndernameLimitParams, AoIncreaseVaultParams, AoJoinNetworkParams, AoMessageResult, AoPaginatedAddressParams, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoRegistrationFees, AoReturnedName, AoRevokeVaultParams, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoVaultData, AoVaultedTransferParams, AoWalletVault, AoWeightedObserver, ArNSNameResolutionData, ArNSNameResolver, BuyArNSNameProgressEvents, CostDetailsResult, DemandFactorSettings, EpochInput, OptionalArweave, OptionalPaymentUrl, PaginationParams, PaginationResult, ProcessConfiguration, SetPrimaryNameProgressEvents, TransactionId, WalletAddress, WithSigner, WriteOptions, mARIOToken } from '../types/index.js';
|
|
3
3
|
import { AOProcess } from './contracts/ao-process.js';
|
|
4
4
|
import { Logger } from './logger.js';
|
|
5
5
|
import { TurboArNSPaymentProviderAuthenticated, TurboArNSPaymentProviderUnauthenticated } from './turbo.js';
|
|
6
|
-
type ARIOConfigNoSigner = OptionalPaymentUrl<OptionalArweave<ProcessConfiguration
|
|
7
|
-
|
|
6
|
+
type ARIOConfigNoSigner = OptionalPaymentUrl<OptionalArweave<ProcessConfiguration & {
|
|
7
|
+
hyperbeamUrl?: string;
|
|
8
|
+
}>>;
|
|
9
|
+
type ARIOConfigWithSigner = WithSigner<OptionalPaymentUrl<OptionalArweave<ProcessConfiguration & {
|
|
10
|
+
hyperbeamUrl?: string;
|
|
11
|
+
}>>>;
|
|
8
12
|
export declare class ARIO {
|
|
9
13
|
static init(): AoARIORead;
|
|
10
14
|
static init(config: ARIOConfigWithSigner): AoARIOWrite;
|
|
@@ -24,6 +28,7 @@ export declare class ARIOReadable implements AoARIORead, ArNSNameResolver {
|
|
|
24
28
|
readonly process: AOProcess;
|
|
25
29
|
protected epochSettings: AoEpochSettings | undefined;
|
|
26
30
|
protected arweave: Arweave;
|
|
31
|
+
protected hyperbeamUrl: string | undefined;
|
|
27
32
|
protected paymentProvider: TurboArNSPaymentProviderUnauthenticated;
|
|
28
33
|
protected logger: Logger;
|
|
29
34
|
constructor(config?: ARIOConfigNoSigner);
|
|
@@ -236,7 +241,8 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
236
241
|
gatewayAddress?: WalletAddress;
|
|
237
242
|
vaultId: string;
|
|
238
243
|
}, options?: WriteOptions | undefined): Promise<AoMessageResult>;
|
|
239
|
-
requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult
|
|
244
|
+
requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult<AoCreatePrimaryNameRequest>>;
|
|
245
|
+
setPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions<keyof SetPrimaryNameProgressEvents, SetPrimaryNameProgressEvents[keyof SetPrimaryNameProgressEvents]>): Promise<AoMessageResult>;
|
|
240
246
|
/**
|
|
241
247
|
* Redelegate stake from one gateway to another gateway.
|
|
242
248
|
*
|
|
@@ -17,7 +17,7 @@ import { ArconnectSigner, ArweaveSigner, EthereumSigner, InjectedEthereumSigner,
|
|
|
17
17
|
import { dryrun, message, monitor, result, results, spawn, unmonitor } from '@permaweb/aoconnect';
|
|
18
18
|
import Arweave from 'arweave';
|
|
19
19
|
import { SpawnANTState } from './ant.js';
|
|
20
|
-
import { AoBuyRecordParams } from './io.js';
|
|
20
|
+
import { AoArNSPurchaseParams, AoBuyRecordParams } from './io.js';
|
|
21
21
|
import { AoSigner } from './token.js';
|
|
22
22
|
export type BlockHeight = number;
|
|
23
23
|
export type SortKey = string;
|
|
@@ -61,6 +61,16 @@ export type AoPrimaryNameRequest = {
|
|
|
61
61
|
startTimestamp: Timestamp;
|
|
62
62
|
endTimestamp: Timestamp;
|
|
63
63
|
};
|
|
64
|
+
export type AoCreatePrimaryNameRequest = {
|
|
65
|
+
request: Omit<AoPrimaryNameRequest, 'initiator'> & {
|
|
66
|
+
initiator: WalletAddress;
|
|
67
|
+
};
|
|
68
|
+
newPrimaryName: AoPrimaryName;
|
|
69
|
+
baseNameOwner: WalletAddress;
|
|
70
|
+
fundingPlan: Record<string, unknown>;
|
|
71
|
+
fundingResult: Record<string, unknown>;
|
|
72
|
+
demandFactor: Record<string, unknown>;
|
|
73
|
+
};
|
|
64
74
|
export type AoPrimaryName = {
|
|
65
75
|
owner: WalletAddress;
|
|
66
76
|
processId: ProcessId;
|
|
@@ -119,6 +129,18 @@ export type SpawnAntProgressEvent = {
|
|
|
119
129
|
export type BuyArNSNameProgressEvents = SpawnAntProgressEvent & {
|
|
120
130
|
'buying-name': AoBuyRecordParams;
|
|
121
131
|
};
|
|
132
|
+
export type SetPrimaryNameProgressEvents = {
|
|
133
|
+
'requesting-primary-name': AoArNSPurchaseParams;
|
|
134
|
+
'request-already-exists': {
|
|
135
|
+
name: string;
|
|
136
|
+
initiator: WalletAddress;
|
|
137
|
+
};
|
|
138
|
+
'approving-request': {
|
|
139
|
+
request: AoPrimaryNameRequest;
|
|
140
|
+
name: string;
|
|
141
|
+
processId: ProcessId;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
122
144
|
export interface AOContract {
|
|
123
145
|
read<K>({ tags, retries, }: {
|
|
124
146
|
tags?: {
|
package/lib/types/types/io.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { AOProcess } from '../common/index.js';
|
|
17
|
-
import { AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoWriteAction, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './index.js';
|
|
17
|
+
import { AoCreatePrimaryNameRequest, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoWriteAction, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './index.js';
|
|
18
18
|
import { mARIOToken } from './token.js';
|
|
19
19
|
type NestedKeys<T> = T extends object ? T extends readonly unknown[] ? never : {
|
|
20
20
|
[K in keyof T & string]: T[K] extends object ? `${K}.${NestedKeys<T[K]>}` : K;
|
|
@@ -555,7 +555,8 @@ export interface AoARIOWrite extends AoARIORead {
|
|
|
555
555
|
gatewayAddress?: WalletAddress;
|
|
556
556
|
vaultId: string;
|
|
557
557
|
}>;
|
|
558
|
-
requestPrimaryName:
|
|
558
|
+
requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult<AoCreatePrimaryNameRequest>>;
|
|
559
|
+
setPrimaryName: AoWriteAction<AoArNSPurchaseParams>;
|
|
559
560
|
redelegateStake: AoWriteAction<AoRedelegateStakeParams>;
|
|
560
561
|
}
|
|
561
562
|
export declare function isProcessConfiguration(config: object | undefined): config is Required<ProcessConfiguration> & Record<string, never>;
|
package/lib/types/utils/ao.d.ts
CHANGED
package/lib/types/version.d.ts
CHANGED