viem 2.54.0 → 2.54.2

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.
Files changed (148) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js +1 -2
  3. package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
  4. package/_cjs/chains/definitions/marsCredit.js +23 -0
  5. package/_cjs/chains/definitions/marsCredit.js.map +1 -0
  6. package/_cjs/chains/index.js +10 -8
  7. package/_cjs/chains/index.js.map +1 -1
  8. package/_cjs/clients/createClient.js +1 -0
  9. package/_cjs/clients/createClient.js.map +1 -1
  10. package/_cjs/errors/encoding.js +13 -1
  11. package/_cjs/errors/encoding.js.map +1 -1
  12. package/_cjs/errors/version.js +1 -1
  13. package/_cjs/index.js +8 -6
  14. package/_cjs/index.js.map +1 -1
  15. package/_cjs/tempo/Abis.js +49 -1
  16. package/_cjs/tempo/Abis.js.map +1 -1
  17. package/_cjs/tempo/Addresses.js +3 -1
  18. package/_cjs/tempo/Addresses.js.map +1 -1
  19. package/_cjs/tempo/Client.js +3 -1
  20. package/_cjs/tempo/Client.js.map +1 -1
  21. package/_cjs/tempo/Decorator.js.map +1 -1
  22. package/_cjs/tempo/Selectors.js +8 -1
  23. package/_cjs/tempo/Selectors.js.map +1 -1
  24. package/_cjs/tempo/actions/receivePolicy.js +29 -5
  25. package/_cjs/tempo/actions/receivePolicy.js.map +1 -1
  26. package/_cjs/tempo/actions/virtualAddress.js +2 -5
  27. package/_cjs/tempo/actions/virtualAddress.js.map +1 -1
  28. package/_cjs/tempo/actions/zone.js +69 -48
  29. package/_cjs/tempo/actions/zone.js.map +1 -1
  30. package/_cjs/tokens/definitions/cirbtc.js +16 -0
  31. package/_cjs/tokens/definitions/cirbtc.js.map +1 -0
  32. package/_cjs/tokens/definitions/eurc.js +24 -0
  33. package/_cjs/tokens/definitions/eurc.js.map +1 -0
  34. package/_cjs/tokens/definitions/usdc.js +18 -0
  35. package/_cjs/tokens/definitions/usdc.js.map +1 -1
  36. package/_cjs/tokens/definitions/usyc.js +18 -0
  37. package/_cjs/tokens/definitions/usyc.js.map +1 -0
  38. package/_cjs/tokens/index.js +9 -1
  39. package/_cjs/tokens/index.js.map +1 -1
  40. package/_cjs/tokens/sets.js +102 -0
  41. package/_cjs/tokens/sets.js.map +1 -0
  42. package/_cjs/utils/encoding/fromRlp.js +9 -0
  43. package/_cjs/utils/encoding/fromRlp.js.map +1 -1
  44. package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js +1 -2
  45. package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
  46. package/_esm/chains/definitions/marsCredit.js +20 -0
  47. package/_esm/chains/definitions/marsCredit.js.map +1 -0
  48. package/_esm/chains/index.js +1 -0
  49. package/_esm/chains/index.js.map +1 -1
  50. package/_esm/clients/createClient.js +5 -3
  51. package/_esm/clients/createClient.js.map +1 -1
  52. package/_esm/errors/encoding.js +10 -0
  53. package/_esm/errors/encoding.js.map +1 -1
  54. package/_esm/errors/version.js +1 -1
  55. package/_esm/index.js +1 -1
  56. package/_esm/index.js.map +1 -1
  57. package/_esm/tempo/Abis.js +48 -0
  58. package/_esm/tempo/Abis.js.map +1 -1
  59. package/_esm/tempo/Addresses.js +2 -0
  60. package/_esm/tempo/Addresses.js.map +1 -1
  61. package/_esm/tempo/Client.js +3 -1
  62. package/_esm/tempo/Client.js.map +1 -1
  63. package/_esm/tempo/Decorator.js.map +1 -1
  64. package/_esm/tempo/Selectors.js +7 -0
  65. package/_esm/tempo/Selectors.js.map +1 -1
  66. package/_esm/tempo/actions/receivePolicy.js +32 -5
  67. package/_esm/tempo/actions/receivePolicy.js.map +1 -1
  68. package/_esm/tempo/actions/virtualAddress.js +2 -6
  69. package/_esm/tempo/actions/virtualAddress.js.map +1 -1
  70. package/_esm/tempo/actions/zone.js +96 -49
  71. package/_esm/tempo/actions/zone.js.map +1 -1
  72. package/_esm/tokens/definitions/cirbtc.js +21 -0
  73. package/_esm/tokens/definitions/cirbtc.js.map +1 -0
  74. package/_esm/tokens/definitions/eurc.js +29 -0
  75. package/_esm/tokens/definitions/eurc.js.map +1 -0
  76. package/_esm/tokens/definitions/usdc.js +18 -0
  77. package/_esm/tokens/definitions/usdc.js.map +1 -1
  78. package/_esm/tokens/definitions/usyc.js +23 -0
  79. package/_esm/tokens/definitions/usyc.js.map +1 -0
  80. package/_esm/tokens/index.js +4 -0
  81. package/_esm/tokens/index.js.map +1 -1
  82. package/_esm/tokens/sets.js +104 -0
  83. package/_esm/tokens/sets.js.map +1 -0
  84. package/_esm/utils/encoding/fromRlp.js +12 -1
  85. package/_esm/utils/encoding/fromRlp.js.map +1 -1
  86. package/_types/account-abstraction/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
  87. package/_types/chains/definitions/marsCredit.d.ts +50 -0
  88. package/_types/chains/definitions/marsCredit.d.ts.map +1 -0
  89. package/_types/chains/index.d.ts +1 -0
  90. package/_types/chains/index.d.ts.map +1 -1
  91. package/_types/clients/createClient.d.ts +4 -3
  92. package/_types/clients/createClient.d.ts.map +1 -1
  93. package/_types/errors/encoding.d.ts +17 -0
  94. package/_types/errors/encoding.d.ts.map +1 -1
  95. package/_types/errors/version.d.ts +1 -1
  96. package/_types/index.d.ts +1 -1
  97. package/_types/index.d.ts.map +1 -1
  98. package/_types/tempo/Abis.d.ts +119 -0
  99. package/_types/tempo/Abis.d.ts.map +1 -1
  100. package/_types/tempo/Addresses.d.ts +2 -0
  101. package/_types/tempo/Addresses.d.ts.map +1 -1
  102. package/_types/tempo/Client.d.ts.map +1 -1
  103. package/_types/tempo/Decorator.d.ts +4 -0
  104. package/_types/tempo/Decorator.d.ts.map +1 -1
  105. package/_types/tempo/Selectors.d.ts +7 -0
  106. package/_types/tempo/Selectors.d.ts.map +1 -1
  107. package/_types/tempo/actions/receivePolicy.d.ts +1 -1
  108. package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
  109. package/_types/tempo/actions/virtualAddress.d.ts.map +1 -1
  110. package/_types/tempo/actions/zone.d.ts +63 -3
  111. package/_types/tempo/actions/zone.d.ts.map +1 -1
  112. package/_types/tokens/definitions/cirbtc.d.ts +21 -0
  113. package/_types/tokens/definitions/cirbtc.d.ts.map +1 -0
  114. package/_types/tokens/definitions/eurc.d.ts +29 -0
  115. package/_types/tokens/definitions/eurc.d.ts.map +1 -0
  116. package/_types/tokens/definitions/usdc.d.ts +18 -0
  117. package/_types/tokens/definitions/usdc.d.ts.map +1 -1
  118. package/_types/tokens/definitions/usyc.d.ts +23 -0
  119. package/_types/tokens/definitions/usyc.d.ts.map +1 -0
  120. package/_types/tokens/index.d.ts +4 -0
  121. package/_types/tokens/index.d.ts.map +1 -1
  122. package/_types/tokens/sets.d.ts +607 -0
  123. package/_types/tokens/sets.d.ts.map +1 -0
  124. package/_types/utils/encoding/fromRlp.d.ts +3 -3
  125. package/_types/utils/encoding/fromRlp.d.ts.map +1 -1
  126. package/account-abstraction/actions/bundler/estimateUserOperationGas.ts +1 -2
  127. package/chains/definitions/marsCredit.ts +20 -0
  128. package/chains/index.ts +1 -0
  129. package/clients/createClient.ts +5 -3
  130. package/errors/encoding.ts +26 -0
  131. package/errors/version.ts +1 -1
  132. package/index.ts +4 -0
  133. package/package.json +2 -2
  134. package/tempo/Abis.ts +49 -0
  135. package/tempo/Addresses.ts +2 -0
  136. package/tempo/Client.ts +3 -1
  137. package/tempo/Decorator.ts +3 -0
  138. package/tempo/Selectors.ts +8 -0
  139. package/tempo/actions/receivePolicy.ts +39 -4
  140. package/tempo/actions/virtualAddress.ts +2 -8
  141. package/tempo/actions/zone.ts +164 -74
  142. package/tokens/definitions/cirbtc.ts +21 -0
  143. package/tokens/definitions/eurc.ts +29 -0
  144. package/tokens/definitions/usdc.ts +18 -0
  145. package/tokens/definitions/usyc.ts +23 -0
  146. package/tokens/index.ts +4 -0
  147. package/tokens/sets.ts +109 -0
  148. package/utils/encoding/fromRlp.ts +18 -1
