Skip to content

Commit

Permalink
fixup! feat: add client support module for fast-usdc with offer maker…
Browse files Browse the repository at this point in the history
…s and tests
  • Loading branch information
turadg committed Jan 25, 2025
1 parent 88f0921 commit f4f6a52
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions packages/fast-usdc/test/clientSupport.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { Offers } from '../src/clientSupport.js';

const usdc = makeIssuerKit('USDC');

/** @satisfies {import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes} */
/** @type {import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes} */
const agoricNames = {
brand: {
// @ts-expect-error not a real BoardRemote
USDC: usdc.brand,
},
// Other required AgoricNames properties...
Expand All @@ -15,12 +16,11 @@ const agoricNames = {
const instance = /** @type {Instance} */ ({});

test('makeDepositOffer', async t => {
const offer = Offers.fastUsdc.Deposit(
agoricNames,
instance,
{ offerId: 'deposit1', amount: 100 }
);

const offer = Offers.fastUsdc.Deposit(agoricNames, instance, {
offerId: 'deposit1',
amount: 100,
});

t.deepEqual(offer, {
id: 'deposit1',
invitationSpec: {
Expand All @@ -32,30 +32,30 @@ test('makeDepositOffer', async t => {
give: {
Deposit: {
brand: agoricNames.brand.USDC,
value: 100000000n
}
}
}
value: 100000000n,
},
},
},
});
});

test('makeWithdrawOffer', async t => {
const offer = Offers.fastUsdc.Withdraw(
agoricNames,
instance,
{ offerId: 'withdraw1', amount: 50 }
);

t.deepEqual(offer.proposal.want.Withdrawal.value, 50000000n);
const offer = Offers.fastUsdc.Withdraw(agoricNames, instance, {
offerId: 'withdraw1',
amount: 50,
});

t.deepEqual(offer.proposal.want?.Withdrawal.value, 50000000n);
});

test('makeOperatorOffer', async t => {
const offer = Offers.fastUsdc.BecomeOperator(
instance,
{ offerId: 'operator1', operatorId: 'op123' }
);

const offer = Offers.fastUsdc.BecomeOperator(instance, {
offerId: 'operator1',
operatorId: 'op123',
});

// @ts-expect-error invitationSpec is AgoricContractInvitationSpec but offer doesn't carry that type
t.deepEqual(offer.invitationSpec.callPipe, [
['makeOperatorInvitation', ['op123']]
['makeOperatorInvitation', ['op123']],
]);
});

0 comments on commit f4f6a52

Please sign in to comment.