Skip to content

Commit

Permalink
fix: cheap auxdata
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Dec 4, 2022
1 parent c863b17 commit 85225cc
Show file tree
Hide file tree
Showing 11 changed files with 658 additions and 160 deletions.
10 changes: 10 additions & 0 deletions packages/ERTP/src/paymentLedger.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export const vivifyPaymentLedger = (
getAmountShape() {
return amountShape;
},
aux() {
return brandAuxData;
},
});

const emptyAmount = AmountMath.makeEmpty(brand, assetKind);
Expand All @@ -110,6 +113,13 @@ export const vivifyPaymentLedger = (
elementShape,
);

const brandAuxData = harden({
name,
assetKind,
displayInfo,
amountShape,
});

const { IssuerI, MintI, PaymentI, PurseIKit } = makeIssuerInterfaces(
brand,
assetKind,
Expand Down
8 changes: 8 additions & 0 deletions packages/ERTP/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,19 @@ export const DisplayInfoShape = M.splitRecord(

// //////////////////////// Interfaces /////////////////////////////////////////

export const BrandAuxDataShape = harden({
name: M.string(),
assetKind: AssetKindShape,
displayInfo: DisplayInfoShape,
amountShape: M.pattern(),
});

export const BrandI = M.interface('Brand', {
isMyIssuer: M.callWhen(M.await(IssuerShape)).returns(M.boolean()),
getAllegedName: M.call().returns(M.string()),
getDisplayInfo: M.call().returns(DisplayInfoShape),
getAmountShape: M.call().returns(M.pattern()),
aux: M.call().returns(BrandAuxDataShape),
});

/**
Expand Down
Loading

0 comments on commit 85225cc

Please sign in to comment.