@@ -33,29 +33,47 @@ export const usdc = /*#__PURE__*/ defineToken({
33
33
  addresses: {
34
34
  1: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // mainnet
35
35
  10: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', // optimism
36
+ 25: '0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D', // cronos
37
+ 50: '0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1', // xdc
38
+ 51: '0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4', // xdcTestnet
36
39
  130: '0x078D782b760474a361dDA0AF3839290b0EF57AD6', // unichain
37
40
  137: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', // polygon
41
+ 143: '0x754704Bc059F8C67012fEd69BC8A327a5aafb603', // monad
38
42
  146: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894', // sonic
43
+ 300: '0xAe045DE5638162fa134807Cb558E15A3F5A7F853', // zksyncSepoliaTestnet
44
+ 324: '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4', // zksync
45
+ 338: '0xEb33dc5fac03833e132593659e1dE7256aB59794', // cronosTestnet
39
46
  480: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1', // worldchain
47
+ 998: '0x2B3370eE501B4a559b57D449569354196457D8Ab', // hyperliquidEvmTestnet
48
+ 999: '0xb88339CB7199b77E23DB6E890353E22632Ba630f', // hyperEvm
40
49
  1301: '0x31d0220469e10c4E71834a79b1f276d740d3768F', // unichainSepolia
41
50
  1328: '0x4fCF1784B31630811181f670Aea7A7bEF803eaED', // seiTestnet
42
51
  1329: '0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392', // sei
52
+ 1439: '0x0C382e685bbeeFE5d3d9C29e29E341fEE8E84C5d', // injectiveTestnet
53
+ 1776: '0xa00C59fF5a080D2b954d0c75e46E22a0c371235a', // injective
54
+ 2818: '0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B', // morph
43
55
  4801: '0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88', // worldchainSepolia
44
56
  8453: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // base
57
+ 10143: '0x534b2f3A21130d7a60830c2Df862319e593943A3', // monadTestnet
45
58
  42161: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // arbitrum
59
+ 42220: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C', // celo
46
60
  43113: '0x5425890298aed601595a70AB815c96711a31Bc65', // avalancheFuji
47
61
  43114: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', // avalanche
48
62
  57054: '0xA4879Fed32Ecbef99399e5cbC247E533421C4eC6', // sonicBlazeTestnet
49
63
  57073: '0x2D270e6886d130D724215A266106e6832161EAEd', // ink
50
64
  59141: '0xFEce4462D57bD51A6A552365A011b95f0E16d9B7', // lineaSepolia
51
65
  59144: '0x176211869cA2b568f2A7D4EE941E073a821EE1ff', // linea
66
+ 64165: '0x0BA304580ee7c9a980CF72e55f5Ed2E9fd30Bc51', // sonicTestnet
52
67
  80002: '0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582', // polygonAmoy
53
68
  81224: '0xd996633a415985DBd7D6D12f4A4343E31f5037cf', // codex
54
69
  84532: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', // baseSepolia
70
+ 98866: '0x222365EF19F7947e5484218551B56bb3965Aa7aF', // plumeMainnet
71
+ 98867: '0xcB5f30e335672893c7eb944B374c196392C19D18', // plumeSepolia
55
72
  421614: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d', // arbitrumSepolia
56
73
  763373: '0xFabab97dCE620294D2B0b0e46C68964e326300Ac', // inkSepolia
57
74
  812242: '0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f', // codexTestnet
58
75
  5042002: '0x3600000000000000000000000000000000000000', // arcTestnet
76
+ 11142220: '0x01C5C0122039549AD1493B8220cABEdD739BC44E', // celoSepolia
59
77
  11155111: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', // sepolia
60
78
  11155420: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7', // optimismSepolia
61
79
  },
@@ -0,0 +1,23 @@
1
+ import { defineToken } from '../defineToken.js'
2
+
3
+ /**
4
+ * [USYC](https://developers.circle.com/tokenized/usyc/overview) token, with
5
+ * canonical contract addresses across supported EVM chains.
6
+ *
7
+ * Pass to a Client's `tokens` array, call with a chain id to produce a
8
+ * [token config](/docs/chains/tokens), or read the metadata and `addresses`
9
+ * map directly.
10
+ */
11
+ export const usyc = /*#__PURE__*/ defineToken({
12
+ addresses: {
13
+ 1: '0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b', // mainnet
14
+ 56: '0x8D0fA28f221eB5735BC71d3a0Da67EE5bC821311', // bsc
15
+ 97: '0x109656Aba6F175c634c63C9874f29CeAAAB8E606', // bscTestnet
16
+ 5042002: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C', // arcTestnet
17
+ 11155111: '0x38D3A3f8717F4DB1CcB4Ad7D8C755919440848A3', // sepolia
18
+ },
19
+ currency: 'USD',
20
+ decimals: 6,
21
+ name: 'US Yield Coin',
22
+ symbol: 'USYC',
23
+ })
package/tokens/index.ts CHANGED
@@ -5,9 +5,11 @@ export { betausd } from './definitions/betausd.js'
5
5
  export { brla } from './definitions/brla.js'
6
6
  export { cbbtc } from './definitions/cbbtc.js'
7
7
  export { chfau } from './definitions/chfau.js'
8
+ export { cirbtc } from './definitions/cirbtc.js'
8
9
  export { cusd } from './definitions/cusd.js'
9
10
  export { dlusd } from './definitions/dlusd.js'
10
11
  export { eurau } from './definitions/eurau.js'
12
+ export { eurc } from './definitions/eurc.js'
11
13
  export { eurce } from './definitions/eurce.js'
12
14
  export { frxusd } from './definitions/frxusd.js'
13
15
  export { gbpa } from './definitions/gbpa.js'
@@ -28,4 +30,6 @@ export { usdc } from './definitions/usdc.js'
28
30
  export { usdce } from './definitions/usdce.js'
29
31
  export { usde } from './definitions/usde.js'
30
32
  export { usdt0 } from './definitions/usdt0.js'
33
+ export { usyc } from './definitions/usyc.js'
31
34
  export { wsrusd } from './definitions/wsrusd.js'
35
+ export { tokens } from './sets.js'
package/tokens/sets.ts ADDED
@@ -0,0 +1,109 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import type { Tokens } from './defineToken.js'
4
+ import { alphausd } from './definitions/alphausd.js'
5
+ import { betausd } from './definitions/betausd.js'
6
+ import { brla } from './definitions/brla.js'
7
+ import { cbbtc } from './definitions/cbbtc.js'
8
+ import { chfau } from './definitions/chfau.js'
9
+ import { cirbtc } from './definitions/cirbtc.js'
10
+ import { cusd } from './definitions/cusd.js'
11
+ import { dlusd } from './definitions/dlusd.js'
12
+ import { eurau } from './definitions/eurau.js'
13
+ import { eurc } from './definitions/eurc.js'
14
+ import { eurce } from './definitions/eurce.js'
15
+ import { frxusd } from './definitions/frxusd.js'
16
+ import { gbpa } from './definitions/gbpa.js'
17
+ import { gusd } from './definitions/gusd.js'
18
+ import { iusd } from './definitions/iusd.js'
19
+ import { pathusd } from './definitions/pathusd.js'
20
+ import { reusd } from './definitions/reusd.js'
21
+ import { rusd } from './definitions/rusd.js'
22
+ import { sbc } from './definitions/sbc.js'
23
+ import { siusd } from './definitions/siusd.js'
24
+ import { stcusd } from './definitions/stcusd.js'
25
+ import { susde } from './definitions/susde.js'
26
+ import { syrupusdc } from './definitions/syrupusdc.js'
27
+ import { thetausd } from './definitions/thetausd.js'
28
+ import { usd1 } from './definitions/usd1.js'
29
+ import { usdb } from './definitions/usdb.js'
30
+ import { usdc } from './definitions/usdc.js'
31
+ import { usdce } from './definitions/usdce.js'
32
+ import { usde } from './definitions/usde.js'
33
+ import { usdt0 } from './definitions/usdt0.js'
34
+ import { usyc } from './definitions/usyc.js'
35
+ import { wsrusd } from './definitions/wsrusd.js'
36
+
37
+ /** Every token definition. */
38
+ const all = [
39
+ alphausd,
40
+ betausd,
41
+ brla,
42
+ cbbtc,
43
+ chfau,
44
+ cirbtc,
45
+ cusd,
46
+ dlusd,
47
+ eurau,
48
+ eurc,
49
+ eurce,
50
+ frxusd,
51
+ gbpa,
52
+ gusd,
53
+ iusd,
54
+ pathusd,
55
+ reusd,
56
+ rusd,
57
+ sbc,
58
+ siusd,
59
+ stcusd,
60
+ susde,
61
+ syrupusdc,
62
+ thetausd,
63
+ usd1,
64
+ usdb,
65
+ usdc,
66
+ usdce,
67
+ usde,
68
+ usdt0,
69
+ usyc,
70
+ wsrusd,
71
+ ] as const satisfies Tokens
72
+
73
+ /** Tokens flagged as popular. */
74
+ const popular = [usdc] as const satisfies Tokens
75
+
76
+ /** All tokens available on Tempo chains. */
77
+ const tempo = [
78
+ alphausd,
79
+ betausd,
80
+ brla,
81
+ cbbtc,
82
+ chfau,
83
+ cusd,
84
+ dlusd,
85
+ eurau,
86
+ eurce,
87
+ frxusd,
88
+ gbpa,
89
+ gusd,
90
+ iusd,
91
+ pathusd,
92
+ reusd,
93
+ rusd,
94
+ sbc,
95
+ siusd,
96
+ stcusd,
97
+ susde,
98
+ syrupusdc,
99
+ thetausd,
100
+ usd1,
101
+ usdb,
102
+ usdce,
103
+ usde,
104
+ usdt0,
105
+ wsrusd,
106
+ ] as const satisfies Tokens
107
+
108
+ /** Curated token sets that can be passed to a Client's `tokens` property. */
109
+ export const tokens = { all, popular, tempo }
@@ -4,6 +4,10 @@ import {
4
4
  type InvalidHexValueErrorType,
5
5
  RlpDepthLimitExceededError,
6
6
  type RlpDepthLimitExceededErrorType,
7
+ RlpListBoundaryExceededError,
8
+ type RlpListBoundaryExceededErrorType,
9
+ RlpTrailingBytesError,
10
+ type RlpTrailingBytesErrorType,
7
11
  } from '../../errors/encoding.js'
8
12
  import type { ErrorType } from '../../errors/utils.js'
9
13
  import type { ByteArray, Hex } from '../../types/misc.js'
@@ -31,6 +35,7 @@ export type FromRlpErrorType =
31
35
  | HexToBytesErrorType
32
36
  | InvalidHexValueErrorType
33
37
  | RlpDepthLimitExceededErrorType
38
+ | RlpTrailingBytesErrorType
34
39
  | ErrorType
35
40
 
36
41
  export function fromRlp<to extends To = 'hex'>(
@@ -51,6 +56,12 @@ export function fromRlp<to extends To = 'hex'>(
51
56
  })
52
57
  const result = fromRlpCursor(cursor, to)
53
58
 
59
+ // RLP payloads encode exactly one item (Yellow Paper, Appendix B).
60
+ if (cursor.position < cursor.bytes.length)
61
+ throw new RlpTrailingBytesError({
62
+ count: cursor.bytes.length - cursor.position,
63
+ })
64
+
54
65
  return result as FromRlpReturnType<to>
55
66
  }
56
67
 
@@ -105,7 +116,7 @@ function readLength(cursor: Cursor, prefix: number, offset: number) {
105
116
  throw new BaseError('Invalid RLP prefix')
106
117
  }
107
118
 
108
- type ReadListErrorType = ErrorType
119
+ type ReadListErrorType = RlpListBoundaryExceededErrorType | ErrorType
109
120
 
110
121
  function readList<to extends To>(
111
122
  cursor: Cursor,
@@ -117,5 +128,11 @@ function readList<to extends To>(
117
128
  const value: FromRlpReturnType<to>[] = []
118
129
  while (cursor.position - position < length)
119
130
  value.push(fromRlpCursor(cursor, to, recursiveDepth))
131
+ // Items must consume exactly the declared list length.
132
+ if (cursor.position - position !== length)
133
+ throw new RlpListBoundaryExceededError({
134
+ consumed: cursor.position - position,
135
+ declared: length,
136
+ })
120
137
  return value
121
138
  }