-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix Payment type #10828
base: master
Are you sure you want to change the base?
fix Payment type #10828
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ | |
import { makeIssuerKit, AssetKind, AmountMath } from '../../src/index.js'; | ||
import { claim, combine } from '../../src/legacy-payment-helpers.js'; | ||
|
||
/** | ||
* @import {IssuerKit} from '../../src/types.js' | ||
*/ | ||
|
||
test('mint.getIssuer', t => { | ||
const { mint, issuer } = makeIssuerKit('fungible'); | ||
t.is(mint.getIssuer(), issuer); | ||
|
@@ -24,13 +28,18 @@ | |
t.assert(AmountMath.isEqual(paymentBalance2, fungible1000)); | ||
}); | ||
|
||
/** @type {import('@agoric/internal').TypedPattern<string>} */ | ||
const StringPattern = M.string(); | ||
|
||
test('mint.mintPayment set w strings AssetKind', async t => { | ||
const { mint, issuer, brand } = makeIssuerKit( | ||
'items', | ||
AssetKind.SET, | ||
undefined, | ||
undefined, | ||
{ elementShape: M.string() }, | ||
{ | ||
elementShape: StringPattern, | ||
}, | ||
); | ||
const items1and2and4 = AmountMath.make(brand, harden(['1', '2', '4'])); | ||
const payment1 = mint.mintPayment(items1and2and4); | ||
|
@@ -110,11 +119,14 @@ | |
// This test models ballet tickets | ||
test('non-fungible tokens example', async t => { | ||
t.plan(11); | ||
|
||
const { | ||
mint: balletTicketMint, | ||
issuer: balletTicketIssuer, | ||
brand, | ||
} = makeIssuerKit('Agoric Ballet Opera tickets', AssetKind.SET); | ||
} = /** | ||
* @type {IssuerKit<'set', { seat: number; show: string; start: string }>} | ||
*/ (makeIssuerKit('Agoric Ballet Opera tickets', AssetKind.SET)); | ||
Comment on lines
+128
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make sense to also pass a corresponding As a test, maybe not worth bothering, so I ask hypothetically: would it have made sense, if code like this appears in production? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Several sites now use elementShape. I think the illustration is best when there's a TypedPattern shape available, like with |
||
|
||
const startDateString = new Date(2020, 1, 17, 20, 30).toISOString(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG cool!