Skip to content

Commit

Permalink
test(a3p): add getMarketCharacterFromVstorage helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge-Lopes committed Oct 28, 2024
1 parent e0ad844 commit f160159
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions a3p-integration/proposals/z:acceptance/test-lib/kread.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ export const getCharacterInventory = async characterName => {
return characterInventory;
};

export const getMarketCharacterFromVstorage = async () => {
const charactersMarket = await getMarketCharactersChildren();
const path = `:published.kread.market-characters.${charactersMarket[0]}`;
const rawCharacterData = await agoric.follow('-lF', path, '-o', 'text');
const marketCharacter = marshaller.fromCapData(JSON.parse(rawCharacterData));

return marketCharacter;
};

export const getBalanceFromPurse = async (address, type) => {
const walletRaw = await agoric.follow(
'-lF',
Expand Down Expand Up @@ -259,10 +268,7 @@ const sellItemOffer = async address => {
};

const buyCharacterOffer = async () => {
const charactersMarket = await getMarketCharactersChildren();
const path = `:published.kread.market-characters.${charactersMarket[0]}`;
const rawCharacterData = await agoric.follow('-lF', path, '-o', 'text');
const marketCharacter = marshaller.fromCapData(JSON.parse(rawCharacterData));
const marketCharacter = await getMarketCharacterFromVstorage();

const kreadCharacterAmount = assetAsAmount(
brands.KREAdCHARACTER,
Expand Down

0 comments on commit f160159

Please sign in to comment.