Closed rowgraus closed 2 years ago
I wonder if what @dtribble just describes works for the voting case: #3901
I also wonder how this compares to web3 APIs.
Acceptance Criteria:
status quo:
sequenceDiagram
dApp->>bridge: getPublicFacet
bridge->>dApp: publicFacet
dApp->>publicFacet: getVaultInvitation
publicFacet->>dApp: invitation
dApp->>bridge: addOffer(invitation, ...)
bridge->>user: ok?
user->>bridge: ok.
bridge->>zoe: offer(invitation, ...)
design sketch:
sequenceDiagram
dApp->>bridge: addOffer({contractPub: "board2342", method: "makeVaultInvitation", give, want})
bridge->>user: {give, want...} ok?
user->>bridge: ok.
bridge->>SmartWallet: addOffer({public: "board2342", method: "makeVaultInvitation"})
SmartWallet->>zoe: getPublicFacet
zoe->>SmartWallet: publicFacet
SmartWallet->>publicFacet: getVaultInvitation
SmartWallet->>zoe: offer(invitation, ...)
refinement, based on discussion with @michaelfig
sequenceDiagram
participant user
participant RPC
participant walletUI
participant walletSt
participant walletB
participant dApp
walletUI->>RPC: ?: published.wallet.agoric1..
RPC-->>walletUI: stateN
dApp->>+walletB: leader = makeLeader(wk-url)
note left of dApp: creates an iframe to well-known url powerbox.agoric.app
dApp->>dApp: f = makeFollower(leader)
dApp->>dApp: c = leader.makeClient()
dApp->>walletB: f.next()
walletB->>walletSt: getDappState
user->>walletUI: approve dApp
walletSt-->>walletB: filter(stateN, dApp)
walletB-->>dApp: filter(stateN, dApp)
note left of dApp: stateN includes services.board, .zoe
dApp->>walletB: instanceP <- E(E(client).getBoard()).getValue('asdf')
dApp->>walletB: pfP <- E(E(client).getZoe()).getPublicFacet(instanceP)
user->>dApp: send me tokens
dApp->>walletB: invP <- E(pfP).makeInvitation()
dApp->>walletB: E(c).deposit(invP)
dApp->>walletB: offerIdP <- E(c).propose({want: 5tok})
note right of walletB: offerId is edge name e.g.: 45
walletB->>walletUI: proposal
note right of walletUI: hits storage
walletUI->>user: proposal
user->>walletUI: Approve
walletUI->>RPC: tx([trivialActions, acceptZoeOffer])
RPC->>walletUI: stateN'
walletUI->>walletSt: stateN'
walletSt->>walletB: stateN'
note right of walletB: stateN' includes offerstates
walletB->>dApp: filter(stateN', dApp)
dapp will use @agoric/casting
library to interact with the wallet front-end. (currently uses @endo/captp
)
casting has
transaction manager (TODO: replace with relevant DB terminology)
fixed by #5946
Acceptance Criteria: