Repository navigation
Releases
@ethect/core@0.1.0-alpha.1
Minor Changes
-
#50
1d512efThanks @maxencerb! - Every address ethect writes is in its EIP-55 form, and anAddressstays lowercase in memory. Ambire keeps the state of each account under its checksummed address and looks it up as a string: askedwallet_getCapabilitiesfor an account in lowercase, it answered that the account does not exist, so a plan of two calls was two steps.Address.wireSchemaandAddress.schemaencode 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.toJsonandConnection.toCookiewrite their addresses in EIP-55, and so does the typed dataSigner.walletsends witheth_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 aTx.toJsontext stored in lowercase before still reads. - The last 8,192 checksums are kept, the oldest dropped first: an address written again costs one
Maplookup instead of a keccak.Address.checksumuses them too. - A test that compares the params of a request with lowercase addresses now sees them checksummed: compare with
Address.checksum(address).
-
#48
2e500d7Thanks @maxencerb! - Plans and waits hold up with real wallets. A locked wallet that never answeredwallet_getCapabilitiesleftTx.planwaiting 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.walletandSigner.connectedtakecapabilitiesRequestTimeout, 3 seconds by default: how longcapabilitieswaits forwallet_getCapabilities. With no answer by then, it gives no capability, so a plan of several calls is one step per call andbatch: "atomic"fails withTx.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
accountsChangedonly:chainChanged, whichonWrongChain: "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. capabilitiesfails 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.RevertedorTx.Dropped. Anything else means nobody could tell, and waiting again may see the transactions mined.Tx.waiton 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.watchover 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
93ddaecThanks @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 answeredwallet_getCallsStatusoff the shape EIP-5792 gives (Ambire: anidthat is an object, nochainId, a block number as a JSON number) madeTx.waitfail on a batch that was already mined.CallsStatus.schemareads EIP-5792 v1's"PENDING"and"CONFIRMED"as 100 and 200, and a receipt'sblockNumberandgasUsedas hex or as JSON numbers.receiptsis always a list, empty when the wallet sends none.idandchainIdare optional: kept when they are in the shape EIP-5792 gives, left out otherwise, and never a failure. Only an answer without astatus, or a receipt without a 32-bytetransactionHash, 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 asundefined. TheEncodedtype of such a field includesundefined, andMethod.optionalnames it asMethod.nullishnames a nullable one. CodecErrorhas avalue: the params or the result that failed, as they were. It stays out of the message. ACodecErrorbuilt by hand needs one.SignerError.causeisRpcError | CodecError. A wallet's answer that cannot be read keeps itsCodecErroras 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 readscause.codecheckscause._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, andms,params, and the rawanswer,errororinterruptedas 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.TestWalletanswerswallet_getCallsStatuswithreceipts: []while a batch is pending or dropped.
-
#45
6690069Thanks @maxencerb! - The tags ofRevertare the module's name, then the export's, as those ofTxare:Revert.Reasonis"RevertReason",Revert.Panicis"RevertPanic"andRevert.Unknownis"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
d2f8656Thanks @maxencerb! -TestWalletanswers 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.maketakeslike, one ofTestWallet.profiles:ambire(accounts looked up by their checksummed address alone, every chain answered, idsTransaction:<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 ofwallet_getCapabilities; the list iseip7702, so{ ...TestWallet.profiles.metamask, eip7702: [31337] }batches on anvil),rainbow(fromrequired, -32004 for an account it cannot delegate) andrabby(-32601 for the three methods of EIP-5792, as Brave and Frame). Each profile is aTestWallet.Profile: a tag, the release read, and the links to the lines its behaviour was read in.TestWallet.maketakessilent: methods the wallet takes and does not answer, as a locked wallet waits for its password.wallet.unlockanswers them, and every request after.
Patch Changes
- #46
05d81c8Thanks @maxencerb! -Tx.simulateno 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 witheth_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 witheth_simulateV1, and a node without it fails withTx.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
Minor Changes
- #38
28fd5a8Thanks @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.