always create new bond with provisionBondId helper call

This commit is contained in:
Michael Shaw 2023-02-20 08:41:12 -05:00
parent 84fed44808
commit 3cb01bca63

View File

@ -24,15 +24,18 @@ export const getBaseConfig = async (path: string) => {
* Provision a bond for record registration. * Provision a bond for record registration.
*/ */
export const provisionBondId = async (registry: Registry, privateKey: string, fee: Fee) => { export const provisionBondId = async (registry: Registry, privateKey: string, fee: Fee) => {
let bonds = await registry.queryBonds(); // let bonds = await registry.queryBonds();
console.log("found bonds: " + bonds.length) // console.log("found bonds: " + bonds.length)
if (!bonds.length) { // if (!bonds.length) {
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee); // await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
bonds = await registry.queryBonds(); // bonds = await registry.queryBonds();
console.log("created bond and got back: " + bonds.length) // console.log("created bond and got back: " + bonds.length)
} // }
let bondId: string;
return bonds[0].id; bondId = await registry.getNextBondId(privateKey);
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
return bondId
//return bonds[0].id;
}; };
export const getConfig = () => { export const getConfig = () => {