Skip to content

Commit

Permalink
fix(wallet): never fail to suggestPetname
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Aug 17, 2021
1 parent 250266b commit dd4fbc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions packages/dapp-svelte-wallet/api/src/lib-dehydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,16 @@ export const makeDehydrator = (initialUnnamedCount = 0) => {
return valToPetname.get(val);
}

if (!isPath(petname)) {
// Assert that the name doesn't exist, and add it.
addPetname(petname, val);
return petname;
}

// Find a unique path.
let uniquePath = petname;
let nonce = 2;
while (petnameToVal.has(uniquePath)) {
// Add the nonce to the path, and try again.
uniquePath = [...petname, `${nonce}`];
if (isPath(petname)) {
uniquePath = [...petname, `${nonce}`];
} else {
uniquePath = `${petname}${nonce}`;
}
nonce += 1;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/vats/src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function buildRootObject(vatPowers, vatParameters) {
const chainTimerServiceP = E(vats.timer).createTimerService(timerDevice);

const feeIssuerConfig = {
name: 'RUN',
name: 'RUNZ', // FIXME: CENTRAL_ISSUER_NAME
assetKind: AssetKind.NAT,
displayInfo: { decimalPlaces: 6, assetKind: AssetKind.NAT },
initialFunds: 1_000_000_000_000_000_000n,
Expand Down

0 comments on commit dd4fbc1

Please sign in to comment.