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,523 @@
|
|
|
1
|
+
import { Transaction } from 'ox/tempo'
|
|
2
|
+
import { describe, expect, test } from 'vitest'
|
|
3
|
+
|
|
4
|
+
describe('fromRpc', () => {
|
|
5
|
+
test('default', () => {
|
|
6
|
+
const transaction = Transaction.fromRpc({
|
|
7
|
+
accessList: [],
|
|
8
|
+
calls: [
|
|
9
|
+
{
|
|
10
|
+
input: '0xdeadbeef',
|
|
11
|
+
to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
12
|
+
value: '0x9b6e64a8ec60000',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
maxFeePerGas: '0x2',
|
|
16
|
+
maxPriorityFeePerGas: '0x1',
|
|
17
|
+
hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
18
|
+
nonce: '0x357',
|
|
19
|
+
blockHash:
|
|
20
|
+
'0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
21
|
+
blockNumber: '0x12f296f',
|
|
22
|
+
transactionIndex: '0x2',
|
|
23
|
+
feeToken: '0x20c0000000000000000000000000000000000000',
|
|
24
|
+
from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
25
|
+
gas: '0x43f5d',
|
|
26
|
+
gasPrice: '0x2ca6ae494',
|
|
27
|
+
signature: {
|
|
28
|
+
r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
|
|
29
|
+
s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
|
|
30
|
+
v: '0x0',
|
|
31
|
+
type: 'secp256k1',
|
|
32
|
+
yParity: '0x0',
|
|
33
|
+
},
|
|
34
|
+
chainId: '0x1',
|
|
35
|
+
type: '0x76',
|
|
36
|
+
})
|
|
37
|
+
expect(transaction).toMatchInlineSnapshot(`
|
|
38
|
+
{
|
|
39
|
+
"accessList": [],
|
|
40
|
+
"blockHash": "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b",
|
|
41
|
+
"blockNumber": 19868015n,
|
|
42
|
+
"calls": [
|
|
43
|
+
{
|
|
44
|
+
"data": "0xdeadbeef",
|
|
45
|
+
"to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
|
|
46
|
+
"value": 700000000000000000n,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
"chainId": 1,
|
|
50
|
+
"data": undefined,
|
|
51
|
+
"feeToken": "0x20c0000000000000000000000000000000000000",
|
|
52
|
+
"from": "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
53
|
+
"gas": 278365n,
|
|
54
|
+
"gasPrice": 11985937556n,
|
|
55
|
+
"hash": "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0",
|
|
56
|
+
"maxFeePerGas": 2n,
|
|
57
|
+
"maxPriorityFeePerGas": 1n,
|
|
58
|
+
"nonce": 855n,
|
|
59
|
+
"signature": {
|
|
60
|
+
"signature": {
|
|
61
|
+
"r": 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
62
|
+
"s": 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
63
|
+
"yParity": 0,
|
|
64
|
+
},
|
|
65
|
+
"type": "secp256k1",
|
|
66
|
+
},
|
|
67
|
+
"transactionIndex": 2,
|
|
68
|
+
"type": "tempo",
|
|
69
|
+
"value": 0n,
|
|
70
|
+
}
|
|
71
|
+
`)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
test('with feePayerSignature', () => {
|
|
75
|
+
const transaction = Transaction.fromRpc({
|
|
76
|
+
accessList: [],
|
|
77
|
+
calls: [
|
|
78
|
+
{
|
|
79
|
+
input: '0xdeadbeef',
|
|
80
|
+
to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
81
|
+
value: '0x9b6e64a8ec60000',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
feePayerSignature: {
|
|
85
|
+
r: '0x12f4d9e9924f62b19de816252efc125006298f43e62d394151e62600e2c2f91e',
|
|
86
|
+
s: '0x31daa78bb3e95dd22f6370e59617c60d109bf28e55c92b25994ddbed420e2a80',
|
|
87
|
+
v: '0x0',
|
|
88
|
+
yParity: '0x0',
|
|
89
|
+
},
|
|
90
|
+
maxFeePerGas: '0x2',
|
|
91
|
+
maxPriorityFeePerGas: '0x1',
|
|
92
|
+
hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
93
|
+
nonce: '0x357',
|
|
94
|
+
blockHash:
|
|
95
|
+
'0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
96
|
+
blockNumber: '0x12f296f',
|
|
97
|
+
transactionIndex: '0x2',
|
|
98
|
+
feeToken: '0x20c0000000000000000000000000000000000000',
|
|
99
|
+
from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
100
|
+
gas: '0x43f5d',
|
|
101
|
+
gasPrice: '0x2ca6ae494',
|
|
102
|
+
signature: {
|
|
103
|
+
r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
|
|
104
|
+
s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
|
|
105
|
+
v: '0x0',
|
|
106
|
+
type: 'secp256k1',
|
|
107
|
+
yParity: '0x0',
|
|
108
|
+
},
|
|
109
|
+
chainId: '0x1',
|
|
110
|
+
type: '0x76',
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
expect(transaction).toMatchInlineSnapshot(`
|
|
114
|
+
{
|
|
115
|
+
"accessList": [],
|
|
116
|
+
"blockHash": "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b",
|
|
117
|
+
"blockNumber": 19868015n,
|
|
118
|
+
"calls": [
|
|
119
|
+
{
|
|
120
|
+
"data": "0xdeadbeef",
|
|
121
|
+
"to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
|
|
122
|
+
"value": 700000000000000000n,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
"chainId": 1,
|
|
126
|
+
"data": undefined,
|
|
127
|
+
"feePayerSignature": {
|
|
128
|
+
"r": 8574245934337799659042750864278046211314109527666697413298781631396794530078n,
|
|
129
|
+
"s": 22549658598721143185960614158212618570884225122794367192341714237232002247296n,
|
|
130
|
+
"v": 27,
|
|
131
|
+
"yParity": 0,
|
|
132
|
+
},
|
|
133
|
+
"feeToken": "0x20c0000000000000000000000000000000000000",
|
|
134
|
+
"from": "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
135
|
+
"gas": 278365n,
|
|
136
|
+
"gasPrice": 11985937556n,
|
|
137
|
+
"hash": "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0",
|
|
138
|
+
"maxFeePerGas": 2n,
|
|
139
|
+
"maxPriorityFeePerGas": 1n,
|
|
140
|
+
"nonce": 855n,
|
|
141
|
+
"signature": {
|
|
142
|
+
"signature": {
|
|
143
|
+
"r": 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
144
|
+
"s": 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
145
|
+
"yParity": 0,
|
|
146
|
+
},
|
|
147
|
+
"type": "secp256k1",
|
|
148
|
+
},
|
|
149
|
+
"transactionIndex": 2,
|
|
150
|
+
"type": "tempo",
|
|
151
|
+
"value": 0n,
|
|
152
|
+
}
|
|
153
|
+
`)
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
test('with keyAuthorization', () => {
|
|
157
|
+
const transaction = Transaction.fromRpc({
|
|
158
|
+
accessList: [],
|
|
159
|
+
calls: [
|
|
160
|
+
{
|
|
161
|
+
input: '0xdeadbeef',
|
|
162
|
+
to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
163
|
+
value: '0x9b6e64a8ec60000',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
keyAuthorization: {
|
|
167
|
+
expiry: '0xffffffffffff',
|
|
168
|
+
keyId: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
|
|
169
|
+
keyType: 'secp256k1',
|
|
170
|
+
limits: [
|
|
171
|
+
{
|
|
172
|
+
token: '0x20c0000000000000000000000000000000000001',
|
|
173
|
+
limit: '0x8ac7230489e80000',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
signature: {
|
|
177
|
+
r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
|
|
178
|
+
s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
|
|
179
|
+
type: 'secp256k1',
|
|
180
|
+
yParity: '0x0',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
maxFeePerGas: '0x2',
|
|
184
|
+
maxPriorityFeePerGas: '0x1',
|
|
185
|
+
hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
186
|
+
nonce: '0x357',
|
|
187
|
+
blockHash:
|
|
188
|
+
'0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
189
|
+
blockNumber: '0x12f296f',
|
|
190
|
+
transactionIndex: '0x2',
|
|
191
|
+
feeToken: '0x20c0000000000000000000000000000000000000',
|
|
192
|
+
from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
193
|
+
gas: '0x43f5d',
|
|
194
|
+
gasPrice: '0x2ca6ae494',
|
|
195
|
+
signature: {
|
|
196
|
+
r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
|
|
197
|
+
s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
|
|
198
|
+
v: '0x0',
|
|
199
|
+
type: 'secp256k1',
|
|
200
|
+
yParity: '0x0',
|
|
201
|
+
},
|
|
202
|
+
chainId: '0x1',
|
|
203
|
+
type: '0x76',
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
expect(transaction).toMatchInlineSnapshot(`
|
|
207
|
+
{
|
|
208
|
+
"accessList": [],
|
|
209
|
+
"blockHash": "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b",
|
|
210
|
+
"blockNumber": 19868015n,
|
|
211
|
+
"calls": [
|
|
212
|
+
{
|
|
213
|
+
"data": "0xdeadbeef",
|
|
214
|
+
"to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
|
|
215
|
+
"value": 700000000000000000n,
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
"chainId": 1,
|
|
219
|
+
"data": undefined,
|
|
220
|
+
"feeToken": "0x20c0000000000000000000000000000000000000",
|
|
221
|
+
"from": "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
222
|
+
"gas": 278365n,
|
|
223
|
+
"gasPrice": 11985937556n,
|
|
224
|
+
"hash": "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0",
|
|
225
|
+
"keyAuthorization": {
|
|
226
|
+
"address": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
|
|
227
|
+
"chainId": 0n,
|
|
228
|
+
"expiry": 281474976710655,
|
|
229
|
+
"limits": [
|
|
230
|
+
{
|
|
231
|
+
"limit": 10000000000000000000n,
|
|
232
|
+
"token": "0x20c0000000000000000000000000000000000001",
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
"signature": {
|
|
236
|
+
"signature": {
|
|
237
|
+
"r": 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
238
|
+
"s": 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
239
|
+
"yParity": 0,
|
|
240
|
+
},
|
|
241
|
+
"type": "secp256k1",
|
|
242
|
+
},
|
|
243
|
+
"type": "secp256k1",
|
|
244
|
+
},
|
|
245
|
+
"maxFeePerGas": 2n,
|
|
246
|
+
"maxPriorityFeePerGas": 1n,
|
|
247
|
+
"nonce": 855n,
|
|
248
|
+
"signature": {
|
|
249
|
+
"signature": {
|
|
250
|
+
"r": 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
251
|
+
"s": 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
252
|
+
"yParity": 0,
|
|
253
|
+
},
|
|
254
|
+
"type": "secp256k1",
|
|
255
|
+
},
|
|
256
|
+
"transactionIndex": 2,
|
|
257
|
+
"type": "tempo",
|
|
258
|
+
"value": 0n,
|
|
259
|
+
}
|
|
260
|
+
`)
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
describe('toRpc', () => {
|
|
265
|
+
test('default', () => {
|
|
266
|
+
const transaction = Transaction.toRpc({
|
|
267
|
+
accessList: [],
|
|
268
|
+
blockHash:
|
|
269
|
+
'0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
270
|
+
blockNumber: 19868015n,
|
|
271
|
+
calls: [
|
|
272
|
+
{
|
|
273
|
+
data: '0xdeadbeef',
|
|
274
|
+
to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
275
|
+
value: 700000000000000000n,
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
chainId: 1,
|
|
279
|
+
data: undefined,
|
|
280
|
+
feeToken: '0x20c0000000000000000000000000000000000000',
|
|
281
|
+
from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
282
|
+
gas: 278365n,
|
|
283
|
+
gasPrice: 11985937556n,
|
|
284
|
+
hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
285
|
+
maxFeePerGas: 2n,
|
|
286
|
+
maxPriorityFeePerGas: 1n,
|
|
287
|
+
nonce: 855n,
|
|
288
|
+
signature: {
|
|
289
|
+
signature: {
|
|
290
|
+
r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
291
|
+
s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
292
|
+
yParity: 0,
|
|
293
|
+
},
|
|
294
|
+
type: 'secp256k1',
|
|
295
|
+
},
|
|
296
|
+
transactionIndex: 2,
|
|
297
|
+
type: 'tempo',
|
|
298
|
+
})
|
|
299
|
+
expect(transaction).toMatchInlineSnapshot(`
|
|
300
|
+
{
|
|
301
|
+
"accessList": [],
|
|
302
|
+
"blockHash": "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b",
|
|
303
|
+
"blockNumber": "0x12f296f",
|
|
304
|
+
"calls": [
|
|
305
|
+
{
|
|
306
|
+
"data": "0xdeadbeef",
|
|
307
|
+
"to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
|
|
308
|
+
"value": "0x9b6e64a8ec60000",
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
"chainId": "0x1",
|
|
312
|
+
"feeToken": "0x20c0000000000000000000000000000000000000",
|
|
313
|
+
"from": "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
314
|
+
"gas": "0x43f5d",
|
|
315
|
+
"gasPrice": "0x2ca6ae494",
|
|
316
|
+
"hash": "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0",
|
|
317
|
+
"input": undefined,
|
|
318
|
+
"maxFeePerGas": "0x2",
|
|
319
|
+
"maxPriorityFeePerGas": "0x1",
|
|
320
|
+
"nonce": "0x357",
|
|
321
|
+
"signature": {
|
|
322
|
+
"r": "0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d",
|
|
323
|
+
"s": "0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540",
|
|
324
|
+
"type": "secp256k1",
|
|
325
|
+
"yParity": "0x0",
|
|
326
|
+
},
|
|
327
|
+
"to": undefined,
|
|
328
|
+
"transactionIndex": "0x2",
|
|
329
|
+
"type": "0x76",
|
|
330
|
+
"value": "0x0",
|
|
331
|
+
}
|
|
332
|
+
`)
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
test('default', () => {
|
|
336
|
+
const transaction = Transaction.toRpc({
|
|
337
|
+
accessList: [],
|
|
338
|
+
blockHash:
|
|
339
|
+
'0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
340
|
+
blockNumber: 19868015n,
|
|
341
|
+
calls: [
|
|
342
|
+
{
|
|
343
|
+
data: '0xdeadbeef',
|
|
344
|
+
to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
345
|
+
value: 700000000000000000n,
|
|
346
|
+
},
|
|
347
|
+
],
|
|
348
|
+
chainId: 1,
|
|
349
|
+
data: undefined,
|
|
350
|
+
feePayerSignature: {
|
|
351
|
+
r: 8574245934337799659042750864278046211314109527666697413298781631396794530078n,
|
|
352
|
+
s: 22549658598721143185960614158212618570884225122794367192341714237232002247296n,
|
|
353
|
+
v: 27,
|
|
354
|
+
yParity: 0,
|
|
355
|
+
},
|
|
356
|
+
feeToken: '0x20c0000000000000000000000000000000000000',
|
|
357
|
+
from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
358
|
+
gas: 278365n,
|
|
359
|
+
gasPrice: 11985937556n,
|
|
360
|
+
hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
361
|
+
maxFeePerGas: 2n,
|
|
362
|
+
maxPriorityFeePerGas: 1n,
|
|
363
|
+
nonce: 855n,
|
|
364
|
+
signature: {
|
|
365
|
+
signature: {
|
|
366
|
+
r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
367
|
+
s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
368
|
+
yParity: 0,
|
|
369
|
+
},
|
|
370
|
+
type: 'secp256k1',
|
|
371
|
+
},
|
|
372
|
+
transactionIndex: 2,
|
|
373
|
+
type: 'tempo',
|
|
374
|
+
})
|
|
375
|
+
expect(transaction).toMatchInlineSnapshot(`
|
|
376
|
+
{
|
|
377
|
+
"accessList": [],
|
|
378
|
+
"blockHash": "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b",
|
|
379
|
+
"blockNumber": "0x12f296f",
|
|
380
|
+
"calls": [
|
|
381
|
+
{
|
|
382
|
+
"data": "0xdeadbeef",
|
|
383
|
+
"to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
|
|
384
|
+
"value": "0x9b6e64a8ec60000",
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
"chainId": "0x1",
|
|
388
|
+
"feePayerSignature": {
|
|
389
|
+
"r": "0x12f4d9e9924f62b19de816252efc125006298f43e62d394151e62600e2c2f91e",
|
|
390
|
+
"s": "0x31daa78bb3e95dd22f6370e59617c60d109bf28e55c92b25994ddbed420e2a80",
|
|
391
|
+
"v": "0x1b",
|
|
392
|
+
"yParity": "0x0",
|
|
393
|
+
},
|
|
394
|
+
"feeToken": "0x20c0000000000000000000000000000000000000",
|
|
395
|
+
"from": "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
396
|
+
"gas": "0x43f5d",
|
|
397
|
+
"gasPrice": "0x2ca6ae494",
|
|
398
|
+
"hash": "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0",
|
|
399
|
+
"input": undefined,
|
|
400
|
+
"maxFeePerGas": "0x2",
|
|
401
|
+
"maxPriorityFeePerGas": "0x1",
|
|
402
|
+
"nonce": "0x357",
|
|
403
|
+
"signature": {
|
|
404
|
+
"r": "0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d",
|
|
405
|
+
"s": "0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540",
|
|
406
|
+
"type": "secp256k1",
|
|
407
|
+
"yParity": "0x0",
|
|
408
|
+
},
|
|
409
|
+
"to": undefined,
|
|
410
|
+
"transactionIndex": "0x2",
|
|
411
|
+
"type": "0x76",
|
|
412
|
+
"value": "0x0",
|
|
413
|
+
}
|
|
414
|
+
`)
|
|
415
|
+
})
|
|
416
|
+
|
|
417
|
+
test('with keyAuthorization', () => {
|
|
418
|
+
const transaction = Transaction.toRpc({
|
|
419
|
+
accessList: [],
|
|
420
|
+
blockHash:
|
|
421
|
+
'0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
422
|
+
blockNumber: 19868015n,
|
|
423
|
+
calls: [
|
|
424
|
+
{
|
|
425
|
+
data: '0xdeadbeef',
|
|
426
|
+
to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
427
|
+
value: 700000000000000000n,
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
chainId: 1,
|
|
431
|
+
data: undefined,
|
|
432
|
+
keyAuthorization: {
|
|
433
|
+
address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
|
|
434
|
+
expiry: 281474976710655,
|
|
435
|
+
type: 'secp256k1',
|
|
436
|
+
limits: [
|
|
437
|
+
{
|
|
438
|
+
limit: 10000000000000000000n,
|
|
439
|
+
token: '0x20c0000000000000000000000000000000000001',
|
|
440
|
+
},
|
|
441
|
+
],
|
|
442
|
+
signature: {
|
|
443
|
+
signature: {
|
|
444
|
+
r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
445
|
+
s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
446
|
+
yParity: 0,
|
|
447
|
+
},
|
|
448
|
+
type: 'secp256k1',
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
feeToken: '0x20c0000000000000000000000000000000000000',
|
|
452
|
+
from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
453
|
+
gas: 278365n,
|
|
454
|
+
gasPrice: 11985937556n,
|
|
455
|
+
hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
456
|
+
maxFeePerGas: 2n,
|
|
457
|
+
maxPriorityFeePerGas: 1n,
|
|
458
|
+
nonce: 855n,
|
|
459
|
+
signature: {
|
|
460
|
+
signature: {
|
|
461
|
+
r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
462
|
+
s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
463
|
+
yParity: 0,
|
|
464
|
+
},
|
|
465
|
+
type: 'secp256k1',
|
|
466
|
+
},
|
|
467
|
+
transactionIndex: 2,
|
|
468
|
+
type: 'tempo',
|
|
469
|
+
})
|
|
470
|
+
expect(transaction).toMatchInlineSnapshot(`
|
|
471
|
+
{
|
|
472
|
+
"accessList": [],
|
|
473
|
+
"blockHash": "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b",
|
|
474
|
+
"blockNumber": "0x12f296f",
|
|
475
|
+
"calls": [
|
|
476
|
+
{
|
|
477
|
+
"data": "0xdeadbeef",
|
|
478
|
+
"to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
|
|
479
|
+
"value": "0x9b6e64a8ec60000",
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
"chainId": "0x1",
|
|
483
|
+
"feeToken": "0x20c0000000000000000000000000000000000000",
|
|
484
|
+
"from": "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6",
|
|
485
|
+
"gas": "0x43f5d",
|
|
486
|
+
"gasPrice": "0x2ca6ae494",
|
|
487
|
+
"hash": "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0",
|
|
488
|
+
"input": undefined,
|
|
489
|
+
"keyAuthorization": {
|
|
490
|
+
"chainId": "0x",
|
|
491
|
+
"expiry": "0xffffffffffff",
|
|
492
|
+
"keyId": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
|
|
493
|
+
"keyType": "secp256k1",
|
|
494
|
+
"limits": [
|
|
495
|
+
{
|
|
496
|
+
"limit": "0x8ac7230489e80000",
|
|
497
|
+
"token": "0x20c0000000000000000000000000000000000001",
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
"signature": {
|
|
501
|
+
"r": "0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d",
|
|
502
|
+
"s": "0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540",
|
|
503
|
+
"type": "secp256k1",
|
|
504
|
+
"yParity": "0x0",
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
"maxFeePerGas": "0x2",
|
|
508
|
+
"maxPriorityFeePerGas": "0x1",
|
|
509
|
+
"nonce": "0x357",
|
|
510
|
+
"signature": {
|
|
511
|
+
"r": "0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d",
|
|
512
|
+
"s": "0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540",
|
|
513
|
+
"type": "secp256k1",
|
|
514
|
+
"yParity": "0x0",
|
|
515
|
+
},
|
|
516
|
+
"to": undefined,
|
|
517
|
+
"transactionIndex": "0x2",
|
|
518
|
+
"type": "0x76",
|
|
519
|
+
"value": "0x0",
|
|
520
|
+
}
|
|
521
|
+
`)
|
|
522
|
+
})
|
|
523
|
+
})
|