@effect-blockchain/evm 0.2.0 → 0.3.0
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/EvmFeeHistory.d.ts +26 -0
- package/dist/EvmFeeHistory.d.ts.map +1 -0
- package/dist/EvmFeeHistory.js +25 -0
- package/dist/EvmFeeHistory.js.map +1 -0
- package/dist/EvmIndexer.d.ts +45 -1
- package/dist/EvmIndexer.d.ts.map +1 -1
- package/dist/EvmIndexer.js +91 -26
- package/dist/EvmIndexer.js.map +1 -1
- package/dist/EvmRelayer.d.ts +200 -0
- package/dist/EvmRelayer.d.ts.map +1 -0
- package/dist/EvmRelayer.js +281 -0
- package/dist/EvmRelayer.js.map +1 -0
- package/dist/EvmRpc.d.ts +87 -3
- package/dist/EvmRpc.d.ts.map +1 -1
- package/dist/EvmRpc.js +29 -4
- package/dist/EvmRpc.js.map +1 -1
- package/dist/EvmSigner.d.ts +78 -0
- package/dist/EvmSigner.d.ts.map +1 -0
- package/dist/EvmSigner.js +98 -0
- package/dist/EvmSigner.js.map +1 -0
- package/dist/EvmTransaction.d.ts +65 -0
- package/dist/EvmTransaction.d.ts.map +1 -0
- package/dist/EvmTransaction.js +60 -0
- package/dist/EvmTransaction.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/confirmations.d.ts +2 -0
- package/dist/internal/confirmations.d.ts.map +1 -0
- package/dist/internal/confirmations.js +13 -0
- package/dist/internal/confirmations.js.map +1 -0
- package/dist/internal/rpcMethods.js +53 -0
- package/dist/internal/rpcMethods.js.map +1 -1
- package/package.json +1 -1
- package/src/EvmFeeHistory.ts +28 -0
- package/src/EvmIndexer.ts +136 -33
- package/src/EvmRelayer.ts +361 -0
- package/src/EvmRpc.ts +105 -4
- package/src/EvmSigner.ts +128 -0
- package/src/EvmTransaction.ts +64 -0
- package/src/index.ts +20 -0
- package/src/internal/confirmations.ts +17 -0
- package/src/internal/rpcMethods.ts +63 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signers of EVM transactions: a local private key, or a custody API that only signs a hash.
|
|
3
|
+
*
|
|
4
|
+
* A signer is a value and receives the whole transaction, never a hash chosen by its caller: signing an opaque hash
|
|
5
|
+
* hides what is being authorised, and custody policy engines and hardware wallets refuse it. Only EIP-1559
|
|
6
|
+
* transactions calling an address are signed.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.3.0
|
|
9
|
+
*/
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Redacted from "effect/Redacted";
|
|
12
|
+
import * as Schema from "effect/Schema";
|
|
13
|
+
import { isHex, keccak256, parseSignature, recoverTransactionAddress, serializeTransaction } from "viem";
|
|
14
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
15
|
+
import { EvmAddress } from "./EvmAddress.js";
|
|
16
|
+
import { EvmHexData } from "./EvmHexData.js";
|
|
17
|
+
/**
|
|
18
|
+
* A signature could not be produced: `cause` is the signer's own failure, or why its signature was refused. It never
|
|
19
|
+
* holds a private key.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.3.0
|
|
22
|
+
* @category errors
|
|
23
|
+
*/
|
|
24
|
+
export class EvmSignerError extends /*#__PURE__*/Schema.TaggedError()("EvmSignerError", {
|
|
25
|
+
cause: /*#__PURE__*/Schema.Defect()
|
|
26
|
+
}) {}
|
|
27
|
+
const toError = cause => new EvmSignerError({
|
|
28
|
+
cause
|
|
29
|
+
});
|
|
30
|
+
const serializable = transaction => ({
|
|
31
|
+
type: "eip1559",
|
|
32
|
+
chainId: transaction.chainId,
|
|
33
|
+
nonce: Number(transaction.nonce),
|
|
34
|
+
to: transaction.to,
|
|
35
|
+
value: transaction.value ?? BigInt(0),
|
|
36
|
+
data: transaction.data ?? "0x",
|
|
37
|
+
gas: transaction.gas,
|
|
38
|
+
maxFeePerGas: transaction.maxFeePerGas,
|
|
39
|
+
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* A signer holding a secp256k1 private key (32 bytes, 0x-prefixed hex) in memory. An invalid key fails with an
|
|
43
|
+
* {@link EvmSignerError} that does not repeat it.
|
|
44
|
+
*
|
|
45
|
+
* @since 0.3.0
|
|
46
|
+
* @category constructors
|
|
47
|
+
*/
|
|
48
|
+
export const fromPrivateKey = key => Effect.try({
|
|
49
|
+
try: () => {
|
|
50
|
+
const value = Redacted.value(key);
|
|
51
|
+
if (!isHex(value)) throw new Error("not hex");
|
|
52
|
+
return privateKeyToAccount(value);
|
|
53
|
+
},
|
|
54
|
+
// the thrown error can quote the key
|
|
55
|
+
catch: () => new EvmSignerError({
|
|
56
|
+
cause: new Error("invalid private key")
|
|
57
|
+
})
|
|
58
|
+
}).pipe(Effect.map(account => ({
|
|
59
|
+
address: Schema.decodeSync(EvmAddress)(account.address),
|
|
60
|
+
signTransaction: transaction => Effect.tryPromise({
|
|
61
|
+
try: () => account.signTransaction(serializable(transaction)),
|
|
62
|
+
catch: toError
|
|
63
|
+
}).pipe(Effect.map(signed => EvmHexData.make(signed)))
|
|
64
|
+
})));
|
|
65
|
+
/**
|
|
66
|
+
* A signer for a key held elsewhere (a custody API, an HSM) that only signs a 32-byte hash. `signHash` receives the
|
|
67
|
+
* keccak256 of the unsigned EIP-1559 serialization and returns the 65-byte signature `r || s || v`, `v` being 0, 1, 27
|
|
68
|
+
* or 28. A failure of `signHash`, a malformed signature or one that does not recover to `address` fails with an
|
|
69
|
+
* {@link EvmSignerError}.
|
|
70
|
+
*
|
|
71
|
+
* @since 0.3.0
|
|
72
|
+
* @category constructors
|
|
73
|
+
*/
|
|
74
|
+
export const fromHashSigner = options => ({
|
|
75
|
+
address: options.address,
|
|
76
|
+
signTransaction: Effect.fnUntraced(function* (transaction) {
|
|
77
|
+
const unsigned = serializable(transaction);
|
|
78
|
+
const hash = yield* Effect.try({
|
|
79
|
+
try: () => keccak256(serializeTransaction(unsigned)),
|
|
80
|
+
catch: toError
|
|
81
|
+
});
|
|
82
|
+
const signature = yield* Effect.mapError(options.signHash(EvmHexData.make(hash)), toError);
|
|
83
|
+
return yield* Effect.tryPromise({
|
|
84
|
+
try: async () => {
|
|
85
|
+
const signed = serializeTransaction(unsigned, parseSignature(signature));
|
|
86
|
+
const signer = await recoverTransactionAddress({
|
|
87
|
+
serializedTransaction: signed
|
|
88
|
+
});
|
|
89
|
+
if (signer.toLowerCase() !== options.address) {
|
|
90
|
+
throw new Error(`signed by ${signer}, expected ${options.address}`);
|
|
91
|
+
}
|
|
92
|
+
return EvmHexData.make(signed);
|
|
93
|
+
},
|
|
94
|
+
catch: toError
|
|
95
|
+
});
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=EvmSigner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EvmSigner.js","names":[],"sources":["../src/EvmSigner.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;AASA,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,SAAS,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,yBAAyB,EAAE,oBAAoB,QAAQ,MAAM;AACxG,SAAS,mBAAmB,QAAQ,eAAe;AACnD,SAAS,UAAU,QAAQ,iBAAiB;AAC5C,SAAS,UAAU,QAAQ,iBAAiB;AAG5C;;;;;;;AAOA,OAAM,MAAO,cAAe,sBAAQ,MAAM,CAAC,WAAW,EAAkB,CAAC,gBAAgB,EAAE;EACzF,KAAK,eAAE,MAAM,CAAC,MAAM;CACrB,CAAC;AAgCF,MAAM,OAAO,GAAI,KAAc,IAAK,IAAI,cAAc,CAAC;EAAE;AAAK,CAAE,CAAC;AAEjE,MAAM,YAAY,GAAI,WAAmC,KAAM;EAC7D,IAAI,EA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AASA,OAAO,MAAM,cAAc,GAAO,OAGjC,KAAiB;EAChB,OAAO,EAAE,OAAO,CAAC,OAAO;EACxB,eAAe,EAAE,MAAM,CAAC,UAAU,CAAC,WAAU,WAAW;IACtD,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,CAAC;IAC1C,MAAM,IAAI,GAAG,OAAO,MAAM,CAAC,GAAG,CAAC;MAAE,GAAG,EAAE,MAAM,SAAS,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;MAAE,KAAK,EAAE;IAAO,CAAE,CAAC;IACxG,MAAM,SAAS,GAAG,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC;IAC1F,OAAO,OAAO,MAAM,CAAC,UAAU,CAAC;MAC9B,GAAG,EAAE,YAAW;QACd,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAAC;UAAE,qBAAqB,EAAE;QAAM,CAAE,CAAC;QACjF,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,OAAO,EAAE;UAC5C,MAAM,IAAI,KAAK,CAAC,aAAa,MAAM,cAAc,OAAO,CAAC,OAAO,EAAE,CAAC;QACrE;QACA,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;MAChC,CAAC;MACD,KAAK,EAAE;KACR,CAAC;EACJ,CAAC;CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EVM transactions and their receipts, as returned by `eth_getTransactionByHash` and `eth_getTransactionReceipt`.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
/**
|
|
8
|
+
* A transaction known to a node, decoded from the raw JSON-RPC transaction. `blockNumber`, `blockHash` and
|
|
9
|
+
* `transactionIndex` are `null` while it is pending, `to` is `null` for a contract creation. Every other field (the
|
|
10
|
+
* fee fields, which depend on the transaction type, and the signature) is ignored.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.3.0
|
|
13
|
+
* @category schemas
|
|
14
|
+
*/
|
|
15
|
+
export declare const EvmTransaction: Schema.Struct<{
|
|
16
|
+
readonly hash: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmTransactionHash">;
|
|
17
|
+
readonly from: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmAddress">;
|
|
18
|
+
readonly to: Schema.NullOr<Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmAddress">>;
|
|
19
|
+
readonly nonce: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
|
|
20
|
+
readonly value: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
|
|
21
|
+
readonly input: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmHexData">;
|
|
22
|
+
readonly gas: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
|
|
23
|
+
readonly blockNumber: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.String, never, never>>;
|
|
24
|
+
readonly blockHash: Schema.NullOr<Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmHexData">>;
|
|
25
|
+
readonly transactionIndex: Schema.NullOr<Schema.decodeTo<Schema.Int, Schema.String, never, never>>;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* @since 0.3.0
|
|
29
|
+
* @category models
|
|
30
|
+
*/
|
|
31
|
+
export type EvmTransaction = typeof EvmTransaction.Type;
|
|
32
|
+
/**
|
|
33
|
+
* The receipt of a transaction included in a block. `status` is 1 for a success and 0 for a revert, and
|
|
34
|
+
* `effectiveGasPrice` is in wei per gas. A receipt older than the Byzantium fork has no `status` and does not decode.
|
|
35
|
+
*
|
|
36
|
+
* @since 0.3.0
|
|
37
|
+
* @category schemas
|
|
38
|
+
*/
|
|
39
|
+
export declare const EvmTransactionReceipt: Schema.Struct<{
|
|
40
|
+
readonly transactionHash: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmTransactionHash">;
|
|
41
|
+
readonly transactionIndex: Schema.decodeTo<Schema.Int, Schema.String, never, never>;
|
|
42
|
+
readonly blockNumber: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
|
|
43
|
+
readonly blockHash: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmHexData">;
|
|
44
|
+
readonly from: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmAddress">;
|
|
45
|
+
readonly to: Schema.NullOr<Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmAddress">>;
|
|
46
|
+
readonly status: Schema.decodeTo<Schema.Int, Schema.String, never, never>;
|
|
47
|
+
readonly gasUsed: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
|
|
48
|
+
readonly effectiveGasPrice: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
|
|
49
|
+
readonly logs: Schema.$Array<Schema.Struct<{
|
|
50
|
+
readonly address: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmAddress">;
|
|
51
|
+
readonly topics: Schema.$Array<Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmHexData">>;
|
|
52
|
+
readonly data: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmHexData">;
|
|
53
|
+
readonly blockNumber: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
|
|
54
|
+
readonly blockHash: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmHexData">;
|
|
55
|
+
readonly transactionHash: Schema.brand<Schema.refine<`0x${string}`, Schema.decodeTo<Schema.String, Schema.String, never, never>>, "EvmTransactionHash">;
|
|
56
|
+
readonly transactionIndex: Schema.decodeTo<Schema.Int, Schema.String, never, never>;
|
|
57
|
+
readonly logIndex: Schema.decodeTo<Schema.Int, Schema.String, never, never>;
|
|
58
|
+
}>>;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* @since 0.3.0
|
|
62
|
+
* @category models
|
|
63
|
+
*/
|
|
64
|
+
export type EvmTransactionReceipt = typeof EvmTransactionReceipt.Type;
|
|
65
|
+
//# sourceMappingURL=EvmTransaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EvmTransaction.d.ts","sourceRoot":"","sources":["../src/EvmTransaction.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAOvC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;EAW4C,CAAA;AAEvE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;EAWoD,CAAA;AAEtF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EVM transactions and their receipts, as returned by `eth_getTransactionByHash` and `eth_getTransactionReceipt`.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import { EvmAddress } from "./EvmAddress.js";
|
|
8
|
+
import { EvmHexData } from "./EvmHexData.js";
|
|
9
|
+
import { EvmLog } from "./EvmLog.js";
|
|
10
|
+
import { EvmTransactionHash } from "./EvmTransactionHash.js";
|
|
11
|
+
import { IntFromHex, QuantityFromHex } from "./internal/QuantityFromHex.js";
|
|
12
|
+
/**
|
|
13
|
+
* A transaction known to a node, decoded from the raw JSON-RPC transaction. `blockNumber`, `blockHash` and
|
|
14
|
+
* `transactionIndex` are `null` while it is pending, `to` is `null` for a contract creation. Every other field (the
|
|
15
|
+
* fee fields, which depend on the transaction type, and the signature) is ignored.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.3.0
|
|
18
|
+
* @category schemas
|
|
19
|
+
*/
|
|
20
|
+
export const EvmTransaction = /*#__PURE__*/Schema.Struct({
|
|
21
|
+
hash: EvmTransactionHash,
|
|
22
|
+
from: EvmAddress,
|
|
23
|
+
to: Schema.NullOr(EvmAddress),
|
|
24
|
+
nonce: QuantityFromHex,
|
|
25
|
+
value: QuantityFromHex,
|
|
26
|
+
input: EvmHexData,
|
|
27
|
+
gas: QuantityFromHex,
|
|
28
|
+
blockNumber: Schema.NullOr(QuantityFromHex),
|
|
29
|
+
blockHash: Schema.NullOr(EvmHexData),
|
|
30
|
+
transactionIndex: Schema.NullOr(IntFromHex)
|
|
31
|
+
}).annotate({
|
|
32
|
+
identifier: "EvmTransaction",
|
|
33
|
+
title: "EVM transaction"
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* The receipt of a transaction included in a block. `status` is 1 for a success and 0 for a revert, and
|
|
37
|
+
* `effectiveGasPrice` is in wei per gas. A receipt older than the Byzantium fork has no `status` and does not decode.
|
|
38
|
+
*
|
|
39
|
+
* @since 0.3.0
|
|
40
|
+
* @category schemas
|
|
41
|
+
*/
|
|
42
|
+
export const EvmTransactionReceipt = /*#__PURE__*/Schema.Struct({
|
|
43
|
+
transactionHash: EvmTransactionHash,
|
|
44
|
+
transactionIndex: IntFromHex,
|
|
45
|
+
blockNumber: QuantityFromHex,
|
|
46
|
+
blockHash: EvmHexData,
|
|
47
|
+
from: EvmAddress,
|
|
48
|
+
to: Schema.NullOr(EvmAddress),
|
|
49
|
+
status: IntFromHex.check(Schema.isBetween({
|
|
50
|
+
minimum: 0,
|
|
51
|
+
maximum: 1
|
|
52
|
+
})),
|
|
53
|
+
gasUsed: QuantityFromHex,
|
|
54
|
+
effectiveGasPrice: QuantityFromHex,
|
|
55
|
+
logs: Schema.Array(EvmLog)
|
|
56
|
+
}).annotate({
|
|
57
|
+
identifier: "EvmTransactionReceipt",
|
|
58
|
+
title: "EVM transaction receipt"
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=EvmTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EvmTransaction.js","names":[],"sources":["../src/EvmTransaction.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,SAAS,UAAU,QAAQ,iBAAiB;AAC5C,SAAS,UAAU,QAAQ,iBAAiB;AAC5C,SAAS,MAAM,QAAQ,aAAa;AACpC,SAAS,kBAAkB,QAAQ,yBAAyB;AAC5D,SAAS,UAAU,EAAE,eAAe,QAAQ,+BAA+B;AAE3E;;;;;;;;AAQA,OAAO,MAAM,cAAc,gBAAG,MAAM,CAAC,MAAM,CAAC;EAC1C,IAAI,EAAE,kBAAkB;EACxB,IAAI,EAAE,UAAU;EAChB,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;EAC7B,KAAK,EAAE,eAAe;EACtB,KAAK,EAAE,eAAe;EACtB,KAAK,EAAE,UAAU;EACjB,GAAG,EAAE,eAAe;EACpB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;EAC3C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;EACpC,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;CAC3C,CAAC,CAAC,QAAQ,CAAC;EAAE,UAAU,EAAE,gBAAgB;EAAE,KAAK,EAAE;AAAiB,CAAE,CAAC;AAQvE;;;;;;;AAOA,OAAO,MAAM,qBAAqB,gBAAG,MAAM,CAAC,MAAM,CAAC;EACjD,eAAe,EAAE,kBAAkB;EACnC,gBAAgB,EAAE,UAAU;EAC5B,WAAW,EAAE,eAAe;EAC5B,SAAS,EAAE,UAAU;EACrB,IAAI,EAAE,UAAU;EAChB,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;EAC7B,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;IAAE,OAAO,EAAE,CAAC;IAAE,OAAO,EAAE;EAAC,CAAE,CAAC,CAAC;EACtE,OAAO,EAAE,eAAe;EACxB,iBAAiB,EAAE,eAAe;EAClC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;CAC1B,CAAC,CAAC,QAAQ,CAAC;EAAE,UAAU,EAAE,uBAAuB;EAAE,KAAK,EAAE;AAAyB,CAAE,CAAC","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export * as EvmAddress from "./EvmAddress.ts";
|
|
|
9
9
|
* @since 0.1.0
|
|
10
10
|
*/
|
|
11
11
|
export * as EvmBlock from "./EvmBlock.ts";
|
|
12
|
+
/**
|
|
13
|
+
* @since 0.3.0
|
|
14
|
+
*/
|
|
15
|
+
export * as EvmFeeHistory from "./EvmFeeHistory.ts";
|
|
12
16
|
/**
|
|
13
17
|
* @since 0.1.0
|
|
14
18
|
*/
|
|
@@ -25,10 +29,22 @@ export * as EvmLog from "./EvmLog.ts";
|
|
|
25
29
|
* @since 0.1.0
|
|
26
30
|
*/
|
|
27
31
|
export * as EvmNetwork from "./EvmNetwork.ts";
|
|
32
|
+
/**
|
|
33
|
+
* @since 0.3.0
|
|
34
|
+
*/
|
|
35
|
+
export * as EvmRelayer from "./EvmRelayer.ts";
|
|
28
36
|
/**
|
|
29
37
|
* @since 0.1.0
|
|
30
38
|
*/
|
|
31
39
|
export * as EvmRpc from "./EvmRpc.ts";
|
|
40
|
+
/**
|
|
41
|
+
* @since 0.3.0
|
|
42
|
+
*/
|
|
43
|
+
export * as EvmSigner from "./EvmSigner.ts";
|
|
44
|
+
/**
|
|
45
|
+
* @since 0.3.0
|
|
46
|
+
*/
|
|
47
|
+
export * as EvmTransaction from "./EvmTransaction.ts";
|
|
32
48
|
/**
|
|
33
49
|
* @since 0.1.0
|
|
34
50
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;GAEG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;GAEG;AACH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;GAEG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;GAEG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,10 @@ export * as EvmAddress from "./EvmAddress.js";
|
|
|
10
10
|
* @since 0.1.0
|
|
11
11
|
*/
|
|
12
12
|
export * as EvmBlock from "./EvmBlock.js";
|
|
13
|
+
/**
|
|
14
|
+
* @since 0.3.0
|
|
15
|
+
*/
|
|
16
|
+
export * as EvmFeeHistory from "./EvmFeeHistory.js";
|
|
13
17
|
/**
|
|
14
18
|
* @since 0.1.0
|
|
15
19
|
*/
|
|
@@ -26,10 +30,22 @@ export * as EvmLog from "./EvmLog.js";
|
|
|
26
30
|
* @since 0.1.0
|
|
27
31
|
*/
|
|
28
32
|
export * as EvmNetwork from "./EvmNetwork.js";
|
|
33
|
+
/**
|
|
34
|
+
* @since 0.3.0
|
|
35
|
+
*/
|
|
36
|
+
export * as EvmRelayer from "./EvmRelayer.js";
|
|
29
37
|
/**
|
|
30
38
|
* @since 0.1.0
|
|
31
39
|
*/
|
|
32
40
|
export * as EvmRpc from "./EvmRpc.js";
|
|
41
|
+
/**
|
|
42
|
+
* @since 0.3.0
|
|
43
|
+
*/
|
|
44
|
+
export * as EvmSigner from "./EvmSigner.js";
|
|
45
|
+
/**
|
|
46
|
+
* @since 0.3.0
|
|
47
|
+
*/
|
|
48
|
+
export * as EvmTransaction from "./EvmTransaction.js";
|
|
33
49
|
/**
|
|
34
50
|
* @since 0.1.0
|
|
35
51
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,QAAQ,MAAM,eAAe;AAEzC;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,MAAM,MAAM,aAAa;AAErC;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,MAAM,MAAM,aAAa;AAErC;;;AAGA,OAAO,KAAK,kBAAkB,MAAM,yBAAyB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,QAAQ,MAAM,eAAe;AAEzC;;;AAGA,OAAO,KAAK,aAAa,MAAM,oBAAoB;AAEnD;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,MAAM,MAAM,aAAa;AAErC;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAK,MAAM,MAAM,aAAa;AAErC;;;AAGA,OAAO,KAAK,SAAS,MAAM,gBAAgB;AAE3C;;;AAGA,OAAO,KAAK,cAAc,MAAM,qBAAqB;AAErD;;;AAGA,OAAO,KAAK,kBAAkB,MAAM,yBAAyB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmations.d.ts","sourceRoot":"","sources":["../../src/internal/confirmations.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as BigInt_ from "effect/BigInt";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as EvmNetwork from "../EvmNetwork.js";
|
|
4
|
+
/**
|
|
5
|
+
* The head block number minus `confirmations` (the network's default when unset), never below 0.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export const lastConfirmedBlock = (rpc, confirmations) => {
|
|
10
|
+
const depth = BigInt(confirmations ?? EvmNetwork.defaultConfirmations(rpc.network));
|
|
11
|
+
return Effect.map(rpc.blockNumber, head => BigInt_.max(head - depth, BigInt(0)));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=confirmations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmations.js","names":[],"sources":["../../src/internal/confirmations.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,UAAU,MAAM,kBAAkB;AAG9C;;;;;AAKA,OAAO,MAAM,kBAAkB,GAAG,CAChC,GAA6B,EAC7B,aAAiC,KACY;EAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,IAAI,UAAU,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;EACnF,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAG,IAAI,IAAK,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACpF,CAAC","ignoreList":[]}
|
|
@@ -2,12 +2,16 @@ import * as JsonRpc from "@effect-blockchain/core/JsonRpc";
|
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
import { EvmAddress } from "../EvmAddress.js";
|
|
4
4
|
import { EvmBlock } from "../EvmBlock.js";
|
|
5
|
+
import { EvmFeeHistory } from "../EvmFeeHistory.js";
|
|
5
6
|
import { EvmHexData } from "../EvmHexData.js";
|
|
6
7
|
import { EvmLog } from "../EvmLog.js";
|
|
8
|
+
import { EvmTransaction, EvmTransactionReceipt } from "../EvmTransaction.js";
|
|
9
|
+
import { EvmTransactionHash } from "../EvmTransactionHash.js";
|
|
7
10
|
import { IntFromHex, QuantityFromHex } from "./QuantityFromHex.js";
|
|
8
11
|
const make = method => method;
|
|
9
12
|
const NoParams = /*#__PURE__*/Schema.Tuple([]);
|
|
10
13
|
const Topics = /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Union([EvmHexData, /*#__PURE__*/Schema.Array(EvmHexData)])));
|
|
14
|
+
const BlockTag = /*#__PURE__*/Schema.Literals(["latest", "pending"]);
|
|
11
15
|
/** @internal */
|
|
12
16
|
export const chainId = /*#__PURE__*/make({
|
|
13
17
|
name: "eth_chainId",
|
|
@@ -29,6 +33,12 @@ export const getBlockByNumber = /*#__PURE__*/make({
|
|
|
29
33
|
result: /*#__PURE__*/Schema.NullOr(EvmBlock)
|
|
30
34
|
});
|
|
31
35
|
/** @internal */
|
|
36
|
+
export const getBalance = /*#__PURE__*/make({
|
|
37
|
+
name: "eth_getBalance",
|
|
38
|
+
params: /*#__PURE__*/Schema.Tuple([EvmAddress, QuantityFromHex]),
|
|
39
|
+
result: QuantityFromHex
|
|
40
|
+
});
|
|
41
|
+
/** @internal */
|
|
32
42
|
export const getLogs = /*#__PURE__*/make({
|
|
33
43
|
name: "eth_getLogs",
|
|
34
44
|
params: /*#__PURE__*/Schema.Tuple([/*#__PURE__*/Schema.Struct({
|
|
@@ -43,4 +53,47 @@ export const getLogs = /*#__PURE__*/make({
|
|
|
43
53
|
removed: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literal(false))
|
|
44
54
|
}))
|
|
45
55
|
});
|
|
56
|
+
/** @internal */
|
|
57
|
+
export const getTransactionByHash = /*#__PURE__*/make({
|
|
58
|
+
name: "eth_getTransactionByHash",
|
|
59
|
+
params: /*#__PURE__*/Schema.Tuple([EvmTransactionHash]),
|
|
60
|
+
// `null` when the node does not know the transaction
|
|
61
|
+
result: /*#__PURE__*/Schema.NullOr(EvmTransaction)
|
|
62
|
+
});
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const getTransactionReceipt = /*#__PURE__*/make({
|
|
65
|
+
name: "eth_getTransactionReceipt",
|
|
66
|
+
params: /*#__PURE__*/Schema.Tuple([EvmTransactionHash]),
|
|
67
|
+
// `null` until the transaction is in a block
|
|
68
|
+
result: /*#__PURE__*/Schema.NullOr(EvmTransactionReceipt)
|
|
69
|
+
});
|
|
70
|
+
/** @internal */
|
|
71
|
+
export const sendRawTransaction = /*#__PURE__*/make({
|
|
72
|
+
name: "eth_sendRawTransaction",
|
|
73
|
+
params: /*#__PURE__*/Schema.Tuple([EvmHexData]),
|
|
74
|
+
result: EvmTransactionHash
|
|
75
|
+
});
|
|
76
|
+
/** @internal */
|
|
77
|
+
export const getTransactionCount = /*#__PURE__*/make({
|
|
78
|
+
name: "eth_getTransactionCount",
|
|
79
|
+
params: /*#__PURE__*/Schema.Tuple([EvmAddress, BlockTag]),
|
|
80
|
+
result: QuantityFromHex
|
|
81
|
+
});
|
|
82
|
+
/** @internal */
|
|
83
|
+
export const estimateGas = /*#__PURE__*/make({
|
|
84
|
+
name: "eth_estimateGas",
|
|
85
|
+
params: /*#__PURE__*/Schema.Tuple([/*#__PURE__*/Schema.Struct({
|
|
86
|
+
from: EvmAddress,
|
|
87
|
+
to: EvmAddress,
|
|
88
|
+
value: /*#__PURE__*/JsonRpc.optionalOmitted(QuantityFromHex),
|
|
89
|
+
data: /*#__PURE__*/JsonRpc.optionalOmitted(EvmHexData)
|
|
90
|
+
})]),
|
|
91
|
+
result: QuantityFromHex
|
|
92
|
+
});
|
|
93
|
+
/** @internal */
|
|
94
|
+
export const feeHistory = /*#__PURE__*/make({
|
|
95
|
+
name: "eth_feeHistory",
|
|
96
|
+
params: /*#__PURE__*/Schema.Tuple([IntFromHex, BlockTag, /*#__PURE__*/Schema.Array(Schema.Number)]),
|
|
97
|
+
result: EvmFeeHistory
|
|
98
|
+
});
|
|
46
99
|
//# sourceMappingURL=rpcMethods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpcMethods.js","names":[],"sources":["../../src/internal/rpcMethods.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iCAAiC;AAC1D,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,SAAS,UAAU,QAAQ,kBAAkB;AAC7C,SAAS,QAAQ,QAAQ,gBAAgB;AACzC,SAAS,UAAU,QAAQ,kBAAkB;AAC7C,SAAS,MAAM,QAAQ,cAAc;AACrC,SAAS,UAAU,EAAE,eAAe,QAAQ,sBAAsB;AAElE,MAAM,IAAI,GAAoB,MAAsC,IAAqC,MAAM;AAE/G,MAAM,QAAQ,gBAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAEjC,MAAM,MAAM,gBAAG,MAAM,CAAC,KAAK,cAAC,MAAM,CAAC,MAAM,cAAC,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,eAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhG;AACA,OAAO,MAAM,OAAO,gBAAG,IAAI,CAAC;EAAE,IAAI,EAAE,aAAa;EAAE,MAAM,EAAE,QAAQ;EAAE,MAAM,EAAE;AAAU,CAAE,CAAC;AAE1F;AACA,OAAO,MAAM,WAAW,gBAAG,IAAI,CAAC;EAAE,IAAI,EAAE,iBAAiB;EAAE,MAAM,EAAE,QAAQ;EAA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AE;CACT,CAAC;AAEF;AACA,OAAO,MAAM,WAAW,gBAAG,IAAI,CAAC;EAC9B,IAAI,EAAE,iBAAiB;EACvB,MAAM,eAAE,MAAM,CAAC,KAAK,CAAC,cACnB,MAAM,CAAC,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU;IAChB,EAAE,EAAE,UAAU;IACd,KAAK,eAAE,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC;IAC/C,IAAI,eAAE,OAAO,CAAC,eAAe,CAAC,UAAU;GACzC,CAAC,CACH,CAAC;EACF,MAAM,EAAE;CACT,CAAC;AAEF;AACA,OAAO,MAAM,UAAU,gBAAG,IAAI,CAAC;EAC7B,IAAI,EAAE,gBAAgB;EACtB,MAAM,eAAE,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,QAAQ,eAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;EACzE,MAAM,EAAE;CACT,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EVM fee history, as returned by `eth_feeHistory`.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema"
|
|
7
|
+
import { QuantityFromHex } from "./internal/QuantityFromHex.ts"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The fees of a range of blocks starting at `oldestBlock`, in wei per gas. `baseFeePerGas` has one more entry than
|
|
11
|
+
* the range: the base fee of the block after it. `reward` holds, per block, the priority fee at each requested
|
|
12
|
+
* percentile, and is absent when none was requested.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.3.0
|
|
15
|
+
* @category schemas
|
|
16
|
+
*/
|
|
17
|
+
export const EvmFeeHistory = Schema.Struct({
|
|
18
|
+
oldestBlock: QuantityFromHex,
|
|
19
|
+
baseFeePerGas: Schema.NonEmptyArray(QuantityFromHex),
|
|
20
|
+
gasUsedRatio: Schema.Array(Schema.Number),
|
|
21
|
+
reward: Schema.optionalKey(Schema.Array(Schema.Array(QuantityFromHex)))
|
|
22
|
+
}).annotate({ identifier: "EvmFeeHistory", title: "EVM fee history" })
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @since 0.3.0
|
|
26
|
+
* @category models
|
|
27
|
+
*/
|
|
28
|
+
export type EvmFeeHistory = typeof EvmFeeHistory.Type
|