Skip to content

Commit 614bfb0

Browse files
committed
admin: merged WIP branch
2 parents 12b629d + 1d85931 commit 614bfb0

23 files changed

+789
-49
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ Change Log
33

44
This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated.
55

6+
ethers/v6.14.0 (2025-05-06 02:03)
7+
---------------------------------
8+
9+
- EIP-7702 support ([#4916](https://github.com/ethers-io/ethers.js/issues/4916); [db490e1](https://github.com/ethers-io/ethers.js/commit/db490e1afaaa139be9cb38e6b50a1bc4ef28e075), [e7c1bdf](https://github.com/ethers-io/ethers.js/commit/e7c1bdf6f0a5d6f976dddd6375e76445ac6851fc)).
10+
- Added support for to override fetch init options in the Browser ([#3895](https://github.com/ethers-io/ethers.js/issues/3895); [844ae68](https://github.com/ethers-io/ethers.js/commit/844ae68a96deabc4d5f053dad5f1112b06f08d9a)).
11+
- Added EIP-6963 discovery to BrowserProvider ([f5469dd](https://github.com/ethers-io/ethers.js/commit/f5469dd0e0719389d51e0106ee36d07a7ebef875)).
12+
- Accept modern KZG library API while exposing legacy API ([#4841](https://github.com/ethers-io/ethers.js/issues/4841); [e5036e7](https://github.com/ethers-io/ethers.js/commit/e5036e778624fea957dd847f7be1a9f148b8997e)).
13+
- Added CommunityResourcable to exports ([#4776](https://github.com/ethers-io/ethers.js/issues/4776); [bca8d1b](https://github.com/ethers-io/ethers.js/commit/bca8d1b549569e6f7793f07fcc46dfd731e37d2b)).
14+
615
ethers/v6.13.7 (2025-04-25 21:50)
716
---------------------------------
817

docs.wrm/links/projects.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
link-alchemy [Alchemy](https://alchemy.com/?a=ethers)
22
link-ankr [Ankr](https://www.ankr.com)
3+
link-blockscout [Blockscout](https://www.blockscout.com)
34
link-chainstack [Chainstack](https://chainstack.com)
45
link-cloudflare [Cloudflare](https://developers.cloudflare.com/distributed-web/ethereum-gateway/)
56
link-ens [ENS](https://ens.domains/)

docs.wrm/links/specs.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ link-eip-2098 [EIP-2098](https://eips.ethereum.org/EIPS/eip-2098)
3131
link-eip-2304 [EIP-2304](https://eips.ethereum.org/EIPS/eip-2304)
3232
link-eip-2718 [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718)
3333
link-eip-2930 [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930)
34-
link-eip-4788 [EIP-4844](https://eips.ethereum.org/EIPS/eip-4788)
34+
link-eip-4788 [EIP-4788](https://eips.ethereum.org/EIPS/eip-4788)
3535
link-eip-4844 [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844)
36+
link-eip-6963 [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963)
37+
link-eip-7702 [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702)
3638

3739
# Open Standards
3840
link-base58 [Base58](https://en.bitcoinwiki.org/wiki/Base58)

src.ts/_tests/create-provider.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
AlchemyProvider,
3+
BlockscoutProvider,
34
// AnkrProvider,
45
// CloudflareProvider,
56
ChainstackProvider,
@@ -36,6 +37,15 @@ const ProviderCreators: Array<ProviderCreator> = [
3637
return new AlchemyProvider(network, "YrPw6SWb20vJDRFkhWq8aKnTQ8JRNRHM");
3738
}
3839
},
40+
{
41+
name: "BlockscoutProvider",
42+
//networks: ethNetworks, // @TODO: they are backfilling some Sepolia txs
43+
networks: [ "mainnet" ],
44+
create: function(network: string) {
45+
//return new BlockscoutProvider(network);
46+
return new BlockscoutProvider(network, "fdbfa288-1695-454e-a369-4501253a120");
47+
}
48+
},
3949
/*
4050
{
4151
name: "AnkrProvider",

src.ts/_tests/test-providers-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ describe("Test Provider Transaction operations", function() {
226226
if (providerName === "CloudflareProvider" ||
227227
providerName === "AnkrProvider" ||
228228
providerName === "PocketProvider" ||
229-
providerName === "AlchemyProvider") {
229+
providerName === "BlockscoutProvider") {
230230
test = Object.assign({ } , test, { root: undefined });
231231
}
232232

src.ts/ethers.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export {
4949
export {
5050
id,
5151
ensNormalize, isValidName, namehash, dnsEncode,
52+
hashAuthorization, verifyAuthorization,
5253
hashMessage, verifyMessage,
5354
solidityPacked, solidityPackedKeccak256, solidityPackedSha256,
5455
TypedDataEncoder,
@@ -69,9 +70,9 @@ export {
6970

7071
BrowserProvider,
7172

72-
AlchemyProvider, AnkrProvider, ChainstackProvider, CloudflareProvider,
73-
EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider,
74-
QuickNodeProvider,
73+
AlchemyProvider, AnkrProvider, BlockscoutProvider, ChainstackProvider,
74+
CloudflareProvider, EtherscanProvider, InfuraProvider,
75+
InfuraWebSocketProvider, PocketProvider, QuickNodeProvider,
7576

7677
IpcSocketProvider, SocketProvider, WebSocketProvider,
7778

@@ -89,7 +90,7 @@ export {
8990
} from "./providers/index.js";
9091

9192
export {
92-
accessListify,
93+
accessListify, authorizationify,
9394
computeAddress, recoverAddress,
9495
Transaction
9596
} from "./transaction/index.js";
@@ -159,26 +160,33 @@ export type {
159160

160161
export type { ProgressCallback, SignatureLike } from "./crypto/index.js";
161162

162-
export type { TypedDataDomain, TypedDataField } from "./hash/index.js";
163+
export type {
164+
AuthorizationRequest, TypedDataDomain, TypedDataField
165+
} from "./hash/index.js";
163166

164167
export type {
165168
Provider, Signer,
166169

170+
CommunityResourcable,
171+
167172
AbstractProviderOptions, BrowserProviderOptions, FallbackProviderOptions,
168173

169-
AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider,
170-
Eip1193Provider, EventFilter, Filter, FilterByBlockHash, GasCostParameters,
171-
JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult,
172-
JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish,
173-
OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction,
174-
PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter,
175-
TransactionReceiptParams, TransactionRequest, TransactionResponseParams,
176-
WebSocketCreator, WebSocketLike
174+
AbstractProviderPlugin, BlockParams, BlockTag, BrowserDiscoverOptions,
175+
ContractRunner, DebugEventBrowserProvider, Eip1193Provider,
176+
Eip6963ProviderInfo, EventFilter, Filter, FilterByBlockHash,
177+
GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError,
178+
JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams,
179+
MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter,
180+
PerformActionFilter, PerformActionRequest, PerformActionTransaction,
181+
PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription,
182+
TopicFilter, TransactionReceiptParams, TransactionRequest,
183+
TransactionResponseParams, WebSocketCreator, WebSocketLike
177184
} from "./providers/index.js";
178185

179186
export type {
180187
AccessList, AccessListish, AccessListEntry,
181-
Blob, BlobLike, KzgLibrary,
188+
Authorization, AuthorizationLike,
189+
Blob, BlobLike, KzgLibrary, KzgLibraryLike,
182190
TransactionLike
183191
} from "./transaction/index.js";
184192

src.ts/hash/authorization.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { getAddress } from "../address/index.js";
2+
import { keccak256 } from "../crypto/index.js";
3+
import { recoverAddress } from "../transaction/index.js";
4+
import {
5+
assertArgument, concat, encodeRlp, toBeArray
6+
} from "../utils/index.js";
7+
8+
import type { Addressable } from "../address/index.js";
9+
import type { SignatureLike } from "../crypto/index.js";
10+
import type { BigNumberish, Numeric } from "../utils/index.js";
11+
12+
export interface AuthorizationRequest {
13+
address: string | Addressable;
14+
nonce?: Numeric;
15+
chainId?: BigNumberish;
16+
}
17+
18+
/**
19+
* Computes the [[link-eip-7702]] authorization digest to sign.
20+
*/
21+
export function hashAuthorization(auth: AuthorizationRequest): string {
22+
assertArgument(typeof(auth.address) === "string", "invalid address for hashAuthorization", "auth.address", auth);
23+
return keccak256(concat([
24+
"0x05", encodeRlp([
25+
(auth.chainId != null) ? toBeArray(auth.chainId): "0x",
26+
getAddress(auth.address),
27+
(auth.nonce != null) ? toBeArray(auth.nonce): "0x",
28+
])
29+
]));
30+
}
31+
32+
/**
33+
* Return the address of the private key that produced
34+
* the signature %%sig%% during signing for %%message%%.
35+
*/
36+
export function verifyAuthorization(auth: AuthorizationRequest, sig: SignatureLike): string {
37+
return recoverAddress(hashAuthorization(auth), sig);
38+
}

src.ts/hash/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @_section: api/hashing:Hashing Utilities [about-hashing]
66
*/
77

8+
export { hashAuthorization, verifyAuthorization } from "./authorization.js";
89
export { id } from "./id.js"
910
export { ensNormalize, isValidName, namehash, dnsEncode } from "./namehash.js";
1011
export { hashMessage, verifyMessage } from "./message.js";
@@ -13,4 +14,5 @@ export {
1314
} from "./solidity.js";
1415
export { TypedDataEncoder, verifyTypedData } from "./typed-data.js";
1516

17+
export type { AuthorizationRequest } from "./authorization.js";
1618
export type { TypedDataDomain, TypedDataField } from "./typed-data.js";

src.ts/providers/abstract-signer.ts

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ import {
1414

1515
import { copyRequest } from "./provider.js";
1616

17-
import type { TypedDataDomain, TypedDataField } from "../hash/index.js";
18-
import type { TransactionLike } from "../transaction/index.js";
17+
import type {
18+
AuthorizationRequest, TypedDataDomain, TypedDataField
19+
} from "../hash/index.js";
20+
import type { Authorization, TransactionLike } from "../transaction/index.js";
1921

2022
import type {
2123
BlockTag, Provider, TransactionRequest, TransactionResponse
2224
} from "./provider.js";
2325
import type { Signer } from "./signer.js";
2426

25-
2627
function checkProvider(signer: AbstractSigner, operation: string): Provider {
2728
if (signer.provider) { return signer.provider; }
2829
assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation });
@@ -150,7 +151,11 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
150151
// The network supports EIP-1559!
151152

152153
// Upgrade transaction from null to eip-1559
153-
pop.type = 2;
154+
if (pop.authorizationList && pop.authorizationList.length) {
155+
pop.type = 4;
156+
} else {
157+
pop.type = 2;
158+
}
154159

155160
if (pop.gasPrice != null) {
156161
// Using legacy gasPrice property on an eip-1559 network,
@@ -194,7 +199,7 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
194199
operation: "signer.getFeeData" });
195200
}
196201

197-
} else if (pop.type === 2 || pop.type === 3) {
202+
} else if (pop.type === 2 || pop.type === 3 || pop.type === 4) {
198203
// Explicitly using EIP-1559 or EIP-4844
199204

200205
// Populate missing fee data
@@ -213,6 +218,21 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
213218
return await resolveProperties(pop);
214219
}
215220

221+
async populateAuthorization(_auth: AuthorizationRequest): Promise<AuthorizationRequest> {
222+
const auth = Object.assign({ }, _auth);
223+
224+
// Add a chain ID if not explicitly set to 0
225+
if (auth.chainId == null) {
226+
auth.chainId = (await checkProvider(this, "getNetwork").getNetwork()).chainId;
227+
}
228+
229+
// @TODO: Take chain ID into account when populating noce?
230+
231+
if (auth.nonce == null) { auth.nonce = await this.getNonce(); }
232+
233+
return auth;
234+
}
235+
216236
async estimateGas(tx: TransactionRequest): Promise<bigint> {
217237
return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx));
218238
}
@@ -235,6 +255,12 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
235255
return await provider.broadcastTransaction(await this.signTransaction(txObj));
236256
}
237257

258+
// @TODO: in v7 move this to be abstract
259+
authorize(authorization: AuthorizationRequest): Promise<Authorization> {
260+
assert(false, "authorization not implemented for this signer",
261+
"UNSUPPORTED_OPERATION", { operation: "authorize" });
262+
}
263+
238264
abstract signTransaction(tx: TransactionRequest): Promise<string>;
239265
abstract signMessage(message: string | Uint8Array): Promise<string>;
240266
abstract signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;

src.ts/providers/default-provider.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { assert } from "../utils/index.js";
33

44
import { AnkrProvider } from "./provider-ankr.js";
55
import { AlchemyProvider } from "./provider-alchemy.js";
6+
import { BlockscoutProvider } from "./provider-blockscout.js";
67
import { ChainstackProvider } from "./provider-chainstack.js";
78
import { CloudflareProvider } from "./provider-cloudflare.js";
89
import { EtherscanProvider } from "./provider-etherscan.js";
@@ -121,6 +122,12 @@ export function getDefaultProvider(network?: string | Networkish | WebSocketLike
121122
} catch (error) { }
122123
}
123124

125+
if (allowService("blockscout")) {
126+
try {
127+
providers.push(new BlockscoutProvider(network, options.blockscout));
128+
} catch (error) { }
129+
}
130+
124131
if (allowService("chainstack")) {
125132
try {
126133
providers.push(new ChainstackProvider(network, options.chainstack));

src.ts/providers/format.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ export function formatTransactionResponse(value: any): TransactionResponseParams
214214
accessList: allowNull(accessListify, null),
215215
blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),
216216

217+
authorizationList: allowNull(arrayOf((v: any) => {
218+
return {
219+
address: getAddress(v.address),
220+
chainId: getBigInt(v.chainId),
221+
nonce: getBigInt(v.nonce),
222+
signature: Signature.from(v.signature ? v.signature: v)
223+
};
224+
}, false), null),
225+
217226
blockHash: allowNull(formatHash, null),
218227
blockNumber: allowNull(getNumber, null),
219228
transactionIndex: allowNull(getNumber, null),

src.ts/providers/formatting.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import type { Signature } from "../crypto/index.js";
8-
import type { AccessList } from "../transaction/index.js";
8+
import type { Authorization, AccessList } from "../transaction/index.js";
99

1010

1111
//////////////////////
@@ -283,6 +283,7 @@ export interface TransactionReceiptParams {
283283
* post-byzantium blocks this is null.
284284
*/
285285
root: null | string;
286+
286287
}
287288

288289
/*
@@ -406,7 +407,12 @@ export interface TransactionResponseParams {
406407
/**
407408
* The [[link-eip-4844]] BLOb versioned hashes.
408409
*/
409-
blobVersionedHashes?: null | Array<string>;
410+
blobVersionedHashes?: null | Array<string>; // @TODO: drop the "?"? (v7)
411+
412+
/**
413+
* The [[link-eip-7702]] authorizations (if any).
414+
*/
415+
authorizationList: null | Array<Authorization>;
410416
};
411417

412418

src.ts/providers/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner } from "./provider-j
6060
export { BrowserProvider } from "./provider-browser.js";
6161

6262
export { AlchemyProvider } from "./provider-alchemy.js";
63+
export { BlockscoutProvider } from "./provider-blockscout.js";
6364
export { AnkrProvider } from "./provider-ankr.js";
6465
export { CloudflareProvider } from "./provider-cloudflare.js";
6566
export { ChainstackProvider } from "./provider-chainstack.js";
@@ -91,11 +92,11 @@ export type {
9192
TransactionResponseParams,
9293
} from "./formatting.js";
9394

94-
/*
9595
export type {
9696
CommunityResourcable
9797
} from "./community.js";
9898

99+
/*
99100
export type {
100101
AvatarLinkageType, AvatarLinkage, AvatarResult
101102
} from "./ens-resolver.js";
@@ -114,7 +115,8 @@ export type {
114115
} from "./provider.js";
115116

116117
export type {
117-
BrowserProviderOptions, DebugEventBrowserProvider, Eip1193Provider
118+
BrowserDiscoverOptions, BrowserProviderOptions, DebugEventBrowserProvider,
119+
Eip1193Provider, Eip6963ProviderInfo
118120
} from "./provider-browser.js";
119121

120122
export type { FallbackProviderOptions } from "./provider-fallback.js";

0 commit comments

Comments
 (0)