viem 2.55.8 → 2.55.11
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 +40 -0
- package/_cjs/account-abstraction/utils/formatters/userOperationRequest.js +1 -1
- package/_cjs/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
- package/_cjs/actions/public/estimateFeesPerGas.js +1 -1
- package/_cjs/actions/public/estimateFeesPerGas.js.map +1 -1
- package/_cjs/actions/public/fillTransaction.js +1 -1
- package/_cjs/actions/public/fillTransaction.js.map +1 -1
- package/_cjs/chains/definitions/0gMainnet.js +1 -1
- package/_cjs/chains/definitions/0gMainnet.js.map +1 -1
- package/_cjs/chains/definitions/0gTestnet.js +2 -2
- package/_cjs/chains/definitions/0gTestnet.js.map +1 -1
- package/_cjs/chains/definitions/eduChain.js +9 -2
- package/_cjs/chains/definitions/eduChain.js.map +1 -1
- package/_cjs/chains/definitions/eduChainTestnet.js +3 -4
- package/_cjs/chains/definitions/eduChainTestnet.js.map +1 -1
- package/_cjs/chains/definitions/polygonAmoy.js +1 -1
- package/_cjs/chains/definitions/polygonAmoy.js.map +1 -1
- package/_cjs/chains/definitions/story.js +7 -7
- package/_cjs/chains/definitions/story.js.map +1 -1
- package/_cjs/chains/definitions/storyAeneid.js +8 -8
- package/_cjs/chains/definitions/storyAeneid.js.map +1 -1
- package/_cjs/errors/typedData.js +11 -1
- package/_cjs/errors/typedData.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/errors/version.js.map +1 -1
- package/_cjs/index.js +5 -4
- package/_cjs/index.js.map +1 -1
- package/_cjs/tempo/Abis.js +1335 -571
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Addresses.js +2 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +197 -135
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/token.js +18 -6
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/zones/Abis.js +6 -0
- package/_cjs/tempo/zones/Abis.js.map +1 -1
- package/_cjs/tokens/definitions/usdc.js +7 -0
- package/_cjs/tokens/definitions/usdc.js.map +1 -1
- package/_cjs/utils/promise/withRetry.js +2 -2
- package/_cjs/utils/promise/withRetry.js.map +1 -1
- package/_cjs/utils/typedData.js +3 -0
- package/_cjs/utils/typedData.js.map +1 -1
- package/_esm/account-abstraction/utils/formatters/userOperationRequest.js +1 -1
- package/_esm/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
- package/_esm/actions/public/estimateFeesPerGas.js +1 -1
- package/_esm/actions/public/estimateFeesPerGas.js.map +1 -1
- package/_esm/actions/public/fillTransaction.js +1 -1
- package/_esm/actions/public/fillTransaction.js.map +1 -1
- package/_esm/chains/definitions/0gMainnet.js +1 -1
- package/_esm/chains/definitions/0gMainnet.js.map +1 -1
- package/_esm/chains/definitions/0gTestnet.js +2 -2
- package/_esm/chains/definitions/0gTestnet.js.map +1 -1
- package/_esm/chains/definitions/eduChain.js +9 -2
- package/_esm/chains/definitions/eduChain.js.map +1 -1
- package/_esm/chains/definitions/eduChainTestnet.js +3 -4
- package/_esm/chains/definitions/eduChainTestnet.js.map +1 -1
- package/_esm/chains/definitions/polygonAmoy.js +1 -1
- package/_esm/chains/definitions/polygonAmoy.js.map +1 -1
- package/_esm/chains/definitions/story.js +7 -7
- package/_esm/chains/definitions/story.js.map +1 -1
- package/_esm/chains/definitions/storyAeneid.js +8 -8
- package/_esm/chains/definitions/storyAeneid.js.map +1 -1
- package/_esm/errors/typedData.js +9 -0
- package/_esm/errors/typedData.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/errors/version.js.map +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/tempo/Abis.js +1336 -572
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Addresses.js +1 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/actions/earn.js +240 -172
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/token.js +21 -8
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/zones/Abis.js +6 -0
- package/_esm/tempo/zones/Abis.js.map +1 -1
- package/_esm/tokens/definitions/usdc.js +7 -0
- package/_esm/tokens/definitions/usdc.js.map +1 -1
- package/_esm/utils/promise/withRetry.js +2 -2
- package/_esm/utils/promise/withRetry.js.map +1 -1
- package/_esm/utils/typedData.js +4 -1
- package/_esm/utils/typedData.js.map +1 -1
- package/_types/chains/definitions/0gMainnet.d.ts +1 -1
- package/_types/chains/definitions/0gTestnet.d.ts +3 -3
- package/_types/chains/definitions/eduChain.d.ts +9 -11
- package/_types/chains/definitions/eduChain.d.ts.map +1 -1
- package/_types/chains/definitions/eduChainTestnet.d.ts +3 -4
- package/_types/chains/definitions/eduChainTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/polygonAmoy.d.ts +1 -1
- package/_types/chains/definitions/story.d.ts +7 -7
- package/_types/chains/definitions/storyAeneid.d.ts +8 -8
- package/_types/errors/typedData.d.ts +8 -0
- package/_types/errors/typedData.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/errors/version.d.ts.map +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/package.json +1 -0
- package/_types/tempo/Abis.d.ts +2153 -950
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +1 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +21 -15
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/actions/earn.d.ts +1369 -1825
- package/_types/tempo/actions/earn.d.ts.map +1 -1
- package/_types/tempo/actions/token.d.ts +1 -1
- package/_types/tempo/actions/token.d.ts.map +1 -1
- package/_types/tempo/zones/Abis.d.ts +20 -0
- package/_types/tempo/zones/Abis.d.ts.map +1 -1
- package/_types/tokens/definitions/usdc.d.ts +7 -0
- package/_types/tokens/definitions/usdc.d.ts.map +1 -1
- package/_types/tokens/sets.d.ts +14 -0
- package/_types/tokens/sets.d.ts.map +1 -1
- package/_types/utils/typedData.d.ts.map +1 -1
- package/account-abstraction/utils/formatters/userOperationRequest.ts +4 -3
- package/actions/public/estimateFeesPerGas.ts +1 -1
- package/actions/public/fillTransaction.ts +1 -1
- package/chains/definitions/0gMainnet.ts +1 -1
- package/chains/definitions/0gTestnet.ts +2 -2
- package/chains/definitions/eduChain.ts +9 -2
- package/chains/definitions/eduChainTestnet.ts +3 -4
- package/chains/definitions/polygonAmoy.ts +1 -1
- package/chains/definitions/story.ts +7 -7
- package/chains/definitions/storyAeneid.ts +8 -8
- package/errors/typedData.ts +13 -0
- package/errors/version.ts +1 -1
- package/index.ts +2 -0
- package/package.json +2 -2
- package/tempo/Abis.ts +1341 -576
- package/tempo/Addresses.ts +1 -0
- package/tempo/Decorator.ts +21 -15
- package/tempo/actions/earn.ts +365 -287
- package/tempo/actions/token.ts +60 -9
- package/tempo/zones/Abis.ts +6 -0
- package/tokens/definitions/usdc.ts +7 -0
- package/utils/promise/withRetry.ts +4 -4
- package/utils/typedData.ts +5 -0
package/tempo/actions/token.ts
CHANGED
|
@@ -4,9 +4,15 @@ import { TokenId, TokenRole } from 'ox/tempo'
|
|
|
4
4
|
import type { Account } from '../../accounts/types.js'
|
|
5
5
|
import { parseAccount } from '../../accounts/utils/parseAccount.js'
|
|
6
6
|
import { estimateContractGas } from '../../actions/public/estimateContractGas.js'
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import {
|
|
8
|
+
type MulticallParameters,
|
|
9
|
+
type MulticallReturnType,
|
|
10
|
+
multicall,
|
|
11
|
+
} from '../../actions/public/multicall.js'
|
|
12
|
+
import {
|
|
13
|
+
type ReadContractReturnType,
|
|
14
|
+
readContract,
|
|
15
|
+
} from '../../actions/public/readContract.js'
|
|
10
16
|
import {
|
|
11
17
|
type SimulateContractReturnType,
|
|
12
18
|
simulateContract,
|
|
@@ -1399,7 +1405,7 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1399
1405
|
}
|
|
1400
1406
|
|
|
1401
1407
|
if (TokenId.fromAddress(address) === TokenId.fromAddress(Addresses.pathUsd))
|
|
1402
|
-
return
|
|
1408
|
+
return readMetadataContracts(client, {
|
|
1403
1409
|
...rest,
|
|
1404
1410
|
contracts: [
|
|
1405
1411
|
{
|
|
@@ -1433,8 +1439,6 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1433
1439
|
functionName: 'totalSupply',
|
|
1434
1440
|
},
|
|
1435
1441
|
] as const,
|
|
1436
|
-
allowFailure: true,
|
|
1437
|
-
deployless: true,
|
|
1438
1442
|
}).then(([currency, decimals, logoURI, name, symbol, totalSupply]) => ({
|
|
1439
1443
|
name: unwrapMulticallResult(name),
|
|
1440
1444
|
symbol: unwrapMulticallResult(symbol),
|
|
@@ -1445,7 +1449,7 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1445
1449
|
...overrides,
|
|
1446
1450
|
}))
|
|
1447
1451
|
|
|
1448
|
-
return
|
|
1452
|
+
return readMetadataContracts(client, {
|
|
1449
1453
|
...rest,
|
|
1450
1454
|
contracts: [
|
|
1451
1455
|
{
|
|
@@ -1499,8 +1503,6 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1499
1503
|
functionName: 'transferPolicyId',
|
|
1500
1504
|
},
|
|
1501
1505
|
] as const,
|
|
1502
|
-
allowFailure: true,
|
|
1503
|
-
deployless: true,
|
|
1504
1506
|
}).then(
|
|
1505
1507
|
([
|
|
1506
1508
|
currency,
|
|
@@ -1529,6 +1531,55 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1529
1531
|
)
|
|
1530
1532
|
}
|
|
1531
1533
|
|
|
1534
|
+
async function readMetadataContracts<
|
|
1535
|
+
chain extends Chain | undefined,
|
|
1536
|
+
const contracts extends readonly unknown[],
|
|
1537
|
+
>(
|
|
1538
|
+
client: Client<Transport, chain>,
|
|
1539
|
+
parameters: Pick<
|
|
1540
|
+
MulticallParameters<contracts>,
|
|
1541
|
+
| 'blockNumber'
|
|
1542
|
+
| 'blockOverrides'
|
|
1543
|
+
| 'blockTag'
|
|
1544
|
+
| 'contracts'
|
|
1545
|
+
| 'stateOverride'
|
|
1546
|
+
>,
|
|
1547
|
+
): Promise<MulticallReturnType<contracts>>
|
|
1548
|
+
async function readMetadataContracts<chain extends Chain | undefined>(
|
|
1549
|
+
client: Client<Transport, chain>,
|
|
1550
|
+
parameters: Pick<
|
|
1551
|
+
MulticallParameters,
|
|
1552
|
+
| 'blockNumber'
|
|
1553
|
+
| 'blockOverrides'
|
|
1554
|
+
| 'blockTag'
|
|
1555
|
+
| 'contracts'
|
|
1556
|
+
| 'stateOverride'
|
|
1557
|
+
>,
|
|
1558
|
+
): Promise<MulticallReturnType> {
|
|
1559
|
+
// Preserve the action's deployless default unless the client overrides it.
|
|
1560
|
+
if (client.batch?.multicall === undefined)
|
|
1561
|
+
return multicall(client, {
|
|
1562
|
+
...parameters,
|
|
1563
|
+
allowFailure: true,
|
|
1564
|
+
deployless: true,
|
|
1565
|
+
})
|
|
1566
|
+
|
|
1567
|
+
const { contracts, ...rest } = parameters
|
|
1568
|
+
const results = await Promise.allSettled(
|
|
1569
|
+
contracts.map((contract) =>
|
|
1570
|
+
readContract(client, {
|
|
1571
|
+
...rest,
|
|
1572
|
+
...contract,
|
|
1573
|
+
}),
|
|
1574
|
+
),
|
|
1575
|
+
)
|
|
1576
|
+
return results.map((result) =>
|
|
1577
|
+
result.status === 'fulfilled'
|
|
1578
|
+
? { result: result.value, status: 'success' }
|
|
1579
|
+
: { error: result.reason, status: 'failure' },
|
|
1580
|
+
)
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1532
1583
|
function unwrapMulticallResult<result>(
|
|
1533
1584
|
response:
|
|
1534
1585
|
| { result: result; status: 'success' }
|
package/tempo/zones/Abis.ts
CHANGED
|
@@ -6,6 +6,8 @@ export const zoneFactory = [
|
|
|
6
6
|
{ name: 'zoneId', type: 'uint32', indexed: true },
|
|
7
7
|
{ name: 'portal', type: 'address', indexed: true },
|
|
8
8
|
{ name: 'initialToken', type: 'address', indexed: false },
|
|
9
|
+
{ name: 'accessMode', type: 'bool', indexed: false },
|
|
10
|
+
{ name: 'gatewayMode', type: 'bool', indexed: false },
|
|
9
11
|
{ name: 'admin', type: 'address', indexed: false },
|
|
10
12
|
{ name: 'sequencers', type: 'address[]', indexed: false },
|
|
11
13
|
{ name: 'threshold', type: 'uint8', indexed: false },
|
|
@@ -42,6 +44,10 @@ export const zoneFactory = [
|
|
|
42
44
|
type: 'tuple',
|
|
43
45
|
components: [
|
|
44
46
|
{ name: 'initialToken', type: 'address' },
|
|
47
|
+
{ name: 'accessMode', type: 'bool' },
|
|
48
|
+
{ name: 'gatewayMode', type: 'bool' },
|
|
49
|
+
{ name: 'allowedAccounts', type: 'address[]' },
|
|
50
|
+
{ name: 'zoneGateways', type: 'address[]' },
|
|
45
51
|
{ name: 'admin', type: 'address' },
|
|
46
52
|
{ name: 'sequencers', type: 'address[]' },
|
|
47
53
|
{ name: 'threshold', type: 'uint8' },
|
|
@@ -40,6 +40,7 @@ export const usdc = /*#__PURE__*/ defineToken({
|
|
|
40
40
|
137: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', // polygon
|
|
41
41
|
143: '0x754704Bc059F8C67012fEd69BC8A327a5aafb603', // monad
|
|
42
42
|
146: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894', // sonic
|
|
43
|
+
196: '0xB6CEceAB302E2E4948951eE7843FC24E92933061', // xLayer
|
|
43
44
|
300: '0xAe045DE5638162fa134807Cb558E15A3F5A7F853', // zksyncSepoliaTestnet
|
|
44
45
|
324: '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4', // zksync
|
|
45
46
|
338: '0xEb33dc5fac03833e132593659e1dE7256aB59794', // cronosTestnet
|
|
@@ -50,11 +51,16 @@ export const usdc = /*#__PURE__*/ defineToken({
|
|
|
50
51
|
1328: '0x4fCF1784B31630811181f670Aea7A7bEF803eaED', // seiTestnet
|
|
51
52
|
1329: '0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392', // sei
|
|
52
53
|
1439: '0x0C382e685bbeeFE5d3d9C29e29E341fEE8E84C5d', // injectiveTestnet
|
|
54
|
+
1672: '0xC879C018dB60520F4355C26eD1a6D572cdAC1815', // pharos
|
|
53
55
|
1776: '0xa00C59fF5a080D2b954d0c75e46E22a0c371235a', // injective
|
|
56
|
+
1952: '0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3', // xLayerTestnet
|
|
54
57
|
2818: '0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B', // morph
|
|
58
|
+
2910: '0x7433b41C6c5e1d58D4Da99483609520255ab661B', // morphHoodi
|
|
59
|
+
3343: '0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c', // edge
|
|
55
60
|
4801: '0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88', // worldchainSepolia
|
|
56
61
|
8453: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // base
|
|
57
62
|
10143: '0x534b2f3A21130d7a60830c2Df862319e593943A3', // monadTestnet
|
|
63
|
+
33431: '0x2d9F7CAD728051AA35Ecdc472a14cf8cDF5CFD6B', // edgeTestnet
|
|
58
64
|
42161: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // arbitrum
|
|
59
65
|
42220: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C', // celo
|
|
60
66
|
43113: '0x5425890298aed601595a70AB815c96711a31Bc65', // avalancheFuji
|
|
@@ -70,6 +76,7 @@ export const usdc = /*#__PURE__*/ defineToken({
|
|
|
70
76
|
98866: '0x222365EF19F7947e5484218551B56bb3965Aa7aF', // plumeMainnet
|
|
71
77
|
98867: '0xcB5f30e335672893c7eb944B374c196392C19D18', // plumeSepolia
|
|
72
78
|
421614: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d', // arbitrumSepolia
|
|
79
|
+
688689: '0xcfC8330f4BCAB529c625D12781b1C19466A9Fc8B', // pharosTestnet
|
|
73
80
|
763373: '0xFabab97dCE620294D2B0b0e46C68964e326300Ac', // inkSepolia
|
|
74
81
|
812242: '0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f', // codexTestnet
|
|
75
82
|
5042002: '0x3600000000000000000000000000000000000000', // arcTestnet
|
|
@@ -39,13 +39,13 @@ export function withRetry<data>(
|
|
|
39
39
|
}: WithRetryParameters = {},
|
|
40
40
|
) {
|
|
41
41
|
return new Promise<data>((resolve, reject) => {
|
|
42
|
-
const attemptRetry = async ({ count = 0 } = {}) => {
|
|
42
|
+
const attemptRetry = async ({ count = 0 } = {}): Promise<void> => {
|
|
43
43
|
if (signal?.aborted) {
|
|
44
44
|
reject(getAbortError(signal))
|
|
45
45
|
return
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const retry = async ({ error }: { error: Error }) => {
|
|
48
|
+
const retry = async ({ error }: { error: Error }): Promise<void> => {
|
|
49
49
|
const delay =
|
|
50
50
|
typeof delay_ === 'function' ? delay_({ count, error }) : delay_
|
|
51
51
|
if (delay) {
|
|
@@ -56,7 +56,7 @@ export function withRetry<data>(
|
|
|
56
56
|
return
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
attemptRetry({ count: count + 1 })
|
|
59
|
+
return attemptRetry({ count: count + 1 })
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
try {
|
|
@@ -79,6 +79,6 @@ export function withRetry<data>(
|
|
|
79
79
|
reject(err)
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
attemptRetry()
|
|
82
|
+
void attemptRetry().catch(reject)
|
|
83
83
|
})
|
|
84
84
|
}
|
package/utils/typedData.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
InvalidDomainError,
|
|
7
7
|
InvalidPrimaryTypeError,
|
|
8
8
|
InvalidStructTypeError,
|
|
9
|
+
InvalidTypedDataTypeError,
|
|
9
10
|
} from '../errors/typedData.js'
|
|
10
11
|
import type { ErrorType } from '../errors/utils.js'
|
|
11
12
|
import type { Hex } from '../types/misc.js'
|
|
@@ -86,6 +87,10 @@ export function validateTypedData<
|
|
|
86
87
|
const { name, type } = param
|
|
87
88
|
const value = data[name]
|
|
88
89
|
|
|
90
|
+
const baseType = type.replace(/(\[[0-9]*\])+$/, '')
|
|
91
|
+
if (baseType === 'int' || baseType === 'uint')
|
|
92
|
+
throw new InvalidTypedDataTypeError({ type })
|
|
93
|
+
|
|
89
94
|
const integerMatch = type.match(integerRegex)
|
|
90
95
|
if (
|
|
91
96
|
integerMatch &&
|