From bf49b160acf3b0b55551c33bb1b414b19b90c9dc Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 10 Mar 2021 15:18:17 -0800 Subject: [PATCH] fix: add Far() where necessary refs https://github.com/Agoric/agoric-sdk/issues/2018 --- api/src/handler.js | 3 ++- api/src/lib-http.js | 9 +++++---- contract/src/contract.js | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/api/src/handler.js b/api/src/handler.js index 62f67a6..6a69285 100644 --- a/api/src/handler.js +++ b/api/src/handler.js @@ -1,5 +1,6 @@ // @ts-check import { E } from '@agoric/eventual-send'; +import { Far } from '@agoric/marshal'; import { makeWebSocketHandler } from './lib-http'; const spawnHandler = ( @@ -7,7 +8,7 @@ const spawnHandler = ( _invitationMaker, ) => makeWebSocketHandler(http, (send, _meta) => - harden({ + Far('connectionHandler', { async onMessage(obj) { switch (obj.type) { case 'fungibleFaucet/sendInvitation': { diff --git a/api/src/lib-http.js b/api/src/lib-http.js index 8ef2875..28f7d8f 100644 --- a/api/src/lib-http.js +++ b/api/src/lib-http.js @@ -5,14 +5,15 @@ // @ts-check import { E } from '@agoric/eventual-send'; +import { Far } from '@agoric/marshal'; export const makeWebSocketHandler = (http, makeConnectionHandler) => { - return harden({ + return Far('webSocketHandler', { // This creates the commandHandler for the http service to handle inbound // websocket requests. getCommandHandler() { const channelToConnHandler = new WeakMap(); - const handler = { + const handler = Far('httpCommandHandler', { // Executed upon an error in handling the websocket. onError(obj, { channelHandle }) { const connHandler = channelToConnHandler.get(channelHandle); @@ -43,8 +44,8 @@ export const makeWebSocketHandler = (http, makeConnectionHandler) => { const connHandler = channelToConnHandler.get(channelHandle); return connHandler.onMessage(obj); }, - }; - return harden(handler); + }); + return handler; }, }); }; diff --git a/contract/src/contract.js b/contract/src/contract.js index 5cf9396..d3f3d1d 100644 --- a/contract/src/contract.js +++ b/contract/src/contract.js @@ -1,5 +1,6 @@ // @ts-check import '@agoric/zoe/exported'; +import { Far } from '@agoric/marshal'; /** * This is a very simple contract that creates a new issuer and mints payments @@ -37,18 +38,18 @@ const start = async (zcf) => { return 'Offer completed. You should receive a payment from Zoe'; }; - const creatorFacet = { + const creatorFacet = Far('creatorFacet', { // The creator of the instance can send invitations to anyone // they wish to. makeInvitation: () => zcf.makeInvitation(mintPayment, 'mint a payment'), getTokenIssuer: () => issuer, - }; + }); - const publicFacet = { + const publicFacet = Far('publicFacet', { // Make the token issuer public. Note that only the mint can // make new digital assets. The issuer is ok to make public. getTokenIssuer: () => issuer, - }; + }); // Return the creatorFacet to the creator, so they can make // invitations for others to get payments of tokens. Publish the