-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
This refers to this documentation page: https://aiken-lang.org/example--vesting/mesh.
When I run the vesting_lock.mjs
, I get the error:
node offchain/vesting/vesting-lock.mjs
file:///home/prometheus/projects/research-projects/intro-aiken/node_modules/@scure/base/lib/esm/index.js:32
throw new Error(`${label}: string expected`);
^
Error: bech32.decode input: string expected
at astr (file:///home/prometheus/projects/research-projects/intro-aiken/node_modules/@scure/base/lib/esm/index.js:32:15)
at Object.decode (file:///home/prometheus/projects/research-projects/intro-aiken/node_modules/@scure/base/lib/esm/index.js:593:9)
at Address.fromBech32 (file:///home/prometheus/projects/research-projects/intro-aiken/node_modules/@cardano-sdk/core/dist/esm/Cardano/Address/Address.js:135:47)
at Module.deserializeBech32Address (file:///home/prometheus/projects/research-projects/intro-aiken/node_modules/@meshsdk/core-cst/dist/index.js:4942:39)
at deserializeAddress (file:///home/prometheus/projects/research-projects/intro-aiken/node_modules/@meshsdk/core/dist/index.js:33:43)
at depositFundTx (file:///home/prometheus/projects/research-projects/intro-aiken/offchain/vesting/vesting-lock.mjs:12:43)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async main (file:///home/prometheus/projects/research-projects/intro-aiken/offchain/vesting/vesting-lock.mjs:43:22)
Node.js v22.17.0
Specifically, this error occurs at:
const { pubKeyHash: ownerPubKeyHash } = deserializeAddress(
owner_wallet.addresses.baseAddressBech32
);
From what I could tell, the issue could be that baseAddressBech32
returns a Promise and this has not been accounted for here.
From the MeshSDK docs, I could not locate the baseAddressBech32
function while address
has no documenation. However, I was able to find getUnusedAddresses()
that returns addresses from the wallet.
I have fixed this by issue by doing:
const ownerAddresses = await owner_wallet.getUnusedAddresses();
const beneficiaryAddresses = await beneficiary_wallet.getUnusedAddresses();
const ownerAddress = ownerAddresses[0];
const beneficiaryAddress = beneficiaryAddresses[0];
const { pubKeyHash: ownerPubKeyHash } = deserializeAddress(ownerAddress);
const { pubKeyHash: beneficiaryPubKeyHash } = deserializeAddress(beneficiaryAddress);
Is this correct or did I miss something. I can make a PR for this if its in order.
Metadata
Metadata
Assignees
Labels
No labels