@parity/dotns-cli 0.5.5 → 0.5.6
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/dist/cli.js +24 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2886,7 +2886,7 @@ var init_Store = __esm(() => {
|
|
|
2886
2886
|
});
|
|
2887
2887
|
|
|
2888
2888
|
// src/utils/constants.ts
|
|
2889
|
-
var PREVIEW_BASE_URL = "http://dotns.paseo.li/#/preview", DEFAULT_BULLETIN_RPC = "wss://paseo-bulletin-rpc.polkadot.io", DEFAULT_CHUNK_SIZE_BYTES, MAX_SINGLE_UPLOAD_SIZE_BYTES, DEFAULT_UPLOAD_MAX_RETRIES = 5, MAX_UPLOAD_MAX_RETRIES = 20, UPLOAD_RETRY_BASE_DELAYS_MS, DEFAULT_AUTHORIZATION_TRANSACTIONS = 1e6, DEFAULT_AUTHORIZATION_BYTES, DEFAULT_VERIFICATION_GATEWAY = "https://paseo-ipfs.polkadot.io", DOT_NODE = "0x3fce7d1364a893e213bc4212792b517ffc88f5b13b86c8ef9c8d390c3a1370ce",
|
|
2889
|
+
var PREVIEW_BASE_URL = "http://dotns.paseo.li/#/preview", DEFAULT_BULLETIN_RPC = "wss://paseo-bulletin-rpc.polkadot.io", DEFAULT_CHUNK_SIZE_BYTES, MAX_SINGLE_UPLOAD_SIZE_BYTES, DEFAULT_UPLOAD_MAX_RETRIES = 5, MAX_UPLOAD_MAX_RETRIES = 20, UPLOAD_RETRY_BASE_DELAYS_MS, DEFAULT_AUTHORIZATION_TRANSACTIONS = 1e6, DEFAULT_AUTHORIZATION_BYTES, DEFAULT_VERIFICATION_GATEWAY = "https://paseo-ipfs.polkadot.io", DOT_NODE = "0x3fce7d1364a893e213bc4212792b517ffc88f5b13b86c8ef9c8d390c3a1370ce", DECIMALS_DOT = 10n, NATIVE_TO_ETH_RATIO = 1000000n, DEFAULT_MNEMONIC = "bottom drive obey lake curtain smoke basket hold race lonely fit walk", DEFAULT_SUDO_KEY_URI = "//Alice", BULLETIN_BLOCK_TIME_MS = 6000, OPERATION_TIMEOUT_MILLISECONDS = 300000, DEFAULT_COMMITMENT_BUFFER_SECONDS = 6, COMMITMENT_POLL_TIMEOUT_MS = 30000, COMMITMENT_POLL_INTERVAL_MS = 2000, DOTNS_REGISTRAR_CONTROLLER_ABI, DOTNS_REGISTRY_ABI, DOTNS_REGISTRAR_ABI, DOTNS_REVERSE_RESOLVER_ABI, DOTNS_CONTENT_RESOLVER_ABI, DOTNS_RESOLVER_ABI, POP_RULES_ABI, STORE_FACTORY_ABI, STORE_ABI, RPC_ENDPOINTS, CONTRACTS;
|
|
2890
2890
|
var init_constants = __esm(() => {
|
|
2891
2891
|
init_DotnsRegistrarController();
|
|
2892
2892
|
init_DotnsRegistry();
|
|
@@ -8292,11 +8292,11 @@ var init_reporter = __esm(() => {
|
|
|
8292
8292
|
|
|
8293
8293
|
// src/utils/formatting.ts
|
|
8294
8294
|
function formatNativeBalance(valueInNativeUnits) {
|
|
8295
|
-
const divisor = 10n **
|
|
8295
|
+
const divisor = 10n ** DECIMALS_DOT;
|
|
8296
8296
|
const wholePart = valueInNativeUnits / divisor;
|
|
8297
8297
|
const fractionalPart = valueInNativeUnits % divisor;
|
|
8298
8298
|
let fractionalString = fractionalPart.toString();
|
|
8299
|
-
const missingZeroCount =
|
|
8299
|
+
const missingZeroCount = DECIMALS_DOT - BigInt(fractionalString.length);
|
|
8300
8300
|
if (missingZeroCount > 0n) {
|
|
8301
8301
|
fractionalString = "0".repeat(Number(missingZeroCount)) + fractionalString;
|
|
8302
8302
|
}
|
|
@@ -8306,8 +8306,8 @@ function parseNativeBalance(decimalValue) {
|
|
|
8306
8306
|
const parts = decimalValue.split(".");
|
|
8307
8307
|
const wholePart = BigInt(parts[0] || "0");
|
|
8308
8308
|
const fractionalPart = parts[1] || "0";
|
|
8309
|
-
const paddedFraction = fractionalPart.padEnd(Number(
|
|
8310
|
-
return wholePart * 10n **
|
|
8309
|
+
const paddedFraction = fractionalPart.padEnd(Number(DECIMALS_DOT), "0").slice(0, Number(DECIMALS_DOT));
|
|
8310
|
+
return wholePart * 10n ** DECIMALS_DOT + BigInt(paddedFraction);
|
|
8311
8311
|
}
|
|
8312
8312
|
function convertWeiToNative(weiValue) {
|
|
8313
8313
|
return weiValue / NATIVE_TO_ETH_RATIO;
|
|
@@ -264964,7 +264964,21 @@ function toSafeAccountFilename(accountName) {
|
|
|
264964
264964
|
const safeFilename = accountName.trim().replaceAll(/[^\w.-]/g, "_");
|
|
264965
264965
|
return `${safeFilename}.json`;
|
|
264966
264966
|
}
|
|
264967
|
+
function resolveAuthSourceFromEnv(account) {
|
|
264968
|
+
const envMnemonic = process.env[ENV.MNEMONIC];
|
|
264969
|
+
if (envMnemonic && envMnemonic.length > 0) {
|
|
264970
|
+
return { source: envMnemonic, isKeyUri: false, resolvedFrom: "env", account };
|
|
264971
|
+
}
|
|
264972
|
+
const envKeyUri = process.env[ENV.KEY_URI];
|
|
264973
|
+
if (envKeyUri && envKeyUri.length > 0) {
|
|
264974
|
+
return { source: envKeyUri, isKeyUri: true, resolvedFrom: "env", account };
|
|
264975
|
+
}
|
|
264976
|
+
return;
|
|
264977
|
+
}
|
|
264967
264978
|
async function resolveAuthSourceReadOnly() {
|
|
264979
|
+
const fromEnv = resolveAuthSourceFromEnv("readonly");
|
|
264980
|
+
if (fromEnv)
|
|
264981
|
+
return fromEnv;
|
|
264968
264982
|
return {
|
|
264969
264983
|
source: DEFAULT_MNEMONIC,
|
|
264970
264984
|
isKeyUri: false,
|
|
@@ -264980,14 +264994,9 @@ async function resolveAuthSource(opts) {
|
|
|
264980
264994
|
if (opts.keyUri) {
|
|
264981
264995
|
return { source: opts.keyUri, isKeyUri: true, resolvedFrom: "cli", account: accountName };
|
|
264982
264996
|
}
|
|
264983
|
-
const
|
|
264984
|
-
|
|
264985
|
-
|
|
264986
|
-
return { source: envMnemonic, isKeyUri: false, resolvedFrom: "env", account: accountName };
|
|
264987
|
-
}
|
|
264988
|
-
if (envKeyUri && envKeyUri.length > 0) {
|
|
264989
|
-
return { source: envKeyUri, isKeyUri: true, resolvedFrom: "env", account: accountName };
|
|
264990
|
-
}
|
|
264997
|
+
const fromEnv = resolveAuthSourceFromEnv(accountName);
|
|
264998
|
+
if (fromEnv)
|
|
264999
|
+
return fromEnv;
|
|
264991
265000
|
const keystoreDirectoryPath = resolveKeystorePath(opts.keystorePath);
|
|
264992
265001
|
if (await pathExists(keystoreDirectoryPath)) {
|
|
264993
265002
|
const password = await getPasswordForDecrypt(opts.password);
|
|
@@ -265391,7 +265400,7 @@ function attachBulletinCommands(root) {
|
|
|
265391
265400
|
const force = Boolean(options2.force);
|
|
265392
265401
|
const signerKeyUri = String(mergedOptions.keyUri || DEFAULT_SUDO_KEY_URI);
|
|
265393
265402
|
const targetAddress = await resolveTargetAddress(positionalAddress, mergedOptions, reporterMode);
|
|
265394
|
-
const signerContext = await withBulletinHumanOutput(reporterMode, () => prepareContext({ keyUri: signerKeyUri, useBulletin: true }));
|
|
265403
|
+
const signerContext = await withBulletinHumanOutput(reporterMode, () => prepareContext({ keyUri: signerKeyUri, useBulletin: true, bulletinRpc }));
|
|
265395
265404
|
if (!jsonOutput) {
|
|
265396
265405
|
console.log(source_default.blue(`
|
|
265397
265406
|
▶ Bulletin Authorize`));
|
|
@@ -266602,6 +266611,7 @@ async function setUserProofOfPersonhoodStatus(clientWrapper, substrateAddress, s
|
|
|
266602
266611
|
const displayName = label ? source_default.cyan(label) : "account";
|
|
266603
266612
|
const checkSpinner = ora(`Checking current PoP status for ${displayName}`).start();
|
|
266604
266613
|
try {
|
|
266614
|
+
await clientWrapper.ensureAccountMapped(substrateAddress, signer);
|
|
266605
266615
|
const currentStatus = await getUserProofOfPersonhoodStatus(clientWrapper, substrateAddress, ownerAddress);
|
|
266606
266616
|
checkSpinner.succeed("Current PoP status");
|
|
266607
266617
|
console.log(source_default.gray(" current: ") + source_default.white(ProofOfPersonhoodStatus[currentStatus]));
|