ox 0.9.16 → 0.10.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/CHANGELOG.md +27 -0
- package/README.md +4 -4
- package/TxEnvelope/package.json +6 -0
- package/TxEnvelopeEip1559/package.json +6 -0
- package/TxEnvelopeEip2930/package.json +6 -0
- package/TxEnvelopeEip4844/package.json +6 -0
- package/TxEnvelopeEip7702/package.json +6 -0
- package/TxEnvelopeLegacy/package.json +6 -0
- package/_cjs/core/{TransactionEnvelope.js → TxEnvelope.js} +1 -1
- package/_cjs/core/TxEnvelope.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeEip1559.js → TxEnvelopeEip1559.js} +2 -2
- package/_cjs/core/TxEnvelopeEip1559.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeEip2930.js → TxEnvelopeEip2930.js} +2 -2
- package/_cjs/core/TxEnvelopeEip2930.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeEip4844.js → TxEnvelopeEip4844.js} +4 -4
- package/_cjs/core/TxEnvelopeEip4844.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeEip7702.js → TxEnvelopeEip7702.js} +4 -4
- package/_cjs/core/TxEnvelopeEip7702.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeLegacy.js → TxEnvelopeLegacy.js} +2 -2
- package/_cjs/core/TxEnvelopeLegacy.js.map +1 -0
- package/_cjs/core/WebAuthnP256.js +1 -1
- package/_cjs/core/WebAuthnP256.js.map +1 -1
- package/_cjs/erc8021/Attribution.js +36 -6
- package/_cjs/erc8021/Attribution.js.map +1 -1
- package/_cjs/index.docs.js +1 -0
- package/_cjs/index.docs.js.map +1 -1
- package/_cjs/index.js +7 -7
- package/_cjs/index.js.map +1 -1
- package/_cjs/tempo/AuthorizationTempo.js +101 -0
- package/_cjs/tempo/AuthorizationTempo.js.map +1 -0
- package/_cjs/tempo/KeyAuthorization.js +123 -0
- package/_cjs/tempo/KeyAuthorization.js.map +1 -0
- package/_cjs/tempo/PoolId.js +10 -0
- package/_cjs/tempo/PoolId.js.map +1 -0
- package/_cjs/tempo/SignatureEnvelope.js +394 -0
- package/_cjs/tempo/SignatureEnvelope.js.map +1 -0
- package/_cjs/tempo/Tick.js +77 -0
- package/_cjs/tempo/Tick.js.map +1 -0
- package/_cjs/tempo/TokenId.js +28 -0
- package/_cjs/tempo/TokenId.js.map +1 -0
- package/_cjs/tempo/TokenRole.js +26 -0
- package/_cjs/tempo/TokenRole.js.map +1 -0
- package/_cjs/tempo/Transaction.js +80 -0
- package/_cjs/tempo/Transaction.js.map +1 -0
- package/_cjs/tempo/TransactionReceipt.js +26 -0
- package/_cjs/tempo/TransactionReceipt.js.map +1 -0
- package/_cjs/tempo/TransactionRequest.js +53 -0
- package/_cjs/tempo/TransactionRequest.js.map +1 -0
- package/_cjs/tempo/TxEnvelopeTempo.js +267 -0
- package/_cjs/tempo/TxEnvelopeTempo.js.map +1 -0
- package/_cjs/tempo/index.js +15 -0
- package/_cjs/tempo/index.js.map +1 -0
- package/_cjs/version.js +1 -1
- package/_esm/core/Blobs.js +8 -8
- package/_esm/core/{TransactionEnvelope.js → TxEnvelope.js} +11 -11
- package/_esm/core/TxEnvelope.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeEip1559.js → TxEnvelopeEip1559.js} +42 -42
- package/_esm/core/TxEnvelopeEip1559.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeEip2930.js → TxEnvelopeEip2930.js} +43 -43
- package/_esm/core/TxEnvelopeEip2930.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeEip4844.js → TxEnvelopeEip4844.js} +42 -42
- package/_esm/core/TxEnvelopeEip4844.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeEip7702.js → TxEnvelopeEip7702.js} +40 -40
- package/_esm/core/TxEnvelopeEip7702.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeLegacy.js → TxEnvelopeLegacy.js} +42 -42
- package/_esm/core/TxEnvelopeLegacy.js.map +1 -0
- package/_esm/core/WebAuthnP256.js +1 -1
- package/_esm/core/WebAuthnP256.js.map +1 -1
- package/_esm/erc8021/Attribution.js +58 -13
- package/_esm/erc8021/Attribution.js.map +1 -1
- package/_esm/index.docs.js +1 -0
- package/_esm/index.docs.js.map +1 -1
- package/_esm/index.js +192 -192
- package/_esm/index.js.map +1 -1
- package/_esm/tempo/AuthorizationTempo.js +664 -0
- package/_esm/tempo/AuthorizationTempo.js.map +1 -0
- package/_esm/tempo/KeyAuthorization.js +426 -0
- package/_esm/tempo/KeyAuthorization.js.map +1 -0
- package/_esm/tempo/PoolId.js +28 -0
- package/_esm/tempo/PoolId.js.map +1 -0
- package/_esm/tempo/SignatureEnvelope.js +660 -0
- package/_esm/tempo/SignatureEnvelope.js.map +1 -0
- package/_esm/tempo/Tick.js +147 -0
- package/_esm/tempo/Tick.js.map +1 -0
- package/_esm/tempo/TokenId.js +71 -0
- package/_esm/tempo/TokenId.js.map +1 -0
- package/_esm/tempo/TokenRole.js +40 -0
- package/_esm/tempo/TokenRole.js.map +1 -0
- package/_esm/tempo/Transaction.js +167 -0
- package/_esm/tempo/Transaction.js.map +1 -0
- package/_esm/tempo/TransactionReceipt.js +138 -0
- package/_esm/tempo/TransactionReceipt.js.map +1 -0
- package/_esm/tempo/TransactionRequest.js +99 -0
- package/_esm/tempo/TransactionRequest.js.map +1 -0
- package/_esm/tempo/TxEnvelopeTempo.js +607 -0
- package/_esm/tempo/TxEnvelopeTempo.js.map +1 -0
- package/_esm/tempo/index.js +298 -0
- package/_esm/tempo/index.js.map +1 -0
- package/_esm/version.js +1 -1
- package/_types/core/Blobs.d.ts +8 -8
- package/_types/core/{TransactionEnvelope.d.ts → TxEnvelope.d.ts} +11 -11
- package/_types/core/TxEnvelope.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeEip1559.d.ts → TxEnvelopeEip1559.d.ts} +54 -54
- package/_types/core/TxEnvelopeEip1559.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeEip2930.d.ts → TxEnvelopeEip2930.d.ts} +55 -55
- package/_types/core/TxEnvelopeEip2930.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeEip4844.d.ts → TxEnvelopeEip4844.d.ts} +54 -54
- package/_types/core/TxEnvelopeEip4844.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeEip7702.d.ts → TxEnvelopeEip7702.d.ts} +49 -49
- package/_types/core/TxEnvelopeEip7702.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeLegacy.d.ts → TxEnvelopeLegacy.d.ts} +54 -54
- package/_types/core/TxEnvelopeLegacy.d.ts.map +1 -0
- package/_types/core/WebAuthnP256.d.ts +1 -1
- package/_types/core/WebAuthnP256.d.ts.map +1 -1
- package/_types/erc8021/Attribution.d.ts +20 -6
- package/_types/erc8021/Attribution.d.ts.map +1 -1
- package/_types/index.d.ts +192 -192
- package/_types/index.d.ts.map +1 -1
- package/_types/index.docs.d.ts +1 -0
- package/_types/index.docs.d.ts.map +1 -1
- package/_types/tempo/AuthorizationTempo.d.ts +688 -0
- package/_types/tempo/AuthorizationTempo.d.ts.map +1 -0
- package/_types/tempo/KeyAuthorization.d.ts +437 -0
- package/_types/tempo/KeyAuthorization.d.ts.map +1 -0
- package/_types/tempo/PoolId.d.ts +33 -0
- package/_types/tempo/PoolId.d.ts.map +1 -0
- package/_types/tempo/SignatureEnvelope.d.ts +438 -0
- package/_types/tempo/SignatureEnvelope.d.ts.map +1 -0
- package/_types/tempo/Tick.d.ts +120 -0
- package/_types/tempo/Tick.d.ts.map +1 -0
- package/_types/tempo/TokenId.d.ts +55 -0
- package/_types/tempo/TokenId.d.ts.map +1 -0
- package/_types/tempo/TokenRole.d.ts +29 -0
- package/_types/tempo/TokenRole.d.ts.map +1 -0
- package/_types/tempo/Transaction.d.ts +208 -0
- package/_types/tempo/Transaction.d.ts.map +1 -0
- package/_types/tempo/TransactionReceipt.d.ts +165 -0
- package/_types/tempo/TransactionReceipt.d.ts.map +1 -0
- package/_types/tempo/TransactionRequest.d.ts +89 -0
- package/_types/tempo/TransactionRequest.d.ts.map +1 -0
- package/_types/tempo/TxEnvelopeTempo.d.ts +551 -0
- package/_types/tempo/TxEnvelopeTempo.d.ts.map +1 -0
- package/_types/tempo/index.d.ts +300 -0
- package/_types/tempo/index.d.ts.map +1 -0
- package/_types/version.d.ts +1 -1
- package/core/Blobs.ts +8 -8
- package/core/{TransactionEnvelope.ts → TxEnvelope.ts} +10 -10
- package/core/{TransactionEnvelopeEip1559.ts → TxEnvelopeEip1559.ts} +60 -69
- package/core/{TransactionEnvelopeEip2930.ts → TxEnvelopeEip2930.ts} +61 -72
- package/core/{TransactionEnvelopeEip4844.ts → TxEnvelopeEip4844.ts} +62 -71
- package/core/{TransactionEnvelopeEip7702.ts → TxEnvelopeEip7702.ts} +58 -67
- package/core/{TransactionEnvelopeLegacy.ts → TxEnvelopeLegacy.ts} +59 -68
- package/core/WebAuthnP256.ts +3 -1
- package/erc8021/Attribution.ts +77 -15
- package/index.docs.ts +1 -0
- package/index.ts +192 -195
- package/package.json +91 -31
- package/tempo/AuthorizationTempo/package.json +6 -0
- package/tempo/AuthorizationTempo.test.ts +1293 -0
- package/tempo/AuthorizationTempo.ts +884 -0
- package/tempo/KeyAuthorization/package.json +6 -0
- package/tempo/KeyAuthorization.test.ts +1373 -0
- package/tempo/KeyAuthorization.ts +622 -0
- package/tempo/PoolId/package.json +6 -0
- package/tempo/PoolId.test.ts +33 -0
- package/tempo/PoolId.ts +42 -0
- package/tempo/SignatureEnvelope/package.json +6 -0
- package/tempo/SignatureEnvelope.test.ts +1877 -0
- package/tempo/SignatureEnvelope.ts +973 -0
- package/tempo/Tick/package.json +6 -0
- package/tempo/Tick.test.ts +281 -0
- package/tempo/Tick.ts +186 -0
- package/tempo/TokenId/package.json +6 -0
- package/tempo/TokenId.test.ts +40 -0
- package/tempo/TokenId.ts +80 -0
- package/tempo/TokenRole/package.json +6 -0
- package/tempo/TokenRole.test.ts +16 -0
- package/tempo/TokenRole.ts +45 -0
- package/tempo/Transaction/package.json +6 -0
- package/tempo/Transaction.test.ts +523 -0
- package/tempo/Transaction.ts +339 -0
- package/tempo/TransactionReceipt/package.json +6 -0
- package/tempo/TransactionReceipt.ts +200 -0
- package/tempo/TransactionRequest/package.json +6 -0
- package/tempo/TransactionRequest.ts +160 -0
- package/tempo/TxEnvelopeTempo/package.json +6 -0
- package/tempo/TxEnvelopeTempo.test.ts +1371 -0
- package/tempo/TxEnvelopeTempo.ts +972 -0
- package/tempo/e2e.test.ts +1387 -0
- package/tempo/index.ts +308 -0
- package/tempo/package.json +6 -0
- package/version.ts +1 -1
- package/TransactionEnvelope/package.json +0 -6
- package/TransactionEnvelopeEip1559/package.json +0 -6
- package/TransactionEnvelopeEip2930/package.json +0 -6
- package/TransactionEnvelopeEip4844/package.json +0 -6
- package/TransactionEnvelopeEip7702/package.json +0 -6
- package/TransactionEnvelopeLegacy/package.json +0 -6
- package/_cjs/core/TransactionEnvelope.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeEip1559.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeEip2930.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeEip4844.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeEip7702.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeLegacy.js.map +0 -1
- package/_esm/core/TransactionEnvelope.js.map +0 -1
- package/_esm/core/TransactionEnvelopeEip1559.js.map +0 -1
- package/_esm/core/TransactionEnvelopeEip2930.js.map +0 -1
- package/_esm/core/TransactionEnvelopeEip4844.js.map +0 -1
- package/_esm/core/TransactionEnvelopeEip7702.js.map +0 -1
- package/_esm/core/TransactionEnvelopeLegacy.js.map +0 -1
- package/_types/core/TransactionEnvelope.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeEip1559.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeEip2930.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeEip4844.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeEip7702.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeLegacy.d.ts.map +0 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type * as AccessList from '../core/AccessList.js';
|
|
2
|
+
import type * as Address from '../core/Address.js';
|
|
3
|
+
import type * as Errors from '../core/Errors.js';
|
|
4
|
+
import * as Hex from '../core/Hex.js';
|
|
5
|
+
import type { Compute, OneOf, UnionCompute } from '../core/internal/types.js';
|
|
6
|
+
import * as ox_Transaction from '../core/Transaction.js';
|
|
7
|
+
import * as AuthorizationTempo from './AuthorizationTempo.js';
|
|
8
|
+
import * as KeyAuthorization from './KeyAuthorization.js';
|
|
9
|
+
import * as SignatureEnvelope from './SignatureEnvelope.js';
|
|
10
|
+
import type { Call } from './TxEnvelopeTempo.js';
|
|
11
|
+
/**
|
|
12
|
+
* A Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://docs.tempo.xyz/protocol/transactions Tempo Transactions}
|
|
15
|
+
*/
|
|
16
|
+
export type Transaction<pending extends boolean = false, bigintType = bigint, numberType = number> = UnionCompute<OneOf<Tempo<pending, bigintType, numberType> | ox_Transaction.Transaction<pending, bigintType, numberType>>>;
|
|
17
|
+
/**
|
|
18
|
+
* An RPC Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
|
|
19
|
+
*/
|
|
20
|
+
export type Rpc<pending extends boolean = false> = UnionCompute<OneOf<TempoRpc<pending> | ox_Transaction.Rpc<pending>>>;
|
|
21
|
+
/**
|
|
22
|
+
* Native account abstraction transaction (type `0x76`).
|
|
23
|
+
*
|
|
24
|
+
* Features configurable fee tokens, call batching, fee sponsorship, access keys,
|
|
25
|
+
* parallelizable nonces, and scheduled execution via `validAfter`/`validBefore`.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction Tempo Transaction Specification}
|
|
28
|
+
*/
|
|
29
|
+
export type Tempo<pending extends boolean = false, bigintType = bigint, numberType = number, type extends string = 'tempo'> = Compute<Omit<ox_Transaction.Base<type, pending, bigintType, numberType>, 'input' | 'to' | 'value' | 'v' | 'r' | 's' | 'yParity'> & {
|
|
30
|
+
/** EIP-2930 Access List. */
|
|
31
|
+
accessList: AccessList.AccessList;
|
|
32
|
+
/** EIP-7702 Authorization list for the transaction. */
|
|
33
|
+
authorizationList?: AuthorizationTempo.ListSigned<bigintType, numberType> | undefined;
|
|
34
|
+
/** Array of calls to execute. */
|
|
35
|
+
calls: readonly Call<bigintType>[];
|
|
36
|
+
/** Fee payer signature. */
|
|
37
|
+
feePayerSignature?: {
|
|
38
|
+
/** ECDSA signature r. */
|
|
39
|
+
r: bigintType;
|
|
40
|
+
/** ECDSA signature s. */
|
|
41
|
+
s: bigintType;
|
|
42
|
+
/** ECDSA signature yParity. */
|
|
43
|
+
yParity: numberType;
|
|
44
|
+
/** @deprecated ECDSA signature v (for backwards compatibility). */
|
|
45
|
+
v?: numberType | undefined;
|
|
46
|
+
} | undefined;
|
|
47
|
+
/** Fee token preference. */
|
|
48
|
+
feeToken: Address.Address;
|
|
49
|
+
/** Effective gas price paid by the sender in wei. */
|
|
50
|
+
gasPrice?: bigintType | undefined;
|
|
51
|
+
/** Key authorization for provisioning a new access key. */
|
|
52
|
+
keyAuthorization?: KeyAuthorization.KeyAuthorization<true, bigintType, numberType> | undefined;
|
|
53
|
+
/** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). */
|
|
54
|
+
maxFeePerGas: bigintType;
|
|
55
|
+
/** Max priority fee per gas (in wei). */
|
|
56
|
+
maxPriorityFeePerGas: bigintType;
|
|
57
|
+
/** Nonce key for 2D nonce system (192 bits). */
|
|
58
|
+
nonceKey?: bigintType | undefined;
|
|
59
|
+
/** Sender signature. */
|
|
60
|
+
signature: SignatureEnvelope.SignatureEnvelope<bigintType, numberType>;
|
|
61
|
+
/** Transaction can only be included in a block before this timestamp. */
|
|
62
|
+
validBefore?: numberType | undefined;
|
|
63
|
+
/** Transaction can only be included in a block after this timestamp. */
|
|
64
|
+
validAfter?: numberType | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Native account abstraction transaction in RPC format.
|
|
68
|
+
*/
|
|
69
|
+
export type TempoRpc<pending extends boolean = false> = Compute<Omit<Tempo<pending, Hex.Hex, Hex.Hex, ToRpcType['tempo']>, 'authorizationList' | 'calls' | 'keyAuthorization' | 'signature'> & {
|
|
70
|
+
aaAuthorizationList?: AuthorizationTempo.ListRpc | undefined;
|
|
71
|
+
calls: readonly {
|
|
72
|
+
input?: Hex.Hex | undefined;
|
|
73
|
+
to?: Hex.Hex | undefined;
|
|
74
|
+
value?: Hex.Hex | undefined;
|
|
75
|
+
}[] | undefined;
|
|
76
|
+
keyAuthorization?: KeyAuthorization.Rpc | undefined;
|
|
77
|
+
signature: SignatureEnvelope.SignatureEnvelopeRpc;
|
|
78
|
+
}>;
|
|
79
|
+
/** Type to RPC Type mapping. */
|
|
80
|
+
export declare const toRpcType: {
|
|
81
|
+
readonly tempo: "0x76";
|
|
82
|
+
readonly legacy: "0x0";
|
|
83
|
+
readonly eip2930: "0x1";
|
|
84
|
+
readonly eip1559: "0x2";
|
|
85
|
+
readonly eip4844: "0x3";
|
|
86
|
+
readonly eip7702: "0x4";
|
|
87
|
+
};
|
|
88
|
+
/** Type to RPC Type mapping. */
|
|
89
|
+
export type ToRpcType = typeof toRpcType & {
|
|
90
|
+
[type: string]: `0x${string}`;
|
|
91
|
+
};
|
|
92
|
+
/** RPC Type to Type mapping. */
|
|
93
|
+
export declare const fromRpcType: {
|
|
94
|
+
readonly '0x76': "tempo";
|
|
95
|
+
readonly '0x0': "legacy";
|
|
96
|
+
readonly '0x1': "eip2930";
|
|
97
|
+
readonly '0x2': "eip1559";
|
|
98
|
+
readonly '0x3': "eip4844";
|
|
99
|
+
readonly '0x4': "eip7702";
|
|
100
|
+
};
|
|
101
|
+
/** RPC Type to Type mapping. */
|
|
102
|
+
export type FromRpcType = typeof fromRpcType & {
|
|
103
|
+
[type: `0x${string}`]: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Converts an {@link ox#Transaction.Rpc} to an {@link ox#Transaction.Transaction}.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts twoslash
|
|
110
|
+
* import { Transaction } from 'ox/tempo'
|
|
111
|
+
*
|
|
112
|
+
* const transaction = Transaction.fromRpc({
|
|
113
|
+
* hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
114
|
+
* nonce: '0x357',
|
|
115
|
+
* blockHash:
|
|
116
|
+
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
117
|
+
* blockNumber: '0x12f296f',
|
|
118
|
+
* calls: [
|
|
119
|
+
* {
|
|
120
|
+
* input: '0xdeadbeef',
|
|
121
|
+
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
122
|
+
* value: '0x9b6e64a8ec60000',
|
|
123
|
+
* },
|
|
124
|
+
* ],
|
|
125
|
+
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
126
|
+
* transactionIndex: '0x2',
|
|
127
|
+
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
128
|
+
* value: '0x9b6e64a8ec60000',
|
|
129
|
+
* gas: '0x43f5d',
|
|
130
|
+
* maxFeePerGas: '0x2ca6ae494',
|
|
131
|
+
* maxPriorityFeePerGas: '0x41cc3c0',
|
|
132
|
+
* input:
|
|
133
|
+
* '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
|
|
134
|
+
* signature: {
|
|
135
|
+
* r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
|
|
136
|
+
* s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
|
|
137
|
+
* type: 'secp256k1',
|
|
138
|
+
* yParity: '0x0',
|
|
139
|
+
* },
|
|
140
|
+
* chainId: '0x1',
|
|
141
|
+
* accessList: [],
|
|
142
|
+
* type: '0x76',
|
|
143
|
+
* })
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* @param transaction - The RPC transaction to convert.
|
|
147
|
+
* @returns An instantiated {@link ox#Transaction.Transaction}.
|
|
148
|
+
*/
|
|
149
|
+
export declare function fromRpc<const transaction extends Rpc | null, pending extends boolean = false>(transaction: transaction | Rpc<pending> | null, _options?: fromRpc.Options<pending>): transaction extends Rpc<pending> ? Transaction<pending> : null;
|
|
150
|
+
export declare namespace fromRpc {
|
|
151
|
+
type Options<pending extends boolean = false> = {
|
|
152
|
+
pending?: pending | boolean | undefined;
|
|
153
|
+
};
|
|
154
|
+
type ErrorType = ox_Transaction.fromRpc.ErrorType | Errors.GlobalErrorType;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Converts an {@link ox#Transaction.Transaction} to an {@link ox#Transaction.Rpc}.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts twoslash
|
|
161
|
+
* import { Transaction } from 'ox/tempo'
|
|
162
|
+
*
|
|
163
|
+
* const transaction = Transaction.toRpc({
|
|
164
|
+
* accessList: [],
|
|
165
|
+
* blockHash:
|
|
166
|
+
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
167
|
+
* blockNumber: 19868015n,
|
|
168
|
+
* calls: [
|
|
169
|
+
* {
|
|
170
|
+
* data: '0xdeadbeef',
|
|
171
|
+
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
172
|
+
* value: 700000000000000000n,
|
|
173
|
+
* },
|
|
174
|
+
* ],
|
|
175
|
+
* chainId: 1,
|
|
176
|
+
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
177
|
+
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
178
|
+
* gas: 278365n,
|
|
179
|
+
* hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
180
|
+
* input:
|
|
181
|
+
* '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
|
|
182
|
+
* maxFeePerGas: 11985937556n,
|
|
183
|
+
* maxPriorityFeePerGas: 68993984n,
|
|
184
|
+
* nonce: 855n,
|
|
185
|
+
* signature: {
|
|
186
|
+
* signature: {
|
|
187
|
+
* r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
188
|
+
* s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
189
|
+
* yParity: 0,
|
|
190
|
+
* },
|
|
191
|
+
* type: 'secp256k1',
|
|
192
|
+
* },
|
|
193
|
+
* transactionIndex: 2,
|
|
194
|
+
* type: 'tempo',
|
|
195
|
+
* })
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* @param transaction - The transaction to convert.
|
|
199
|
+
* @returns An RPC-formatted transaction.
|
|
200
|
+
*/
|
|
201
|
+
export declare function toRpc<pending extends boolean = false>(transaction: Transaction<pending>, _options?: toRpc.Options<pending>): Rpc<pending>;
|
|
202
|
+
export declare namespace toRpc {
|
|
203
|
+
type Options<pending extends boolean = false> = {
|
|
204
|
+
pending?: pending | boolean | undefined;
|
|
205
|
+
};
|
|
206
|
+
type ErrorType = ox_Transaction.toRpc.ErrorType | Errors.GlobalErrorType;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=Transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../tempo/Transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7E,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAEhD;;;;GAIG;AACH,MAAM,MAAM,WAAW,CACrB,OAAO,SAAS,OAAO,GAAG,KAAK,EAC/B,UAAU,GAAG,MAAM,EACnB,UAAU,GAAG,MAAM,IACjB,YAAY,CACd,KAAK,CACD,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,GACtC,cAAc,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAC9D,CACF,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,GAAG,CA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AC,OAAO,SAAS,OAAO,GAAG,KAAK,IAAI;QAC9C,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAA;KACxC,CAAA;IAED,KAAK,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACzE"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type * as Address from '../core/Address.js';
|
|
2
|
+
import type * as Hex from '../core/Hex.js';
|
|
3
|
+
import type { Compute } from '../core/internal/types.js';
|
|
4
|
+
import * as ox_TransactionReceipt from '../core/TransactionReceipt.js';
|
|
5
|
+
/**
|
|
6
|
+
* Tempo transaction receipt.
|
|
7
|
+
*
|
|
8
|
+
* Extends standard receipts with `feePayer` (the address that paid fees) and
|
|
9
|
+
* `feeToken` (the TIP-20 token used for fee payment).
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://docs.tempo.xyz/protocol/transactions Tempo Transactions}
|
|
12
|
+
*/
|
|
13
|
+
export type TransactionReceipt<status = ox_TransactionReceipt.Status, type = ox_TransactionReceipt.Type, bigintType = bigint, numberType = number> = Compute<ox_TransactionReceipt.TransactionReceipt<status, type, bigintType, numberType> & {
|
|
14
|
+
/** Address of the fee payer. */
|
|
15
|
+
feePayer?: Address.Address | undefined;
|
|
16
|
+
/** Address of the fee token. */
|
|
17
|
+
feeToken?: Address.Address | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type Rpc = TransactionReceipt<ox_TransactionReceipt.RpcStatus, ox_TransactionReceipt.RpcType, Hex.Hex, Hex.Hex>;
|
|
20
|
+
export type Type = 'tempo' | ox_TransactionReceipt.Type;
|
|
21
|
+
export type RpcType = '0x76' | ox_TransactionReceipt.RpcType;
|
|
22
|
+
export type Status = ox_TransactionReceipt.Status;
|
|
23
|
+
export type RpcStatus = ox_TransactionReceipt.RpcStatus;
|
|
24
|
+
/** RPC type to type mapping. */
|
|
25
|
+
export declare const fromRpcType: {
|
|
26
|
+
readonly '0x76': "tempo";
|
|
27
|
+
readonly '0x0': "legacy";
|
|
28
|
+
readonly '0x1': "eip2930";
|
|
29
|
+
readonly '0x2': "eip1559";
|
|
30
|
+
readonly '0x3': "eip4844";
|
|
31
|
+
readonly '0x4': "eip7702";
|
|
32
|
+
};
|
|
33
|
+
/** Type to RPC type mapping. */
|
|
34
|
+
export declare const toRpcType: {
|
|
35
|
+
readonly tempo: "0x76";
|
|
36
|
+
readonly legacy: "0x0";
|
|
37
|
+
readonly eip2930: "0x1";
|
|
38
|
+
readonly eip1559: "0x2";
|
|
39
|
+
readonly eip4844: "0x3";
|
|
40
|
+
readonly eip7702: "0x4";
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Converts an RPC receipt to a TransactionReceipt.
|
|
44
|
+
*
|
|
45
|
+
* @see {@link https://docs.tempo.xyz/protocol/transactions Tempo Transactions}
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts twoslash
|
|
49
|
+
* import { TransactionReceipt } from 'ox/tempo'
|
|
50
|
+
*
|
|
51
|
+
* const receipt = TransactionReceipt.fromRpc({
|
|
52
|
+
* blobGasPrice: '0x42069',
|
|
53
|
+
* blobGasUsed: '0x1337',
|
|
54
|
+
* blockHash:
|
|
55
|
+
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
56
|
+
* blockNumber: '0x12f296f',
|
|
57
|
+
* contractAddress: null,
|
|
58
|
+
* cumulativeGasUsed: '0x82515',
|
|
59
|
+
* effectiveGasPrice: '0x21c2f6c09',
|
|
60
|
+
* feePayer: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
61
|
+
* feeToken: '0x20c0000000000000000000000000000000000001',
|
|
62
|
+
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
63
|
+
* gasUsed: '0x2abba',
|
|
64
|
+
* logs: [],
|
|
65
|
+
* logsBloom:
|
|
66
|
+
* '0x00200000000000000000008080000000000000000040000000000000000000000000000000000000000000000000000022000000080000000000000000000000000000080000000000000008000000200000000000000000000200008020400000000000000000280000000000100000000000000000000000000010000000000000000000020000000000000020000000000001000000080000004000000000000000000000000000000000000000000000400000000000001000000000000000000002000000000000000020000000000000000000001000000000000000000000200000000000000000000000000000001000000000c00000000000000000',
|
|
67
|
+
* status: '0x1',
|
|
68
|
+
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
69
|
+
* transactionHash:
|
|
70
|
+
* '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
71
|
+
* transactionIndex: '0x2',
|
|
72
|
+
* type: '0x2',
|
|
73
|
+
* })
|
|
74
|
+
* // @log: {
|
|
75
|
+
* // @log: blobGasPrice: 270441n,
|
|
76
|
+
* // @log: blobGasUsed: 4919n,
|
|
77
|
+
* // @log: blockHash: "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b",
|
|
78
|
+
* // @log: blockNumber: 19868015n,
|
|
79
|
+
* // @log: contractAddress: null,
|
|
80
|
+
* // @log: cumulativeGasUsed: 533781n,
|
|
81
|
+
* // @log: effectiveGasPrice: 9062804489n,
|
|
82
|
+
* // @log: feePayer: "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
83
|
+
* // @log: feeToken: "0x20c0000000000000000000000000000000000001",
|
|
84
|
+
* // @log: from: "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
85
|
+
* // @log: gasUsed: 175034n,
|
|
86
|
+
* // @log: logs: [],
|
|
87
|
+
* // @log: logsBloom: "0x00200000000000000000008080000000000000000040000000000000000000000000000000000000000000000000000022000000080000000000000000000000000000080000000000000008000000200000000000000000000200008020400000000000000000280000000000100000000000000000000000000010000000000000000000020000000000000020000000000001000000080000004000000000000000000000000000000000000000000000400000000000001000000000000000000002000000000000000020000000000000000000001000000000000000000000200000000000000000000000000000001000000000c00000000000000000",
|
|
88
|
+
* // @log: root: undefined,
|
|
89
|
+
* // @log: status: "success",
|
|
90
|
+
* // @log: to: "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
|
|
91
|
+
* // @log: transactionHash: "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0",
|
|
92
|
+
* // @log: transactionIndex: 2,
|
|
93
|
+
* // @log: type: "eip1559",
|
|
94
|
+
* // @log: }
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @param receipt - The RPC receipt to convert.
|
|
98
|
+
* @returns A TransactionReceipt.
|
|
99
|
+
*/
|
|
100
|
+
export declare function fromRpc<const receipt extends Rpc | null>(receipt: receipt | Rpc | null): receipt extends Rpc ? TransactionReceipt : null;
|
|
101
|
+
export declare namespace fromRpc {
|
|
102
|
+
type ErrorType = ox_TransactionReceipt.fromRpc.ErrorType;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Converts a TransactionReceipt to an RPC receipt.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts twoslash
|
|
109
|
+
* import { TransactionReceipt } from 'ox/tempo'
|
|
110
|
+
*
|
|
111
|
+
* const receipt = TransactionReceipt.toRpc({
|
|
112
|
+
* blobGasPrice: 270441n,
|
|
113
|
+
* blobGasUsed: 4919n,
|
|
114
|
+
* blockHash:
|
|
115
|
+
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
116
|
+
* blockNumber: 19868015n,
|
|
117
|
+
* contractAddress: null,
|
|
118
|
+
* cumulativeGasUsed: 533781n,
|
|
119
|
+
* effectiveGasPrice: 9062804489n,
|
|
120
|
+
* feePayer: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
121
|
+
* feeToken: '0x20c0000000000000000000000000000000000001',
|
|
122
|
+
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
123
|
+
* gasUsed: 175034n,
|
|
124
|
+
* logs: [],
|
|
125
|
+
* logsBloom:
|
|
126
|
+
* '0x00200000000000000000008080000000000000000040000000000000000000000000000000000000000000000000000022000000080000000000000000000000000000080000000000000008000000200000000000000000000200008020400000000000000000280000000000100000000000000000000000000010000000000000000000020000000000000020000000000001000000080000004000000000000000000000000000000000000000000000400000000000001000000000000000000002000000000000000020000000000000000000001000000000000000000000200000000000000000000000000000001000000000c00000000000000000',
|
|
127
|
+
* root: undefined,
|
|
128
|
+
* status: 'success',
|
|
129
|
+
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
130
|
+
* transactionHash:
|
|
131
|
+
* '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
132
|
+
* transactionIndex: 2,
|
|
133
|
+
* type: 'eip1559',
|
|
134
|
+
* })
|
|
135
|
+
* // @log: {
|
|
136
|
+
* // @log: blobGasPrice: "0x042069",
|
|
137
|
+
* // @log: blobGasUsed: "0x1337",
|
|
138
|
+
* // @log: blockHash: "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b",
|
|
139
|
+
* // @log: blockNumber: "0x012f296f",
|
|
140
|
+
* // @log: contractAddress: null,
|
|
141
|
+
* // @log: cumulativeGasUsed: "0x082515",
|
|
142
|
+
* // @log: effectiveGasPrice: "0x021c2f6c09",
|
|
143
|
+
* // @log: feePayer: "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
144
|
+
* // @log: feeToken: "0x20c0000000000000000000000000000000000001",
|
|
145
|
+
* // @log: from: "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
146
|
+
* // @log: gasUsed: "0x02abba",
|
|
147
|
+
* // @log: logs: [],
|
|
148
|
+
* // @log: logsBloom: "0x00200000000000000000008080000000000000000040000000000000000000000000000000000000000000000000000022000000080000000000000000000000000000080000000000000008000000200000000000000000000200008020400000000000000000280000000000100000000000000000000000000010000000000000000000020000000000000020000000000001000000080000004000000000000000000000000000000000000000000000400000000000001000000000000000000002000000000000000020000000000000000000001000000000000000000000200000000000000000000000000000001000000000c00000000000000000",
|
|
149
|
+
* // @log: root: undefined,
|
|
150
|
+
* // @log: status: "0x1",
|
|
151
|
+
* // @log: to: "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
|
|
152
|
+
* // @log: transactionHash: "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0",
|
|
153
|
+
* // @log: transactionIndex: "0x02",
|
|
154
|
+
* // @log: type: "eip1559",
|
|
155
|
+
* // @log: }
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @param receipt - The receipt to convert.
|
|
159
|
+
* @returns An RPC receipt.
|
|
160
|
+
*/
|
|
161
|
+
export declare function toRpc(receipt: TransactionReceipt): Rpc;
|
|
162
|
+
export declare namespace toRpc {
|
|
163
|
+
type ErrorType = ox_TransactionReceipt.toRpc.ErrorType;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=TransactionReceipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionReceipt.d.ts","sourceRoot":"","sources":["../../tempo/TransactionReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,KAAK,GAAG,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAA;AAEtE;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,CAC5B,MAAM,GAAG,qBAAqB,CAAC,MAAM,EACrC,IAAI,GAAG,qBAAqB,CAAC,IAAI,EACjC,UAAU,GAAG,MAAM,EACnB,UAAU,GAAG,MAAM,IACjB,OAAO,CACT,qBAAqB,CAAC,kBAAkB,CACtC,MAAM,EACN,IAAI,EACJ,UAAU,EACV,UAAU,C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W,KAAK,CAAC;IAC7B,KAAY,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC,SAAS,CAAA;CAC9D"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type * as Errors from '../core/Errors.js';
|
|
2
|
+
import * as Hex from '../core/Hex.js';
|
|
3
|
+
import type { Compute } from '../core/internal/types.js';
|
|
4
|
+
import * as ox_TransactionRequest from '../core/TransactionRequest.js';
|
|
5
|
+
import * as AuthorizationTempo from './AuthorizationTempo.js';
|
|
6
|
+
import * as KeyAuthorization from './KeyAuthorization.js';
|
|
7
|
+
import * as TokenId from './TokenId.js';
|
|
8
|
+
import type { Call } from './TxEnvelopeTempo.js';
|
|
9
|
+
type KeyType = 'secp256k1' | 'p256' | 'webAuthn';
|
|
10
|
+
/**
|
|
11
|
+
* A Transaction Request that is generic to all transaction types.
|
|
12
|
+
*
|
|
13
|
+
* Extends the [Execution API specification](https://github.com/ethereum/execution-apis/blob/4aca1d7a3e5aab24c8f6437131289ad386944eaa/src/schemas/transaction.yaml#L358-L423)
|
|
14
|
+
* with Tempo-specific fields for batched calls, fee tokens, access keys, and scheduled execution.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link https://docs.tempo.xyz/protocol/transactions Tempo Transactions}
|
|
17
|
+
*/
|
|
18
|
+
export type TransactionRequest<bigintType = bigint, numberType = number, type extends string = string> = Compute<Omit<ox_TransactionRequest.TransactionRequest<bigintType, numberType, type>, 'authorizationList'> & {
|
|
19
|
+
authorizationList?: AuthorizationTempo.ListSigned<bigintType, numberType> | undefined;
|
|
20
|
+
calls?: readonly Call<bigintType>[] | undefined;
|
|
21
|
+
keyAuthorization?: KeyAuthorization.KeyAuthorization<true> | undefined;
|
|
22
|
+
keyData?: Hex.Hex | undefined;
|
|
23
|
+
keyType?: KeyType | undefined;
|
|
24
|
+
feeToken?: TokenId.TokenIdOrAddress | undefined;
|
|
25
|
+
nonceKey?: 'random' | bigintType | undefined;
|
|
26
|
+
validBefore?: numberType | undefined;
|
|
27
|
+
validAfter?: numberType | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
/** RPC representation of a {@link ox#TransactionRequest.TransactionRequest}. */
|
|
30
|
+
export type Rpc = Omit<TransactionRequest<Hex.Hex, Hex.Hex, string>, 'authorizationList' | 'keyAuthorization'> & {
|
|
31
|
+
authorizationList?: AuthorizationTempo.ListRpc | undefined;
|
|
32
|
+
keyAuthorization?: KeyAuthorization.Rpc | undefined;
|
|
33
|
+
nonceKey?: Hex.Hex | undefined;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Converts a {@link ox#TransactionRequest.TransactionRequest} to a {@link ox#TransactionRequest.Rpc}.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link https://docs.tempo.xyz/protocol/transactions Tempo Transactions}
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts twoslash
|
|
42
|
+
* import { Value } from 'ox'
|
|
43
|
+
* import { TransactionRequest } from 'ox/tempo'
|
|
44
|
+
*
|
|
45
|
+
* const request = TransactionRequest.toRpc({
|
|
46
|
+
* calls: [{
|
|
47
|
+
* data: '0xdeadbeef',
|
|
48
|
+
* to: '0xcafebabecafebabecafebabecafebabecafebabe',
|
|
49
|
+
* }],
|
|
50
|
+
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
51
|
+
* })
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ### Using with a Provider
|
|
56
|
+
*
|
|
57
|
+
* You can use {@link ox#Provider.(from:function)} to instantiate an EIP-1193 Provider and
|
|
58
|
+
* send a transaction to the Wallet using the `eth_sendTransaction` method.
|
|
59
|
+
*
|
|
60
|
+
* ```ts twoslash
|
|
61
|
+
* import 'ox/window'
|
|
62
|
+
* import { Provider, Value } from 'ox'
|
|
63
|
+
* import { TransactionRequest } from 'ox/tempo'
|
|
64
|
+
*
|
|
65
|
+
* const provider = Provider.from(window.ethereum!)
|
|
66
|
+
*
|
|
67
|
+
* const request = TransactionRequest.toRpc({
|
|
68
|
+
* calls: [{
|
|
69
|
+
* data: '0xdeadbeef',
|
|
70
|
+
* to: '0xcafebabecafebabecafebabecafebabecafebabe',
|
|
71
|
+
* }],
|
|
72
|
+
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
73
|
+
* })
|
|
74
|
+
*
|
|
75
|
+
* const hash = await provider.request({ // [!code focus]
|
|
76
|
+
* method: 'eth_sendTransaction', // [!code focus]
|
|
77
|
+
* params: [request], // [!code focus]
|
|
78
|
+
* }) // [!code focus]
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param request - The request to convert.
|
|
82
|
+
* @returns An RPC request.
|
|
83
|
+
*/
|
|
84
|
+
export declare function toRpc(request: TransactionRequest): Rpc;
|
|
85
|
+
export declare namespace toRpc {
|
|
86
|
+
type ErrorType = AuthorizationTempo.toRpcList.ErrorType | Hex.fromNumber.ErrorType | Errors.GlobalErrorType;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=TransactionRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionRequest.d.ts","sourceRoot":"","sources":["../../tempo/TransactionRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAA;AACtE,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAEhD,KAAK,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAA;AAE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