Skip to content

Releases

@ethect/core@0.1.0-alpha.1

Pre-release

Choose a tag to compare

@github-actions github-actions released this 02 Dec 13:59
f28e673

Minor Changes

  • #50 1d512ef Thanks @maxencerb! - Every address ethect writes is in its EIP-55 form, and an Address stays lowercase in memory. Ambire keeps the state of each account under its checksummed address and looks it up as a string: asked wallet_getCapabilities for an account in lowercase, it answered that the account does not exist, so a plan of two calls was two steps.

    • Address.wireSchema and Address.schema encode to EIP-55. Every request built from a schema, to a node or a wallet, sends its addresses checksummed: params, filters, transaction requests, wallet_sendCalls, signing requests and the keys of a state override. ABI-encoded addresses are bytes, and are unchanged.
    • Tx.toJson, Connection.toJson and Connection.toCookie write their addresses in EIP-55, and so does the typed data Signer.wallet sends with eth_signTypedData_v4, in structs and arrays alike.
    • Reading is unchanged: an address in any case is read as its lowercase Address, and the case of a wire value is not checked as a checksum. A cookie or a Tx.toJson text stored in lowercase before still reads.
    • The last 8,192 checksums are kept, the oldest dropped first: an address written again costs one Map lookup instead of a keccak. Address.checksum uses them too.
    • A test that compares the params of a request with lowercase addresses now sees them checksummed: compare with Address.checksum(address).
  • #48 2e500d7 Thanks @maxencerb! - Plans and waits hold up with real wallets. A locked wallet that never answered wallet_getCapabilities left Tx.plan waiting without end, a batch wait ended at the first status it could not read although the transaction hashes were known, and over HTTP the first poll for a new block came after 4 s whatever the chain.

    • Signer.wallet and Signer.connected take capabilitiesRequestTimeout, 3 seconds by default: how long capabilities waits for wallet_getCapabilities. With no answer by then, it gives no capability, so a plan of several calls is one step per call and batch: "atomic" fails with Tx.Unsupported "atomic". The ask is not stopped: its answer is kept when it comes, and the next plan uses it.
    • Capabilities are kept per account and chain for the session, and forgotten on accountsChanged only: chainChanged, which onWrongChain: "switch" causes before a send, forgets nothing. Every chain of an answer is kept, not only the one asked. A second ask for the same account and chain, while one is out, waits for that one.
    • capabilities fails only on 4100, 4900 and 4901. Any other error of the wallet (a refusal, an account it does not find, an answer that does not read) is no capability, not kept, and logged at the Debug level.
    • Tx.isOutcome(error): whether a failure of a wait says how it ended, Tx.Reverted or Tx.Dropped. Anything else means nobody could tell, and waiting again may see the transactions mined.
    • Tx.wait on a handle asks a signer that could not say where it stands again at the next head, the first answer included, and fails with that failure at the third in a row. "UnknownBatch" still fails at once.
    • Block.watch over a transport that cannot push reads the parent of the first block once, under the "auto" interval: the pace is half the block time from the first pause, 1 s on a chain of 2 s blocks.
  • #47 93ddaec Thanks @maxencerb! - ethect reads what a wallet means whenever it is unambiguous, and keeps the answer on the failure when it is not. A wallet that answered wallet_getCallsStatus off the shape EIP-5792 gives (Ambire: an id that is an object, no chainId, a block number as a JSON number) made Tx.wait fail on a batch that was already mined.

    • CallsStatus.schema reads EIP-5792 v1's "PENDING" and "CONFIRMED" as 100 and 200, and a receipt's blockNumber and gasUsed as hex or as JSON numbers. receipts is always a list, empty when the wallet sends none. id and chainId are optional: kept when they are in the shape EIP-5792 gives, left out otherwise, and never a failure. Only an answer without a status, or a receipt without a 32-byte transactionHash, is refused. Encoding still writes what EIP-5792 writes.
    • In every wire schema, a key set to undefined, which only a provider in the page can send, decodes as an absent key. Decoded types are unchanged, and nothing is encoded as undefined. The Encoded type of such a field includes undefined, and Method.optional names it as Method.nullish names a nullable one.
    • CodecError has a value: the params or the result that failed, as they were. It stays out of the message. A CodecError built by hand needs one.
    • SignerError.cause is RpcError | CodecError. A wallet's answer that cannot be read keeps its CodecError as the cause, where it was dropped, and the message names the method: "The wallet answered wallet_getCallsStatus in a shape EIP-5792 does not allow: …". Code that reads cause.code checks cause._tag === "RpcError" first.
    • Transport.eip1193, and with it every wallet signer and connection, logs each request at the Debug level: its method as the message, and ms, params, and the raw answer, error or interrupted as annotations. Wallet requests never show in a browser's Network tab: Effect.provideService(References.MinimumLogLevel, "Debug") shows them. Nothing is logged at the default level.
    • TestWallet answers wallet_getCallsStatus with receipts: [] while a batch is pending or dropped.
  • #45 6690069 Thanks @maxencerb! - The tags of Revert are the module's name, then the export's, as those of Tx are: Revert.Reason is "RevertReason", Revert.Panic is "RevertPanic" and Revert.Unknown is "RevertUnknown". They were "Revert", "Panic" and "UnknownRevert", and a match on those no longer compiles. The classes are named after their tags, which error unions print.

  • #51 d2f8656 Thanks @maxencerb! - TestWallet answers as real wallets do, read in their source, so an app can be tested against the wallets its users have and not only against EIP-5792 as it is written.

    • TestWallet.make takes like, one of TestWallet.profiles: ambire (accounts looked up by their checksummed address alone, every chain answered, ids Transaction:<hash>, statuses off the shape EIP-5792 gives, 200 for a reverted batch, a status looked up under the chain and account of now), metamask (on a chain missing from its EIP-7702 list, 5710 for several calls, and the chain left out of wallet_getCapabilities; the list is eip7702, so { ...TestWallet.profiles.metamask, eip7702: [31337] } batches on anvil), rainbow (from required, -32004 for an account it cannot delegate) and rabby (-32601 for the three methods of EIP-5792, as Brave and Frame). Each profile is a TestWallet.Profile: a tag, the release read, and the links to the lines its behaviour was read in.
    • TestWallet.make takes silent: methods the wallet takes and does not answer, as a locked wallet waits for its password. wallet.unlock answers them, and every request after.

Patch Changes

  • #46 05d81c8 Thanks @maxencerb! - Tx.simulate no longer reports a false revert for a sender that has code: a contract, a smart account, or an account that delegates (EIP-7702). The executor took the place of that code, so a call that reached back to the sender (a callback, an ERC-1271 check, a vault that supplies into the sender) reverted without data where the transaction succeeds. With no method named, the sender's code is now asked with eth_getCode, together with the executor's call (one HTTP batch when batching is on, so an account waits for no request more). A sender with code runs with eth_simulateV1, and a node without it fails with Tx.Unsupported "simulation". A state override that gives the sender code is taken for its code. method: "override" named behaves as before, and its documentation says what it cannot do.

@ethect/core@0.1.0-alpha.0

Pre-release

Choose a tag to compare

@github-actions github-actions released this 01 Dec 18:13
4341107

Minor Changes

  • #38 28fd5a8 Thanks @maxencerb! - The first alpha. A viem alternative built on Effect: contracts, calls, transactions, events and wallets, on typed JSON-RPC over HTTP, WebSocket, IPC and EIP-1193.