voltaire-effect 0.3.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{X25519Test-D5Q-5fL9.d.ts → X25519Test-avt1DUgp.d.ts} +231 -6
- package/dist/crypto/index.d.ts +2 -2
- package/dist/crypto/index.js +72 -2
- package/dist/{index-3UKSP3cd.d.ts → index-DxwZo3xo.d.ts} +7781 -5513
- package/dist/index.d.ts +990 -3096
- package/dist/index.js +2374 -1652
- package/dist/native/index.d.ts +6 -6
- package/dist/native/index.js +2399 -1677
- package/dist/primitives/index.d.ts +7 -6
- package/dist/primitives/index.js +2966 -2361
- package/dist/services/index.d.ts +1631 -1255
- package/dist/services/index.js +4493 -3977
- package/package.json +7 -3
- package/src/crypto/Signers/SignersService.ts +1 -1
- package/src/crypto/Signers/errors.ts +29 -0
- package/src/crypto/Signers/index.ts +1 -0
- package/src/crypto/Signers/operations.ts +26 -8
- package/src/crypto/index.ts +10 -11
- package/src/index.ts +1 -2
- package/src/jsonrpc/Anvil.ts +13 -8
- package/src/jsonrpc/Eth.ts +13 -8
- package/src/jsonrpc/Hardhat.ts +13 -8
- package/src/jsonrpc/IdCounter.ts +21 -5
- package/src/jsonrpc/JsonRpc.test.ts +126 -61
- package/src/jsonrpc/Net.ts +13 -8
- package/src/jsonrpc/Request.ts +16 -8
- package/src/jsonrpc/Txpool.ts +13 -8
- package/src/jsonrpc/Wallet.ts +13 -8
- package/src/jsonrpc/Web3.ts +13 -8
- package/src/jsonrpc/index.ts +1 -1
- package/src/primitives/Abi/AbiSchema.ts +3 -4
- package/src/primitives/Abi/fromBytecode.test.ts +47 -0
- package/src/primitives/Abi/fromBytecode.ts +81 -0
- package/src/primitives/Abi/index.ts +3 -0
- package/src/primitives/AccessList/from.ts +12 -9
- package/src/primitives/Address/Checksummed.ts +21 -27
- package/src/primitives/Address/from.ts +12 -15
- package/src/primitives/Address/toHex.ts +2 -1
- package/src/primitives/Base64/from.ts +21 -4
- package/src/primitives/Blob/from.ts +12 -4
- package/src/primitives/BlockHash/index.ts +2 -2
- package/src/primitives/BlockNumber/index.ts +3 -3
- package/src/primitives/Bytecode/from.ts +11 -2
- package/src/primitives/ContractSignature/verifySignature.ts +3 -5
- package/src/primitives/Ens/from.ts +12 -11
- package/src/primitives/Hex/from.ts +12 -4
- package/src/primitives/Signature/from.ts +11 -2
- package/src/primitives/Transaction/EIP2930/index.ts +12 -12
- package/src/primitives/Transaction/EIP4844/index.ts +14 -14
- package/src/primitives/Transaction/EIP7702/index.ts +13 -13
- package/src/primitives/Transaction/Legacy/index.ts +13 -13
- package/src/primitives/TransactionHash/index.ts +3 -2
- package/src/primitives/TransactionIndex/index.ts +2 -2
- package/src/primitives/Trie/Trie.test.ts +70 -0
- package/src/primitives/Trie/TrieSchema.ts +26 -0
- package/src/primitives/Trie/clear.ts +16 -0
- package/src/primitives/Trie/del.ts +18 -0
- package/src/primitives/Trie/get.ts +18 -0
- package/src/primitives/Trie/index.ts +30 -0
- package/src/primitives/Trie/init.ts +13 -0
- package/src/primitives/Trie/prove.ts +19 -0
- package/src/primitives/Trie/put.ts +20 -0
- package/src/primitives/Trie/rootHash.ts +14 -0
- package/src/primitives/Trie/verify.ts +18 -0
- package/src/primitives/Uint/from.ts +11 -2
- package/src/primitives/Uint16/index.ts +5 -4
- package/src/primitives/Uint64/index.ts +5 -4
- package/src/primitives/Uint8/index.ts +5 -4
- package/src/primitives/index.ts +3 -2
- package/src/services/BlockExplorerApi/BlockExplorerApi.test.ts +789 -0
- package/src/services/BlockExplorerApi/BlockExplorerApi.ts +797 -0
- package/src/services/BlockExplorerApi/BlockExplorerApiErrors.ts +176 -0
- package/src/services/BlockExplorerApi/BlockExplorerApiService.ts +60 -0
- package/src/services/BlockExplorerApi/BlockExplorerApiTypes.ts +225 -0
- package/src/services/BlockExplorerApi/index.ts +42 -0
- package/src/services/Contract/Contract.test.ts +2 -6
- package/src/services/Contract/ContractTypes.ts +26 -8
- package/src/services/Contract/estimateGas.test.ts +4 -7
- package/src/services/Provider/actions/multicall.ts +28 -9
- package/src/services/Provider/actions/readContract.test.ts +8 -11
- package/src/services/Provider/actions/readContract.ts +28 -9
- package/src/services/Provider/functions/getBlock.ts +2 -1
- package/src/services/Provider/functions/getBlockReceipts.ts +2 -1
- package/src/services/Provider/functions/getBlockTransactionCount.ts +2 -1
- package/src/services/Provider/functions/getUncle.ts +2 -1
- package/src/services/Provider/functions/getUncleCount.ts +2 -1
- package/src/services/Signer/actions/deployContract.ts +1 -1
- package/src/services/index.ts +25 -0
package/dist/services/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as Layer from 'effect/Layer';
|
|
2
2
|
import * as effect_Cause from 'effect/Cause';
|
|
3
3
|
import * as effect_Types from 'effect/Types';
|
|
4
|
-
import { HexType as HexType$
|
|
4
|
+
import { HexType as HexType$6 } from '@tevm/voltaire/Hex';
|
|
5
5
|
import * as Context from 'effect/Context';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { T as TransportError, P as ProviderService, K as KeccakService } from '../ProviderService-BZ5pqDrD.js';
|
|
8
8
|
export { a as ProviderShape } from '../ProviderService-BZ5pqDrD.js';
|
|
9
9
|
import { WatchPendingOptions, PendingTransactionEvent, WatchConfirmedOptions, ConfirmedTransactionEvent, TrackOptions, TransactionStreamEvent } from '@tevm/voltaire/transaction';
|
|
10
10
|
import * as Stream from 'effect/Stream';
|
|
11
|
+
import { ExecutionPlan, Redacted } from 'effect';
|
|
11
12
|
import { BrandedAddress, BrandedHex, BrandedSignature, TypedData, EventLog, BrandedHash } from '@tevm/voltaire';
|
|
13
|
+
import { HashType as HashType$1 } from '@tevm/voltaire/Hash';
|
|
12
14
|
import { S as Secp256k1Service } from '../Secp256k1Service-OxQ6hJFp.js';
|
|
13
15
|
import { BlockInclude, WatchOptions, BlockStreamEvent, BackfillOptions, BlocksEvent } from '@tevm/voltaire/block';
|
|
14
16
|
export { BackfillOptions, BlockInclude, BlockStreamEvent, BlocksEvent, WatchOptions } from '@tevm/voltaire/block';
|
|
15
|
-
import { HashType as HashType$1 } from '@tevm/voltaire/Hash';
|
|
16
17
|
import { AddressType as AddressType$9 } from '@tevm/voltaire/Address';
|
|
17
18
|
import * as RequestResolver from 'effect/RequestResolver';
|
|
18
19
|
import * as Request from 'effect/Request';
|
|
@@ -22,7 +23,6 @@ import * as Socket from '@effect/platform/Socket';
|
|
|
22
23
|
import * as Duration from 'effect/Duration';
|
|
23
24
|
import * as Schedule from 'effect/Schedule';
|
|
24
25
|
import { Schedule as Schedule$1 } from 'effect/Schedule';
|
|
25
|
-
import { ExecutionPlan } from 'effect';
|
|
26
26
|
import * as Scope from 'effect/Scope';
|
|
27
27
|
import * as RateLimiter from 'effect/RateLimiter';
|
|
28
28
|
import * as FiberRef from 'effect/FiberRef';
|
|
@@ -416,7 +416,7 @@ type SubmitHashrateError = TransportError;
|
|
|
416
416
|
interface AccountStateOverride {
|
|
417
417
|
readonly balance?: bigint;
|
|
418
418
|
readonly nonce?: bigint;
|
|
419
|
-
readonly code?: HexType$
|
|
419
|
+
readonly code?: HexType$6 | `0x${string}`;
|
|
420
420
|
readonly state?: Record<`0x${string}`, `0x${string}`>;
|
|
421
421
|
readonly stateDiff?: Record<`0x${string}`, `0x${string}`>;
|
|
422
422
|
}
|
|
@@ -442,7 +442,7 @@ interface BlockOverrides {
|
|
|
442
442
|
interface CallRequest {
|
|
443
443
|
readonly to?: AddressInput$2;
|
|
444
444
|
readonly from?: AddressInput$2;
|
|
445
|
-
readonly data?: HexType$
|
|
445
|
+
readonly data?: HexType$6 | `0x${string}`;
|
|
446
446
|
readonly value?: bigint;
|
|
447
447
|
readonly gas?: bigint;
|
|
448
448
|
}
|
|
@@ -3132,19 +3132,18 @@ declare const TestProvider: (mocks: Record<string, (...args: unknown[]) => unkno
|
|
|
3132
3132
|
*/
|
|
3133
3133
|
|
|
3134
3134
|
type AddressType$8 = BrandedAddress.AddressType;
|
|
3135
|
-
type HexType$7 = BrandedHex.HexType;
|
|
3136
3135
|
/**
|
|
3137
3136
|
* Represents a single ABI item.
|
|
3138
3137
|
* @internal
|
|
3139
3138
|
*/
|
|
3140
|
-
type AbiItem$
|
|
3139
|
+
type AbiItem$2 = {
|
|
3141
3140
|
type: string;
|
|
3142
3141
|
name?: string;
|
|
3143
3142
|
};
|
|
3144
3143
|
/**
|
|
3145
3144
|
* ABI type that can be used with readContract.
|
|
3146
3145
|
*/
|
|
3147
|
-
type Abi$2 = readonly AbiItem$
|
|
3146
|
+
type Abi$2 = readonly AbiItem$2[];
|
|
3148
3147
|
/**
|
|
3149
3148
|
* Error union for readContract.
|
|
3150
3149
|
*/
|
|
@@ -3176,12 +3175,17 @@ type GetFunctionInputs$1<TAbi extends Abi$2, TFunctionName extends string> = TAb
|
|
|
3176
3175
|
type AbiInputsToArgs$2<TInputs extends readonly {
|
|
3177
3176
|
type: string;
|
|
3178
3177
|
}[]> = {
|
|
3179
|
-
[K in keyof TInputs]:
|
|
3178
|
+
[K in keyof TInputs]: AbiTypeToInput$2<TInputs[K]["type"]>;
|
|
3180
3179
|
};
|
|
3181
3180
|
/**
|
|
3182
|
-
* Maps a single ABI type to TypeScript type.
|
|
3181
|
+
* Maps a single ABI type to TypeScript input type.
|
|
3182
|
+
*/
|
|
3183
|
+
type BytesInput$2 = Uint8Array | `0x${string}`;
|
|
3184
|
+
type AbiTypeToInput$2<T extends string> = T extends `uint${string}` | `int${string}` ? bigint : T extends "address" ? AddressType$8 | `0x${string}` : T extends "bool" ? boolean : T extends `bytes${string}` | "bytes" ? BytesInput$2 : T extends "string" ? string : T extends `${string}[]` ? readonly unknown[] : T extends `(${string})` ? readonly unknown[] : unknown;
|
|
3185
|
+
/**
|
|
3186
|
+
* Maps a single ABI type to TypeScript output type.
|
|
3183
3187
|
*/
|
|
3184
|
-
type
|
|
3188
|
+
type AbiTypeToOutput$2<T extends string> = T extends `uint${string}` | `int${string}` ? bigint : T extends "address" ? AddressType$8 | `0x${string}` : T extends "bool" ? boolean : T extends `bytes${string}` | "bytes" ? Uint8Array : T extends "string" ? string : T extends `${string}[]` ? readonly unknown[] : T extends `(${string})` ? readonly unknown[] : unknown;
|
|
3185
3189
|
/**
|
|
3186
3190
|
* Gets the output type for a specific function from an ABI.
|
|
3187
3191
|
*/
|
|
@@ -3191,8 +3195,8 @@ type GetFunctionOutput$1<TAbi extends Abi$2, TFunctionName extends string> = TAb
|
|
|
3191
3195
|
outputs: infer Outputs;
|
|
3192
3196
|
} ? Outputs extends readonly {
|
|
3193
3197
|
type: string;
|
|
3194
|
-
}[] ? Outputs["length"] extends 0 ? undefined : Outputs["length"] extends 1 ?
|
|
3195
|
-
[K in keyof Outputs]:
|
|
3198
|
+
}[] ? Outputs["length"] extends 0 ? undefined : Outputs["length"] extends 1 ? AbiTypeToOutput$2<Outputs[0]["type"]> : {
|
|
3199
|
+
[K in keyof Outputs]: AbiTypeToOutput$2<Outputs[K] extends {
|
|
3196
3200
|
type: string;
|
|
3197
3201
|
} ? Outputs[K]["type"] : never>;
|
|
3198
3202
|
} : unknown : never : unknown;
|
|
@@ -3325,7 +3329,6 @@ declare const readContract: <const TAbi extends Abi$2, TFunctionName extends Ext
|
|
|
3325
3329
|
*/
|
|
3326
3330
|
|
|
3327
3331
|
type AddressType$7 = BrandedAddress.AddressType;
|
|
3328
|
-
type HexType$6 = BrandedHex.HexType;
|
|
3329
3332
|
/**
|
|
3330
3333
|
* Extracts function names from an ABI.
|
|
3331
3334
|
*/
|
|
@@ -3349,12 +3352,17 @@ type GetFunctionInputs<TAbi extends Abi$2, TFunctionName extends string> = TAbi
|
|
|
3349
3352
|
type AbiInputsToArgs$1<TInputs extends readonly {
|
|
3350
3353
|
type: string;
|
|
3351
3354
|
}[]> = {
|
|
3352
|
-
[K in keyof TInputs]:
|
|
3355
|
+
[K in keyof TInputs]: AbiTypeToInput$1<TInputs[K]["type"]>;
|
|
3353
3356
|
};
|
|
3354
3357
|
/**
|
|
3355
|
-
* Maps a single ABI type to TypeScript type.
|
|
3358
|
+
* Maps a single ABI type to TypeScript input type.
|
|
3359
|
+
*/
|
|
3360
|
+
type BytesInput$1 = Uint8Array | `0x${string}`;
|
|
3361
|
+
type AbiTypeToInput$1<T extends string> = T extends `uint${string}` | `int${string}` ? bigint : T extends "address" ? AddressType$7 | `0x${string}` : T extends "bool" ? boolean : T extends `bytes${string}` | "bytes" ? BytesInput$1 : T extends "string" ? string : T extends `${string}[]` ? readonly unknown[] : T extends `(${string})` ? readonly unknown[] : unknown;
|
|
3362
|
+
/**
|
|
3363
|
+
* Maps a single ABI type to TypeScript output type.
|
|
3356
3364
|
*/
|
|
3357
|
-
type
|
|
3365
|
+
type AbiTypeToOutput$1<T extends string> = T extends `uint${string}` | `int${string}` ? bigint : T extends "address" ? AddressType$7 | `0x${string}` : T extends "bool" ? boolean : T extends `bytes${string}` | "bytes" ? Uint8Array : T extends "string" ? string : T extends `${string}[]` ? readonly unknown[] : T extends `(${string})` ? readonly unknown[] : unknown;
|
|
3358
3366
|
/**
|
|
3359
3367
|
* Gets the output type for a specific function from an ABI.
|
|
3360
3368
|
*/
|
|
@@ -3364,8 +3372,8 @@ type GetFunctionOutput<TAbi extends Abi$2, TFunctionName extends string> = TAbi
|
|
|
3364
3372
|
outputs: infer Outputs;
|
|
3365
3373
|
} ? Outputs extends readonly {
|
|
3366
3374
|
type: string;
|
|
3367
|
-
}[] ? Outputs["length"] extends 0 ? undefined : Outputs["length"] extends 1 ?
|
|
3368
|
-
[K in keyof Outputs]:
|
|
3375
|
+
}[] ? Outputs["length"] extends 0 ? undefined : Outputs["length"] extends 1 ? AbiTypeToOutput$1<Outputs[0]["type"]> : {
|
|
3376
|
+
[K in keyof Outputs]: AbiTypeToOutput$1<Outputs[K] extends {
|
|
3369
3377
|
type: string;
|
|
3370
3378
|
} ? Outputs[K]["type"] : never>;
|
|
3371
3379
|
} : unknown : unknown : unknown;
|
|
@@ -3635,7 +3643,7 @@ declare const makeResilientProviderPlan: (primaryUrl: string, fallbackUrl: strin
|
|
|
3635
3643
|
/**
|
|
3636
3644
|
* Hex input type for block hashes and data.
|
|
3637
3645
|
*/
|
|
3638
|
-
type HexInput = HexType$
|
|
3646
|
+
type HexInput = HexType$6 | `0x${string}`;
|
|
3639
3647
|
/**
|
|
3640
3648
|
* Block structure matching the native blockchain implementation.
|
|
3641
3649
|
*
|
|
@@ -5352,452 +5360,1148 @@ declare const JsonRpcAccount: (address: AddressType$4) => Layer.Layer<AccountSer
|
|
|
5352
5360
|
type HexType$3 = BrandedHex.HexType;
|
|
5353
5361
|
declare const LocalAccount: (privateKeyHex: HexType$3) => Layer.Layer<AccountService, never, KeccakService | Secp256k1Service>;
|
|
5354
5362
|
|
|
5363
|
+
type AddressType$3 = BrandedAddress.AddressType;
|
|
5364
|
+
type HexType$2 = BrandedHex.HexType;
|
|
5365
|
+
type SignatureType = BrandedSignature.SignatureType;
|
|
5366
|
+
type TypedDataType = TypedData.TypedDataType;
|
|
5367
|
+
type EventLogType = EventLog.EventLogType;
|
|
5355
5368
|
/**
|
|
5356
|
-
*
|
|
5357
|
-
*
|
|
5358
|
-
*
|
|
5359
|
-
* @since 0.2.12
|
|
5369
|
+
* Address input type that accepts both branded AddressType and plain hex strings.
|
|
5370
|
+
* Provides flexibility for API consumers while maintaining type safety.
|
|
5371
|
+
* Matches ProviderService.AddressInput for consistency.
|
|
5360
5372
|
*/
|
|
5361
|
-
|
|
5362
|
-
readonly _tag: "BlockStreamError";
|
|
5363
|
-
} & Readonly<A>;
|
|
5373
|
+
type AddressInput = AddressType$3 | `0x${string}`;
|
|
5364
5374
|
/**
|
|
5365
|
-
*
|
|
5375
|
+
* Caveat applied to a permission.
|
|
5366
5376
|
*
|
|
5367
|
-
* @since 0.
|
|
5377
|
+
* @since 0.0.1
|
|
5368
5378
|
*/
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
readonly
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
constructor(message: string, options?: {
|
|
5375
|
-
cause?: unknown;
|
|
5376
|
-
context?: Record<string, unknown>;
|
|
5377
|
-
});
|
|
5379
|
+
interface Caveat {
|
|
5380
|
+
/** Caveat type */
|
|
5381
|
+
readonly type: string;
|
|
5382
|
+
/** Caveat value */
|
|
5383
|
+
readonly value: unknown;
|
|
5378
5384
|
}
|
|
5379
|
-
|
|
5380
|
-
/**
|
|
5381
|
-
* @fileoverview BlockStream service definition for Effect-native block streaming.
|
|
5382
|
-
*
|
|
5383
|
-
* @module BlockStreamService
|
|
5384
|
-
* @since 0.2.12
|
|
5385
|
-
*
|
|
5386
|
-
* @description
|
|
5387
|
-
* Provides Effect Stream integration for watching blocks with reorg support.
|
|
5388
|
-
* Wraps voltaire core's BlockStream for fiber-safe, composable block streaming.
|
|
5389
|
-
*
|
|
5390
|
-
* @see {@link BlockStream} - The live implementation layer
|
|
5391
|
-
* @see {@link TransportService} - Required dependency
|
|
5392
|
-
*/
|
|
5393
|
-
|
|
5394
5385
|
/**
|
|
5395
|
-
*
|
|
5386
|
+
* Wallet permission object per EIP-2255.
|
|
5396
5387
|
*
|
|
5397
|
-
* @since 0.
|
|
5388
|
+
* @since 0.0.1
|
|
5398
5389
|
*/
|
|
5399
|
-
|
|
5400
|
-
/**
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
* yield* Stream.runForEach(
|
|
5408
|
-
* stream.backfill({ fromBlock: 18000000n, toBlock: 18000100n }),
|
|
5409
|
-
* (event) => Effect.log(`Got ${event.blocks.length} blocks`)
|
|
5410
|
-
* );
|
|
5411
|
-
* });
|
|
5412
|
-
* ```
|
|
5413
|
-
*/
|
|
5414
|
-
readonly backfill: <TInclude extends BlockInclude = "header">(options: BackfillOptions<TInclude>) => Stream.Stream<BlocksEvent<TInclude>, BlockStreamError>;
|
|
5415
|
-
/**
|
|
5416
|
-
* Watch for new blocks with reorg detection.
|
|
5417
|
-
*
|
|
5418
|
-
* @example
|
|
5419
|
-
* ```typescript
|
|
5420
|
-
* const program = Effect.gen(function* () {
|
|
5421
|
-
* const stream = yield* BlockStreamService;
|
|
5422
|
-
* yield* Stream.runForEach(
|
|
5423
|
-
* stream.watch({ include: 'transactions' }),
|
|
5424
|
-
* (event) => {
|
|
5425
|
-
* if (event.type === 'reorg') {
|
|
5426
|
-
* return Effect.log(`Reorg: ${event.removed.length} blocks removed`);
|
|
5427
|
-
* }
|
|
5428
|
-
* return Effect.log(`New block: ${event.blocks[0]?.header.number}`);
|
|
5429
|
-
* }
|
|
5430
|
-
* );
|
|
5431
|
-
* });
|
|
5432
|
-
* ```
|
|
5433
|
-
*/
|
|
5434
|
-
readonly watch: <TInclude extends BlockInclude = "header">(options?: WatchOptions<TInclude>) => Stream.Stream<BlockStreamEvent<TInclude>, BlockStreamError>;
|
|
5435
|
-
};
|
|
5436
|
-
declare const BlockStreamService_base: Context.TagClass<BlockStreamService, "BlockStreamService", BlockStreamShape>;
|
|
5390
|
+
interface Permission {
|
|
5391
|
+
/** Parent capability (e.g., "eth_accounts") */
|
|
5392
|
+
readonly parentCapability: string;
|
|
5393
|
+
/** Invoker (origin) that was granted the permission */
|
|
5394
|
+
readonly invoker: string;
|
|
5395
|
+
/** Optional caveats restricting the permission */
|
|
5396
|
+
readonly caveats?: readonly Caveat[];
|
|
5397
|
+
}
|
|
5437
5398
|
/**
|
|
5438
|
-
*
|
|
5439
|
-
*
|
|
5440
|
-
* @since 0.2.12
|
|
5441
|
-
*
|
|
5442
|
-
* @example
|
|
5443
|
-
* ```typescript
|
|
5444
|
-
* import { Effect, Stream } from 'effect';
|
|
5445
|
-
* import { BlockStreamService, BlockStream, HttpTransport } from 'voltaire-effect';
|
|
5446
|
-
*
|
|
5447
|
-
* const program = Effect.gen(function* () {
|
|
5448
|
-
* const blockStream = yield* BlockStreamService;
|
|
5399
|
+
* Permission request object.
|
|
5449
5400
|
*
|
|
5450
|
-
*
|
|
5451
|
-
* blockStream.watch({ include: 'receipts' }),
|
|
5452
|
-
* (event) => {
|
|
5453
|
-
* if (event.type === 'reorg') {
|
|
5454
|
-
* return Effect.log(`Reorg detected`);
|
|
5455
|
-
* }
|
|
5456
|
-
* return Effect.log(`Block ${event.blocks[0]?.header.number}`);
|
|
5457
|
-
* }
|
|
5458
|
-
* );
|
|
5459
|
-
* }).pipe(
|
|
5460
|
-
* Effect.provide(BlockStream),
|
|
5461
|
-
* Effect.provide(HttpTransport('https://mainnet.infura.io/v3/YOUR_KEY'))
|
|
5462
|
-
* );
|
|
5463
|
-
* ```
|
|
5401
|
+
* @since 0.0.1
|
|
5464
5402
|
*/
|
|
5465
|
-
|
|
5403
|
+
interface PermissionRequest {
|
|
5404
|
+
/** The permission being requested (e.g., "eth_accounts") */
|
|
5405
|
+
readonly [permission: string]: Record<string, unknown>;
|
|
5466
5406
|
}
|
|
5467
|
-
|
|
5468
5407
|
/**
|
|
5469
|
-
*
|
|
5470
|
-
*
|
|
5471
|
-
* @module BlockStream
|
|
5472
|
-
* @since 0.2.12
|
|
5408
|
+
* Native currency configuration for a chain.
|
|
5473
5409
|
*
|
|
5474
|
-
* @
|
|
5475
|
-
* Provides the live implementation layer for BlockStreamService.
|
|
5476
|
-
* Creates an EIP-1193 provider from TransportService and wraps core BlockStream.
|
|
5477
|
-
*/
|
|
5478
|
-
|
|
5479
|
-
/**
|
|
5480
|
-
* Build a BlockStream directly from TransportService without a service layer.
|
|
5410
|
+
* @since 0.0.1
|
|
5481
5411
|
*/
|
|
5482
|
-
|
|
5412
|
+
interface NativeCurrency {
|
|
5413
|
+
/** Currency name (e.g., "Ether") */
|
|
5414
|
+
readonly name: string;
|
|
5415
|
+
/** Currency symbol (e.g., "ETH") */
|
|
5416
|
+
readonly symbol: string;
|
|
5417
|
+
/** Currency decimals (typically 18) */
|
|
5418
|
+
readonly decimals: number;
|
|
5419
|
+
}
|
|
5483
5420
|
/**
|
|
5484
|
-
*
|
|
5485
|
-
*
|
|
5486
|
-
* @since 0.2.12
|
|
5487
|
-
*
|
|
5488
|
-
* @example
|
|
5489
|
-
* ```typescript
|
|
5490
|
-
* import { Effect, Stream } from 'effect';
|
|
5491
|
-
* import { makeBlockStream, HttpTransport } from 'voltaire-effect/services';
|
|
5421
|
+
* Chain configuration for wallet_addEthereumChain (EIP-3085).
|
|
5492
5422
|
*
|
|
5493
|
-
*
|
|
5494
|
-
* const blockStream = yield* makeBlockStream();
|
|
5495
|
-
* yield* Stream.runForEach(
|
|
5496
|
-
* blockStream.watch(),
|
|
5497
|
-
* (event) => Effect.log(`Event: ${event.type}`)
|
|
5498
|
-
* );
|
|
5499
|
-
* }).pipe(
|
|
5500
|
-
* Effect.provide(HttpTransport('https://...'))
|
|
5501
|
-
* );
|
|
5502
|
-
* ```
|
|
5423
|
+
* @since 0.0.1
|
|
5503
5424
|
*/
|
|
5504
|
-
|
|
5505
|
-
|
|
5425
|
+
interface ChainConfig$1 {
|
|
5426
|
+
/** Chain ID as a number */
|
|
5427
|
+
readonly id: number;
|
|
5428
|
+
/** Human-readable chain name */
|
|
5429
|
+
readonly name: string;
|
|
5430
|
+
/** Native currency configuration */
|
|
5431
|
+
readonly nativeCurrency: NativeCurrency;
|
|
5432
|
+
/** RPC URL endpoints */
|
|
5433
|
+
readonly rpcUrls: {
|
|
5434
|
+
readonly default: {
|
|
5435
|
+
readonly http: readonly string[];
|
|
5436
|
+
};
|
|
5437
|
+
};
|
|
5438
|
+
/** Block explorer URLs (optional) */
|
|
5439
|
+
readonly blockExplorers?: {
|
|
5440
|
+
readonly default: {
|
|
5441
|
+
readonly name: string;
|
|
5442
|
+
readonly url: string;
|
|
5443
|
+
};
|
|
5444
|
+
};
|
|
5445
|
+
}
|
|
5446
|
+
declare const SignerError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
5447
|
+
readonly _tag: "SignerError";
|
|
5448
|
+
} & Readonly<A>;
|
|
5506
5449
|
/**
|
|
5507
|
-
*
|
|
5450
|
+
* Error thrown when a signer operation fails.
|
|
5508
5451
|
*
|
|
5509
5452
|
* @description
|
|
5510
|
-
*
|
|
5511
|
-
*
|
|
5453
|
+
* Contains the original input, error message and optional underlying cause.
|
|
5454
|
+
* All SignerService methods may fail with this error type.
|
|
5512
5455
|
*
|
|
5513
|
-
*
|
|
5514
|
-
*
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
*
|
|
5456
|
+
* Common failure reasons:
|
|
5457
|
+
* - User rejected the request (in browser wallet)
|
|
5458
|
+
* - Insufficient funds for transaction
|
|
5459
|
+
* - Invalid transaction parameters
|
|
5460
|
+
* - Network errors during broadcast
|
|
5461
|
+
* - Signing failures
|
|
5519
5462
|
*
|
|
5520
5463
|
* @since 0.0.1
|
|
5521
5464
|
*/
|
|
5522
|
-
|
|
5465
|
+
declare class SignerError extends SignerError_base<{
|
|
5523
5466
|
/**
|
|
5524
|
-
*
|
|
5525
|
-
*
|
|
5526
|
-
* @param key - The cache key
|
|
5527
|
-
* @returns Effect containing the cached value or undefined
|
|
5467
|
+
* The original input that caused the error.
|
|
5528
5468
|
*/
|
|
5529
|
-
readonly
|
|
5469
|
+
readonly input: unknown;
|
|
5530
5470
|
/**
|
|
5531
|
-
*
|
|
5532
|
-
*
|
|
5533
|
-
* @param key - The cache key
|
|
5534
|
-
* @param value - The value to cache
|
|
5535
|
-
* @param ttl - Optional time-to-live in milliseconds
|
|
5536
|
-
* @returns Effect that completes when value is stored
|
|
5471
|
+
* Human-readable error message.
|
|
5537
5472
|
*/
|
|
5538
|
-
readonly
|
|
5473
|
+
readonly message: string;
|
|
5539
5474
|
/**
|
|
5540
|
-
*
|
|
5541
|
-
*
|
|
5542
|
-
* @param key - The cache key
|
|
5543
|
-
* @returns Effect that completes when value is deleted
|
|
5475
|
+
* JSON-RPC error code (propagated from underlying errors).
|
|
5476
|
+
* May be undefined if the error originated outside JSON-RPC.
|
|
5544
5477
|
*/
|
|
5545
|
-
readonly
|
|
5478
|
+
readonly code?: number;
|
|
5546
5479
|
/**
|
|
5547
|
-
*
|
|
5548
|
-
*
|
|
5549
|
-
* @returns Effect that completes when cache is cleared
|
|
5480
|
+
* Optional underlying cause.
|
|
5550
5481
|
*/
|
|
5551
|
-
readonly
|
|
5552
|
-
}
|
|
5553
|
-
declare const CacheService_base: Context.TagClass<CacheService, "CacheService", CacheShape>;
|
|
5554
|
-
/**
|
|
5555
|
-
* Cache service for Effect-based applications.
|
|
5556
|
-
*
|
|
5557
|
-
* @since 0.0.1
|
|
5558
|
-
*/
|
|
5559
|
-
declare class CacheService extends CacheService_base {
|
|
5560
|
-
}
|
|
5561
|
-
/**
|
|
5562
|
-
* Options for the MemoryCache implementation.
|
|
5563
|
-
*/
|
|
5564
|
-
interface MemoryCacheOptions {
|
|
5482
|
+
readonly cause?: unknown;
|
|
5565
5483
|
/**
|
|
5566
|
-
*
|
|
5567
|
-
* If not provided, entries never expire.
|
|
5484
|
+
* Optional context for debugging.
|
|
5568
5485
|
*/
|
|
5569
|
-
readonly
|
|
5486
|
+
readonly context?: Record<string, unknown>;
|
|
5487
|
+
}> {
|
|
5570
5488
|
/**
|
|
5571
|
-
*
|
|
5572
|
-
*
|
|
5489
|
+
* Creates a new SignerError.
|
|
5490
|
+
*
|
|
5491
|
+
* @param input - The original input that caused the error
|
|
5492
|
+
* @param message - Human-readable error message (optional, defaults to cause message)
|
|
5493
|
+
* @param options - Optional error options
|
|
5494
|
+
* @param options.code - JSON-RPC error code
|
|
5495
|
+
* @param options.cause - Underlying error that caused this failure
|
|
5573
5496
|
*/
|
|
5574
|
-
|
|
5497
|
+
constructor(input: unknown, message?: string, options?: {
|
|
5498
|
+
code?: number;
|
|
5499
|
+
context?: Record<string, unknown>;
|
|
5500
|
+
cause?: Error;
|
|
5501
|
+
});
|
|
5575
5502
|
}
|
|
5576
5503
|
/**
|
|
5577
|
-
*
|
|
5504
|
+
* Transaction request for sending transactions.
|
|
5578
5505
|
*
|
|
5579
|
-
* @
|
|
5580
|
-
*
|
|
5506
|
+
* @description
|
|
5507
|
+
* Supports all Ethereum transaction types:
|
|
5508
|
+
* - Legacy (type 0) - original transactions with gasPrice
|
|
5509
|
+
* - EIP-2930 (type 1) - access list transactions with gasPrice
|
|
5510
|
+
* - EIP-1559 (type 2) - priority fee transactions
|
|
5511
|
+
* - EIP-4844 (type 3) - blob transactions for L2 data availability
|
|
5512
|
+
* - EIP-7702 (type 4) - set code transactions for smart account delegation
|
|
5581
5513
|
*
|
|
5582
|
-
*
|
|
5583
|
-
|
|
5584
|
-
declare const MemoryCache: (options?: MemoryCacheOptions) => Layer.Layer<CacheService>;
|
|
5585
|
-
/**
|
|
5586
|
-
* No-op cache implementation that never stores values.
|
|
5587
|
-
* Useful for testing or when caching is disabled.
|
|
5514
|
+
* Transaction type is auto-detected based on provided fields, or can be
|
|
5515
|
+
* explicitly set via the `type` field.
|
|
5588
5516
|
*
|
|
5589
|
-
*
|
|
5517
|
+
* Most fields are optional and will be auto-filled if not provided.
|
|
5590
5518
|
*
|
|
5591
|
-
*
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
* Parameters for a CCIP offchain lookup request.
|
|
5519
|
+
* Auto-filled fields:
|
|
5520
|
+
* - `nonce` - Fetched from network via getTransactionCount('pending')
|
|
5521
|
+
* - `gasLimit` - Estimated via estimateGas
|
|
5522
|
+
* - `gasPrice` or `maxFeePerGas` - Fetched from network
|
|
5523
|
+
* - `chainId` - Fetched from network via eth_chainId
|
|
5597
5524
|
*
|
|
5598
5525
|
* @since 0.0.1
|
|
5599
5526
|
*/
|
|
5600
|
-
|
|
5601
|
-
/**
|
|
5602
|
-
readonly
|
|
5603
|
-
/**
|
|
5604
|
-
readonly
|
|
5605
|
-
/**
|
|
5606
|
-
readonly
|
|
5607
|
-
/**
|
|
5608
|
-
readonly
|
|
5609
|
-
/**
|
|
5610
|
-
readonly
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5527
|
+
type TransactionRequest = {
|
|
5528
|
+
/** Recipient address (null or undefined for contract deployment) */
|
|
5529
|
+
readonly to?: AddressInput | null;
|
|
5530
|
+
/** Value in wei to send with the transaction */
|
|
5531
|
+
readonly value?: bigint;
|
|
5532
|
+
/** Transaction input data (for contract calls/deployment) */
|
|
5533
|
+
readonly data?: HexType$2;
|
|
5534
|
+
/** Transaction nonce (auto-filled from network if not provided) */
|
|
5535
|
+
readonly nonce?: bigint;
|
|
5536
|
+
/** Gas limit (auto-estimated if not provided) */
|
|
5537
|
+
readonly gasLimit?: bigint;
|
|
5538
|
+
/** Gas price for legacy/EIP-2930 transactions (type 0/1) */
|
|
5539
|
+
readonly gasPrice?: bigint;
|
|
5540
|
+
/** Max fee per gas for EIP-1559+ transactions (type 2/3/4) */
|
|
5541
|
+
readonly maxFeePerGas?: bigint;
|
|
5542
|
+
/** Max priority fee (tip) for EIP-1559+ transactions (type 2/3/4) */
|
|
5543
|
+
readonly maxPriorityFeePerGas?: bigint;
|
|
5544
|
+
/** Chain ID for replay protection (auto-detected if not provided) */
|
|
5545
|
+
readonly chainId?: bigint;
|
|
5546
|
+
/** EIP-2930+ access list for pre-warming storage slots */
|
|
5547
|
+
readonly accessList?: Array<{
|
|
5548
|
+
address: AddressInput;
|
|
5549
|
+
storageKeys: Array<`0x${string}`>;
|
|
5550
|
+
}>;
|
|
5551
|
+
/** Transaction type (auto-detected if not provided) */
|
|
5552
|
+
readonly type?: 0 | 1 | 2 | 3 | 4;
|
|
5553
|
+
/** EIP-4844: Versioned hashes for blob commitments */
|
|
5554
|
+
readonly blobVersionedHashes?: readonly `0x${string}`[];
|
|
5555
|
+
/** EIP-4844: Max fee per blob gas */
|
|
5556
|
+
readonly maxFeePerBlobGas?: bigint;
|
|
5557
|
+
/** EIP-4844: Raw blob data (sidecar) */
|
|
5558
|
+
readonly blobs?: readonly Uint8Array[];
|
|
5559
|
+
/** EIP-4844: KZG commitments for blobs (sidecar) */
|
|
5560
|
+
readonly kzgCommitments?: readonly `0x${string}`[];
|
|
5561
|
+
/** EIP-4844: KZG proofs for blobs (sidecar) */
|
|
5562
|
+
readonly kzgProofs?: readonly `0x${string}`[];
|
|
5563
|
+
/** EIP-7702: Authorization list for set code transactions */
|
|
5564
|
+
readonly authorizationList?: readonly AuthorizationInput[];
|
|
5565
|
+
};
|
|
5615
5566
|
/**
|
|
5616
|
-
*
|
|
5567
|
+
* Parameters for preparing an EIP-7702 authorization.
|
|
5617
5568
|
*
|
|
5618
5569
|
* @since 0.0.1
|
|
5619
5570
|
*/
|
|
5620
|
-
|
|
5621
|
-
/**
|
|
5622
|
-
readonly
|
|
5623
|
-
/**
|
|
5624
|
-
readonly
|
|
5625
|
-
/**
|
|
5626
|
-
readonly
|
|
5627
|
-
}> {
|
|
5571
|
+
interface PrepareAuthorizationParams {
|
|
5572
|
+
/** Address of the contract to delegate to */
|
|
5573
|
+
readonly contractAddress: `0x${string}` | AddressType$3;
|
|
5574
|
+
/** Chain ID where the authorization is valid */
|
|
5575
|
+
readonly chainId?: bigint;
|
|
5576
|
+
/** Nonce of the authorizing account (fetched if not provided) */
|
|
5577
|
+
readonly nonce?: bigint;
|
|
5628
5578
|
}
|
|
5629
5579
|
/**
|
|
5630
|
-
*
|
|
5580
|
+
* Parameters for EIP-5792 wallet_sendCalls.
|
|
5581
|
+
*
|
|
5582
|
+
* @description
|
|
5583
|
+
* Defines a batch of calls to be sent atomically via wallet_sendCalls.
|
|
5584
|
+
* Supported by smart contract wallets and some browser wallets.
|
|
5631
5585
|
*
|
|
5632
5586
|
* @since 0.0.1
|
|
5633
5587
|
*/
|
|
5634
|
-
|
|
5635
|
-
/**
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5588
|
+
interface SendCallsParams {
|
|
5589
|
+
/** Array of calls to execute atomically */
|
|
5590
|
+
readonly calls: readonly {
|
|
5591
|
+
/** Target contract address */
|
|
5592
|
+
readonly to: AddressInput;
|
|
5593
|
+
/** Calldata for the call */
|
|
5594
|
+
readonly data?: HexType$2;
|
|
5595
|
+
/** Value in wei to send */
|
|
5596
|
+
readonly value?: bigint;
|
|
5597
|
+
}[];
|
|
5598
|
+
/** Optional capabilities like paymaster service */
|
|
5599
|
+
readonly capabilities?: {
|
|
5600
|
+
/** Paymaster service configuration */
|
|
5601
|
+
readonly paymasterService?: {
|
|
5602
|
+
readonly url: string;
|
|
5603
|
+
};
|
|
5604
|
+
};
|
|
5605
|
+
}
|
|
5644
5606
|
/**
|
|
5645
|
-
*
|
|
5607
|
+
* Status of an EIP-5792 call bundle.
|
|
5646
5608
|
*
|
|
5647
5609
|
* @description
|
|
5648
|
-
*
|
|
5649
|
-
* When a contract reverts with OffchainLookup, this service handles
|
|
5650
|
-
* fetching the data from the specified gateway URLs.
|
|
5610
|
+
* Represents the current state of a batch of calls sent via wallet_sendCalls.
|
|
5651
5611
|
*
|
|
5652
5612
|
* @since 0.0.1
|
|
5653
|
-
*
|
|
5654
|
-
* @example Basic usage with DefaultCcip
|
|
5655
|
-
* ```typescript
|
|
5656
|
-
* import { Effect } from 'effect'
|
|
5657
|
-
* import { CcipService, DefaultCcip } from 'voltaire-effect'
|
|
5658
|
-
*
|
|
5659
|
-
* const program = Effect.gen(function* () {
|
|
5660
|
-
* const ccip = yield* CcipService
|
|
5661
|
-
* return yield* ccip.request({
|
|
5662
|
-
* sender: '0x...',
|
|
5663
|
-
* urls: ['https://gateway.example.com/{sender}/{data}'],
|
|
5664
|
-
* callData: '0x...',
|
|
5665
|
-
* callbackSelector: '0x...',
|
|
5666
|
-
* extraData: '0x'
|
|
5667
|
-
* })
|
|
5668
|
-
* }).pipe(
|
|
5669
|
-
* Effect.provide(DefaultCcip)
|
|
5670
|
-
* )
|
|
5671
|
-
* ```
|
|
5672
|
-
*
|
|
5673
|
-
* @see {@link DefaultCcip} - HTTP-based implementation
|
|
5674
|
-
* @see {@link NoopCcip} - Disabled implementation
|
|
5675
|
-
* @see {@link CcipShape} - The service interface shape
|
|
5676
5613
|
*/
|
|
5677
|
-
|
|
5614
|
+
interface CallsStatus {
|
|
5615
|
+
/** Current status of the bundle */
|
|
5616
|
+
readonly status: "PENDING" | "CONFIRMED" | "FAILED";
|
|
5617
|
+
/** Transaction receipts (only present when CONFIRMED) */
|
|
5618
|
+
readonly receipts?: readonly {
|
|
5619
|
+
readonly transactionHash: HexType$2;
|
|
5620
|
+
readonly blockNumber: bigint;
|
|
5621
|
+
readonly gasUsed: bigint;
|
|
5622
|
+
readonly status: "success" | "reverted";
|
|
5623
|
+
readonly logs: readonly EventLogType[];
|
|
5624
|
+
}[];
|
|
5678
5625
|
}
|
|
5679
|
-
|
|
5680
5626
|
/**
|
|
5681
|
-
*
|
|
5682
|
-
*
|
|
5683
|
-
* @module DefaultCcip
|
|
5684
|
-
* @since 0.0.1
|
|
5627
|
+
* Wallet capabilities per chain (EIP-5792).
|
|
5685
5628
|
*
|
|
5686
5629
|
* @description
|
|
5687
|
-
*
|
|
5688
|
-
* URLs are tried in order until one succeeds.
|
|
5689
|
-
*
|
|
5690
|
-
* URL format per EIP-3668:
|
|
5691
|
-
* - Replace {sender} with the contract address (lowercase)
|
|
5692
|
-
* - Replace {data} with the calldata
|
|
5693
|
-
* - If URL contains {data}, use GET request
|
|
5694
|
-
* - Otherwise use POST with JSON body { sender, data }
|
|
5630
|
+
* Describes what features a wallet supports for each chain.
|
|
5695
5631
|
*
|
|
5696
|
-
* @
|
|
5697
|
-
* @see {@link NoopCcip} - Disabled implementation
|
|
5698
|
-
* @see https://eips.ethereum.org/EIPS/eip-3668
|
|
5632
|
+
* @since 0.0.1
|
|
5699
5633
|
*/
|
|
5700
|
-
|
|
5634
|
+
interface WalletCapabilities {
|
|
5635
|
+
[chainId: string]: {
|
|
5636
|
+
/** Whether atomic batch transactions are supported */
|
|
5637
|
+
readonly atomicBatch?: {
|
|
5638
|
+
readonly supported: boolean;
|
|
5639
|
+
};
|
|
5640
|
+
/** Whether paymaster service is supported */
|
|
5641
|
+
readonly paymasterService?: {
|
|
5642
|
+
readonly supported: boolean;
|
|
5643
|
+
};
|
|
5644
|
+
/** Whether session keys are supported */
|
|
5645
|
+
readonly sessionKeys?: {
|
|
5646
|
+
readonly supported: boolean;
|
|
5647
|
+
};
|
|
5648
|
+
};
|
|
5649
|
+
}
|
|
5701
5650
|
/**
|
|
5702
|
-
*
|
|
5651
|
+
* Shape of the signer service.
|
|
5703
5652
|
*
|
|
5704
5653
|
* @description
|
|
5705
|
-
*
|
|
5706
|
-
*
|
|
5654
|
+
* Defines all signing and transaction operations available through SignerService.
|
|
5655
|
+
* Each method returns an Effect that may fail with SignerError.
|
|
5707
5656
|
*
|
|
5708
5657
|
* @since 0.0.1
|
|
5709
|
-
|
|
5710
|
-
|
|
5658
|
+
*/
|
|
5659
|
+
type SignerShape = {
|
|
5660
|
+
/**
|
|
5661
|
+
* Signs a message using EIP-191 personal_sign.
|
|
5662
|
+
* @param message - The message to sign (hex-encoded)
|
|
5663
|
+
* @returns Signature
|
|
5664
|
+
*/
|
|
5665
|
+
readonly signMessage: (message: HexType$2) => Effect.Effect<SignatureType, SignerError>;
|
|
5666
|
+
/**
|
|
5667
|
+
* Signs a transaction without broadcasting.
|
|
5668
|
+
* @param tx - Transaction parameters
|
|
5669
|
+
* @returns Signed transaction (hex-encoded)
|
|
5670
|
+
*/
|
|
5671
|
+
readonly signTransaction: (tx: TransactionRequest) => Effect.Effect<HexType$2, SignerError>;
|
|
5672
|
+
/**
|
|
5673
|
+
* Signs EIP-712 typed structured data.
|
|
5674
|
+
* @param typedData - Typed data to sign
|
|
5675
|
+
* @returns Signature
|
|
5676
|
+
*/
|
|
5677
|
+
readonly signTypedData: (typedData: TypedDataType) => Effect.Effect<SignatureType, SignerError>;
|
|
5678
|
+
/**
|
|
5679
|
+
* Prepares an EIP-7702 authorization tuple.
|
|
5680
|
+
* @param params - Authorization parameters
|
|
5681
|
+
* @returns Unsigned authorization ready for signing
|
|
5682
|
+
*/
|
|
5683
|
+
readonly prepareAuthorization: (params: PrepareAuthorizationParams) => Effect.Effect<UnsignedAuthorization, SignerError>;
|
|
5684
|
+
/**
|
|
5685
|
+
* Signs and broadcasts a transaction.
|
|
5686
|
+
* @param tx - Transaction parameters
|
|
5687
|
+
* @returns Transaction hash
|
|
5688
|
+
*/
|
|
5689
|
+
readonly sendTransaction: (tx: TransactionRequest) => Effect.Effect<HashType$1, SignerError>;
|
|
5690
|
+
/**
|
|
5691
|
+
* Broadcasts an already-signed transaction.
|
|
5692
|
+
* @param signedTx - RLP-encoded signed transaction
|
|
5693
|
+
* @returns Transaction hash
|
|
5694
|
+
*/
|
|
5695
|
+
readonly sendRawTransaction: (signedTx: HexType$2) => Effect.Effect<HashType$1, SignerError>;
|
|
5696
|
+
/**
|
|
5697
|
+
* Gets wallet addresses without prompting (eth_accounts).
|
|
5698
|
+
* @returns Array of connected addresses
|
|
5699
|
+
*/
|
|
5700
|
+
readonly getAddresses: () => Effect.Effect<AddressType$3[], SignerError>;
|
|
5701
|
+
/**
|
|
5702
|
+
* Requests wallet addresses (triggers wallet popup in browser).
|
|
5703
|
+
* @returns Array of connected addresses
|
|
5704
|
+
*/
|
|
5705
|
+
readonly requestAddresses: () => Effect.Effect<AddressType$3[], SignerError>;
|
|
5706
|
+
/**
|
|
5707
|
+
* Gets the current permissions granted to the dapp (EIP-2255).
|
|
5708
|
+
* @returns Array of granted permissions
|
|
5709
|
+
*/
|
|
5710
|
+
readonly getPermissions: () => Effect.Effect<Permission[], SignerError>;
|
|
5711
|
+
/**
|
|
5712
|
+
* Requests specific permissions from the wallet (EIP-2255).
|
|
5713
|
+
* @param permissions - Object with permission names as keys
|
|
5714
|
+
* @returns Array of granted permissions
|
|
5715
|
+
*/
|
|
5716
|
+
readonly requestPermissions: (permissions: PermissionRequest) => Effect.Effect<Permission[], SignerError>;
|
|
5717
|
+
/**
|
|
5718
|
+
* Requests the wallet to add a new chain (EIP-3085).
|
|
5719
|
+
* @param chain - Chain configuration to add
|
|
5720
|
+
*/
|
|
5721
|
+
readonly addChain: (chain: ChainConfig$1) => Effect.Effect<void, SignerError>;
|
|
5722
|
+
/**
|
|
5723
|
+
* Requests wallet to switch to a different chain.
|
|
5724
|
+
* @param chainId - Target chain ID (e.g., 1 for mainnet)
|
|
5725
|
+
*/
|
|
5726
|
+
readonly switchChain: (chainId: number) => Effect.Effect<void, SignerError>;
|
|
5727
|
+
/**
|
|
5728
|
+
* Gets wallet capabilities per chain (EIP-5792).
|
|
5729
|
+
* @param account - Optional account address to query capabilities for
|
|
5730
|
+
* @returns Wallet capabilities indexed by chain ID
|
|
5731
|
+
*/
|
|
5732
|
+
readonly getCapabilities: (account?: AddressInput) => Effect.Effect<WalletCapabilities, SignerError>;
|
|
5733
|
+
/**
|
|
5734
|
+
* Sends a batch of calls atomically (EIP-5792).
|
|
5735
|
+
* @param params - Batch call parameters
|
|
5736
|
+
* @returns Bundle ID for tracking the batch
|
|
5737
|
+
*/
|
|
5738
|
+
readonly sendCalls: (params: SendCallsParams) => Effect.Effect<string, SignerError>;
|
|
5739
|
+
/**
|
|
5740
|
+
* Gets the status of a call bundle (EIP-5792).
|
|
5741
|
+
* @param bundleId - The bundle ID returned from sendCalls
|
|
5742
|
+
* @returns Current status and receipts if confirmed
|
|
5743
|
+
*/
|
|
5744
|
+
readonly getCallsStatus: (bundleId: string) => Effect.Effect<CallsStatus, SignerError>;
|
|
5745
|
+
/**
|
|
5746
|
+
* Waits for a call bundle to complete (EIP-5792).
|
|
5747
|
+
* @param bundleId - The bundle ID returned from sendCalls
|
|
5748
|
+
* @param options - Polling options
|
|
5749
|
+
* @returns Final status with receipts
|
|
5750
|
+
*/
|
|
5751
|
+
readonly waitForCallsStatus: (bundleId: string, options?: {
|
|
5752
|
+
readonly timeout?: number;
|
|
5753
|
+
readonly pollingInterval?: number;
|
|
5754
|
+
}) => Effect.Effect<CallsStatus, SignerError>;
|
|
5755
|
+
};
|
|
5756
|
+
declare const SignerService_base: Context.TagClass<SignerService, "SignerService", SignerShape>;
|
|
5757
|
+
/**
|
|
5758
|
+
* Signer service for signing and sending transactions.
|
|
5759
|
+
*
|
|
5760
|
+
* @description
|
|
5761
|
+
* Provides methods for signing messages, transactions, and typed data.
|
|
5762
|
+
* This is an Effect Context.Tag that must be provided with a concrete
|
|
5763
|
+
* implementation (Signer.Live layer) before running.
|
|
5764
|
+
*
|
|
5765
|
+
* The service provides:
|
|
5766
|
+
* - Message signing (signMessage - EIP-191)
|
|
5767
|
+
* - Transaction signing (signTransaction)
|
|
5768
|
+
* - Typed data signing (signTypedData - EIP-712)
|
|
5769
|
+
* - Transaction sending (sendTransaction, sendRawTransaction)
|
|
5770
|
+
* - Wallet interaction (getAddresses, requestAddresses, getPermissions, requestPermissions, addChain, switchChain)
|
|
5771
|
+
*
|
|
5772
|
+
* Requires:
|
|
5773
|
+
* - AccountService - For cryptographic signing
|
|
5774
|
+
* - ProviderService - For gas estimation and nonce
|
|
5775
|
+
* - TransportService - For transaction broadcast
|
|
5776
|
+
*
|
|
5777
|
+
* @since 0.0.1
|
|
5778
|
+
*
|
|
5779
|
+
* @see {@link Signer} - The live implementation layer and composition helpers
|
|
5780
|
+
* @see {@link SignerShape} - The service interface shape
|
|
5781
|
+
* @see {@link SignerError} - Error type for failed operations
|
|
5782
|
+
* @see {@link AccountService} - Required for signing
|
|
5783
|
+
*/
|
|
5784
|
+
declare class SignerService extends SignerService_base {
|
|
5785
|
+
}
|
|
5786
|
+
|
|
5787
|
+
type HexType$1 = BrandedHex.HexType;
|
|
5788
|
+
|
|
5789
|
+
/**
|
|
5790
|
+
* Signer namespace with layer constructors and composition helpers.
|
|
5791
|
+
*
|
|
5792
|
+
* @description
|
|
5793
|
+
* Provides the live implementation and convenient factory functions for
|
|
5794
|
+
* creating Signer layers with different configurations.
|
|
5795
|
+
*
|
|
5796
|
+
* @since 0.0.1
|
|
5797
|
+
*
|
|
5798
|
+
* @example Basic usage with separate layers
|
|
5711
5799
|
* ```typescript
|
|
5712
5800
|
* import { Effect } from 'effect'
|
|
5713
|
-
* import {
|
|
5801
|
+
* import { Signer, SignerService, LocalAccount, Provider, HttpTransport } from 'voltaire-effect'
|
|
5714
5802
|
*
|
|
5715
5803
|
* const program = Effect.gen(function* () {
|
|
5716
|
-
* const
|
|
5717
|
-
* return yield*
|
|
5718
|
-
*
|
|
5719
|
-
*
|
|
5720
|
-
*
|
|
5721
|
-
*
|
|
5722
|
-
*
|
|
5723
|
-
*
|
|
5724
|
-
*
|
|
5804
|
+
* const signer = yield* SignerService
|
|
5805
|
+
* return yield* signer.sendTransaction({ to: recipient, value: 1n })
|
|
5806
|
+
* }).pipe(
|
|
5807
|
+
* Effect.provide(Signer.Live),
|
|
5808
|
+
* Effect.provide(LocalAccount(privateKey)),
|
|
5809
|
+
* Effect.provide(Provider),
|
|
5810
|
+
* Effect.provide(HttpTransport('https://...'))
|
|
5811
|
+
* )
|
|
5812
|
+
* ```
|
|
5813
|
+
*
|
|
5814
|
+
* @example Using fromProvider for composed layers
|
|
5815
|
+
* ```typescript
|
|
5816
|
+
* import { Effect } from 'effect'
|
|
5817
|
+
* import { Signer, SignerService, LocalAccount, Provider, HttpTransport } from 'voltaire-effect'
|
|
5818
|
+
*
|
|
5819
|
+
* const transport = HttpTransport('https://...')
|
|
5820
|
+
* const signerLayer = Signer.fromProvider(Provider, LocalAccount(privateKey))
|
|
5821
|
+
*
|
|
5822
|
+
* const program = Effect.gen(function* () {
|
|
5823
|
+
* const signer = yield* SignerService
|
|
5824
|
+
* return yield* signer.sendTransaction({ to: recipient, value: 1n })
|
|
5825
|
+
* }).pipe(
|
|
5826
|
+
* Effect.provide(signerLayer),
|
|
5827
|
+
* Effect.provide(transport)
|
|
5828
|
+
* )
|
|
5829
|
+
* ```
|
|
5830
|
+
*
|
|
5831
|
+
* @example Using fromPrivateKey for quick setup
|
|
5832
|
+
* ```typescript
|
|
5833
|
+
* import { Effect } from 'effect'
|
|
5834
|
+
* import { Signer, SignerService, Provider, HttpTransport } from 'voltaire-effect'
|
|
5835
|
+
*
|
|
5836
|
+
* const transport = HttpTransport('https://...')
|
|
5837
|
+
* const signerLayer = Signer.fromPrivateKey(privateKey, Provider)
|
|
5838
|
+
*
|
|
5839
|
+
* const program = Effect.gen(function* () {
|
|
5840
|
+
* const signer = yield* SignerService
|
|
5841
|
+
* return yield* signer.sendTransaction({ to: recipient, value: 1n })
|
|
5842
|
+
* }).pipe(
|
|
5843
|
+
* Effect.provide(signerLayer),
|
|
5844
|
+
* Effect.provide(transport)
|
|
5845
|
+
* )
|
|
5725
5846
|
* ```
|
|
5726
5847
|
*/
|
|
5727
|
-
declare const
|
|
5728
|
-
|
|
5848
|
+
declare const Signer: {
|
|
5849
|
+
/**
|
|
5850
|
+
* Live implementation layer requiring AccountService, ProviderService, and TransportService.
|
|
5851
|
+
*/
|
|
5852
|
+
readonly Live: Layer.Layer<SignerService, never, TransportService | ProviderService | AccountService>;
|
|
5853
|
+
/**
|
|
5854
|
+
* Creates a Signer layer by composing a provider layer and account layer.
|
|
5855
|
+
*
|
|
5856
|
+
* @description
|
|
5857
|
+
* Combines a ProviderService layer with an AccountService layer to create
|
|
5858
|
+
* a fully configured SignerService layer. The resulting layer still requires
|
|
5859
|
+
* TransportService to be provided.
|
|
5860
|
+
*
|
|
5861
|
+
* @param providerLayer - Layer providing ProviderService (requires TransportService)
|
|
5862
|
+
* @param accountLayer - Layer providing AccountService
|
|
5863
|
+
* @returns Layer providing SignerService (requires TransportService)
|
|
5864
|
+
*
|
|
5865
|
+
* @since 0.0.1
|
|
5866
|
+
*/
|
|
5867
|
+
readonly fromProvider: <E1, R1, E2, R2>(providerLayer: Layer.Layer<ProviderService, E1, R1>, accountLayer: Layer.Layer<AccountService, E2, R2>) => Layer.Layer<SignerService, E1 | E2, R1 | R2 | TransportService>;
|
|
5868
|
+
/**
|
|
5869
|
+
* Creates a Signer layer from a private key and provider layer.
|
|
5870
|
+
*
|
|
5871
|
+
* @description
|
|
5872
|
+
* Convenience function that creates a LocalAccount from the private key
|
|
5873
|
+
* and composes it with the given provider layer. The resulting layer
|
|
5874
|
+
* still requires TransportService and the crypto services (Secp256k1Service, KeccakService).
|
|
5875
|
+
*
|
|
5876
|
+
* @param privateKey - The private key as a hex string (with 0x prefix)
|
|
5877
|
+
* @param providerLayer - Layer providing ProviderService (requires TransportService)
|
|
5878
|
+
* @returns Layer providing SignerService (requires TransportService and crypto services)
|
|
5879
|
+
*
|
|
5880
|
+
* @since 0.0.1
|
|
5881
|
+
*/
|
|
5882
|
+
readonly fromPrivateKey: <E, R>(privateKey: HexType$1, providerLayer: Layer.Layer<ProviderService, E, R>) => Layer.Layer<SignerService, E, KeccakService | Secp256k1Service | TransportService | R>;
|
|
5883
|
+
};
|
|
5884
|
+
|
|
5885
|
+
type AddressType$2 = BrandedAddress.AddressType;
|
|
5886
|
+
type HashType = BrandedHash.HashType;
|
|
5887
|
+
type HexType = BrandedHex.HexType;
|
|
5888
|
+
/**
|
|
5889
|
+
* Single item in an ABI definition.
|
|
5890
|
+
*
|
|
5891
|
+
* @description
|
|
5892
|
+
* Can be a function, event, error, constructor, or fallback.
|
|
5893
|
+
* This is a simplified ABI item type for basic usage.
|
|
5894
|
+
*
|
|
5895
|
+
* @since 0.0.1
|
|
5896
|
+
*/
|
|
5897
|
+
type AbiItem$1 = {
|
|
5898
|
+
/** Item type (function, event, error, constructor, fallback, receive) */
|
|
5899
|
+
readonly type: string;
|
|
5900
|
+
/** Item name (undefined for constructor/fallback/receive) */
|
|
5901
|
+
readonly name?: string;
|
|
5902
|
+
/** Input parameters for functions/events/errors */
|
|
5903
|
+
readonly inputs?: readonly {
|
|
5904
|
+
type: string;
|
|
5905
|
+
name?: string;
|
|
5906
|
+
indexed?: boolean;
|
|
5907
|
+
}[];
|
|
5908
|
+
/** Output parameters for functions */
|
|
5909
|
+
readonly outputs?: readonly {
|
|
5910
|
+
type: string;
|
|
5911
|
+
name?: string;
|
|
5912
|
+
}[];
|
|
5913
|
+
/** Function state mutability (pure, view, nonpayable, payable) */
|
|
5914
|
+
readonly stateMutability?: string;
|
|
5915
|
+
/** Whether event is anonymous */
|
|
5916
|
+
readonly anonymous?: boolean;
|
|
5917
|
+
};
|
|
5918
|
+
/**
|
|
5919
|
+
* Full ABI definition as an array of items.
|
|
5920
|
+
*
|
|
5921
|
+
* @description
|
|
5922
|
+
* Standard Solidity ABI format as produced by solc.
|
|
5923
|
+
* Used to create type-safe contract instances.
|
|
5924
|
+
*
|
|
5925
|
+
* @since 0.0.1
|
|
5926
|
+
*
|
|
5927
|
+
* @example
|
|
5928
|
+
* ```typescript
|
|
5929
|
+
* const erc20Abi: Abi = [
|
|
5930
|
+
* { type: 'function', name: 'balanceOf', inputs: [{ type: 'address' }], outputs: [{ type: 'uint256' }], stateMutability: 'view' },
|
|
5931
|
+
* { type: 'function', name: 'transfer', inputs: [{ type: 'address' }, { type: 'uint256' }], outputs: [{ type: 'bool' }], stateMutability: 'nonpayable' },
|
|
5932
|
+
* { type: 'event', name: 'Transfer', inputs: [{ type: 'address', indexed: true }, { type: 'address', indexed: true }, { type: 'uint256' }] }
|
|
5933
|
+
* ] as const
|
|
5934
|
+
* ```
|
|
5935
|
+
*/
|
|
5936
|
+
type Abi = readonly AbiItem$1[];
|
|
5937
|
+
|
|
5938
|
+
/**
|
|
5939
|
+
* Block identifier for event filtering.
|
|
5940
|
+
* Can be a named tag or a block number.
|
|
5941
|
+
* @since 0.0.1
|
|
5942
|
+
*/
|
|
5943
|
+
type BlockTag = "latest" | "earliest" | "pending" | "safe" | "finalized" | bigint;
|
|
5944
|
+
/**
|
|
5945
|
+
* Filter options for querying contract events.
|
|
5946
|
+
* @since 0.0.1
|
|
5947
|
+
*/
|
|
5948
|
+
interface EventFilter {
|
|
5949
|
+
/** Start block for the query */
|
|
5950
|
+
readonly fromBlock?: BlockTag;
|
|
5951
|
+
/** End block for the query */
|
|
5952
|
+
readonly toBlock?: BlockTag;
|
|
5953
|
+
/** Indexed argument filters */
|
|
5954
|
+
readonly args?: Record<string, unknown>;
|
|
5955
|
+
}
|
|
5956
|
+
/**
|
|
5957
|
+
* Decoded event from a contract log.
|
|
5958
|
+
* @since 0.0.1
|
|
5959
|
+
*/
|
|
5960
|
+
interface DecodedEvent {
|
|
5961
|
+
/** Name of the event */
|
|
5962
|
+
readonly eventName: string;
|
|
5963
|
+
/** Decoded event arguments */
|
|
5964
|
+
readonly args: Record<string, unknown>;
|
|
5965
|
+
/** Block number where the event was emitted */
|
|
5966
|
+
readonly blockNumber: bigint;
|
|
5967
|
+
/** Transaction hash that emitted the event */
|
|
5968
|
+
readonly transactionHash: HexType;
|
|
5969
|
+
/** Log index within the block */
|
|
5970
|
+
readonly logIndex: number;
|
|
5971
|
+
}
|
|
5972
|
+
declare const ContractError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
5973
|
+
readonly _tag: "ContractError";
|
|
5974
|
+
} & Readonly<A>;
|
|
5975
|
+
/**
|
|
5976
|
+
* Base error class for contract operations.
|
|
5977
|
+
* @since 0.0.1
|
|
5978
|
+
*/
|
|
5979
|
+
declare class ContractError extends ContractError_base<{
|
|
5980
|
+
/**
|
|
5981
|
+
* The original input that caused the error.
|
|
5982
|
+
*/
|
|
5983
|
+
readonly input: unknown;
|
|
5984
|
+
/**
|
|
5985
|
+
* Human-readable error message.
|
|
5986
|
+
*/
|
|
5987
|
+
readonly message: string;
|
|
5988
|
+
/**
|
|
5989
|
+
* JSON-RPC error code (if applicable).
|
|
5990
|
+
*/
|
|
5991
|
+
readonly code?: number;
|
|
5992
|
+
/**
|
|
5993
|
+
* Optional underlying cause.
|
|
5994
|
+
*/
|
|
5995
|
+
readonly cause?: unknown;
|
|
5996
|
+
/**
|
|
5997
|
+
* Optional context for debugging.
|
|
5998
|
+
*/
|
|
5999
|
+
readonly context?: Record<string, unknown>;
|
|
6000
|
+
}> {
|
|
6001
|
+
constructor(input: unknown, message: string, options?: {
|
|
6002
|
+
code?: number;
|
|
6003
|
+
context?: Record<string, unknown>;
|
|
6004
|
+
cause?: unknown;
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
declare const ContractCallError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6008
|
+
readonly _tag: "ContractCallError";
|
|
6009
|
+
} & Readonly<A>;
|
|
6010
|
+
/**
|
|
6011
|
+
* Error thrown when a contract read call fails.
|
|
6012
|
+
* @since 0.0.1
|
|
6013
|
+
*/
|
|
6014
|
+
declare class ContractCallError extends ContractCallError_base<{
|
|
6015
|
+
readonly input: unknown;
|
|
6016
|
+
readonly message: string;
|
|
6017
|
+
readonly code?: number;
|
|
6018
|
+
readonly cause?: unknown;
|
|
6019
|
+
readonly context?: Record<string, unknown>;
|
|
6020
|
+
}> {
|
|
6021
|
+
constructor(input: unknown, message: string, options?: {
|
|
6022
|
+
code?: number;
|
|
6023
|
+
context?: Record<string, unknown>;
|
|
6024
|
+
cause?: unknown;
|
|
6025
|
+
});
|
|
6026
|
+
}
|
|
6027
|
+
declare const ContractWriteError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6028
|
+
readonly _tag: "ContractWriteError";
|
|
6029
|
+
} & Readonly<A>;
|
|
6030
|
+
/**
|
|
6031
|
+
* Error thrown when a contract write transaction fails.
|
|
6032
|
+
* @since 0.0.1
|
|
6033
|
+
*/
|
|
6034
|
+
declare class ContractWriteError extends ContractWriteError_base<{
|
|
6035
|
+
readonly input: unknown;
|
|
6036
|
+
readonly message: string;
|
|
6037
|
+
readonly code?: number;
|
|
6038
|
+
readonly cause?: unknown;
|
|
6039
|
+
readonly context?: Record<string, unknown>;
|
|
6040
|
+
}> {
|
|
6041
|
+
constructor(input: unknown, message: string, options?: {
|
|
6042
|
+
code?: number;
|
|
6043
|
+
context?: Record<string, unknown>;
|
|
6044
|
+
cause?: unknown;
|
|
6045
|
+
});
|
|
6046
|
+
}
|
|
6047
|
+
declare const ContractEventError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6048
|
+
readonly _tag: "ContractEventError";
|
|
6049
|
+
} & Readonly<A>;
|
|
6050
|
+
/**
|
|
6051
|
+
* Error thrown when fetching contract events fails.
|
|
6052
|
+
* @since 0.0.1
|
|
6053
|
+
*/
|
|
6054
|
+
declare class ContractEventError extends ContractEventError_base<{
|
|
6055
|
+
readonly input: unknown;
|
|
6056
|
+
readonly message: string;
|
|
6057
|
+
readonly code?: number;
|
|
6058
|
+
readonly cause?: unknown;
|
|
6059
|
+
readonly context?: Record<string, unknown>;
|
|
6060
|
+
}> {
|
|
6061
|
+
constructor(input: unknown, message: string, options?: {
|
|
6062
|
+
code?: number;
|
|
6063
|
+
context?: Record<string, unknown>;
|
|
6064
|
+
cause?: unknown;
|
|
6065
|
+
});
|
|
6066
|
+
}
|
|
6067
|
+
/**
|
|
6068
|
+
* Type-safe contract instance with read, write, simulate, and event methods.
|
|
6069
|
+
* @since 0.0.1
|
|
6070
|
+
*/
|
|
6071
|
+
interface ContractInstance<TAbi extends Abi> {
|
|
6072
|
+
/** Contract address */
|
|
6073
|
+
readonly address: AddressType$2;
|
|
6074
|
+
/** Contract ABI */
|
|
6075
|
+
readonly abi: TAbi;
|
|
6076
|
+
/** Read-only contract methods (view/pure functions) */
|
|
6077
|
+
readonly read: ContractReadMethods<TAbi>;
|
|
6078
|
+
/** State-changing contract methods */
|
|
6079
|
+
readonly write: ContractWriteMethods<TAbi>;
|
|
6080
|
+
/** Simulate state-changing methods without sending transactions */
|
|
6081
|
+
readonly simulate: ContractSimulateMethods<TAbi>;
|
|
6082
|
+
/** Query contract events */
|
|
6083
|
+
readonly getEvents: <E extends ExtractEventNames<TAbi>>(eventName: E, filter?: EventFilter) => Effect.Effect<DecodedEvent[], ContractEventError, ProviderService>;
|
|
6084
|
+
}
|
|
6085
|
+
type ExtractViewFunctions<TAbi extends Abi> = Extract<TAbi[number], {
|
|
6086
|
+
type: "function";
|
|
6087
|
+
stateMutability: "view" | "pure";
|
|
6088
|
+
}>;
|
|
6089
|
+
type ExtractWriteFunctions<TAbi extends Abi> = Extract<TAbi[number], {
|
|
6090
|
+
type: "function";
|
|
6091
|
+
stateMutability: "nonpayable" | "payable";
|
|
6092
|
+
}>;
|
|
6093
|
+
/**
|
|
6094
|
+
* Transaction options for write methods.
|
|
6095
|
+
* @since 0.0.1
|
|
6096
|
+
*/
|
|
6097
|
+
interface WriteOptions {
|
|
6098
|
+
/** Value in wei to send with the transaction */
|
|
6099
|
+
readonly value?: bigint;
|
|
6100
|
+
/** Gas limit for the transaction */
|
|
6101
|
+
readonly gas?: bigint;
|
|
6102
|
+
/** Gas price for legacy transactions */
|
|
6103
|
+
readonly gasPrice?: bigint;
|
|
6104
|
+
/** Max fee per gas for EIP-1559 transactions */
|
|
6105
|
+
readonly maxFeePerGas?: bigint;
|
|
6106
|
+
/** Max priority fee for EIP-1559 transactions */
|
|
6107
|
+
readonly maxPriorityFeePerGas?: bigint;
|
|
6108
|
+
/** Transaction nonce */
|
|
6109
|
+
readonly nonce?: bigint;
|
|
6110
|
+
}
|
|
6111
|
+
type ExtractEvents<TAbi extends Abi> = Extract<TAbi[number], {
|
|
6112
|
+
type: "event";
|
|
6113
|
+
}>;
|
|
6114
|
+
type ExtractEventNames<TAbi extends Abi> = ExtractEvents<TAbi> extends {
|
|
6115
|
+
name: infer N;
|
|
6116
|
+
} ? N extends string ? N : never : never;
|
|
6117
|
+
type AbiInputsToArgs<TInputs extends readonly {
|
|
6118
|
+
type: string;
|
|
6119
|
+
name?: string;
|
|
6120
|
+
}[]> = {
|
|
6121
|
+
[K in keyof TInputs]: AbiTypeToInput<TInputs[K]["type"]>;
|
|
6122
|
+
};
|
|
6123
|
+
type BytesInput = Uint8Array | `0x${string}`;
|
|
6124
|
+
type AbiTypeToInput<T extends string> = T extends `uint${string}` ? bigint : T extends `int${string}` ? bigint : T extends "address" ? AddressType$2 : T extends "bool" ? boolean : T extends "string" ? string : T extends `bytes${string}` | "bytes" ? BytesInput : T extends `${string}[]` ? readonly unknown[] : T extends `tuple` ? Record<string, unknown> : unknown;
|
|
6125
|
+
type AbiTypeToOutput<T extends string> = T extends `uint${string}` ? bigint : T extends `int${string}` ? bigint : T extends "address" ? AddressType$2 : T extends "bool" ? boolean : T extends "string" ? string : T extends `bytes${string}` | "bytes" ? Uint8Array : T extends `${string}[]` ? readonly unknown[] : T extends `tuple` ? Record<string, unknown> : unknown;
|
|
6126
|
+
type AbiOutputToTs<TOutputs extends readonly {
|
|
6127
|
+
type: string;
|
|
6128
|
+
}[]> = TOutputs extends readonly [{
|
|
6129
|
+
type: infer T;
|
|
6130
|
+
}] ? T extends string ? AbiTypeToOutput<T> : unknown : TOutputs extends readonly [] ? undefined : Record<string, unknown>;
|
|
6131
|
+
type ContractReadMethods<TAbi extends Abi> = {
|
|
6132
|
+
[F in ExtractViewFunctions<TAbi> as F["name"] extends string ? F["name"] : never]: (...args: F extends {
|
|
6133
|
+
inputs: infer I;
|
|
6134
|
+
} ? I extends readonly {
|
|
6135
|
+
type: string;
|
|
6136
|
+
}[] ? AbiInputsToArgs<I> : [] : []) => Effect.Effect<F extends {
|
|
6137
|
+
outputs: infer O;
|
|
6138
|
+
} ? O extends readonly {
|
|
6139
|
+
type: string;
|
|
6140
|
+
}[] ? AbiOutputToTs<O> : unknown : unknown, ContractCallError, ProviderService>;
|
|
6141
|
+
};
|
|
6142
|
+
type WriteMethodArgs$1<TInputs> = TInputs extends readonly {
|
|
6143
|
+
type: string;
|
|
6144
|
+
}[] ? AbiInputsToArgs<TInputs> extends readonly [] ? [options?: WriteOptions] : [...args: AbiInputsToArgs<TInputs>, options?: WriteOptions] : [options?: WriteOptions];
|
|
6145
|
+
type ContractWriteMethods<TAbi extends Abi> = {
|
|
6146
|
+
[F in ExtractWriteFunctions<TAbi> as F["name"] extends string ? F["name"] : never]: (...args: WriteMethodArgs$1<F extends {
|
|
6147
|
+
inputs: infer I;
|
|
6148
|
+
} ? I : []>) => Effect.Effect<HashType, ContractWriteError, SignerService>;
|
|
6149
|
+
};
|
|
6150
|
+
type ContractSimulateMethods<TAbi extends Abi> = {
|
|
6151
|
+
[F in ExtractWriteFunctions<TAbi> as F["name"] extends string ? F["name"] : never]: (...args: F extends {
|
|
6152
|
+
inputs: infer I;
|
|
6153
|
+
} ? I extends readonly {
|
|
6154
|
+
type: string;
|
|
6155
|
+
}[] ? AbiInputsToArgs<I> : [] : []) => Effect.Effect<F extends {
|
|
6156
|
+
outputs: infer O;
|
|
6157
|
+
} ? O extends readonly {
|
|
6158
|
+
type: string;
|
|
6159
|
+
}[] ? AbiOutputToTs<O> : unknown : unknown, ContractCallError, ProviderService>;
|
|
6160
|
+
};
|
|
6161
|
+
|
|
6162
|
+
/**
|
|
6163
|
+
* @fileoverview Block Explorer API type definitions.
|
|
6164
|
+
*
|
|
6165
|
+
* @module BlockExplorerApiTypes
|
|
6166
|
+
* @since 0.0.1
|
|
6167
|
+
*
|
|
6168
|
+
* @description
|
|
6169
|
+
* Defines types for Block Explorer API configuration, responses, and errors.
|
|
6170
|
+
* Used by BlockExplorerApiService to resolve ABIs and contract metadata.
|
|
6171
|
+
*/
|
|
6172
|
+
|
|
6173
|
+
/**
|
|
6174
|
+
* Identifier for supported block explorer sources.
|
|
6175
|
+
* @since 0.0.1
|
|
6176
|
+
*/
|
|
6177
|
+
type ExplorerSourceId = "sourcify" | "etherscanV2" | "blockscout";
|
|
6178
|
+
/**
|
|
6179
|
+
* Configuration for the Block Explorer API service.
|
|
6180
|
+
* @since 0.0.1
|
|
6181
|
+
*/
|
|
6182
|
+
interface BlockExplorerApiConfig {
|
|
6183
|
+
readonly sources: {
|
|
6184
|
+
readonly sourcify?: {
|
|
6185
|
+
readonly enabled: boolean;
|
|
6186
|
+
/** Custom Sourcify instance URL */
|
|
6187
|
+
readonly baseUrl?: string;
|
|
6188
|
+
};
|
|
6189
|
+
readonly etherscanV2?: {
|
|
6190
|
+
readonly enabled: boolean;
|
|
6191
|
+
readonly apiKey?: Redacted.Redacted<string> | string;
|
|
6192
|
+
/** Custom Etherscan-compatible API URL */
|
|
6193
|
+
readonly baseUrl?: string;
|
|
6194
|
+
};
|
|
6195
|
+
readonly blockscout?: {
|
|
6196
|
+
readonly enabled: boolean;
|
|
6197
|
+
readonly apiKey?: Redacted.Redacted<string> | string;
|
|
6198
|
+
/** Custom Blockscout instance URL */
|
|
6199
|
+
readonly baseUrl?: string;
|
|
6200
|
+
};
|
|
6201
|
+
};
|
|
6202
|
+
/**
|
|
6203
|
+
* Order for "verified-first" resolution.
|
|
6204
|
+
* Defaults to ["sourcify", "etherscanV2", "blockscout"].
|
|
6205
|
+
*/
|
|
6206
|
+
readonly sourceOrder?: ReadonlyArray<ExplorerSourceId>;
|
|
6207
|
+
/**
|
|
6208
|
+
* Default behavior for proxy following.
|
|
6209
|
+
*/
|
|
6210
|
+
readonly followProxiesByDefault?: boolean;
|
|
6211
|
+
/**
|
|
6212
|
+
* Enable best-effort ABI recovery (ABR) when verified ABI is missing.
|
|
6213
|
+
* Intended for inspection tooling.
|
|
6214
|
+
*/
|
|
6215
|
+
readonly enableBestEffortAbiRecovery?: boolean;
|
|
6216
|
+
/**
|
|
6217
|
+
* Cache resolved ABIs.
|
|
6218
|
+
*/
|
|
6219
|
+
readonly cache?: {
|
|
6220
|
+
readonly enabled: boolean;
|
|
6221
|
+
readonly ttlMillis?: number;
|
|
6222
|
+
readonly capacity?: number;
|
|
6223
|
+
};
|
|
6224
|
+
}
|
|
6225
|
+
/**
|
|
6226
|
+
* Single item in an ABI definition.
|
|
6227
|
+
* Standard Solidity ABI format.
|
|
6228
|
+
* @since 0.0.1
|
|
6229
|
+
*/
|
|
6230
|
+
type AbiItem = {
|
|
6231
|
+
readonly type: string;
|
|
6232
|
+
readonly name?: string;
|
|
6233
|
+
readonly inputs?: ReadonlyArray<{
|
|
6234
|
+
readonly name?: string;
|
|
6235
|
+
readonly type: string;
|
|
6236
|
+
readonly indexed?: boolean;
|
|
6237
|
+
readonly components?: ReadonlyArray<{
|
|
6238
|
+
readonly name?: string;
|
|
6239
|
+
readonly type: string;
|
|
6240
|
+
}>;
|
|
6241
|
+
}>;
|
|
6242
|
+
readonly outputs?: ReadonlyArray<{
|
|
6243
|
+
readonly name?: string;
|
|
6244
|
+
readonly type: string;
|
|
6245
|
+
readonly components?: ReadonlyArray<{
|
|
6246
|
+
readonly name?: string;
|
|
6247
|
+
readonly type: string;
|
|
6248
|
+
}>;
|
|
6249
|
+
}>;
|
|
6250
|
+
readonly stateMutability?: "pure" | "view" | "nonpayable" | "payable";
|
|
6251
|
+
readonly anonymous?: boolean;
|
|
6252
|
+
};
|
|
6253
|
+
/**
|
|
6254
|
+
* Source file from a verified contract.
|
|
6255
|
+
* @since 0.0.1
|
|
6256
|
+
*/
|
|
6257
|
+
interface ContractSourceFile {
|
|
6258
|
+
readonly path: string;
|
|
6259
|
+
readonly content: string;
|
|
6260
|
+
}
|
|
6261
|
+
/**
|
|
6262
|
+
* How the ABI was resolved.
|
|
6263
|
+
* @since 0.0.1
|
|
6264
|
+
*/
|
|
6265
|
+
type AbiResolution = {
|
|
6266
|
+
readonly mode: "verified";
|
|
6267
|
+
readonly source: ExplorerSourceId;
|
|
6268
|
+
} | {
|
|
6269
|
+
readonly mode: "best-effort";
|
|
6270
|
+
readonly source: "whatsabi";
|
|
6271
|
+
};
|
|
6272
|
+
/**
|
|
6273
|
+
* Proxy chain entry for debugging/UX.
|
|
6274
|
+
* @since 0.0.1
|
|
6275
|
+
*/
|
|
6276
|
+
interface ProxyInfo {
|
|
6277
|
+
readonly kind: string;
|
|
6278
|
+
readonly address: `0x${string}`;
|
|
6279
|
+
}
|
|
6280
|
+
/**
|
|
6281
|
+
* Result of resolving a contract from block explorers.
|
|
6282
|
+
* @since 0.0.1
|
|
6283
|
+
*/
|
|
6284
|
+
interface ResolvedExplorerContract {
|
|
6285
|
+
/** Resolved address (implementation if proxies followed) */
|
|
6286
|
+
readonly address: `0x${string}`;
|
|
6287
|
+
/** Original input address */
|
|
6288
|
+
readonly requestedAddress: `0x${string}`;
|
|
6289
|
+
/** Contract name if available */
|
|
6290
|
+
readonly name?: string;
|
|
6291
|
+
/** Resolved ABI */
|
|
6292
|
+
readonly abi: ReadonlyArray<AbiItem>;
|
|
6293
|
+
/** How the ABI was resolved */
|
|
6294
|
+
readonly resolution: AbiResolution;
|
|
6295
|
+
/** Source files if requested and available */
|
|
6296
|
+
readonly sources?: ReadonlyArray<ContractSourceFile>;
|
|
6297
|
+
/** Proxy chain if followProxies was true */
|
|
6298
|
+
readonly proxies?: ReadonlyArray<ProxyInfo>;
|
|
6299
|
+
}
|
|
6300
|
+
/**
|
|
6301
|
+
* Options for getContract.
|
|
6302
|
+
* @since 0.0.1
|
|
6303
|
+
*/
|
|
6304
|
+
interface GetContractOptions {
|
|
6305
|
+
/**
|
|
6306
|
+
* Resolution mode for ABI retrieval.
|
|
6307
|
+
* - "verified-only": Only verified ABIs, fail if not found
|
|
6308
|
+
* - "verified-first": Try verified first, fail if not found (default)
|
|
6309
|
+
* - "best-effort": Fall back to ABI recovery when unverified
|
|
6310
|
+
*/
|
|
6311
|
+
readonly resolution?: "verified-only" | "verified-first" | "best-effort";
|
|
6312
|
+
/** Include source files in response */
|
|
6313
|
+
readonly includeSources?: boolean;
|
|
6314
|
+
/** Follow proxy contracts to implementation */
|
|
6315
|
+
readonly followProxies?: boolean;
|
|
6316
|
+
}
|
|
5729
6317
|
/**
|
|
5730
|
-
*
|
|
5731
|
-
*
|
|
5732
|
-
* @module NoopCcip
|
|
6318
|
+
* Options for getAbi.
|
|
5733
6319
|
* @since 0.0.1
|
|
5734
|
-
*
|
|
5735
|
-
* @description
|
|
5736
|
-
* A CCIP implementation that always returns an error. Use this when offchain
|
|
5737
|
-
* lookups should be disabled (e.g., in sandboxed environments, testing, or
|
|
5738
|
-
* when external network access is restricted).
|
|
5739
|
-
*
|
|
5740
|
-
* @see {@link CcipService} - The service interface
|
|
5741
|
-
* @see {@link DefaultCcip} - Working HTTP implementation
|
|
5742
6320
|
*/
|
|
5743
|
-
|
|
6321
|
+
interface GetAbiOptions {
|
|
6322
|
+
readonly resolution?: "verified-only" | "verified-first" | "best-effort";
|
|
6323
|
+
readonly followProxies?: boolean;
|
|
6324
|
+
}
|
|
5744
6325
|
/**
|
|
5745
|
-
*
|
|
5746
|
-
*
|
|
5747
|
-
* @description
|
|
5748
|
-
* Provides CcipService with an implementation that immediately fails
|
|
5749
|
-
* with "CCIP disabled". Use when offchain lookups should not be performed.
|
|
5750
|
-
*
|
|
6326
|
+
* Options for getSources.
|
|
5751
6327
|
* @since 0.0.1
|
|
5752
|
-
*
|
|
5753
|
-
* @example Disable CCIP in tests
|
|
5754
|
-
* ```typescript
|
|
5755
|
-
* import { Effect } from 'effect'
|
|
5756
|
-
* import { CcipService, NoopCcip } from 'voltaire-effect'
|
|
5757
|
-
*
|
|
5758
|
-
* const program = Effect.gen(function* () {
|
|
5759
|
-
* const ccip = yield* CcipService
|
|
5760
|
-
* // This will always fail with "CCIP disabled"
|
|
5761
|
-
* return yield* ccip.request({ ... })
|
|
5762
|
-
* }).pipe(Effect.provide(NoopCcip))
|
|
5763
|
-
* ```
|
|
5764
6328
|
*/
|
|
5765
|
-
|
|
6329
|
+
interface GetSourcesOptions {
|
|
6330
|
+
readonly followProxies?: boolean;
|
|
6331
|
+
}
|
|
6332
|
+
/**
|
|
6333
|
+
* Dynamic contract instance with callable methods.
|
|
6334
|
+
* Returned by getContract() for interacting with contracts.
|
|
6335
|
+
* @since 0.0.1
|
|
6336
|
+
*/
|
|
6337
|
+
interface ExplorerContractInstance {
|
|
6338
|
+
/** Resolved address (implementation if proxies followed) */
|
|
6339
|
+
readonly address: `0x${string}`;
|
|
6340
|
+
/** Original input address */
|
|
6341
|
+
readonly requestedAddress: `0x${string}`;
|
|
6342
|
+
/** Resolved ABI */
|
|
6343
|
+
readonly abi: ReadonlyArray<AbiItem>;
|
|
6344
|
+
/** How the ABI was resolved */
|
|
6345
|
+
readonly resolution: AbiResolution;
|
|
6346
|
+
/** Contract name if available */
|
|
6347
|
+
readonly name?: string;
|
|
6348
|
+
/** Source files if requested and available */
|
|
6349
|
+
readonly sources?: ReadonlyArray<ContractSourceFile>;
|
|
6350
|
+
/** Proxy chain if followProxies was true */
|
|
6351
|
+
readonly proxies?: ReadonlyArray<ProxyInfo>;
|
|
6352
|
+
/** Read-only methods (view/pure) */
|
|
6353
|
+
readonly read: Record<string, (...args: ReadonlyArray<unknown>) => Effect.Effect<unknown, ContractCallError, ProviderService>>;
|
|
6354
|
+
/** Simulate state-changing methods */
|
|
6355
|
+
readonly simulate: Record<string, (...args: ReadonlyArray<unknown>) => Effect.Effect<unknown, ContractCallError, ProviderService>>;
|
|
6356
|
+
/** State-changing methods */
|
|
6357
|
+
readonly write: Record<string, (...args: ReadonlyArray<unknown>) => Effect.Effect<`0x${string}`, ContractWriteError, SignerService>>;
|
|
6358
|
+
/** Explicit signature-based access */
|
|
6359
|
+
readonly call: (signature: string, args: ReadonlyArray<unknown>) => Effect.Effect<unknown, ContractCallError, ProviderService>;
|
|
6360
|
+
}
|
|
6361
|
+
|
|
6362
|
+
declare const BlockExplorerConfigError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6363
|
+
readonly _tag: "BlockExplorerConfigError";
|
|
6364
|
+
} & Readonly<A>;
|
|
6365
|
+
/**
|
|
6366
|
+
* Error thrown when configuration is invalid.
|
|
6367
|
+
* @since 0.0.1
|
|
6368
|
+
*/
|
|
6369
|
+
declare class BlockExplorerConfigError extends BlockExplorerConfigError_base<{
|
|
6370
|
+
readonly message: string;
|
|
6371
|
+
}> {
|
|
6372
|
+
constructor(message: string);
|
|
6373
|
+
}
|
|
6374
|
+
declare const BlockExplorerNotFoundError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6375
|
+
readonly _tag: "BlockExplorerNotFoundError";
|
|
6376
|
+
} & Readonly<A>;
|
|
6377
|
+
/**
|
|
6378
|
+
* Error thrown when no ABI is found from any configured source.
|
|
6379
|
+
* @since 0.0.1
|
|
6380
|
+
*/
|
|
6381
|
+
declare class BlockExplorerNotFoundError extends BlockExplorerNotFoundError_base<{
|
|
6382
|
+
readonly address: `0x${string}`;
|
|
6383
|
+
readonly attemptedSources: ReadonlyArray<string>;
|
|
6384
|
+
readonly message: string;
|
|
6385
|
+
}> {
|
|
6386
|
+
constructor(address: `0x${string}`, attemptedSources: ReadonlyArray<string>);
|
|
6387
|
+
}
|
|
6388
|
+
declare const BlockExplorerRateLimitError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6389
|
+
readonly _tag: "BlockExplorerRateLimitError";
|
|
6390
|
+
} & Readonly<A>;
|
|
6391
|
+
/**
|
|
6392
|
+
* Error thrown when rate limited by a block explorer source.
|
|
6393
|
+
* @since 0.0.1
|
|
6394
|
+
*/
|
|
6395
|
+
declare class BlockExplorerRateLimitError extends BlockExplorerRateLimitError_base<{
|
|
6396
|
+
readonly source: ExplorerSourceId;
|
|
6397
|
+
readonly address: `0x${string}`;
|
|
6398
|
+
readonly message: string;
|
|
6399
|
+
readonly retryAfterSeconds?: number;
|
|
6400
|
+
}> {
|
|
6401
|
+
constructor(source: ExplorerSourceId, address: `0x${string}`, message: string, retryAfterSeconds?: number);
|
|
6402
|
+
}
|
|
6403
|
+
declare const BlockExplorerResponseError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6404
|
+
readonly _tag: "BlockExplorerResponseError";
|
|
6405
|
+
} & Readonly<A>;
|
|
6406
|
+
/**
|
|
6407
|
+
* Error thrown when a block explorer returns a non-200 response or network error.
|
|
6408
|
+
* @since 0.0.1
|
|
6409
|
+
*/
|
|
6410
|
+
declare class BlockExplorerResponseError extends BlockExplorerResponseError_base<{
|
|
6411
|
+
readonly source: ExplorerSourceId;
|
|
6412
|
+
readonly address: `0x${string}`;
|
|
6413
|
+
readonly status?: number;
|
|
6414
|
+
readonly message: string;
|
|
6415
|
+
readonly body?: string;
|
|
6416
|
+
}> {
|
|
6417
|
+
constructor(source: ExplorerSourceId, address: `0x${string}`, message: string, options?: {
|
|
6418
|
+
status?: number;
|
|
6419
|
+
body?: string;
|
|
6420
|
+
});
|
|
6421
|
+
}
|
|
6422
|
+
declare const BlockExplorerDecodeError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6423
|
+
readonly _tag: "BlockExplorerDecodeError";
|
|
6424
|
+
} & Readonly<A>;
|
|
6425
|
+
/**
|
|
6426
|
+
* Error thrown when a block explorer response cannot be decoded.
|
|
6427
|
+
* @since 0.0.1
|
|
6428
|
+
*/
|
|
6429
|
+
declare class BlockExplorerDecodeError extends BlockExplorerDecodeError_base<{
|
|
6430
|
+
readonly source: ExplorerSourceId;
|
|
6431
|
+
readonly address: `0x${string}`;
|
|
6432
|
+
readonly message: string;
|
|
6433
|
+
readonly bodySnippet?: string;
|
|
6434
|
+
}> {
|
|
6435
|
+
constructor(source: ExplorerSourceId, address: `0x${string}`, message: string, bodySnippet?: string);
|
|
6436
|
+
}
|
|
6437
|
+
declare const BlockExplorerProxyResolutionError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6438
|
+
readonly _tag: "BlockExplorerProxyResolutionError";
|
|
6439
|
+
} & Readonly<A>;
|
|
6440
|
+
/**
|
|
6441
|
+
* Error thrown when proxy resolution fails.
|
|
6442
|
+
* @since 0.0.1
|
|
6443
|
+
*/
|
|
6444
|
+
declare class BlockExplorerProxyResolutionError extends BlockExplorerProxyResolutionError_base<{
|
|
6445
|
+
readonly address: `0x${string}`;
|
|
6446
|
+
readonly message: string;
|
|
6447
|
+
}> {
|
|
6448
|
+
constructor(address: `0x${string}`, message: string);
|
|
6449
|
+
}
|
|
6450
|
+
declare const BlockExplorerUnexpectedError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6451
|
+
readonly _tag: "BlockExplorerUnexpectedError";
|
|
6452
|
+
} & Readonly<A>;
|
|
6453
|
+
/**
|
|
6454
|
+
* Catch-all error for unexpected failures.
|
|
6455
|
+
* @since 0.0.1
|
|
6456
|
+
*/
|
|
6457
|
+
declare class BlockExplorerUnexpectedError extends BlockExplorerUnexpectedError_base<{
|
|
6458
|
+
readonly phase: "getAbi" | "getContract" | "getSources" | "followProxies" | "bestEffortRecovery";
|
|
6459
|
+
readonly message: string;
|
|
6460
|
+
readonly cause: unknown;
|
|
6461
|
+
}> {
|
|
6462
|
+
constructor(phase: BlockExplorerUnexpectedError["phase"], message: string, cause: unknown);
|
|
6463
|
+
}
|
|
6464
|
+
/**
|
|
6465
|
+
* Union of all Block Explorer API errors.
|
|
6466
|
+
* @since 0.0.1
|
|
6467
|
+
*/
|
|
6468
|
+
type BlockExplorerApiError = BlockExplorerConfigError | BlockExplorerNotFoundError | BlockExplorerRateLimitError | BlockExplorerResponseError | BlockExplorerDecodeError | BlockExplorerProxyResolutionError | BlockExplorerUnexpectedError;
|
|
5766
6469
|
|
|
5767
6470
|
/**
|
|
5768
|
-
* @fileoverview Block
|
|
6471
|
+
* @fileoverview Block Explorer API service definition.
|
|
5769
6472
|
*
|
|
5770
|
-
* @module
|
|
6473
|
+
* @module BlockExplorerApiService
|
|
5771
6474
|
* @since 0.0.1
|
|
5772
6475
|
*
|
|
5773
6476
|
* @description
|
|
5774
|
-
* The
|
|
5775
|
-
*
|
|
6477
|
+
* The BlockExplorerApiService provides typed access to block explorer APIs
|
|
6478
|
+
* for resolving contract ABIs, metadata, and source code.
|
|
5776
6479
|
*/
|
|
5777
6480
|
|
|
5778
6481
|
/**
|
|
5779
|
-
*
|
|
5780
|
-
*
|
|
6482
|
+
* Service interface for Block Explorer API operations.
|
|
5781
6483
|
* @since 0.0.1
|
|
5782
6484
|
*/
|
|
5783
|
-
interface
|
|
5784
|
-
/**
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
6485
|
+
interface BlockExplorerApiShape {
|
|
6486
|
+
/**
|
|
6487
|
+
* Fetch contract with callable read/write methods.
|
|
6488
|
+
*/
|
|
6489
|
+
readonly getContract: (address: `0x${string}`, options?: GetContractOptions) => Effect.Effect<ExplorerContractInstance, BlockExplorerApiError>;
|
|
6490
|
+
/**
|
|
6491
|
+
* Convenience wrapper for getContract(...).abi
|
|
6492
|
+
*/
|
|
6493
|
+
readonly getAbi: (address: `0x${string}`, options?: GetAbiOptions) => Effect.Effect<ReadonlyArray<AbiItem>, BlockExplorerApiError>;
|
|
6494
|
+
/**
|
|
6495
|
+
* Convenience wrapper for getContract(...).sources
|
|
6496
|
+
*/
|
|
6497
|
+
readonly getSources: (address: `0x${string}`, options?: GetSourcesOptions) => Effect.Effect<ReadonlyArray<ContractSourceFile>, BlockExplorerApiError>;
|
|
5790
6498
|
}
|
|
5791
|
-
declare const
|
|
6499
|
+
declare const BlockExplorerApiService_base: Context.TagClass<BlockExplorerApiService, "BlockExplorerApiService", BlockExplorerApiShape>;
|
|
5792
6500
|
/**
|
|
5793
|
-
* Block
|
|
5794
|
-
*
|
|
5795
|
-
* @description
|
|
5796
|
-
* Provides access to block explorer information for the active chain.
|
|
5797
|
-
*
|
|
6501
|
+
* Block Explorer API service for resolving contract ABIs and metadata.
|
|
5798
6502
|
* @since 0.0.1
|
|
5799
6503
|
*/
|
|
5800
|
-
declare class
|
|
6504
|
+
declare class BlockExplorerApiService extends BlockExplorerApiService_base {
|
|
5801
6505
|
}
|
|
5802
6506
|
|
|
5803
6507
|
/**
|
|
@@ -5836,7 +6540,7 @@ declare class BlockExplorerService extends BlockExplorerService_base {
|
|
|
5836
6540
|
* }
|
|
5837
6541
|
* ```
|
|
5838
6542
|
*/
|
|
5839
|
-
interface ChainConfig
|
|
6543
|
+
interface ChainConfig {
|
|
5840
6544
|
/** Chain ID (e.g., 1 for mainnet, 11155111 for sepolia) */
|
|
5841
6545
|
readonly id: number;
|
|
5842
6546
|
/** Human-readable chain name */
|
|
@@ -5852,7 +6556,7 @@ interface ChainConfig$1 {
|
|
|
5852
6556
|
/** Whether this is a testnet */
|
|
5853
6557
|
readonly testnet?: boolean;
|
|
5854
6558
|
}
|
|
5855
|
-
declare const ChainService_base: Context.TagClass<ChainService, "ChainService", ChainConfig
|
|
6559
|
+
declare const ChainService_base: Context.TagClass<ChainService, "ChainService", ChainConfig>;
|
|
5856
6560
|
/**
|
|
5857
6561
|
* Chain service for blockchain network configuration.
|
|
5858
6562
|
*
|
|
@@ -5895,1124 +6599,796 @@ declare class ChainService extends ChainService_base {
|
|
|
5895
6599
|
}
|
|
5896
6600
|
|
|
5897
6601
|
/**
|
|
5898
|
-
* @fileoverview
|
|
6602
|
+
* @fileoverview Block Explorer API layer factory.
|
|
5899
6603
|
*
|
|
5900
|
-
* @module
|
|
6604
|
+
* @module BlockExplorerApi
|
|
5901
6605
|
* @since 0.0.1
|
|
5902
6606
|
*
|
|
5903
6607
|
* @description
|
|
5904
|
-
*
|
|
5905
|
-
*
|
|
6608
|
+
* Factory functions for creating BlockExplorerApiService layers.
|
|
6609
|
+
* Supports explicit configuration and environment-based configuration.
|
|
5906
6610
|
*/
|
|
5907
6611
|
|
|
5908
6612
|
/**
|
|
5909
|
-
*
|
|
5910
|
-
*
|
|
5911
|
-
* @since 0.0.1
|
|
5912
|
-
*/
|
|
5913
|
-
interface ChainContract {
|
|
5914
|
-
readonly address: `0x${string}`;
|
|
5915
|
-
readonly blockCreated?: number;
|
|
5916
|
-
}
|
|
5917
|
-
/**
|
|
5918
|
-
* Well-known contract deployments for a chain.
|
|
5919
|
-
*
|
|
5920
|
-
* @since 0.0.1
|
|
5921
|
-
*/
|
|
5922
|
-
interface ContractsConfig {
|
|
5923
|
-
readonly multicall3?: ChainContract;
|
|
5924
|
-
readonly ensRegistry?: ChainContract;
|
|
5925
|
-
readonly ensUniversalResolver?: ChainContract;
|
|
5926
|
-
}
|
|
5927
|
-
declare const ContractsService_base: Context.TagClass<ContractsService, "ContractsService", ContractsConfig>;
|
|
5928
|
-
/**
|
|
5929
|
-
* Contracts service for chain deployment metadata.
|
|
5930
|
-
*
|
|
5931
|
-
* @description
|
|
5932
|
-
* Provides access to well-known contract deployments for the active chain.
|
|
5933
|
-
*
|
|
6613
|
+
* Create a BlockExplorerApiService layer from explicit configuration.
|
|
6614
|
+
* Requires ChainService. ProviderService is required when followProxies is used.
|
|
5934
6615
|
* @since 0.0.1
|
|
5935
6616
|
*/
|
|
5936
|
-
declare
|
|
6617
|
+
declare function BlockExplorerApi(config: BlockExplorerApiConfig): Layer.Layer<BlockExplorerApiService, BlockExplorerConfigError, ChainService | ProviderService>;
|
|
6618
|
+
declare namespace BlockExplorerApi {
|
|
6619
|
+
var fromEnv: () => Layer.Layer<BlockExplorerApiService, BlockExplorerConfigError, ChainService | ProviderService>;
|
|
5937
6620
|
}
|
|
5938
6621
|
|
|
5939
6622
|
/**
|
|
5940
|
-
* @fileoverview
|
|
5941
|
-
*
|
|
5942
|
-
* @module arbitrum
|
|
5943
|
-
* @since 0.0.1
|
|
5944
|
-
*/
|
|
5945
|
-
|
|
5946
|
-
/**
|
|
5947
|
-
* Arbitrum One configuration.
|
|
5948
|
-
*
|
|
5949
|
-
* @since 0.0.1
|
|
5950
|
-
*/
|
|
5951
|
-
declare const arbitrumConfig: ChainConfig$1;
|
|
5952
|
-
/**
|
|
5953
|
-
* Arbitrum block explorer configuration.
|
|
5954
|
-
*
|
|
5955
|
-
* @since 0.0.1
|
|
5956
|
-
*/
|
|
5957
|
-
declare const arbitrumBlockExplorers: BlockExplorerConfig;
|
|
5958
|
-
/**
|
|
5959
|
-
* Arbitrum contract deployments.
|
|
5960
|
-
*
|
|
5961
|
-
* @since 0.0.1
|
|
5962
|
-
*/
|
|
5963
|
-
declare const arbitrumContracts: ContractsConfig;
|
|
5964
|
-
/**
|
|
5965
|
-
* Arbitrum One L2 Layer for chain metadata, explorers, and contracts.
|
|
5966
|
-
*
|
|
5967
|
-
* @since 0.0.1
|
|
5968
|
-
*
|
|
5969
|
-
* @example
|
|
5970
|
-
* ```typescript
|
|
5971
|
-
* import { Effect } from 'effect'
|
|
5972
|
-
* import { ChainService, arbitrum } from 'voltaire-effect'
|
|
5973
|
-
*
|
|
5974
|
-
* const program = Effect.gen(function* () {
|
|
5975
|
-
* const chain = yield* ChainService
|
|
5976
|
-
* console.log(chain.id) // 42161
|
|
5977
|
-
* }).pipe(Effect.provide(arbitrum))
|
|
5978
|
-
* ```
|
|
5979
|
-
*/
|
|
5980
|
-
declare const arbitrum: Layer.Layer<BlockExplorerService | ChainService | ContractsService, never, never>;
|
|
5981
|
-
|
|
5982
|
-
/**
|
|
5983
|
-
* @fileoverview Base L2 chain configuration.
|
|
5984
|
-
*
|
|
5985
|
-
* @module base
|
|
5986
|
-
* @since 0.0.1
|
|
5987
|
-
*/
|
|
5988
|
-
|
|
5989
|
-
/**
|
|
5990
|
-
* Base L2 configuration.
|
|
5991
|
-
*
|
|
5992
|
-
* @since 0.0.1
|
|
5993
|
-
*/
|
|
5994
|
-
declare const baseConfig: ChainConfig$1;
|
|
5995
|
-
/**
|
|
5996
|
-
* Base block explorer configuration.
|
|
5997
|
-
*
|
|
5998
|
-
* @since 0.0.1
|
|
5999
|
-
*/
|
|
6000
|
-
declare const baseBlockExplorers: BlockExplorerConfig;
|
|
6001
|
-
/**
|
|
6002
|
-
* Base contract deployments.
|
|
6003
|
-
*
|
|
6004
|
-
* @since 0.0.1
|
|
6005
|
-
*/
|
|
6006
|
-
declare const baseContracts: ContractsConfig;
|
|
6007
|
-
/**
|
|
6008
|
-
* Base L2 Layer for chain metadata, explorers, and contracts.
|
|
6009
|
-
*
|
|
6010
|
-
* @since 0.0.1
|
|
6011
|
-
*
|
|
6012
|
-
* @example
|
|
6013
|
-
* ```typescript
|
|
6014
|
-
* import { Effect } from 'effect'
|
|
6015
|
-
* import { ChainService, base } from 'voltaire-effect'
|
|
6623
|
+
* @fileoverview BlockStream error type for voltaire-effect.
|
|
6016
6624
|
*
|
|
6017
|
-
*
|
|
6018
|
-
*
|
|
6019
|
-
* console.log(chain.id) // 8453
|
|
6020
|
-
* }).pipe(Effect.provide(base))
|
|
6021
|
-
* ```
|
|
6625
|
+
* @module BlockStreamError
|
|
6626
|
+
* @since 0.2.12
|
|
6022
6627
|
*/
|
|
6023
|
-
declare const
|
|
6024
|
-
|
|
6628
|
+
declare const BlockStreamError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6629
|
+
readonly _tag: "BlockStreamError";
|
|
6630
|
+
} & Readonly<A>;
|
|
6025
6631
|
/**
|
|
6026
|
-
*
|
|
6632
|
+
* Error thrown when a BlockStream operation fails.
|
|
6027
6633
|
*
|
|
6028
|
-
* @
|
|
6029
|
-
* @since 0.0.1
|
|
6634
|
+
* @since 0.2.12
|
|
6030
6635
|
*/
|
|
6636
|
+
declare class BlockStreamError extends BlockStreamError_base<{
|
|
6637
|
+
readonly message: string;
|
|
6638
|
+
readonly cause?: unknown;
|
|
6639
|
+
readonly context?: Record<string, unknown>;
|
|
6640
|
+
}> {
|
|
6641
|
+
constructor(message: string, options?: {
|
|
6642
|
+
cause?: unknown;
|
|
6643
|
+
context?: Record<string, unknown>;
|
|
6644
|
+
});
|
|
6645
|
+
}
|
|
6031
6646
|
|
|
6032
6647
|
/**
|
|
6033
|
-
*
|
|
6648
|
+
* @fileoverview BlockStream service definition for Effect-native block streaming.
|
|
6034
6649
|
*
|
|
6035
|
-
* @
|
|
6036
|
-
|
|
6037
|
-
declare const mainnetConfig: ChainConfig$1;
|
|
6038
|
-
/**
|
|
6039
|
-
* Ethereum mainnet block explorer configuration.
|
|
6650
|
+
* @module BlockStreamService
|
|
6651
|
+
* @since 0.2.12
|
|
6040
6652
|
*
|
|
6041
|
-
* @
|
|
6653
|
+
* @description
|
|
6654
|
+
* Provides Effect Stream integration for watching blocks with reorg support.
|
|
6655
|
+
* Wraps voltaire core's BlockStream for fiber-safe, composable block streaming.
|
|
6656
|
+
*
|
|
6657
|
+
* @see {@link BlockStream} - The live implementation layer
|
|
6658
|
+
* @see {@link TransportService} - Required dependency
|
|
6042
6659
|
*/
|
|
6043
|
-
|
|
6660
|
+
|
|
6044
6661
|
/**
|
|
6045
|
-
*
|
|
6662
|
+
* Shape of the BlockStream service.
|
|
6046
6663
|
*
|
|
6047
|
-
* @since 0.
|
|
6664
|
+
* @since 0.2.12
|
|
6048
6665
|
*/
|
|
6049
|
-
|
|
6666
|
+
type BlockStreamShape = {
|
|
6667
|
+
/**
|
|
6668
|
+
* Backfill historical blocks within a range.
|
|
6669
|
+
*
|
|
6670
|
+
* @example
|
|
6671
|
+
* ```typescript
|
|
6672
|
+
* const program = Effect.gen(function* () {
|
|
6673
|
+
* const stream = yield* BlockStreamService;
|
|
6674
|
+
* yield* Stream.runForEach(
|
|
6675
|
+
* stream.backfill({ fromBlock: 18000000n, toBlock: 18000100n }),
|
|
6676
|
+
* (event) => Effect.log(`Got ${event.blocks.length} blocks`)
|
|
6677
|
+
* );
|
|
6678
|
+
* });
|
|
6679
|
+
* ```
|
|
6680
|
+
*/
|
|
6681
|
+
readonly backfill: <TInclude extends BlockInclude = "header">(options: BackfillOptions<TInclude>) => Stream.Stream<BlocksEvent<TInclude>, BlockStreamError>;
|
|
6682
|
+
/**
|
|
6683
|
+
* Watch for new blocks with reorg detection.
|
|
6684
|
+
*
|
|
6685
|
+
* @example
|
|
6686
|
+
* ```typescript
|
|
6687
|
+
* const program = Effect.gen(function* () {
|
|
6688
|
+
* const stream = yield* BlockStreamService;
|
|
6689
|
+
* yield* Stream.runForEach(
|
|
6690
|
+
* stream.watch({ include: 'transactions' }),
|
|
6691
|
+
* (event) => {
|
|
6692
|
+
* if (event.type === 'reorg') {
|
|
6693
|
+
* return Effect.log(`Reorg: ${event.removed.length} blocks removed`);
|
|
6694
|
+
* }
|
|
6695
|
+
* return Effect.log(`New block: ${event.blocks[0]?.header.number}`);
|
|
6696
|
+
* }
|
|
6697
|
+
* );
|
|
6698
|
+
* });
|
|
6699
|
+
* ```
|
|
6700
|
+
*/
|
|
6701
|
+
readonly watch: <TInclude extends BlockInclude = "header">(options?: WatchOptions<TInclude>) => Stream.Stream<BlockStreamEvent<TInclude>, BlockStreamError>;
|
|
6702
|
+
};
|
|
6703
|
+
declare const BlockStreamService_base: Context.TagClass<BlockStreamService, "BlockStreamService", BlockStreamShape>;
|
|
6050
6704
|
/**
|
|
6051
|
-
*
|
|
6705
|
+
* BlockStream service for Effect-native block streaming.
|
|
6052
6706
|
*
|
|
6053
|
-
* @since 0.
|
|
6707
|
+
* @since 0.2.12
|
|
6054
6708
|
*
|
|
6055
6709
|
* @example
|
|
6056
6710
|
* ```typescript
|
|
6057
|
-
* import { Effect } from 'effect'
|
|
6058
|
-
* import {
|
|
6711
|
+
* import { Effect, Stream } from 'effect';
|
|
6712
|
+
* import { BlockStreamService, BlockStream, HttpTransport } from 'voltaire-effect';
|
|
6059
6713
|
*
|
|
6060
6714
|
* const program = Effect.gen(function* () {
|
|
6061
|
-
* const
|
|
6062
|
-
* console.log(chain.name) // "Ethereum"
|
|
6063
|
-
* }).pipe(Effect.provide(mainnet))
|
|
6064
|
-
* ```
|
|
6065
|
-
*/
|
|
6066
|
-
declare const mainnet: Layer.Layer<BlockExplorerService | ChainService | ContractsService, never, never>;
|
|
6067
|
-
|
|
6068
|
-
/**
|
|
6069
|
-
* @fileoverview Optimism L2 chain configuration.
|
|
6715
|
+
* const blockStream = yield* BlockStreamService;
|
|
6070
6716
|
*
|
|
6071
|
-
*
|
|
6072
|
-
*
|
|
6717
|
+
* yield* Stream.runForEach(
|
|
6718
|
+
* blockStream.watch({ include: 'receipts' }),
|
|
6719
|
+
* (event) => {
|
|
6720
|
+
* if (event.type === 'reorg') {
|
|
6721
|
+
* return Effect.log(`Reorg detected`);
|
|
6722
|
+
* }
|
|
6723
|
+
* return Effect.log(`Block ${event.blocks[0]?.header.number}`);
|
|
6724
|
+
* }
|
|
6725
|
+
* );
|
|
6726
|
+
* }).pipe(
|
|
6727
|
+
* Effect.provide(BlockStream),
|
|
6728
|
+
* Effect.provide(HttpTransport('https://mainnet.infura.io/v3/YOUR_KEY'))
|
|
6729
|
+
* );
|
|
6730
|
+
* ```
|
|
6073
6731
|
*/
|
|
6732
|
+
declare class BlockStreamService extends BlockStreamService_base {
|
|
6733
|
+
}
|
|
6074
6734
|
|
|
6075
6735
|
/**
|
|
6076
|
-
*
|
|
6736
|
+
* @fileoverview Live implementation of BlockStreamService.
|
|
6077
6737
|
*
|
|
6078
|
-
* @
|
|
6079
|
-
|
|
6080
|
-
declare const optimismConfig: ChainConfig$1;
|
|
6081
|
-
/**
|
|
6082
|
-
* Optimism block explorer configuration.
|
|
6738
|
+
* @module BlockStream
|
|
6739
|
+
* @since 0.2.12
|
|
6083
6740
|
*
|
|
6084
|
-
* @
|
|
6741
|
+
* @description
|
|
6742
|
+
* Provides the live implementation layer for BlockStreamService.
|
|
6743
|
+
* Creates an EIP-1193 provider from TransportService and wraps core BlockStream.
|
|
6085
6744
|
*/
|
|
6086
|
-
|
|
6745
|
+
|
|
6087
6746
|
/**
|
|
6088
|
-
*
|
|
6089
|
-
*
|
|
6090
|
-
* @since 0.0.1
|
|
6747
|
+
* Build a BlockStream directly from TransportService without a service layer.
|
|
6091
6748
|
*/
|
|
6092
|
-
declare const
|
|
6749
|
+
declare const makeBlockStream: () => Effect.Effect<BlockStreamShape, never, TransportService>;
|
|
6093
6750
|
/**
|
|
6094
|
-
*
|
|
6751
|
+
* Live implementation of BlockStreamService.
|
|
6095
6752
|
*
|
|
6096
|
-
* @since 0.
|
|
6753
|
+
* @since 0.2.12
|
|
6097
6754
|
*
|
|
6098
6755
|
* @example
|
|
6099
6756
|
* ```typescript
|
|
6100
|
-
* import { Effect } from 'effect'
|
|
6101
|
-
* import {
|
|
6757
|
+
* import { Effect, Stream } from 'effect';
|
|
6758
|
+
* import { makeBlockStream, HttpTransport } from 'voltaire-effect/services';
|
|
6102
6759
|
*
|
|
6103
6760
|
* const program = Effect.gen(function* () {
|
|
6104
|
-
* const
|
|
6105
|
-
*
|
|
6106
|
-
*
|
|
6761
|
+
* const blockStream = yield* makeBlockStream();
|
|
6762
|
+
* yield* Stream.runForEach(
|
|
6763
|
+
* blockStream.watch(),
|
|
6764
|
+
* (event) => Effect.log(`Event: ${event.type}`)
|
|
6765
|
+
* );
|
|
6766
|
+
* }).pipe(
|
|
6767
|
+
* Effect.provide(HttpTransport('https://...'))
|
|
6768
|
+
* );
|
|
6107
6769
|
* ```
|
|
6108
6770
|
*/
|
|
6109
|
-
declare const
|
|
6771
|
+
declare const BlockStream: Layer.Layer<BlockStreamService, never, TransportService>;
|
|
6110
6772
|
|
|
6111
6773
|
/**
|
|
6112
|
-
* @fileoverview
|
|
6774
|
+
* @fileoverview Cache service module for voltaire-effect.
|
|
6113
6775
|
*
|
|
6114
|
-
* @
|
|
6776
|
+
* @description
|
|
6777
|
+
* Provides caching capabilities for RPC responses and other data
|
|
6778
|
+
* to reduce network requests and improve performance.
|
|
6779
|
+
*
|
|
6780
|
+
* @module Cache
|
|
6115
6781
|
* @since 0.0.1
|
|
6116
6782
|
*/
|
|
6117
6783
|
|
|
6118
6784
|
/**
|
|
6119
|
-
*
|
|
6785
|
+
* Shape interface for the Cache service.
|
|
6120
6786
|
*
|
|
6121
6787
|
* @since 0.0.1
|
|
6122
6788
|
*/
|
|
6123
|
-
|
|
6789
|
+
interface CacheShape {
|
|
6790
|
+
/**
|
|
6791
|
+
* Gets a value from the cache.
|
|
6792
|
+
*
|
|
6793
|
+
* @param key - The cache key
|
|
6794
|
+
* @returns Effect containing the cached value or undefined
|
|
6795
|
+
*/
|
|
6796
|
+
readonly get: <T>(key: string) => Effect.Effect<T | undefined>;
|
|
6797
|
+
/**
|
|
6798
|
+
* Sets a value in the cache.
|
|
6799
|
+
*
|
|
6800
|
+
* @param key - The cache key
|
|
6801
|
+
* @param value - The value to cache
|
|
6802
|
+
* @param ttl - Optional time-to-live in milliseconds
|
|
6803
|
+
* @returns Effect that completes when value is stored
|
|
6804
|
+
*/
|
|
6805
|
+
readonly set: <T>(key: string, value: T, ttl?: number) => Effect.Effect<void>;
|
|
6806
|
+
/**
|
|
6807
|
+
* Deletes a value from the cache.
|
|
6808
|
+
*
|
|
6809
|
+
* @param key - The cache key
|
|
6810
|
+
* @returns Effect that completes when value is deleted
|
|
6811
|
+
*/
|
|
6812
|
+
readonly delete: (key: string) => Effect.Effect<void>;
|
|
6813
|
+
/**
|
|
6814
|
+
* Clears all values from the cache.
|
|
6815
|
+
*
|
|
6816
|
+
* @returns Effect that completes when cache is cleared
|
|
6817
|
+
*/
|
|
6818
|
+
readonly clear: () => Effect.Effect<void>;
|
|
6819
|
+
}
|
|
6820
|
+
declare const CacheService_base: Context.TagClass<CacheService, "CacheService", CacheShape>;
|
|
6124
6821
|
/**
|
|
6125
|
-
*
|
|
6822
|
+
* Cache service for Effect-based applications.
|
|
6126
6823
|
*
|
|
6127
6824
|
* @since 0.0.1
|
|
6128
6825
|
*/
|
|
6129
|
-
declare
|
|
6826
|
+
declare class CacheService extends CacheService_base {
|
|
6827
|
+
}
|
|
6130
6828
|
/**
|
|
6131
|
-
*
|
|
6132
|
-
*
|
|
6133
|
-
* @since 0.0.1
|
|
6829
|
+
* Options for the MemoryCache implementation.
|
|
6134
6830
|
*/
|
|
6135
|
-
|
|
6831
|
+
interface MemoryCacheOptions {
|
|
6832
|
+
/**
|
|
6833
|
+
* Default time-to-live in milliseconds.
|
|
6834
|
+
* If not provided, entries never expire.
|
|
6835
|
+
*/
|
|
6836
|
+
readonly defaultTtl?: number;
|
|
6837
|
+
/**
|
|
6838
|
+
* Maximum number of entries in the cache.
|
|
6839
|
+
* If not provided, no limit is enforced.
|
|
6840
|
+
*/
|
|
6841
|
+
readonly maxEntries?: number;
|
|
6842
|
+
}
|
|
6136
6843
|
/**
|
|
6137
|
-
*
|
|
6138
|
-
*
|
|
6139
|
-
* @since 0.0.1
|
|
6844
|
+
* In-memory cache implementation.
|
|
6140
6845
|
*
|
|
6141
|
-
* @
|
|
6142
|
-
*
|
|
6143
|
-
* import { Effect } from 'effect'
|
|
6144
|
-
* import { ChainService, polygon } from 'voltaire-effect'
|
|
6846
|
+
* @param options - Cache configuration options
|
|
6847
|
+
* @returns Layer providing CacheService
|
|
6145
6848
|
*
|
|
6146
|
-
*
|
|
6147
|
-
* const chain = yield* ChainService
|
|
6148
|
-
* console.log(chain.nativeCurrency.symbol) // "POL"
|
|
6149
|
-
* }).pipe(Effect.provide(polygon))
|
|
6150
|
-
* ```
|
|
6849
|
+
* @since 0.0.1
|
|
6151
6850
|
*/
|
|
6152
|
-
declare const
|
|
6153
|
-
|
|
6851
|
+
declare const MemoryCache: (options?: MemoryCacheOptions) => Layer.Layer<CacheService>;
|
|
6154
6852
|
/**
|
|
6155
|
-
*
|
|
6853
|
+
* No-op cache implementation that never stores values.
|
|
6854
|
+
* Useful for testing or when caching is disabled.
|
|
6855
|
+
*
|
|
6856
|
+
* @returns Layer providing CacheService
|
|
6156
6857
|
*
|
|
6157
|
-
* @module sepolia
|
|
6158
6858
|
* @since 0.0.1
|
|
6159
6859
|
*/
|
|
6860
|
+
declare const NoopCache: Layer.Layer<CacheService>;
|
|
6160
6861
|
|
|
6161
6862
|
/**
|
|
6162
|
-
*
|
|
6863
|
+
* Parameters for a CCIP offchain lookup request.
|
|
6163
6864
|
*
|
|
6164
6865
|
* @since 0.0.1
|
|
6165
6866
|
*/
|
|
6166
|
-
|
|
6867
|
+
interface CcipRequest {
|
|
6868
|
+
/** The contract address that initiated the lookup */
|
|
6869
|
+
readonly sender: `0x${string}`;
|
|
6870
|
+
/** URLs to try for fetching offchain data (tried in order) */
|
|
6871
|
+
readonly urls: readonly string[];
|
|
6872
|
+
/** The calldata to send to the offchain gateway */
|
|
6873
|
+
readonly callData: `0x${string}`;
|
|
6874
|
+
/** The callback function selector on the contract */
|
|
6875
|
+
readonly callbackSelector: `0x${string}`;
|
|
6876
|
+
/** Extra data to pass through to the callback */
|
|
6877
|
+
readonly extraData: `0x${string}`;
|
|
6878
|
+
}
|
|
6879
|
+
declare const CcipError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6880
|
+
readonly _tag: "CcipError";
|
|
6881
|
+
} & Readonly<A>;
|
|
6167
6882
|
/**
|
|
6168
|
-
*
|
|
6883
|
+
* Error returned when CCIP lookup fails.
|
|
6169
6884
|
*
|
|
6170
6885
|
* @since 0.0.1
|
|
6171
6886
|
*/
|
|
6172
|
-
declare
|
|
6887
|
+
declare class CcipError extends CcipError_base<{
|
|
6888
|
+
/** The URLs that were attempted */
|
|
6889
|
+
readonly urls: readonly string[];
|
|
6890
|
+
/** Human-readable error message */
|
|
6891
|
+
readonly message: string;
|
|
6892
|
+
/** The underlying cause of the error */
|
|
6893
|
+
readonly cause?: unknown;
|
|
6894
|
+
}> {
|
|
6895
|
+
}
|
|
6173
6896
|
/**
|
|
6174
|
-
*
|
|
6897
|
+
* Shape of the CCIP service.
|
|
6175
6898
|
*
|
|
6176
6899
|
* @since 0.0.1
|
|
6177
6900
|
*/
|
|
6178
|
-
|
|
6901
|
+
type CcipShape = {
|
|
6902
|
+
/**
|
|
6903
|
+
* Performs a CCIP offchain lookup request.
|
|
6904
|
+
*
|
|
6905
|
+
* @param params - The CCIP request parameters
|
|
6906
|
+
* @returns The offchain data as hex bytes
|
|
6907
|
+
*/
|
|
6908
|
+
readonly request: (params: CcipRequest) => Effect.Effect<`0x${string}`, CcipError>;
|
|
6909
|
+
};
|
|
6910
|
+
declare const CcipService_base: Context.TagClass<CcipService, "CcipService", CcipShape>;
|
|
6179
6911
|
/**
|
|
6180
|
-
*
|
|
6912
|
+
* CCIP service for EIP-3668 offchain lookups.
|
|
6913
|
+
*
|
|
6914
|
+
* @description
|
|
6915
|
+
* Provides the ability to fetch offchain data during contract calls.
|
|
6916
|
+
* When a contract reverts with OffchainLookup, this service handles
|
|
6917
|
+
* fetching the data from the specified gateway URLs.
|
|
6181
6918
|
*
|
|
6182
6919
|
* @since 0.0.1
|
|
6183
6920
|
*
|
|
6184
|
-
* @example
|
|
6921
|
+
* @example Basic usage with DefaultCcip
|
|
6185
6922
|
* ```typescript
|
|
6186
6923
|
* import { Effect } from 'effect'
|
|
6187
|
-
* import {
|
|
6924
|
+
* import { CcipService, DefaultCcip } from 'voltaire-effect'
|
|
6188
6925
|
*
|
|
6189
6926
|
* const program = Effect.gen(function* () {
|
|
6190
|
-
* const
|
|
6191
|
-
*
|
|
6192
|
-
*
|
|
6927
|
+
* const ccip = yield* CcipService
|
|
6928
|
+
* return yield* ccip.request({
|
|
6929
|
+
* sender: '0x...',
|
|
6930
|
+
* urls: ['https://gateway.example.com/{sender}/{data}'],
|
|
6931
|
+
* callData: '0x...',
|
|
6932
|
+
* callbackSelector: '0x...',
|
|
6933
|
+
* extraData: '0x'
|
|
6934
|
+
* })
|
|
6935
|
+
* }).pipe(
|
|
6936
|
+
* Effect.provide(DefaultCcip)
|
|
6937
|
+
* )
|
|
6193
6938
|
* ```
|
|
6939
|
+
*
|
|
6940
|
+
* @see {@link DefaultCcip} - HTTP-based implementation
|
|
6941
|
+
* @see {@link NoopCcip} - Disabled implementation
|
|
6942
|
+
* @see {@link CcipShape} - The service interface shape
|
|
6194
6943
|
*/
|
|
6195
|
-
declare
|
|
6944
|
+
declare class CcipService extends CcipService_base {
|
|
6945
|
+
}
|
|
6196
6946
|
|
|
6197
6947
|
/**
|
|
6198
|
-
* @fileoverview
|
|
6948
|
+
* @fileoverview Default CCIP implementation using HTTP fetch.
|
|
6199
6949
|
*
|
|
6200
|
-
* @module
|
|
6950
|
+
* @module DefaultCcip
|
|
6201
6951
|
* @since 0.0.1
|
|
6202
|
-
*/
|
|
6203
|
-
/**
|
|
6204
|
-
* RPC endpoint configuration for a chain.
|
|
6205
6952
|
*
|
|
6206
|
-
* @
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
readonly default: {
|
|
6210
|
-
readonly http: readonly string[];
|
|
6211
|
-
};
|
|
6212
|
-
}
|
|
6213
|
-
/**
|
|
6214
|
-
* RPC URLs keyed by chain ID.
|
|
6953
|
+
* @description
|
|
6954
|
+
* Implements EIP-3668 CCIP requests by fetching data from offchain gateway URLs.
|
|
6955
|
+
* URLs are tried in order until one succeeds.
|
|
6215
6956
|
*
|
|
6216
|
-
*
|
|
6957
|
+
* URL format per EIP-3668:
|
|
6958
|
+
* - Replace {sender} with the contract address (lowercase)
|
|
6959
|
+
* - Replace {data} with the calldata
|
|
6960
|
+
* - If URL contains {data}, use GET request
|
|
6961
|
+
* - Otherwise use POST with JSON body { sender, data }
|
|
6962
|
+
*
|
|
6963
|
+
* @see {@link CcipService} - The service interface
|
|
6964
|
+
* @see {@link NoopCcip} - Disabled implementation
|
|
6965
|
+
* @see https://eips.ethereum.org/EIPS/eip-3668
|
|
6217
6966
|
*/
|
|
6218
|
-
declare const rpcUrlsByChainId: Readonly<Record<number, RpcUrlsConfig>>;
|
|
6219
6967
|
|
|
6220
|
-
type AddressType$3 = BrandedAddress.AddressType;
|
|
6221
|
-
type HexType$2 = BrandedHex.HexType;
|
|
6222
|
-
type SignatureType = BrandedSignature.SignatureType;
|
|
6223
|
-
type TypedDataType = TypedData.TypedDataType;
|
|
6224
|
-
type EventLogType = EventLog.EventLogType;
|
|
6225
6968
|
/**
|
|
6226
|
-
*
|
|
6227
|
-
* Provides flexibility for API consumers while maintaining type safety.
|
|
6228
|
-
* Matches ProviderService.AddressInput for consistency.
|
|
6229
|
-
*/
|
|
6230
|
-
type AddressInput = AddressType$3 | `0x${string}`;
|
|
6231
|
-
/**
|
|
6232
|
-
* Caveat applied to a permission.
|
|
6969
|
+
* Default CCIP implementation layer.
|
|
6233
6970
|
*
|
|
6234
|
-
* @
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
/** Caveat type */
|
|
6238
|
-
readonly type: string;
|
|
6239
|
-
/** Caveat value */
|
|
6240
|
-
readonly value: unknown;
|
|
6241
|
-
}
|
|
6242
|
-
/**
|
|
6243
|
-
* Wallet permission object per EIP-2255.
|
|
6971
|
+
* @description
|
|
6972
|
+
* Provides CcipService with an HTTP-based implementation that follows EIP-3668.
|
|
6973
|
+
* Tries each URL in order until one succeeds.
|
|
6244
6974
|
*
|
|
6245
6975
|
* @since 0.0.1
|
|
6246
|
-
*/
|
|
6247
|
-
interface Permission {
|
|
6248
|
-
/** Parent capability (e.g., "eth_accounts") */
|
|
6249
|
-
readonly parentCapability: string;
|
|
6250
|
-
/** Invoker (origin) that was granted the permission */
|
|
6251
|
-
readonly invoker: string;
|
|
6252
|
-
/** Optional caveats restricting the permission */
|
|
6253
|
-
readonly caveats?: readonly Caveat[];
|
|
6254
|
-
}
|
|
6255
|
-
/**
|
|
6256
|
-
* Permission request object.
|
|
6257
6976
|
*
|
|
6258
|
-
* @
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
readonly [permission: string]: Record<string, unknown>;
|
|
6263
|
-
}
|
|
6264
|
-
/**
|
|
6265
|
-
* Native currency configuration for a chain.
|
|
6977
|
+
* @example
|
|
6978
|
+
* ```typescript
|
|
6979
|
+
* import { Effect } from 'effect'
|
|
6980
|
+
* import { CcipService, DefaultCcip } from 'voltaire-effect'
|
|
6266
6981
|
*
|
|
6267
|
-
*
|
|
6982
|
+
* const program = Effect.gen(function* () {
|
|
6983
|
+
* const ccip = yield* CcipService
|
|
6984
|
+
* return yield* ccip.request({
|
|
6985
|
+
* sender: '0x123...',
|
|
6986
|
+
* urls: ['https://gateway.example.com/{sender}/{data}'],
|
|
6987
|
+
* callData: '0xabc...',
|
|
6988
|
+
* callbackSelector: '0x12345678',
|
|
6989
|
+
* extraData: '0x'
|
|
6990
|
+
* })
|
|
6991
|
+
* }).pipe(Effect.provide(DefaultCcip))
|
|
6992
|
+
* ```
|
|
6268
6993
|
*/
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
readonly name: string;
|
|
6272
|
-
/** Currency symbol (e.g., "ETH") */
|
|
6273
|
-
readonly symbol: string;
|
|
6274
|
-
/** Currency decimals (typically 18) */
|
|
6275
|
-
readonly decimals: number;
|
|
6276
|
-
}
|
|
6994
|
+
declare const DefaultCcip: Layer.Layer<CcipService>;
|
|
6995
|
+
|
|
6277
6996
|
/**
|
|
6278
|
-
*
|
|
6997
|
+
* @fileoverview No-op CCIP implementation that always fails.
|
|
6279
6998
|
*
|
|
6999
|
+
* @module NoopCcip
|
|
6280
7000
|
* @since 0.0.1
|
|
6281
|
-
*/
|
|
6282
|
-
interface ChainConfig {
|
|
6283
|
-
/** Chain ID as a number */
|
|
6284
|
-
readonly id: number;
|
|
6285
|
-
/** Human-readable chain name */
|
|
6286
|
-
readonly name: string;
|
|
6287
|
-
/** Native currency configuration */
|
|
6288
|
-
readonly nativeCurrency: NativeCurrency;
|
|
6289
|
-
/** RPC URL endpoints */
|
|
6290
|
-
readonly rpcUrls: {
|
|
6291
|
-
readonly default: {
|
|
6292
|
-
readonly http: readonly string[];
|
|
6293
|
-
};
|
|
6294
|
-
};
|
|
6295
|
-
/** Block explorer URLs (optional) */
|
|
6296
|
-
readonly blockExplorers?: {
|
|
6297
|
-
readonly default: {
|
|
6298
|
-
readonly name: string;
|
|
6299
|
-
readonly url: string;
|
|
6300
|
-
};
|
|
6301
|
-
};
|
|
6302
|
-
}
|
|
6303
|
-
declare const SignerError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6304
|
-
readonly _tag: "SignerError";
|
|
6305
|
-
} & Readonly<A>;
|
|
6306
|
-
/**
|
|
6307
|
-
* Error thrown when a signer operation fails.
|
|
6308
7001
|
*
|
|
6309
7002
|
* @description
|
|
6310
|
-
*
|
|
6311
|
-
*
|
|
6312
|
-
*
|
|
6313
|
-
* Common failure reasons:
|
|
6314
|
-
* - User rejected the request (in browser wallet)
|
|
6315
|
-
* - Insufficient funds for transaction
|
|
6316
|
-
* - Invalid transaction parameters
|
|
6317
|
-
* - Network errors during broadcast
|
|
6318
|
-
* - Signing failures
|
|
7003
|
+
* A CCIP implementation that always returns an error. Use this when offchain
|
|
7004
|
+
* lookups should be disabled (e.g., in sandboxed environments, testing, or
|
|
7005
|
+
* when external network access is restricted).
|
|
6319
7006
|
*
|
|
6320
|
-
* @
|
|
7007
|
+
* @see {@link CcipService} - The service interface
|
|
7008
|
+
* @see {@link DefaultCcip} - Working HTTP implementation
|
|
6321
7009
|
*/
|
|
6322
|
-
|
|
6323
|
-
/**
|
|
6324
|
-
* The original input that caused the error.
|
|
6325
|
-
*/
|
|
6326
|
-
readonly input: unknown;
|
|
6327
|
-
/**
|
|
6328
|
-
* Human-readable error message.
|
|
6329
|
-
*/
|
|
6330
|
-
readonly message: string;
|
|
6331
|
-
/**
|
|
6332
|
-
* JSON-RPC error code (propagated from underlying errors).
|
|
6333
|
-
* May be undefined if the error originated outside JSON-RPC.
|
|
6334
|
-
*/
|
|
6335
|
-
readonly code?: number;
|
|
6336
|
-
/**
|
|
6337
|
-
* Optional underlying cause.
|
|
6338
|
-
*/
|
|
6339
|
-
readonly cause?: unknown;
|
|
6340
|
-
/**
|
|
6341
|
-
* Optional context for debugging.
|
|
6342
|
-
*/
|
|
6343
|
-
readonly context?: Record<string, unknown>;
|
|
6344
|
-
}> {
|
|
6345
|
-
/**
|
|
6346
|
-
* Creates a new SignerError.
|
|
6347
|
-
*
|
|
6348
|
-
* @param input - The original input that caused the error
|
|
6349
|
-
* @param message - Human-readable error message (optional, defaults to cause message)
|
|
6350
|
-
* @param options - Optional error options
|
|
6351
|
-
* @param options.code - JSON-RPC error code
|
|
6352
|
-
* @param options.cause - Underlying error that caused this failure
|
|
6353
|
-
*/
|
|
6354
|
-
constructor(input: unknown, message?: string, options?: {
|
|
6355
|
-
code?: number;
|
|
6356
|
-
context?: Record<string, unknown>;
|
|
6357
|
-
cause?: Error;
|
|
6358
|
-
});
|
|
6359
|
-
}
|
|
7010
|
+
|
|
6360
7011
|
/**
|
|
6361
|
-
*
|
|
7012
|
+
* No-op CCIP layer that always fails.
|
|
6362
7013
|
*
|
|
6363
7014
|
* @description
|
|
6364
|
-
*
|
|
6365
|
-
*
|
|
6366
|
-
* - EIP-2930 (type 1) - access list transactions with gasPrice
|
|
6367
|
-
* - EIP-1559 (type 2) - priority fee transactions
|
|
6368
|
-
* - EIP-4844 (type 3) - blob transactions for L2 data availability
|
|
6369
|
-
* - EIP-7702 (type 4) - set code transactions for smart account delegation
|
|
7015
|
+
* Provides CcipService with an implementation that immediately fails
|
|
7016
|
+
* with "CCIP disabled". Use when offchain lookups should not be performed.
|
|
6370
7017
|
*
|
|
6371
|
-
*
|
|
6372
|
-
* explicitly set via the `type` field.
|
|
7018
|
+
* @since 0.0.1
|
|
6373
7019
|
*
|
|
6374
|
-
*
|
|
7020
|
+
* @example Disable CCIP in tests
|
|
7021
|
+
* ```typescript
|
|
7022
|
+
* import { Effect } from 'effect'
|
|
7023
|
+
* import { CcipService, NoopCcip } from 'voltaire-effect'
|
|
6375
7024
|
*
|
|
6376
|
-
*
|
|
6377
|
-
*
|
|
6378
|
-
*
|
|
6379
|
-
*
|
|
6380
|
-
*
|
|
7025
|
+
* const program = Effect.gen(function* () {
|
|
7026
|
+
* const ccip = yield* CcipService
|
|
7027
|
+
* // This will always fail with "CCIP disabled"
|
|
7028
|
+
* return yield* ccip.request({ ... })
|
|
7029
|
+
* }).pipe(Effect.provide(NoopCcip))
|
|
7030
|
+
* ```
|
|
7031
|
+
*/
|
|
7032
|
+
declare const NoopCcip: Layer.Layer<CcipService>;
|
|
7033
|
+
|
|
7034
|
+
/**
|
|
7035
|
+
* @fileoverview Block explorer service definition for chain explorer metadata.
|
|
6381
7036
|
*
|
|
7037
|
+
* @module BlockExplorerService
|
|
6382
7038
|
* @since 0.0.1
|
|
7039
|
+
*
|
|
7040
|
+
* @description
|
|
7041
|
+
* The BlockExplorerService provides block explorer metadata for a chain,
|
|
7042
|
+
* including human-readable name, base URL, and optional API URL.
|
|
6383
7043
|
*/
|
|
6384
|
-
|
|
6385
|
-
/** Recipient address (null or undefined for contract deployment) */
|
|
6386
|
-
readonly to?: AddressInput | null;
|
|
6387
|
-
/** Value in wei to send with the transaction */
|
|
6388
|
-
readonly value?: bigint;
|
|
6389
|
-
/** Transaction input data (for contract calls/deployment) */
|
|
6390
|
-
readonly data?: HexType$2;
|
|
6391
|
-
/** Transaction nonce (auto-filled from network if not provided) */
|
|
6392
|
-
readonly nonce?: bigint;
|
|
6393
|
-
/** Gas limit (auto-estimated if not provided) */
|
|
6394
|
-
readonly gasLimit?: bigint;
|
|
6395
|
-
/** Gas price for legacy/EIP-2930 transactions (type 0/1) */
|
|
6396
|
-
readonly gasPrice?: bigint;
|
|
6397
|
-
/** Max fee per gas for EIP-1559+ transactions (type 2/3/4) */
|
|
6398
|
-
readonly maxFeePerGas?: bigint;
|
|
6399
|
-
/** Max priority fee (tip) for EIP-1559+ transactions (type 2/3/4) */
|
|
6400
|
-
readonly maxPriorityFeePerGas?: bigint;
|
|
6401
|
-
/** Chain ID for replay protection (auto-detected if not provided) */
|
|
6402
|
-
readonly chainId?: bigint;
|
|
6403
|
-
/** EIP-2930+ access list for pre-warming storage slots */
|
|
6404
|
-
readonly accessList?: Array<{
|
|
6405
|
-
address: AddressInput;
|
|
6406
|
-
storageKeys: Array<`0x${string}`>;
|
|
6407
|
-
}>;
|
|
6408
|
-
/** Transaction type (auto-detected if not provided) */
|
|
6409
|
-
readonly type?: 0 | 1 | 2 | 3 | 4;
|
|
6410
|
-
/** EIP-4844: Versioned hashes for blob commitments */
|
|
6411
|
-
readonly blobVersionedHashes?: readonly `0x${string}`[];
|
|
6412
|
-
/** EIP-4844: Max fee per blob gas */
|
|
6413
|
-
readonly maxFeePerBlobGas?: bigint;
|
|
6414
|
-
/** EIP-4844: Raw blob data (sidecar) */
|
|
6415
|
-
readonly blobs?: readonly Uint8Array[];
|
|
6416
|
-
/** EIP-4844: KZG commitments for blobs (sidecar) */
|
|
6417
|
-
readonly kzgCommitments?: readonly `0x${string}`[];
|
|
6418
|
-
/** EIP-4844: KZG proofs for blobs (sidecar) */
|
|
6419
|
-
readonly kzgProofs?: readonly `0x${string}`[];
|
|
6420
|
-
/** EIP-7702: Authorization list for set code transactions */
|
|
6421
|
-
readonly authorizationList?: readonly AuthorizationInput[];
|
|
6422
|
-
};
|
|
7044
|
+
|
|
6423
7045
|
/**
|
|
6424
|
-
*
|
|
7046
|
+
* Block explorer configuration for a chain.
|
|
6425
7047
|
*
|
|
6426
7048
|
* @since 0.0.1
|
|
6427
7049
|
*/
|
|
6428
|
-
interface
|
|
6429
|
-
/**
|
|
6430
|
-
readonly
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
7050
|
+
interface BlockExplorerConfig {
|
|
7051
|
+
/** Default block explorer for the chain */
|
|
7052
|
+
readonly default?: {
|
|
7053
|
+
readonly name: string;
|
|
7054
|
+
readonly url: string;
|
|
7055
|
+
readonly apiUrl?: string;
|
|
7056
|
+
};
|
|
6435
7057
|
}
|
|
7058
|
+
declare const BlockExplorerService_base: Context.TagClass<BlockExplorerService, "BlockExplorerService", BlockExplorerConfig>;
|
|
6436
7059
|
/**
|
|
6437
|
-
*
|
|
7060
|
+
* Block explorer service for chain metadata.
|
|
6438
7061
|
*
|
|
6439
7062
|
* @description
|
|
6440
|
-
*
|
|
6441
|
-
* Supported by smart contract wallets and some browser wallets.
|
|
7063
|
+
* Provides access to block explorer information for the active chain.
|
|
6442
7064
|
*
|
|
6443
7065
|
* @since 0.0.1
|
|
6444
7066
|
*/
|
|
6445
|
-
|
|
6446
|
-
/** Array of calls to execute atomically */
|
|
6447
|
-
readonly calls: readonly {
|
|
6448
|
-
/** Target contract address */
|
|
6449
|
-
readonly to: AddressInput;
|
|
6450
|
-
/** Calldata for the call */
|
|
6451
|
-
readonly data?: HexType$2;
|
|
6452
|
-
/** Value in wei to send */
|
|
6453
|
-
readonly value?: bigint;
|
|
6454
|
-
}[];
|
|
6455
|
-
/** Optional capabilities like paymaster service */
|
|
6456
|
-
readonly capabilities?: {
|
|
6457
|
-
/** Paymaster service configuration */
|
|
6458
|
-
readonly paymasterService?: {
|
|
6459
|
-
readonly url: string;
|
|
6460
|
-
};
|
|
6461
|
-
};
|
|
7067
|
+
declare class BlockExplorerService extends BlockExplorerService_base {
|
|
6462
7068
|
}
|
|
7069
|
+
|
|
6463
7070
|
/**
|
|
6464
|
-
*
|
|
7071
|
+
* @fileoverview Contracts service definition for well-known deployments.
|
|
7072
|
+
*
|
|
7073
|
+
* @module ContractsService
|
|
7074
|
+
* @since 0.0.1
|
|
6465
7075
|
*
|
|
6466
7076
|
* @description
|
|
6467
|
-
*
|
|
7077
|
+
* The ContractsService provides well-known contract deployments for a chain,
|
|
7078
|
+
* such as multicall and ENS resolver addresses.
|
|
7079
|
+
*/
|
|
7080
|
+
|
|
7081
|
+
/**
|
|
7082
|
+
* Contract deployment information.
|
|
6468
7083
|
*
|
|
6469
7084
|
* @since 0.0.1
|
|
6470
7085
|
*/
|
|
6471
|
-
interface
|
|
6472
|
-
|
|
6473
|
-
readonly
|
|
6474
|
-
/** Transaction receipts (only present when CONFIRMED) */
|
|
6475
|
-
readonly receipts?: readonly {
|
|
6476
|
-
readonly transactionHash: HexType$2;
|
|
6477
|
-
readonly blockNumber: bigint;
|
|
6478
|
-
readonly gasUsed: bigint;
|
|
6479
|
-
readonly status: "success" | "reverted";
|
|
6480
|
-
readonly logs: readonly EventLogType[];
|
|
6481
|
-
}[];
|
|
7086
|
+
interface ChainContract {
|
|
7087
|
+
readonly address: `0x${string}`;
|
|
7088
|
+
readonly blockCreated?: number;
|
|
6482
7089
|
}
|
|
6483
7090
|
/**
|
|
6484
|
-
*
|
|
6485
|
-
*
|
|
6486
|
-
* @description
|
|
6487
|
-
* Describes what features a wallet supports for each chain.
|
|
7091
|
+
* Well-known contract deployments for a chain.
|
|
6488
7092
|
*
|
|
6489
7093
|
* @since 0.0.1
|
|
6490
7094
|
*/
|
|
6491
|
-
interface
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
readonly supported: boolean;
|
|
6496
|
-
};
|
|
6497
|
-
/** Whether paymaster service is supported */
|
|
6498
|
-
readonly paymasterService?: {
|
|
6499
|
-
readonly supported: boolean;
|
|
6500
|
-
};
|
|
6501
|
-
/** Whether session keys are supported */
|
|
6502
|
-
readonly sessionKeys?: {
|
|
6503
|
-
readonly supported: boolean;
|
|
6504
|
-
};
|
|
6505
|
-
};
|
|
7095
|
+
interface ContractsConfig {
|
|
7096
|
+
readonly multicall3?: ChainContract;
|
|
7097
|
+
readonly ensRegistry?: ChainContract;
|
|
7098
|
+
readonly ensUniversalResolver?: ChainContract;
|
|
6506
7099
|
}
|
|
7100
|
+
declare const ContractsService_base: Context.TagClass<ContractsService, "ContractsService", ContractsConfig>;
|
|
6507
7101
|
/**
|
|
6508
|
-
*
|
|
7102
|
+
* Contracts service for chain deployment metadata.
|
|
6509
7103
|
*
|
|
6510
7104
|
* @description
|
|
6511
|
-
*
|
|
6512
|
-
* Each method returns an Effect that may fail with SignerError.
|
|
7105
|
+
* Provides access to well-known contract deployments for the active chain.
|
|
6513
7106
|
*
|
|
6514
7107
|
* @since 0.0.1
|
|
6515
7108
|
*/
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
* @returns Signed transaction (hex-encoded)
|
|
6527
|
-
*/
|
|
6528
|
-
readonly signTransaction: (tx: TransactionRequest) => Effect.Effect<HexType$2, SignerError>;
|
|
6529
|
-
/**
|
|
6530
|
-
* Signs EIP-712 typed structured data.
|
|
6531
|
-
* @param typedData - Typed data to sign
|
|
6532
|
-
* @returns Signature
|
|
6533
|
-
*/
|
|
6534
|
-
readonly signTypedData: (typedData: TypedDataType) => Effect.Effect<SignatureType, SignerError>;
|
|
6535
|
-
/**
|
|
6536
|
-
* Prepares an EIP-7702 authorization tuple.
|
|
6537
|
-
* @param params - Authorization parameters
|
|
6538
|
-
* @returns Unsigned authorization ready for signing
|
|
6539
|
-
*/
|
|
6540
|
-
readonly prepareAuthorization: (params: PrepareAuthorizationParams) => Effect.Effect<UnsignedAuthorization, SignerError>;
|
|
6541
|
-
/**
|
|
6542
|
-
* Signs and broadcasts a transaction.
|
|
6543
|
-
* @param tx - Transaction parameters
|
|
6544
|
-
* @returns Transaction hash
|
|
6545
|
-
*/
|
|
6546
|
-
readonly sendTransaction: (tx: TransactionRequest) => Effect.Effect<HashType$1, SignerError>;
|
|
6547
|
-
/**
|
|
6548
|
-
* Broadcasts an already-signed transaction.
|
|
6549
|
-
* @param signedTx - RLP-encoded signed transaction
|
|
6550
|
-
* @returns Transaction hash
|
|
6551
|
-
*/
|
|
6552
|
-
readonly sendRawTransaction: (signedTx: HexType$2) => Effect.Effect<HashType$1, SignerError>;
|
|
6553
|
-
/**
|
|
6554
|
-
* Gets wallet addresses without prompting (eth_accounts).
|
|
6555
|
-
* @returns Array of connected addresses
|
|
6556
|
-
*/
|
|
6557
|
-
readonly getAddresses: () => Effect.Effect<AddressType$3[], SignerError>;
|
|
6558
|
-
/**
|
|
6559
|
-
* Requests wallet addresses (triggers wallet popup in browser).
|
|
6560
|
-
* @returns Array of connected addresses
|
|
6561
|
-
*/
|
|
6562
|
-
readonly requestAddresses: () => Effect.Effect<AddressType$3[], SignerError>;
|
|
6563
|
-
/**
|
|
6564
|
-
* Gets the current permissions granted to the dapp (EIP-2255).
|
|
6565
|
-
* @returns Array of granted permissions
|
|
6566
|
-
*/
|
|
6567
|
-
readonly getPermissions: () => Effect.Effect<Permission[], SignerError>;
|
|
6568
|
-
/**
|
|
6569
|
-
* Requests specific permissions from the wallet (EIP-2255).
|
|
6570
|
-
* @param permissions - Object with permission names as keys
|
|
6571
|
-
* @returns Array of granted permissions
|
|
6572
|
-
*/
|
|
6573
|
-
readonly requestPermissions: (permissions: PermissionRequest) => Effect.Effect<Permission[], SignerError>;
|
|
6574
|
-
/**
|
|
6575
|
-
* Requests the wallet to add a new chain (EIP-3085).
|
|
6576
|
-
* @param chain - Chain configuration to add
|
|
6577
|
-
*/
|
|
6578
|
-
readonly addChain: (chain: ChainConfig) => Effect.Effect<void, SignerError>;
|
|
6579
|
-
/**
|
|
6580
|
-
* Requests wallet to switch to a different chain.
|
|
6581
|
-
* @param chainId - Target chain ID (e.g., 1 for mainnet)
|
|
6582
|
-
*/
|
|
6583
|
-
readonly switchChain: (chainId: number) => Effect.Effect<void, SignerError>;
|
|
6584
|
-
/**
|
|
6585
|
-
* Gets wallet capabilities per chain (EIP-5792).
|
|
6586
|
-
* @param account - Optional account address to query capabilities for
|
|
6587
|
-
* @returns Wallet capabilities indexed by chain ID
|
|
6588
|
-
*/
|
|
6589
|
-
readonly getCapabilities: (account?: AddressInput) => Effect.Effect<WalletCapabilities, SignerError>;
|
|
6590
|
-
/**
|
|
6591
|
-
* Sends a batch of calls atomically (EIP-5792).
|
|
6592
|
-
* @param params - Batch call parameters
|
|
6593
|
-
* @returns Bundle ID for tracking the batch
|
|
6594
|
-
*/
|
|
6595
|
-
readonly sendCalls: (params: SendCallsParams) => Effect.Effect<string, SignerError>;
|
|
6596
|
-
/**
|
|
6597
|
-
* Gets the status of a call bundle (EIP-5792).
|
|
6598
|
-
* @param bundleId - The bundle ID returned from sendCalls
|
|
6599
|
-
* @returns Current status and receipts if confirmed
|
|
6600
|
-
*/
|
|
6601
|
-
readonly getCallsStatus: (bundleId: string) => Effect.Effect<CallsStatus, SignerError>;
|
|
6602
|
-
/**
|
|
6603
|
-
* Waits for a call bundle to complete (EIP-5792).
|
|
6604
|
-
* @param bundleId - The bundle ID returned from sendCalls
|
|
6605
|
-
* @param options - Polling options
|
|
6606
|
-
* @returns Final status with receipts
|
|
6607
|
-
*/
|
|
6608
|
-
readonly waitForCallsStatus: (bundleId: string, options?: {
|
|
6609
|
-
readonly timeout?: number;
|
|
6610
|
-
readonly pollingInterval?: number;
|
|
6611
|
-
}) => Effect.Effect<CallsStatus, SignerError>;
|
|
6612
|
-
};
|
|
6613
|
-
declare const SignerService_base: Context.TagClass<SignerService, "SignerService", SignerShape>;
|
|
7109
|
+
declare class ContractsService extends ContractsService_base {
|
|
7110
|
+
}
|
|
7111
|
+
|
|
7112
|
+
/**
|
|
7113
|
+
* @fileoverview Arbitrum One L2 chain configuration.
|
|
7114
|
+
*
|
|
7115
|
+
* @module arbitrum
|
|
7116
|
+
* @since 0.0.1
|
|
7117
|
+
*/
|
|
7118
|
+
|
|
6614
7119
|
/**
|
|
6615
|
-
*
|
|
7120
|
+
* Arbitrum One configuration.
|
|
6616
7121
|
*
|
|
6617
|
-
* @
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
7122
|
+
* @since 0.0.1
|
|
7123
|
+
*/
|
|
7124
|
+
declare const arbitrumConfig: ChainConfig;
|
|
7125
|
+
/**
|
|
7126
|
+
* Arbitrum block explorer configuration.
|
|
6621
7127
|
*
|
|
6622
|
-
*
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
*
|
|
6627
|
-
* - Wallet interaction (getAddresses, requestAddresses, getPermissions, requestPermissions, addChain, switchChain)
|
|
7128
|
+
* @since 0.0.1
|
|
7129
|
+
*/
|
|
7130
|
+
declare const arbitrumBlockExplorers: BlockExplorerConfig;
|
|
7131
|
+
/**
|
|
7132
|
+
* Arbitrum contract deployments.
|
|
6628
7133
|
*
|
|
6629
|
-
*
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
7134
|
+
* @since 0.0.1
|
|
7135
|
+
*/
|
|
7136
|
+
declare const arbitrumContracts: ContractsConfig;
|
|
7137
|
+
/**
|
|
7138
|
+
* Arbitrum One L2 Layer for chain metadata, explorers, and contracts.
|
|
6633
7139
|
*
|
|
6634
7140
|
* @since 0.0.1
|
|
6635
7141
|
*
|
|
6636
|
-
* @
|
|
6637
|
-
*
|
|
6638
|
-
*
|
|
6639
|
-
*
|
|
7142
|
+
* @example
|
|
7143
|
+
* ```typescript
|
|
7144
|
+
* import { Effect } from 'effect'
|
|
7145
|
+
* import { ChainService, arbitrum } from 'voltaire-effect'
|
|
7146
|
+
*
|
|
7147
|
+
* const program = Effect.gen(function* () {
|
|
7148
|
+
* const chain = yield* ChainService
|
|
7149
|
+
* console.log(chain.id) // 42161
|
|
7150
|
+
* }).pipe(Effect.provide(arbitrum))
|
|
7151
|
+
* ```
|
|
6640
7152
|
*/
|
|
6641
|
-
declare
|
|
6642
|
-
}
|
|
7153
|
+
declare const arbitrum: Layer.Layer<ChainService | BlockExplorerService | ContractsService, never, never>;
|
|
6643
7154
|
|
|
6644
|
-
|
|
7155
|
+
/**
|
|
7156
|
+
* @fileoverview Base L2 chain configuration.
|
|
7157
|
+
*
|
|
7158
|
+
* @module base
|
|
7159
|
+
* @since 0.0.1
|
|
7160
|
+
*/
|
|
6645
7161
|
|
|
6646
7162
|
/**
|
|
6647
|
-
*
|
|
7163
|
+
* Base L2 configuration.
|
|
6648
7164
|
*
|
|
6649
|
-
* @
|
|
6650
|
-
|
|
6651
|
-
|
|
7165
|
+
* @since 0.0.1
|
|
7166
|
+
*/
|
|
7167
|
+
declare const baseConfig: ChainConfig;
|
|
7168
|
+
/**
|
|
7169
|
+
* Base block explorer configuration.
|
|
7170
|
+
*
|
|
7171
|
+
* @since 0.0.1
|
|
7172
|
+
*/
|
|
7173
|
+
declare const baseBlockExplorers: BlockExplorerConfig;
|
|
7174
|
+
/**
|
|
7175
|
+
* Base contract deployments.
|
|
7176
|
+
*
|
|
7177
|
+
* @since 0.0.1
|
|
7178
|
+
*/
|
|
7179
|
+
declare const baseContracts: ContractsConfig;
|
|
7180
|
+
/**
|
|
7181
|
+
* Base L2 Layer for chain metadata, explorers, and contracts.
|
|
6652
7182
|
*
|
|
6653
7183
|
* @since 0.0.1
|
|
6654
7184
|
*
|
|
6655
|
-
* @example
|
|
7185
|
+
* @example
|
|
6656
7186
|
* ```typescript
|
|
6657
7187
|
* import { Effect } from 'effect'
|
|
6658
|
-
* import {
|
|
7188
|
+
* import { ChainService, base } from 'voltaire-effect'
|
|
6659
7189
|
*
|
|
6660
7190
|
* const program = Effect.gen(function* () {
|
|
6661
|
-
* const
|
|
6662
|
-
*
|
|
6663
|
-
* }).pipe(
|
|
6664
|
-
* Effect.provide(Signer.Live),
|
|
6665
|
-
* Effect.provide(LocalAccount(privateKey)),
|
|
6666
|
-
* Effect.provide(Provider),
|
|
6667
|
-
* Effect.provide(HttpTransport('https://...'))
|
|
6668
|
-
* )
|
|
7191
|
+
* const chain = yield* ChainService
|
|
7192
|
+
* console.log(chain.id) // 8453
|
|
7193
|
+
* }).pipe(Effect.provide(base))
|
|
6669
7194
|
* ```
|
|
7195
|
+
*/
|
|
7196
|
+
declare const base: Layer.Layer<ChainService | BlockExplorerService | ContractsService, never, never>;
|
|
7197
|
+
|
|
7198
|
+
/**
|
|
7199
|
+
* @fileoverview Ethereum mainnet chain configuration.
|
|
6670
7200
|
*
|
|
6671
|
-
* @
|
|
7201
|
+
* @module mainnet
|
|
7202
|
+
* @since 0.0.1
|
|
7203
|
+
*/
|
|
7204
|
+
|
|
7205
|
+
/**
|
|
7206
|
+
* Ethereum mainnet configuration.
|
|
7207
|
+
*
|
|
7208
|
+
* @since 0.0.1
|
|
7209
|
+
*/
|
|
7210
|
+
declare const mainnetConfig: ChainConfig;
|
|
7211
|
+
/**
|
|
7212
|
+
* Ethereum mainnet block explorer configuration.
|
|
7213
|
+
*
|
|
7214
|
+
* @since 0.0.1
|
|
7215
|
+
*/
|
|
7216
|
+
declare const mainnetBlockExplorers: BlockExplorerConfig;
|
|
7217
|
+
/**
|
|
7218
|
+
* Ethereum mainnet contract deployments.
|
|
7219
|
+
*
|
|
7220
|
+
* @since 0.0.1
|
|
7221
|
+
*/
|
|
7222
|
+
declare const mainnetContracts: ContractsConfig;
|
|
7223
|
+
/**
|
|
7224
|
+
* Ethereum mainnet Layer for chain metadata, explorers, and contracts.
|
|
7225
|
+
*
|
|
7226
|
+
* @since 0.0.1
|
|
7227
|
+
*
|
|
7228
|
+
* @example
|
|
6672
7229
|
* ```typescript
|
|
6673
7230
|
* import { Effect } from 'effect'
|
|
6674
|
-
* import {
|
|
6675
|
-
*
|
|
6676
|
-
* const transport = HttpTransport('https://...')
|
|
6677
|
-
* const signerLayer = Signer.fromProvider(Provider, LocalAccount(privateKey))
|
|
7231
|
+
* import { ChainService, mainnet } from 'voltaire-effect'
|
|
6678
7232
|
*
|
|
6679
7233
|
* const program = Effect.gen(function* () {
|
|
6680
|
-
* const
|
|
6681
|
-
*
|
|
6682
|
-
* }).pipe(
|
|
6683
|
-
* Effect.provide(signerLayer),
|
|
6684
|
-
* Effect.provide(transport)
|
|
6685
|
-
* )
|
|
7234
|
+
* const chain = yield* ChainService
|
|
7235
|
+
* console.log(chain.name) // "Ethereum"
|
|
7236
|
+
* }).pipe(Effect.provide(mainnet))
|
|
6686
7237
|
* ```
|
|
7238
|
+
*/
|
|
7239
|
+
declare const mainnet: Layer.Layer<ChainService | BlockExplorerService | ContractsService, never, never>;
|
|
7240
|
+
|
|
7241
|
+
/**
|
|
7242
|
+
* @fileoverview Optimism L2 chain configuration.
|
|
6687
7243
|
*
|
|
6688
|
-
* @
|
|
7244
|
+
* @module optimism
|
|
7245
|
+
* @since 0.0.1
|
|
7246
|
+
*/
|
|
7247
|
+
|
|
7248
|
+
/**
|
|
7249
|
+
* Optimism (OP Mainnet) configuration.
|
|
7250
|
+
*
|
|
7251
|
+
* @since 0.0.1
|
|
7252
|
+
*/
|
|
7253
|
+
declare const optimismConfig: ChainConfig;
|
|
7254
|
+
/**
|
|
7255
|
+
* Optimism block explorer configuration.
|
|
7256
|
+
*
|
|
7257
|
+
* @since 0.0.1
|
|
7258
|
+
*/
|
|
7259
|
+
declare const optimismBlockExplorers: BlockExplorerConfig;
|
|
7260
|
+
/**
|
|
7261
|
+
* Optimism contract deployments.
|
|
7262
|
+
*
|
|
7263
|
+
* @since 0.0.1
|
|
7264
|
+
*/
|
|
7265
|
+
declare const optimismContracts: ContractsConfig;
|
|
7266
|
+
/**
|
|
7267
|
+
* Optimism L2 Layer for chain metadata, explorers, and contracts.
|
|
7268
|
+
*
|
|
7269
|
+
* @since 0.0.1
|
|
7270
|
+
*
|
|
7271
|
+
* @example
|
|
6689
7272
|
* ```typescript
|
|
6690
7273
|
* import { Effect } from 'effect'
|
|
6691
|
-
* import {
|
|
6692
|
-
*
|
|
6693
|
-
* const transport = HttpTransport('https://...')
|
|
6694
|
-
* const signerLayer = Signer.fromPrivateKey(privateKey, Provider)
|
|
7274
|
+
* import { ChainService, optimism } from 'voltaire-effect'
|
|
6695
7275
|
*
|
|
6696
7276
|
* const program = Effect.gen(function* () {
|
|
6697
|
-
* const
|
|
6698
|
-
*
|
|
6699
|
-
* }).pipe(
|
|
6700
|
-
* Effect.provide(signerLayer),
|
|
6701
|
-
* Effect.provide(transport)
|
|
6702
|
-
* )
|
|
7277
|
+
* const chain = yield* ChainService
|
|
7278
|
+
* console.log(chain.id) // 10
|
|
7279
|
+
* }).pipe(Effect.provide(optimism))
|
|
6703
7280
|
* ```
|
|
6704
7281
|
*/
|
|
6705
|
-
declare const
|
|
6706
|
-
/**
|
|
6707
|
-
* Live implementation layer requiring AccountService, ProviderService, and TransportService.
|
|
6708
|
-
*/
|
|
6709
|
-
readonly Live: Layer.Layer<SignerService, never, TransportService | ProviderService | AccountService>;
|
|
6710
|
-
/**
|
|
6711
|
-
* Creates a Signer layer by composing a provider layer and account layer.
|
|
6712
|
-
*
|
|
6713
|
-
* @description
|
|
6714
|
-
* Combines a ProviderService layer with an AccountService layer to create
|
|
6715
|
-
* a fully configured SignerService layer. The resulting layer still requires
|
|
6716
|
-
* TransportService to be provided.
|
|
6717
|
-
*
|
|
6718
|
-
* @param providerLayer - Layer providing ProviderService (requires TransportService)
|
|
6719
|
-
* @param accountLayer - Layer providing AccountService
|
|
6720
|
-
* @returns Layer providing SignerService (requires TransportService)
|
|
6721
|
-
*
|
|
6722
|
-
* @since 0.0.1
|
|
6723
|
-
*/
|
|
6724
|
-
readonly fromProvider: <E1, R1, E2, R2>(providerLayer: Layer.Layer<ProviderService, E1, R1>, accountLayer: Layer.Layer<AccountService, E2, R2>) => Layer.Layer<SignerService, E1 | E2, R1 | R2 | TransportService>;
|
|
6725
|
-
/**
|
|
6726
|
-
* Creates a Signer layer from a private key and provider layer.
|
|
6727
|
-
*
|
|
6728
|
-
* @description
|
|
6729
|
-
* Convenience function that creates a LocalAccount from the private key
|
|
6730
|
-
* and composes it with the given provider layer. The resulting layer
|
|
6731
|
-
* still requires TransportService and the crypto services (Secp256k1Service, KeccakService).
|
|
6732
|
-
*
|
|
6733
|
-
* @param privateKey - The private key as a hex string (with 0x prefix)
|
|
6734
|
-
* @param providerLayer - Layer providing ProviderService (requires TransportService)
|
|
6735
|
-
* @returns Layer providing SignerService (requires TransportService and crypto services)
|
|
6736
|
-
*
|
|
6737
|
-
* @since 0.0.1
|
|
6738
|
-
*/
|
|
6739
|
-
readonly fromPrivateKey: <E, R>(privateKey: HexType$1, providerLayer: Layer.Layer<ProviderService, E, R>) => Layer.Layer<SignerService, E, KeccakService | Secp256k1Service | TransportService | R>;
|
|
6740
|
-
};
|
|
7282
|
+
declare const optimism: Layer.Layer<ChainService | BlockExplorerService | ContractsService, never, never>;
|
|
6741
7283
|
|
|
6742
|
-
type AddressType$2 = BrandedAddress.AddressType;
|
|
6743
|
-
type HashType = BrandedHash.HashType;
|
|
6744
|
-
type HexType = BrandedHex.HexType;
|
|
6745
7284
|
/**
|
|
6746
|
-
*
|
|
7285
|
+
* @fileoverview Polygon chain configuration.
|
|
6747
7286
|
*
|
|
6748
|
-
* @
|
|
6749
|
-
*
|
|
6750
|
-
|
|
7287
|
+
* @module polygon
|
|
7288
|
+
* @since 0.0.1
|
|
7289
|
+
*/
|
|
7290
|
+
|
|
7291
|
+
/**
|
|
7292
|
+
* Polygon (formerly Matic) configuration.
|
|
6751
7293
|
*
|
|
6752
7294
|
* @since 0.0.1
|
|
6753
7295
|
*/
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
type: string;
|
|
6762
|
-
name?: string;
|
|
6763
|
-
indexed?: boolean;
|
|
6764
|
-
}[];
|
|
6765
|
-
/** Output parameters for functions */
|
|
6766
|
-
readonly outputs?: readonly {
|
|
6767
|
-
type: string;
|
|
6768
|
-
name?: string;
|
|
6769
|
-
}[];
|
|
6770
|
-
/** Function state mutability (pure, view, nonpayable, payable) */
|
|
6771
|
-
readonly stateMutability?: string;
|
|
6772
|
-
/** Whether event is anonymous */
|
|
6773
|
-
readonly anonymous?: boolean;
|
|
6774
|
-
};
|
|
7296
|
+
declare const polygonConfig: ChainConfig;
|
|
7297
|
+
/**
|
|
7298
|
+
* Polygon block explorer configuration.
|
|
7299
|
+
*
|
|
7300
|
+
* @since 0.0.1
|
|
7301
|
+
*/
|
|
7302
|
+
declare const polygonBlockExplorers: BlockExplorerConfig;
|
|
6775
7303
|
/**
|
|
6776
|
-
*
|
|
7304
|
+
* Polygon contract deployments.
|
|
6777
7305
|
*
|
|
6778
|
-
* @
|
|
6779
|
-
|
|
6780
|
-
|
|
7306
|
+
* @since 0.0.1
|
|
7307
|
+
*/
|
|
7308
|
+
declare const polygonContracts: ContractsConfig;
|
|
7309
|
+
/**
|
|
7310
|
+
* Polygon Layer for chain metadata, explorers, and contracts.
|
|
6781
7311
|
*
|
|
6782
7312
|
* @since 0.0.1
|
|
6783
7313
|
*
|
|
6784
7314
|
* @example
|
|
6785
7315
|
* ```typescript
|
|
6786
|
-
*
|
|
6787
|
-
*
|
|
6788
|
-
*
|
|
6789
|
-
*
|
|
6790
|
-
*
|
|
7316
|
+
* import { Effect } from 'effect'
|
|
7317
|
+
* import { ChainService, polygon } from 'voltaire-effect'
|
|
7318
|
+
*
|
|
7319
|
+
* const program = Effect.gen(function* () {
|
|
7320
|
+
* const chain = yield* ChainService
|
|
7321
|
+
* console.log(chain.nativeCurrency.symbol) // "POL"
|
|
7322
|
+
* }).pipe(Effect.provide(polygon))
|
|
6791
7323
|
* ```
|
|
6792
7324
|
*/
|
|
6793
|
-
|
|
7325
|
+
declare const polygon: Layer.Layer<ChainService | BlockExplorerService | ContractsService, never, never>;
|
|
6794
7326
|
|
|
6795
7327
|
/**
|
|
6796
|
-
*
|
|
6797
|
-
*
|
|
6798
|
-
* @
|
|
6799
|
-
*/
|
|
6800
|
-
type BlockTag = "latest" | "earliest" | "pending" | "safe" | "finalized" | bigint;
|
|
6801
|
-
/**
|
|
6802
|
-
* Filter options for querying contract events.
|
|
7328
|
+
* @fileoverview Sepolia testnet chain configuration.
|
|
7329
|
+
*
|
|
7330
|
+
* @module sepolia
|
|
6803
7331
|
* @since 0.0.1
|
|
6804
7332
|
*/
|
|
6805
|
-
|
|
6806
|
-
/** Start block for the query */
|
|
6807
|
-
readonly fromBlock?: BlockTag;
|
|
6808
|
-
/** End block for the query */
|
|
6809
|
-
readonly toBlock?: BlockTag;
|
|
6810
|
-
/** Indexed argument filters */
|
|
6811
|
-
readonly args?: Record<string, unknown>;
|
|
6812
|
-
}
|
|
7333
|
+
|
|
6813
7334
|
/**
|
|
6814
|
-
*
|
|
7335
|
+
* Sepolia testnet configuration.
|
|
7336
|
+
*
|
|
6815
7337
|
* @since 0.0.1
|
|
6816
7338
|
*/
|
|
6817
|
-
|
|
6818
|
-
/** Name of the event */
|
|
6819
|
-
readonly eventName: string;
|
|
6820
|
-
/** Decoded event arguments */
|
|
6821
|
-
readonly args: Record<string, unknown>;
|
|
6822
|
-
/** Block number where the event was emitted */
|
|
6823
|
-
readonly blockNumber: bigint;
|
|
6824
|
-
/** Transaction hash that emitted the event */
|
|
6825
|
-
readonly transactionHash: HexType;
|
|
6826
|
-
/** Log index within the block */
|
|
6827
|
-
readonly logIndex: number;
|
|
6828
|
-
}
|
|
6829
|
-
declare const ContractError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6830
|
-
readonly _tag: "ContractError";
|
|
6831
|
-
} & Readonly<A>;
|
|
7339
|
+
declare const sepoliaConfig: ChainConfig;
|
|
6832
7340
|
/**
|
|
6833
|
-
*
|
|
7341
|
+
* Sepolia testnet block explorer configuration.
|
|
7342
|
+
*
|
|
6834
7343
|
* @since 0.0.1
|
|
6835
7344
|
*/
|
|
6836
|
-
declare
|
|
6837
|
-
/**
|
|
6838
|
-
* The original input that caused the error.
|
|
6839
|
-
*/
|
|
6840
|
-
readonly input: unknown;
|
|
6841
|
-
/**
|
|
6842
|
-
* Human-readable error message.
|
|
6843
|
-
*/
|
|
6844
|
-
readonly message: string;
|
|
6845
|
-
/**
|
|
6846
|
-
* JSON-RPC error code (if applicable).
|
|
6847
|
-
*/
|
|
6848
|
-
readonly code?: number;
|
|
6849
|
-
/**
|
|
6850
|
-
* Optional underlying cause.
|
|
6851
|
-
*/
|
|
6852
|
-
readonly cause?: unknown;
|
|
6853
|
-
/**
|
|
6854
|
-
* Optional context for debugging.
|
|
6855
|
-
*/
|
|
6856
|
-
readonly context?: Record<string, unknown>;
|
|
6857
|
-
}> {
|
|
6858
|
-
constructor(input: unknown, message: string, options?: {
|
|
6859
|
-
code?: number;
|
|
6860
|
-
context?: Record<string, unknown>;
|
|
6861
|
-
cause?: unknown;
|
|
6862
|
-
});
|
|
6863
|
-
}
|
|
6864
|
-
declare const ContractCallError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6865
|
-
readonly _tag: "ContractCallError";
|
|
6866
|
-
} & Readonly<A>;
|
|
7345
|
+
declare const sepoliaBlockExplorers: BlockExplorerConfig;
|
|
6867
7346
|
/**
|
|
6868
|
-
*
|
|
7347
|
+
* Sepolia testnet contract deployments.
|
|
7348
|
+
*
|
|
6869
7349
|
* @since 0.0.1
|
|
6870
7350
|
*/
|
|
6871
|
-
declare
|
|
6872
|
-
readonly input: unknown;
|
|
6873
|
-
readonly message: string;
|
|
6874
|
-
readonly code?: number;
|
|
6875
|
-
readonly cause?: unknown;
|
|
6876
|
-
readonly context?: Record<string, unknown>;
|
|
6877
|
-
}> {
|
|
6878
|
-
constructor(input: unknown, message: string, options?: {
|
|
6879
|
-
code?: number;
|
|
6880
|
-
context?: Record<string, unknown>;
|
|
6881
|
-
cause?: unknown;
|
|
6882
|
-
});
|
|
6883
|
-
}
|
|
6884
|
-
declare const ContractWriteError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6885
|
-
readonly _tag: "ContractWriteError";
|
|
6886
|
-
} & Readonly<A>;
|
|
7351
|
+
declare const sepoliaContracts: ContractsConfig;
|
|
6887
7352
|
/**
|
|
6888
|
-
*
|
|
7353
|
+
* Sepolia testnet Layer for chain metadata, explorers, and contracts.
|
|
7354
|
+
*
|
|
6889
7355
|
* @since 0.0.1
|
|
7356
|
+
*
|
|
7357
|
+
* @example
|
|
7358
|
+
* ```typescript
|
|
7359
|
+
* import { Effect } from 'effect'
|
|
7360
|
+
* import { ChainService, sepolia } from 'voltaire-effect'
|
|
7361
|
+
*
|
|
7362
|
+
* const program = Effect.gen(function* () {
|
|
7363
|
+
* const chain = yield* ChainService
|
|
7364
|
+
* console.log(chain.testnet) // true
|
|
7365
|
+
* }).pipe(Effect.provide(sepolia))
|
|
7366
|
+
* ```
|
|
6890
7367
|
*/
|
|
6891
|
-
declare
|
|
6892
|
-
|
|
6893
|
-
readonly message: string;
|
|
6894
|
-
readonly code?: number;
|
|
6895
|
-
readonly cause?: unknown;
|
|
6896
|
-
readonly context?: Record<string, unknown>;
|
|
6897
|
-
}> {
|
|
6898
|
-
constructor(input: unknown, message: string, options?: {
|
|
6899
|
-
code?: number;
|
|
6900
|
-
context?: Record<string, unknown>;
|
|
6901
|
-
cause?: unknown;
|
|
6902
|
-
});
|
|
6903
|
-
}
|
|
6904
|
-
declare const ContractEventError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
6905
|
-
readonly _tag: "ContractEventError";
|
|
6906
|
-
} & Readonly<A>;
|
|
7368
|
+
declare const sepolia: Layer.Layer<ChainService | BlockExplorerService | ContractsService, never, never>;
|
|
7369
|
+
|
|
6907
7370
|
/**
|
|
6908
|
-
*
|
|
7371
|
+
* @fileoverview RPC URL map for built-in chains.
|
|
7372
|
+
*
|
|
7373
|
+
* @module rpcUrls
|
|
6909
7374
|
* @since 0.0.1
|
|
6910
7375
|
*/
|
|
6911
|
-
declare class ContractEventError extends ContractEventError_base<{
|
|
6912
|
-
readonly input: unknown;
|
|
6913
|
-
readonly message: string;
|
|
6914
|
-
readonly code?: number;
|
|
6915
|
-
readonly cause?: unknown;
|
|
6916
|
-
readonly context?: Record<string, unknown>;
|
|
6917
|
-
}> {
|
|
6918
|
-
constructor(input: unknown, message: string, options?: {
|
|
6919
|
-
code?: number;
|
|
6920
|
-
context?: Record<string, unknown>;
|
|
6921
|
-
cause?: unknown;
|
|
6922
|
-
});
|
|
6923
|
-
}
|
|
6924
7376
|
/**
|
|
6925
|
-
*
|
|
7377
|
+
* RPC endpoint configuration for a chain.
|
|
7378
|
+
*
|
|
6926
7379
|
* @since 0.0.1
|
|
6927
7380
|
*/
|
|
6928
|
-
interface
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
readonly abi: TAbi;
|
|
6933
|
-
/** Read-only contract methods (view/pure functions) */
|
|
6934
|
-
readonly read: ContractReadMethods<TAbi>;
|
|
6935
|
-
/** State-changing contract methods */
|
|
6936
|
-
readonly write: ContractWriteMethods<TAbi>;
|
|
6937
|
-
/** Simulate state-changing methods without sending transactions */
|
|
6938
|
-
readonly simulate: ContractSimulateMethods<TAbi>;
|
|
6939
|
-
/** Query contract events */
|
|
6940
|
-
readonly getEvents: <E extends ExtractEventNames<TAbi>>(eventName: E, filter?: EventFilter) => Effect.Effect<DecodedEvent[], ContractEventError, ProviderService>;
|
|
7381
|
+
interface RpcUrlsConfig {
|
|
7382
|
+
readonly default: {
|
|
7383
|
+
readonly http: readonly string[];
|
|
7384
|
+
};
|
|
6941
7385
|
}
|
|
6942
|
-
type ExtractViewFunctions<TAbi extends Abi> = Extract<TAbi[number], {
|
|
6943
|
-
type: "function";
|
|
6944
|
-
stateMutability: "view" | "pure";
|
|
6945
|
-
}>;
|
|
6946
|
-
type ExtractWriteFunctions<TAbi extends Abi> = Extract<TAbi[number], {
|
|
6947
|
-
type: "function";
|
|
6948
|
-
stateMutability: "nonpayable" | "payable";
|
|
6949
|
-
}>;
|
|
6950
7386
|
/**
|
|
6951
|
-
*
|
|
7387
|
+
* RPC URLs keyed by chain ID.
|
|
7388
|
+
*
|
|
6952
7389
|
* @since 0.0.1
|
|
6953
7390
|
*/
|
|
6954
|
-
|
|
6955
|
-
/** Value in wei to send with the transaction */
|
|
6956
|
-
readonly value?: bigint;
|
|
6957
|
-
/** Gas limit for the transaction */
|
|
6958
|
-
readonly gas?: bigint;
|
|
6959
|
-
/** Gas price for legacy transactions */
|
|
6960
|
-
readonly gasPrice?: bigint;
|
|
6961
|
-
/** Max fee per gas for EIP-1559 transactions */
|
|
6962
|
-
readonly maxFeePerGas?: bigint;
|
|
6963
|
-
/** Max priority fee for EIP-1559 transactions */
|
|
6964
|
-
readonly maxPriorityFeePerGas?: bigint;
|
|
6965
|
-
/** Transaction nonce */
|
|
6966
|
-
readonly nonce?: bigint;
|
|
6967
|
-
}
|
|
6968
|
-
type ExtractEvents<TAbi extends Abi> = Extract<TAbi[number], {
|
|
6969
|
-
type: "event";
|
|
6970
|
-
}>;
|
|
6971
|
-
type ExtractEventNames<TAbi extends Abi> = ExtractEvents<TAbi> extends {
|
|
6972
|
-
name: infer N;
|
|
6973
|
-
} ? N extends string ? N : never : never;
|
|
6974
|
-
type AbiInputsToArgs<TInputs extends readonly {
|
|
6975
|
-
type: string;
|
|
6976
|
-
name?: string;
|
|
6977
|
-
}[]> = {
|
|
6978
|
-
[K in keyof TInputs]: AbiTypeToTs<TInputs[K]["type"]>;
|
|
6979
|
-
};
|
|
6980
|
-
type AbiTypeToTs<T extends string> = T extends `uint${string}` ? bigint : T extends `int${string}` ? bigint : T extends "address" ? AddressType$2 : T extends "bool" ? boolean : T extends "string" ? string : T extends `bytes${string}` ? HexType : T extends "bytes" ? HexType : T extends `${string}[]` ? readonly unknown[] : T extends `tuple` ? Record<string, unknown> : unknown;
|
|
6981
|
-
type AbiOutputToTs<TOutputs extends readonly {
|
|
6982
|
-
type: string;
|
|
6983
|
-
}[]> = TOutputs extends readonly [{
|
|
6984
|
-
type: infer T;
|
|
6985
|
-
}] ? T extends string ? AbiTypeToTs<T> : unknown : TOutputs extends readonly [] ? undefined : Record<string, unknown>;
|
|
6986
|
-
type ContractReadMethods<TAbi extends Abi> = {
|
|
6987
|
-
[F in ExtractViewFunctions<TAbi> as F["name"] extends string ? F["name"] : never]: (...args: F extends {
|
|
6988
|
-
inputs: infer I;
|
|
6989
|
-
} ? I extends readonly {
|
|
6990
|
-
type: string;
|
|
6991
|
-
}[] ? AbiInputsToArgs<I> : [] : []) => Effect.Effect<F extends {
|
|
6992
|
-
outputs: infer O;
|
|
6993
|
-
} ? O extends readonly {
|
|
6994
|
-
type: string;
|
|
6995
|
-
}[] ? AbiOutputToTs<O> : unknown : unknown, ContractCallError, ProviderService>;
|
|
6996
|
-
};
|
|
6997
|
-
type WriteMethodArgs$1<TInputs> = TInputs extends readonly {
|
|
6998
|
-
type: string;
|
|
6999
|
-
}[] ? AbiInputsToArgs<TInputs> extends readonly [] ? [options?: WriteOptions] : [...args: AbiInputsToArgs<TInputs>, options?: WriteOptions] : [options?: WriteOptions];
|
|
7000
|
-
type ContractWriteMethods<TAbi extends Abi> = {
|
|
7001
|
-
[F in ExtractWriteFunctions<TAbi> as F["name"] extends string ? F["name"] : never]: (...args: WriteMethodArgs$1<F extends {
|
|
7002
|
-
inputs: infer I;
|
|
7003
|
-
} ? I : []>) => Effect.Effect<HashType, ContractWriteError, SignerService>;
|
|
7004
|
-
};
|
|
7005
|
-
type ContractSimulateMethods<TAbi extends Abi> = {
|
|
7006
|
-
[F in ExtractWriteFunctions<TAbi> as F["name"] extends string ? F["name"] : never]: (...args: F extends {
|
|
7007
|
-
inputs: infer I;
|
|
7008
|
-
} ? I extends readonly {
|
|
7009
|
-
type: string;
|
|
7010
|
-
}[] ? AbiInputsToArgs<I> : [] : []) => Effect.Effect<F extends {
|
|
7011
|
-
outputs: infer O;
|
|
7012
|
-
} ? O extends readonly {
|
|
7013
|
-
type: string;
|
|
7014
|
-
}[] ? AbiOutputToTs<O> : unknown : unknown, ContractCallError, ProviderService>;
|
|
7015
|
-
};
|
|
7391
|
+
declare const rpcUrlsByChainId: Readonly<Record<number, RpcUrlsConfig>>;
|
|
7016
7392
|
|
|
7017
7393
|
/**
|
|
7018
7394
|
* @fileoverview Contract gas estimation helper.
|
|
@@ -9575,4 +9951,4 @@ declare const makeRpcResolver: (transport: {
|
|
|
9575
9951
|
*/
|
|
9576
9952
|
declare const RpcBatch: Layer.Layer<RpcBatchService, never, TransportService>;
|
|
9577
9953
|
|
|
9578
|
-
export { type Abi$2 as Abi, AbiDecodeError, AbiEncodeError, AbiEncoderService, type AbiEncoderShape, type AccessListInput, type AccessListType, AccountError, AccountService, type AccountShape, type AccountStateOverride, type AddressInput$2 as AddressInput, ArbitrumFormatter, ArbitrumProvider, type AssetChange, type BackfillBlocksError, BalanceResolver, BaseProvider, type Block, type BlockExplorerConfig, BlockExplorerService, type BlockOverrides, BlockStream, BlockStreamError, BlockStreamService, type BlockStreamShape, type BlockTag$1 as BlockTag, type BlockType, BlockchainError, type HexInput as BlockchainHexInput, BlockchainService, type BlockchainShape, BrowserProvider, BrowserTransport, CacheService, type CacheShape, type CallError, type CallRequest, CcipError, type CcipRequest, CcipService, type CcipShape, type ChainConfig
|
|
9954
|
+
export { type Abi$2 as Abi, AbiDecodeError, AbiEncodeError, AbiEncoderService, type AbiEncoderShape, type AbiResolution, type AccessListInput, type AccessListType, AccountError, AccountService, type AccountShape, type AccountStateOverride, type AddressInput$2 as AddressInput, ArbitrumFormatter, ArbitrumProvider, type AssetChange, type BackfillBlocksError, BalanceResolver, BaseProvider, type Block, BlockExplorerApi, type BlockExplorerApiConfig, type BlockExplorerApiError, BlockExplorerApiService, type BlockExplorerApiShape, type BlockExplorerConfig, BlockExplorerConfigError, BlockExplorerDecodeError, BlockExplorerNotFoundError, BlockExplorerProxyResolutionError, BlockExplorerRateLimitError, BlockExplorerResponseError, BlockExplorerService, BlockExplorerUnexpectedError, type BlockOverrides, BlockStream, BlockStreamError, BlockStreamService, type BlockStreamShape, type BlockTag$1 as BlockTag, type BlockType, BlockchainError, type HexInput as BlockchainHexInput, BlockchainService, type BlockchainShape, BrowserProvider, BrowserTransport, CacheService, type CacheShape, type CallError, type CallRequest, CcipError, type CcipRequest, CcipService, type CcipShape, type ChainConfig, type ChainContract, ChainService, type ComposedServices, Contract, type Abi as ContractAbi, type AbiItem$1 as ContractAbiItem, type BlockTag as ContractBlockTag, type ContractCall, ContractCallError, type ContractDef, ContractError, ContractEventError, type ContractFactory, type ContractInstance, type ContractRegistryBase, type ContractRegistryConfig, ContractRegistryService, type ContractRegistryShape, type ContractSourceFile, ContractWriteError, type ContractsConfig, ContractsService, type CreateAccessListError, type CreateAccessListResult, type CreateBlockFilterError, type CreateEventFilterError, type CreatePendingTransactionFilterError, CustomTransport, type CustomTransportConfig, CustomTransportFromFn, Debug, DebugService, type DebugShape, type DebugTraceConfig, type DecodedEvent, DefaultAbiEncoder, DefaultCcip, DefaultEns, DefaultFeeEstimator, DefaultFormatter, DefaultKzg, DefaultNonceManager, DefaultRateLimiter, DefaultTransactionSerializer, DeserializeError, type EIP1193Provider, ENS_REGISTRY_ADDRESS, ENS_UNIVERSAL_RESOLVER_ADDRESS, EngineApi, EngineApiService, type EngineApiShape, EnsError, EnsService, type EnsShape, type EstimateGasError, EthBlockNumber, EthCall, EthChainId, EthEstimateGas, EthGasPrice, EthGetBalance, EthGetBlockByHash, EthGetBlockByNumber, EthGetCode, EthGetLogs, EthGetStorageAt, EthGetTransactionByHash, EthGetTransactionCount, EthGetTransactionReceipt, type EventFilter, type AbiItem as ExplorerAbiItem, type ExplorerContractInstance, type ExplorerSourceId, FeeEstimationError, FeeEstimatorService, type FeeEstimatorShape, type FeeHistoryType, type FeeValues, type FeeValuesEIP1559, type FeeValuesLegacy, type FilterChanges, type FilterId, ForkBlockchain, type ForkBlockchainOptions, FormatError, FormatterService, type FormatterShape, GenericRpcRequest, type GetAbiOptions, type GetAccountsError, GetBalance, type GetBalanceError, type GetBlobBaseFeeError, type GetBlockArgs, type GetBlockError, type GetBlockNumberError, type GetBlockReceiptsArgs, type GetBlockReceiptsError, type GetBlockTransactionCountArgs, type GetBlockTransactionCountError, type GetChainIdError, type GetCodeError, type GetCoinbaseError, type GetContractOptions, type GetEnsAddressParams, type GetEnsAvatarParams, type GetEnsNameParams, type GetEnsResolverParams, type GetEnsTextParams, type GetFeeHistoryError, type GetFilterChangesError, type GetFilterLogsError, type GetGasPriceError, type GetHashrateError, type GetLogsError, type GetMaxPriorityFeePerGasError, type GetMiningError, type GetProofError, type GetProtocolVersionError, type GetSourcesOptions, type GetStorageAtError, type GetSyncingError, type GetTransactionByBlockHashAndIndexError, type GetTransactionByBlockNumberAndIndexError, type GetTransactionConfirmationsError, type GetTransactionCountError, type GetTransactionError, type GetTransactionReceiptError, type GetUncleArgs, type GetUncleCountArgs, type GetUncleCountError, type GetUncleError, type GetWorkError, type HashInput, HttpProvider, HttpProviderFetch, HttpTransport, IdGenerator, IdGeneratorLive, type IdGeneratorShape, InMemoryBlockchain, type InferContractRegistry, IpcProvider, JsonRpcAccount, KzgError, KzgService, type KzgShape, LocalAccount, type LogFilter, type LogType, MULTICALL3_ADDRESS, MainnetFullProvider, MainnetProvider, MemoryCache, type MemoryCacheOptions, type MulticallCall, MulticallError, type MulticallParams, type MulticallResult, type MulticallResults, type NetVersionError, NonceError, NonceManagerService, type NonceManagerShape, NoopCache, NoopCcip, NoopKzg, NoopRateLimiter, OptimismFormatter, OptimismProvider, PolygonProvider, type ProofType, Provider, ProviderConfirmationsPendingError, type ProviderError, ProviderNotFoundError, ProviderReceiptPendingError, ProviderResponseError, ProviderService, type ProviderStepConfig, ProviderStreamError, ProviderTimeoutError, ProviderValidationError, type ProxyInfo, type RateLimitBehavior, RateLimitError, RateLimitedTransport, type RateLimiterConfig, RateLimiterService, type RateLimiterShape, RawProviderService, type RawProviderShape, RawProviderTransport, type RequestArguments as RawRequestArguments, type ReadContractError, type ReadContractParams, type ReceiptType, type ResolvedExplorerContract, RpcBatch, RpcBatchService, type RpcBatchShape, type RpcRequest, type RpcTransactionRequest$1 as RpcTransactionRequest, type RpcUrlsConfig, type SendRawTransactionError, type SendTransactionError, SepoliaProvider, SerializeError, type SignError, type SignTransactionError, Signer, SignerError, SignerService, type SignerShape, type SimulateCallsError, type SimulateCallsParams, type SimulateContractError, type SimulateContractParams, type SimulateContractResult, type SimulateV1BlockCall, type SimulateV1BlockResult, type SimulateV1CallResult, type SimulateV1Error, type SimulateV1Payload, type SimulateV1Result, type SimulateV2Error, type SimulateV2Payload, type SimulateV2Result, type SimulationResult, type StateOverride, type StorageProofType, type SubmitHashrateError, type SubmitWorkError, type SubscribeError, type SyncingStatus, TestProvider, TestTransport, type TransactionIndexInput, type TransactionRequest, TransactionSerializerService, TransactionStream, TransactionStreamError, TransactionStreamService, type TransactionStreamShape, type TransactionType, TransportError, TransportService, type TransportShape, type UncleBlockType, type UninstallFilterError, type UnsignedTransaction, type UnsubscribeError, type WaitForTransactionReceiptArgs, type WaitForTransactionReceiptError, type WaitForTransactionReceiptOptions, type WatchBlocksError, WebSocketProvider, type WebSocketProviderConfig, WebSocketProviderGlobal, WebSocketTransport, type WithdrawalType, ZkSyncFormatter, aggregate3, arbitrum, arbitrumBlockExplorers, arbitrumConfig, arbitrumContracts, backfillBlocks, base, baseBlockExplorers, baseConfig, baseContracts, bytesToHex, cacheEnabledRef, call, createAccessList, createBlockFilter, createEventFilter, createPendingTransactionFilter, createProvider, estimateGas$1 as estimateGas, formatAccessList, formatCallRequest, formatLogFilterParams, formatTransactionRequest, getAccounts, getBalance, getBlobBaseFee, getBlock, getBlockNumber, getBlockReceipts, getBlockTransactionCount, getChainId, getCode, getCoinbase, getEnsAddress, getEnsAvatar, getEnsName, getEnsResolver, getEnsText, getFeeHistory, getFilterChanges, getFilterLogs, getGasPrice, getHashrate, getLogs, getMaxPriorityFeePerGas, getMining, getProof, getProtocolVersion, getStorageAt, getSyncing, getTransaction, getTransactionByBlockHashAndIndex, getTransactionByBlockNumberAndIndex, getTransactionConfirmations, getTransactionCount, getTransactionReceipt, getUncle, getUncleCount, mainnet, mainnetBlockExplorers, mainnetConfig, mainnetContracts, makeBlockStream, makeContractRegistry, makeFeeEstimator, makeIdGenerator, makeProviderPlan, makeRateLimiter, makeResilientProviderPlan, makeRpcResolver, makeTransactionStream, multicall, netVersion, nextId, optimism, optimismBlockExplorers, optimismConfig, optimismContracts, parseHexToBigInt, polygon, polygonBlockExplorers, polygonConfig, polygonContracts, readContract, retryScheduleRef, rpcUrlsByChainId, sendRawTransaction, sendTransaction, sepolia, sepoliaBlockExplorers, sepoliaConfig, sepoliaContracts, sign, signTransaction, simulateCalls, simulateContract, simulateV1, simulateV2, subscribe, timeoutRef, toAddressHex, toHashHex, tracingRef, uninstallFilter, unsubscribe, waitForTransactionReceipt, watchBlocks, withRetrySchedule, withTimeout, withTracing, withoutCache };
|