tempo.ts 0.0.6 → 0.1.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/chains.d.ts +244 -541
- package/dist/chains.d.ts.map +1 -1
- package/dist/chains.js +10 -23
- package/dist/chains.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ox/SignatureEnvelope.d.ts +245 -0
- package/dist/ox/SignatureEnvelope.d.ts.map +1 -0
- package/dist/ox/SignatureEnvelope.js +437 -0
- package/dist/ox/SignatureEnvelope.js.map +1 -0
- package/dist/ox/Transaction.d.ts +61 -24
- package/dist/ox/Transaction.d.ts.map +1 -1
- package/dist/ox/Transaction.js +63 -18
- package/dist/ox/Transaction.js.map +1 -1
- package/dist/ox/TransactionEnvelopeAA.d.ts +461 -0
- package/dist/ox/TransactionEnvelopeAA.d.ts.map +1 -0
- package/dist/ox/TransactionEnvelopeAA.js +528 -0
- package/dist/ox/TransactionEnvelopeAA.js.map +1 -0
- package/dist/ox/TransactionRequest.d.ts +7 -5
- package/dist/ox/TransactionRequest.d.ts.map +1 -1
- package/dist/ox/TransactionRequest.js +21 -12
- package/dist/ox/TransactionRequest.js.map +1 -1
- package/dist/ox/index.d.ts +5 -4
- package/dist/ox/index.d.ts.map +1 -1
- package/dist/ox/index.js +5 -4
- package/dist/ox/index.js.map +1 -1
- package/dist/prool/Instance.d.ts +0 -4
- package/dist/prool/Instance.d.ts.map +1 -1
- package/dist/prool/Instance.js +7 -7
- package/dist/prool/Instance.js.map +1 -1
- package/dist/prool/index.d.ts +1 -1
- package/dist/prool/index.d.ts.map +1 -1
- package/dist/prool/index.js +1 -1
- package/dist/prool/index.js.map +1 -1
- package/dist/viem/{abis.d.ts → Abis.d.ts} +523 -9
- package/dist/viem/Abis.d.ts.map +1 -0
- package/dist/viem/{abis.js → Abis.js} +321 -9
- package/dist/viem/Abis.js.map +1 -0
- package/dist/viem/{actions → Actions}/amm.d.ts +21 -21
- package/dist/viem/Actions/amm.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/amm.js +55 -43
- package/dist/viem/Actions/amm.js.map +1 -0
- package/dist/viem/Actions/dex.d.ts +3263 -0
- package/dist/viem/Actions/dex.d.ts.map +1 -0
- package/dist/viem/Actions/dex.js +1357 -0
- package/dist/viem/Actions/dex.js.map +1 -0
- package/dist/viem/{actions → Actions}/fee.d.ts +8 -8
- package/dist/viem/Actions/fee.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/fee.js +14 -13
- package/dist/viem/Actions/fee.js.map +1 -0
- package/dist/viem/Actions/index.d.ts +6 -0
- package/dist/viem/Actions/index.d.ts.map +1 -0
- package/dist/viem/Actions/index.js +6 -0
- package/dist/viem/Actions/index.js.map +1 -0
- package/dist/viem/{actions → Actions}/policy.d.ts +19 -19
- package/dist/viem/Actions/policy.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/policy.js +59 -46
- package/dist/viem/Actions/policy.js.map +1 -0
- package/dist/viem/{actions → Actions}/token.d.ts +3275 -698
- package/dist/viem/Actions/token.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/token.js +458 -84
- package/dist/viem/Actions/token.js.map +1 -0
- package/dist/viem/Addresses.d.ts +9 -0
- package/dist/viem/Addresses.d.ts.map +1 -0
- package/dist/viem/Addresses.js +9 -0
- package/dist/viem/Addresses.js.map +1 -0
- package/dist/viem/{chain.d.ts → Chain.d.ts} +81 -57
- package/dist/viem/Chain.d.ts.map +1 -0
- package/dist/viem/{chain.js → Chain.js} +7 -7
- package/dist/viem/Chain.js.map +1 -0
- package/dist/viem/{client.d.ts → Client.d.ts} +4 -4
- package/dist/viem/Client.d.ts.map +1 -0
- package/dist/viem/{client.js → Client.js} +3 -3
- package/dist/viem/Client.js.map +1 -0
- package/dist/viem/{decorator.d.ts → Decorator.d.ts} +507 -5
- package/dist/viem/Decorator.d.ts.map +1 -0
- package/dist/viem/{decorator.js → Decorator.js} +31 -5
- package/dist/viem/Decorator.js.map +1 -0
- package/dist/viem/{formatters.d.ts → Formatters.d.ts} +2 -2
- package/dist/viem/Formatters.d.ts.map +1 -0
- package/dist/viem/{formatters.js → Formatters.js} +24 -17
- package/dist/viem/Formatters.js.map +1 -0
- package/dist/viem/Tick.d.ts +111 -0
- package/dist/viem/Tick.d.ts.map +1 -0
- package/dist/viem/Tick.js +127 -0
- package/dist/viem/Tick.js.map +1 -0
- package/dist/viem/TokenIds.d.ts +3 -0
- package/dist/viem/TokenIds.d.ts.map +1 -0
- package/dist/viem/TokenIds.js +3 -0
- package/dist/viem/TokenIds.js.map +1 -0
- package/dist/viem/Transaction.d.ts +57 -0
- package/dist/viem/Transaction.d.ts.map +1 -0
- package/dist/viem/Transaction.js +137 -0
- package/dist/viem/Transaction.js.map +1 -0
- package/dist/viem/{transport.d.ts → Transport.d.ts} +3 -3
- package/dist/viem/Transport.d.ts.map +1 -0
- package/dist/viem/{transport.js → Transport.js} +3 -3
- package/dist/viem/Transport.js.map +1 -0
- package/dist/viem/index.d.ts +13 -9
- package/dist/viem/index.d.ts.map +1 -1
- package/dist/viem/index.js +13 -9
- package/dist/viem/index.js.map +1 -1
- package/dist/viem/{types.d.ts → internal/types.d.ts} +3 -3
- package/dist/viem/internal/types.d.ts.map +1 -0
- package/dist/viem/{types.js.map → internal/types.js.map} +1 -1
- package/dist/viem/internal/utils.d.ts.map +1 -0
- package/dist/viem/internal/utils.js.map +1 -0
- package/package.json +87 -101
- package/src/chains.ts +10 -24
- package/src/ox/SignatureEnvelope.test.ts +1252 -0
- package/src/ox/SignatureEnvelope.ts +709 -0
- package/src/ox/Transaction.test.ts +144 -89
- package/src/ox/Transaction.ts +104 -29
- package/src/ox/TransactionEnvelopeAA.test.ts +1533 -0
- package/src/ox/TransactionEnvelopeAA.ts +858 -0
- package/src/ox/TransactionRequest.ts +25 -17
- package/src/ox/index.ts +2 -1
- package/src/prool/Instance.ts +6 -14
- package/src/prool/internal/chain.json +101 -27
- package/src/viem/{abis.ts → Abis.ts} +322 -8
- package/src/viem/{actions → Actions}/amm.test.ts +65 -68
- package/src/viem/{actions → Actions}/amm.ts +72 -60
- package/src/viem/Actions/dex.test.ts +1608 -0
- package/src/viem/Actions/dex.ts +2026 -0
- package/src/viem/{actions → Actions}/fee.test.ts +34 -36
- package/src/viem/{actions → Actions}/fee.ts +18 -17
- package/src/viem/{actions → Actions}/index.ts +1 -0
- package/src/viem/{actions → Actions}/policy.test.ts +2 -2
- package/src/viem/{actions → Actions}/policy.ts +77 -64
- package/src/viem/{actions → Actions}/token.test.ts +419 -64
- package/src/viem/{actions → Actions}/token.ts +751 -145
- package/src/viem/Addresses.ts +9 -0
- package/src/viem/{chain.ts → Chain.ts} +6 -6
- package/src/viem/{client.bench-d.ts → Client.bench-d.ts} +2 -2
- package/src/viem/{client.test.ts → Client.test.ts} +31 -6
- package/src/viem/{client.ts → Client.ts} +1 -1
- package/src/viem/{decorator.bench-d.ts → Decorator.bench-d.ts} +2 -2
- package/src/viem/{decorator.test.ts → Decorator.test.ts} +1 -0
- package/src/viem/{decorator.ts → Decorator.ts} +586 -4
- package/src/viem/{formatters.ts → Formatters.ts} +31 -20
- package/src/viem/Tick.test.ts +281 -0
- package/src/viem/Tick.ts +176 -0
- package/src/viem/TokenIds.ts +2 -0
- package/src/viem/Transaction.ts +303 -0
- package/src/viem/{transport.ts → Transport.ts} +5 -5
- package/src/viem/e2e.test.ts +153 -78
- package/src/viem/index.ts +13 -9
- package/src/viem/{types.ts → internal/types.ts} +3 -3
- package/dist/ox/TransactionEnvelopeFeeToken.d.ts +0 -393
- package/dist/ox/TransactionEnvelopeFeeToken.d.ts.map +0 -1
- package/dist/ox/TransactionEnvelopeFeeToken.js +0 -452
- package/dist/ox/TransactionEnvelopeFeeToken.js.map +0 -1
- package/dist/viem/abis.d.ts.map +0 -1
- package/dist/viem/abis.js.map +0 -1
- package/dist/viem/actions/amm.d.ts.map +0 -1
- package/dist/viem/actions/amm.js.map +0 -1
- package/dist/viem/actions/fee.d.ts.map +0 -1
- package/dist/viem/actions/fee.js.map +0 -1
- package/dist/viem/actions/index.d.ts +0 -5
- package/dist/viem/actions/index.d.ts.map +0 -1
- package/dist/viem/actions/index.js +0 -5
- package/dist/viem/actions/index.js.map +0 -1
- package/dist/viem/actions/policy.d.ts.map +0 -1
- package/dist/viem/actions/policy.js.map +0 -1
- package/dist/viem/actions/token.d.ts.map +0 -1
- package/dist/viem/actions/token.js.map +0 -1
- package/dist/viem/addresses.d.ts +0 -8
- package/dist/viem/addresses.d.ts.map +0 -1
- package/dist/viem/addresses.js +0 -8
- package/dist/viem/addresses.js.map +0 -1
- package/dist/viem/chain.d.ts.map +0 -1
- package/dist/viem/chain.js.map +0 -1
- package/dist/viem/client.d.ts.map +0 -1
- package/dist/viem/client.js.map +0 -1
- package/dist/viem/decorator.d.ts.map +0 -1
- package/dist/viem/decorator.js.map +0 -1
- package/dist/viem/formatters.d.ts.map +0 -1
- package/dist/viem/formatters.js.map +0 -1
- package/dist/viem/transaction.d.ts +0 -54
- package/dist/viem/transaction.d.ts.map +0 -1
- package/dist/viem/transaction.js +0 -108
- package/dist/viem/transaction.js.map +0 -1
- package/dist/viem/transport.d.ts.map +0 -1
- package/dist/viem/transport.js.map +0 -1
- package/dist/viem/types.d.ts.map +0 -1
- package/dist/viem/utils.d.ts.map +0 -1
- package/dist/viem/utils.js.map +0 -1
- package/src/ox/TransactionEnvelopeFeeToken.test.ts +0 -1119
- package/src/ox/TransactionEnvelopeFeeToken.ts +0 -717
- package/src/prool/internal/consensus.toml +0 -32
- package/src/viem/addresses.ts +0 -10
- package/src/viem/transaction.ts +0 -253
- /package/dist/viem/{types.js → internal/types.js} +0 -0
- /package/dist/viem/{utils.d.ts → internal/utils.d.ts} +0 -0
- /package/dist/viem/{utils.js → internal/utils.js} +0 -0
- /package/src/viem/{utils.ts → internal/utils.ts} +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
signer = "0x117be1de549d1d4322c4711f11efa0c5137903124f85fc37c761ffc91ace30cb"
|
|
2
|
-
share = "0x006b170a6a737021ce871c154f6681ea2297b65bfcce6eb2e6a43c5e8a40fefba4"
|
|
3
|
-
polynomial = "0x98c6e82fdf8990fa8b78df3788c45d4a36d83dd6c4e619b7b746abe12891427dd93ccd2d00596b8a87a5b084578fd2cf0a1f3a02672f4b370b2601e6425f873eafeb10a62adaa093b503a8630b89994c5f1401e62001896d2bd4f858be2cb94186445b36c1e706cf466b003845b0aabdade971bd12eae6c97c5c489d77b55301fc0c20d3c70172c9e80441cf1c1168680906ac1638aa86671fb3e5cecbc9356b30044ca8e8cc1b3baa4389d62fba2812e1d3820f63f7785f763f82fb3b3cf1a787f4417a797c779941dc3a61fe17cf23ea885f447cd319aed4ebe916242968f781480c2c06980ec7c1b6b6c73f0b51cf04f301e6bd7d10b45e2106510af7bff7ee392f4319224352722fd1cd5c1d1f2785caf6808be769232813fd78804397b7"
|
|
4
|
-
listen_port = 8000
|
|
5
|
-
metrics_port = 8001
|
|
6
|
-
storage_directory = "/tmp/consensus"
|
|
7
|
-
worker_threads = 3
|
|
8
|
-
bootstrappers = [
|
|
9
|
-
"0x2a685998ee44953a3eb0a5d316937f810a80bdcc952c0aa07b4d82b3fed459c2",
|
|
10
|
-
]
|
|
11
|
-
message_backlog = 16384
|
|
12
|
-
mailbox_size = 16384
|
|
13
|
-
deque_size = 10
|
|
14
|
-
fee_recipient = "0x0000000000000000000000000000000000000000"
|
|
15
|
-
|
|
16
|
-
[p2p]
|
|
17
|
-
max_message_size_bytes = 1048576
|
|
18
|
-
|
|
19
|
-
[peers]
|
|
20
|
-
0x0c229e27a8c69e7afe86900dfbceab6ef6d207582c127a0d99fe9b3fb5a2068a = "tempo-validator-0:8000"
|
|
21
|
-
0x2a685998ee44953a3eb0a5d316937f810a80bdcc952c0aa07b4d82b3fed459c2 = "tempo-validator-1:8000"
|
|
22
|
-
0x7f7fdd1ca8d7c3ed8206137178b47bcafe7a54d4a0b4ce5bd9e25978184b48ce = "tempo-validator-2:8000"
|
|
23
|
-
0xee1aa49a4459dfe813a3cf6eb882041230c7b2558469de81f87c9bf23bf10a03 = "tempo-validator-3:8000"
|
|
24
|
-
|
|
25
|
-
[timeouts]
|
|
26
|
-
time_for_peer_response = "200ms"
|
|
27
|
-
time_to_collect_notarizations = "200ms"
|
|
28
|
-
time_to_propose = "200ms"
|
|
29
|
-
time_to_retry_nullify_broadcast = "3s"
|
|
30
|
-
views_to_track = 256
|
|
31
|
-
views_until_leader_skip = 32
|
|
32
|
-
new_payload_wait_time = "100ms"
|
package/src/viem/addresses.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const accountImplementationAddress =
|
|
2
|
-
'0x7702c00000000000000000000000000000000000'
|
|
3
|
-
export const accountRegistrarAddress =
|
|
4
|
-
'0x7702ac0000000000000000000000000000000000'
|
|
5
|
-
export const feeManagerAddress = '0xfeec000000000000000000000000000000000000'
|
|
6
|
-
export const tip20FactoryAddress = '0x20fc000000000000000000000000000000000000'
|
|
7
|
-
export const tip403RegistryAddress =
|
|
8
|
-
'0x403c000000000000000000000000000000000000'
|
|
9
|
-
export const usdAddress = '0x20c0000000000000000000000000000000000000'
|
|
10
|
-
export const usdId = 0n
|
package/src/viem/transaction.ts
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import type * as Calls from 'ox/erc7821/Calls'
|
|
2
|
-
import * as Execute from 'ox/erc7821/Execute'
|
|
3
|
-
import * as Hex from 'ox/Hex'
|
|
4
|
-
import * as Secp256k1 from 'ox/Secp256k1'
|
|
5
|
-
import * as Signature from 'ox/Signature'
|
|
6
|
-
import {
|
|
7
|
-
type AccessList,
|
|
8
|
-
type Account,
|
|
9
|
-
type Address,
|
|
10
|
-
type AuthorizationList,
|
|
11
|
-
type FeeValuesEIP1559,
|
|
12
|
-
type ParseTransactionReturnType,
|
|
13
|
-
type SignedAuthorizationList,
|
|
14
|
-
type TransactionBase,
|
|
15
|
-
type TransactionRequestBase,
|
|
16
|
-
type TransactionSerializableBase,
|
|
17
|
-
type TransactionSerializableGeneric,
|
|
18
|
-
type TransactionSerializedGeneric,
|
|
19
|
-
parseTransaction as viem_parseTransaction,
|
|
20
|
-
type RpcTransaction as viem_RpcTransaction,
|
|
21
|
-
type RpcTransactionRequest as viem_RpcTransactionRequest,
|
|
22
|
-
type Signature as viem_Signature,
|
|
23
|
-
serializeTransaction as viem_serializeTransaction,
|
|
24
|
-
type Transaction as viem_Transaction,
|
|
25
|
-
type TransactionRequest as viem_TransactionRequest,
|
|
26
|
-
type TransactionSerializable as viem_TransactionSerializable,
|
|
27
|
-
type TransactionSerialized as viem_TransactionSerialized,
|
|
28
|
-
type TransactionType as viem_TransactionType,
|
|
29
|
-
} from 'viem'
|
|
30
|
-
import type { ExactPartial, OneOf } from '../internal/types.js'
|
|
31
|
-
import * as TxFeeToken from '../ox/TransactionEnvelopeFeeToken.js'
|
|
32
|
-
|
|
33
|
-
export type Transaction<
|
|
34
|
-
bigintType = bigint,
|
|
35
|
-
numberType = number,
|
|
36
|
-
pending extends boolean = false,
|
|
37
|
-
> = OneOf<
|
|
38
|
-
| viem_Transaction<bigintType, numberType, pending>
|
|
39
|
-
| TransactionFeeToken<bigintType, numberType, pending>
|
|
40
|
-
>
|
|
41
|
-
export type TransactionRpc<pending extends boolean = false> = OneOf<
|
|
42
|
-
| viem_RpcTransaction<pending>
|
|
43
|
-
| TransactionFeeToken<Hex.Hex, Hex.Hex, pending, '0x77'>
|
|
44
|
-
>
|
|
45
|
-
|
|
46
|
-
export type TransactionFeeToken<
|
|
47
|
-
quantity = bigint,
|
|
48
|
-
index = number,
|
|
49
|
-
isPending extends boolean = boolean,
|
|
50
|
-
type = 'feeToken',
|
|
51
|
-
> = TransactionBase<quantity, index, isPending> & {
|
|
52
|
-
/** EIP-2930 Access List. */
|
|
53
|
-
accessList: AccessList
|
|
54
|
-
/** Authorization list for the transaction. */
|
|
55
|
-
authorizationList: SignedAuthorizationList
|
|
56
|
-
/** Chain ID that this transaction is valid on. */
|
|
57
|
-
chainId: index
|
|
58
|
-
/** Fee token preference. */
|
|
59
|
-
feeToken?: Address | undefined
|
|
60
|
-
/** Fee payer address. */
|
|
61
|
-
feePayer?: Address | undefined
|
|
62
|
-
/** Fee payer signature. */
|
|
63
|
-
feePayerSignature?: viem_Signature | undefined
|
|
64
|
-
type: type
|
|
65
|
-
} & FeeValuesEIP1559<quantity>
|
|
66
|
-
|
|
67
|
-
export type TransactionRequest<
|
|
68
|
-
bigintType = bigint,
|
|
69
|
-
numberType = number,
|
|
70
|
-
> = OneOf<
|
|
71
|
-
| viem_TransactionRequest<bigintType, numberType>
|
|
72
|
-
| TransactionRequestFeeToken<bigintType, numberType>
|
|
73
|
-
>
|
|
74
|
-
export type TransactionRequestRpc = OneOf<
|
|
75
|
-
| viem_RpcTransactionRequest
|
|
76
|
-
| TransactionRequestFeeToken<Hex.Hex, Hex.Hex, '0x77'>
|
|
77
|
-
>
|
|
78
|
-
|
|
79
|
-
export type TransactionRequestFeeToken<
|
|
80
|
-
quantity = bigint,
|
|
81
|
-
index = number,
|
|
82
|
-
type = 'feeToken',
|
|
83
|
-
> = TransactionRequestBase<quantity, index, type> &
|
|
84
|
-
ExactPartial<FeeValuesEIP1559<quantity>> & {
|
|
85
|
-
accessList?: AccessList | undefined
|
|
86
|
-
authorizationList?: AuthorizationList<index, boolean> | undefined
|
|
87
|
-
calls?: readonly Calls.Call[] | undefined
|
|
88
|
-
feePayer?: Account | true | undefined
|
|
89
|
-
feeToken?: Address | bigint | undefined
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type TransactionSerializable = OneOf<
|
|
93
|
-
viem_TransactionSerializable | TransactionSerializableFeeToken
|
|
94
|
-
>
|
|
95
|
-
|
|
96
|
-
export type TransactionSerializableFeeToken<
|
|
97
|
-
quantity = bigint,
|
|
98
|
-
index = number,
|
|
99
|
-
> = TransactionSerializableBase<quantity, index> &
|
|
100
|
-
ExactPartial<FeeValuesEIP1559<quantity>> & {
|
|
101
|
-
accessList?: AccessList | undefined
|
|
102
|
-
authorizationList: SignedAuthorizationList
|
|
103
|
-
feeToken?: Address | bigint | undefined
|
|
104
|
-
feePayerSignature?: viem_Signature | undefined
|
|
105
|
-
chainId: number
|
|
106
|
-
type?: 'feeToken' | undefined
|
|
107
|
-
yParity?: number | undefined
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export type TransactionSerialized<
|
|
111
|
-
type extends TransactionType = TransactionType,
|
|
112
|
-
> = viem_TransactionSerialized<type> | TransactionSerializedFeeToken
|
|
113
|
-
|
|
114
|
-
export type TransactionSerializedFeeToken = `0x77${string}`
|
|
115
|
-
|
|
116
|
-
export type TransactionType = viem_TransactionType | 'feeToken'
|
|
117
|
-
|
|
118
|
-
export function isTempoTransaction(transaction: Record<string, unknown>) {
|
|
119
|
-
if (transaction.type === 'feeToken') return true
|
|
120
|
-
if (typeof transaction.calls !== 'undefined') return true
|
|
121
|
-
if (typeof transaction.feePayer !== 'undefined') return true
|
|
122
|
-
if (typeof transaction.feeToken !== 'undefined') return true
|
|
123
|
-
return false
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function parseTransaction<
|
|
127
|
-
const serialized extends TransactionSerializedGeneric,
|
|
128
|
-
>(serializedTransaction: serialized): parseTransaction.ReturnValue<serialized> {
|
|
129
|
-
const type = Hex.slice(serializedTransaction, 0, 1)
|
|
130
|
-
if (type === '0x77') {
|
|
131
|
-
const { authorizationList, nonce, r, s, v, ...tx } = TxFeeToken.deserialize(
|
|
132
|
-
serializedTransaction as `0x77${string}`,
|
|
133
|
-
)
|
|
134
|
-
return {
|
|
135
|
-
...tx,
|
|
136
|
-
authorizationList: authorizationList?.map((auth) => ({
|
|
137
|
-
...auth,
|
|
138
|
-
nonce: Number(auth.nonce ?? 0n),
|
|
139
|
-
r: Hex.fromNumber(auth.r, { size: 32 }),
|
|
140
|
-
s: Hex.fromNumber(auth.s, { size: 32 }),
|
|
141
|
-
})),
|
|
142
|
-
nonce: Number(nonce ?? 0n),
|
|
143
|
-
...(r ? { r: Hex.fromNumber(r, { size: 32 }) } : {}),
|
|
144
|
-
...(s ? { s: Hex.fromNumber(s, { size: 32 }) } : {}),
|
|
145
|
-
...(v ? { v: BigInt(v) } : {}),
|
|
146
|
-
} satisfies TransactionSerializableGeneric as never
|
|
147
|
-
}
|
|
148
|
-
return viem_parseTransaction(serializedTransaction) as never
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export declare namespace parseTransaction {
|
|
152
|
-
export type ReturnValue<
|
|
153
|
-
serialized extends
|
|
154
|
-
TransactionSerializedGeneric = TransactionSerializedGeneric,
|
|
155
|
-
> = serialized extends TransactionSerializedFeeToken
|
|
156
|
-
? TransactionSerializableFeeToken
|
|
157
|
-
: ParseTransactionReturnType<serialized>
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export async function serializeTransaction(
|
|
161
|
-
transaction: TransactionSerializable & {
|
|
162
|
-
calls?: readonly Calls.Call[] | undefined
|
|
163
|
-
feePayer?: Account | true | undefined
|
|
164
|
-
from?: Address | undefined
|
|
165
|
-
},
|
|
166
|
-
signature?: viem_Signature | undefined,
|
|
167
|
-
) {
|
|
168
|
-
if (!isTempoTransaction(transaction))
|
|
169
|
-
return viem_serializeTransaction(transaction as never, signature)
|
|
170
|
-
|
|
171
|
-
const signature_ = transaction.r && transaction.s ? transaction : signature
|
|
172
|
-
|
|
173
|
-
const {
|
|
174
|
-
authorizationList,
|
|
175
|
-
chainId,
|
|
176
|
-
calls,
|
|
177
|
-
feePayer,
|
|
178
|
-
feePayerSignature,
|
|
179
|
-
from,
|
|
180
|
-
nonce,
|
|
181
|
-
r,
|
|
182
|
-
s,
|
|
183
|
-
v,
|
|
184
|
-
...rest
|
|
185
|
-
} = transaction
|
|
186
|
-
|
|
187
|
-
// TODO: remove once native transaction type has `calls`.
|
|
188
|
-
const { data, to, value } = (() => {
|
|
189
|
-
if (calls && from)
|
|
190
|
-
return {
|
|
191
|
-
data: Execute.encodeData(calls),
|
|
192
|
-
to: from,
|
|
193
|
-
value: 0n,
|
|
194
|
-
} as const
|
|
195
|
-
return {
|
|
196
|
-
data: transaction.data,
|
|
197
|
-
to: transaction.to,
|
|
198
|
-
value: transaction.value,
|
|
199
|
-
} as const
|
|
200
|
-
})()
|
|
201
|
-
|
|
202
|
-
const transaction_ox = {
|
|
203
|
-
...rest,
|
|
204
|
-
authorizationList: authorizationList?.map((auth) => ({
|
|
205
|
-
...auth,
|
|
206
|
-
nonce: BigInt(auth.nonce),
|
|
207
|
-
r: BigInt(auth.r!),
|
|
208
|
-
s: BigInt(auth.s!),
|
|
209
|
-
yParity: Number(auth.yParity),
|
|
210
|
-
})),
|
|
211
|
-
chainId: Number(chainId),
|
|
212
|
-
data,
|
|
213
|
-
feePayerSignature: feePayerSignature
|
|
214
|
-
? {
|
|
215
|
-
r: BigInt(feePayerSignature.r!),
|
|
216
|
-
s: BigInt(feePayerSignature.s!),
|
|
217
|
-
yParity: Number(feePayerSignature.yParity),
|
|
218
|
-
}
|
|
219
|
-
: feePayer
|
|
220
|
-
? null
|
|
221
|
-
: undefined,
|
|
222
|
-
to,
|
|
223
|
-
type: 'feeToken',
|
|
224
|
-
value,
|
|
225
|
-
...(nonce ? { nonce: BigInt(nonce) } : {}),
|
|
226
|
-
...(r ? { r: BigInt(r) } : {}),
|
|
227
|
-
...(s ? { s: BigInt(s) } : {}),
|
|
228
|
-
...(v ? { v: Number(v) } : {}),
|
|
229
|
-
} satisfies TxFeeToken.TransactionEnvelopeFeeToken
|
|
230
|
-
|
|
231
|
-
if (signature_ && typeof transaction.feePayer === 'object') {
|
|
232
|
-
const tx = TxFeeToken.from(transaction_ox, {
|
|
233
|
-
signature: signature_ as never,
|
|
234
|
-
})
|
|
235
|
-
const sender = Secp256k1.recoverAddress({
|
|
236
|
-
payload: TxFeeToken.getSignPayload(tx),
|
|
237
|
-
signature: signature_ as never,
|
|
238
|
-
})
|
|
239
|
-
const hash = TxFeeToken.getFeePayerSignPayload(tx, {
|
|
240
|
-
sender,
|
|
241
|
-
})
|
|
242
|
-
const feePayerSignature = await transaction.feePayer.sign!({
|
|
243
|
-
hash,
|
|
244
|
-
})
|
|
245
|
-
return TxFeeToken.serialize(tx, {
|
|
246
|
-
feePayerSignature: Signature.from(feePayerSignature),
|
|
247
|
-
})
|
|
248
|
-
}
|
|
249
|
-
return TxFeeToken.serialize(transaction_ox, {
|
|
250
|
-
feePayerSignature: feePayer === true ? null : undefined,
|
|
251
|
-
signature: signature as never,
|
|
252
|
-
})
|
|
253
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|