Repository navigation
Pay per call from a browser wallet - #8
Merged
Merged
Conversation
Per-call payment took only a local account, a raw key. It now also takes a
browser wallet's JSON-RPC account, { address, type: 'json-rpc' }, with the
wallet as transport (custom(window.ethereum)). The payment is signed through
the client's wallet client: a local account still signs by itself, byte for
byte as before, and a JSON-RPC account asks its wallet for one
eth_signTypedData_v4. Smart accounts stay out: the JobRegistry takes only an
ECDSA signature by the payer's key.
The per-call tests sign the scheme's vectors through a stand-in wallet too,
and pin what a rejected signature gives back: the 402, with the wallet's
reason. The README shows the browser use, and what the page has to do first:
put the wallet on the network's chain.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per-call payment used to take only a local account (a raw private key). It now also takes a browser wallet's JSON-RPC account,
{ address, type: 'json-rpc' }, with the wallet astransport(custom(window.ethereum)). A web page can then pay each call through the SDK, with the visitor's own wallet signing.eth_signTypedData_v4. No transaction, no gas.error.messagestartingNot paid by the SDK: User rejected the request., followed by the wallet's own reason.Tests
npm run typecheck,npm run buildandnpm testall pass (73 of 73).eth_signTypedData_v4for the payer, with no transaction.Not covered:
deposit()through a browser wallet, and a real wallet against the live API.