From f1601598f005309ca9a2c3563d39235d61617238 Mon Sep 17 00:00:00 2001 From: Jorge-Lopes Date: Mon, 28 Oct 2024 10:20:27 +0000 Subject: [PATCH] test(a3p): add getMarketCharacterFromVstorage helper function rel: https://github.com/Agoric/BytePitchPartnerEng/issues/13 --- .../proposals/z:acceptance/test-lib/kread.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/test-lib/kread.js b/a3p-integration/proposals/z:acceptance/test-lib/kread.js index 50a22cf22346..ec7bb80fd3bb 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/kread.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/kread.js @@ -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', @@ -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,