viem 2.30.5 → 2.30.6
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 +12 -0
- package/_cjs/actions/public/call.js +2 -2
- package/_cjs/actions/public/call.js.map +1 -1
- package/_cjs/actions/public/estimateGas.js +1 -1
- package/_cjs/actions/public/estimateGas.js.map +1 -1
- package/_cjs/actions/public/simulateBlocks.js +1 -1
- package/_cjs/actions/public/simulateBlocks.js.map +1 -1
- package/_cjs/chains/definitions/omni.js +23 -0
- package/_cjs/chains/definitions/omni.js.map +1 -0
- package/_cjs/chains/definitions/omniOmega.js +23 -0
- package/_cjs/chains/definitions/omniOmega.js.map +1 -0
- package/_cjs/chains/index.js +9 -5
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/transports/webSocket.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/utils/abi/decodeEventLog.js +13 -9
- package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
- package/_esm/actions/public/call.js +2 -2
- package/_esm/actions/public/call.js.map +1 -1
- package/_esm/actions/public/estimateGas.js +1 -1
- package/_esm/actions/public/estimateGas.js.map +1 -1
- package/_esm/actions/public/simulateBlocks.js +1 -1
- package/_esm/actions/public/simulateBlocks.js.map +1 -1
- package/_esm/chains/definitions/omni.js +20 -0
- package/_esm/chains/definitions/omni.js.map +1 -0
- package/_esm/chains/definitions/omniOmega.js +20 -0
- package/_esm/chains/definitions/omniOmega.js.map +1 -0
- package/_esm/chains/index.js +2 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/transports/webSocket.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/utils/abi/decodeEventLog.js +13 -9
- package/_esm/utils/abi/decodeEventLog.js.map +1 -1
- package/_types/actions/public/call.d.ts +1 -1
- package/_types/actions/public/estimateGas.d.ts +1 -1
- package/_types/chains/definitions/omni.d.ts +38 -0
- package/_types/chains/definitions/omni.d.ts.map +1 -0
- package/_types/chains/definitions/omniOmega.d.ts +38 -0
- package/_types/chains/definitions/omniOmega.d.ts.map +1 -0
- package/_types/chains/index.d.ts +2 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/transports/webSocket.d.ts +16 -7
- package/_types/clients/transports/webSocket.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
- package/actions/public/call.ts +3 -3
- package/actions/public/estimateGas.ts +2 -2
- package/actions/public/simulateBlocks.ts +1 -1
- package/chains/definitions/omni.ts +20 -0
- package/chains/definitions/omniOmega.ts +20 -0
- package/chains/index.ts +2 -0
- package/clients/transports/webSocket.ts +23 -8
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/utils/abi/decodeEventLog.ts +14 -9
@@ -57,7 +57,7 @@ export type EstimateGasParameters<
|
|
57
57
|
blockNumber?: undefined
|
58
58
|
/**
|
59
59
|
* The balance of the account at a block tag.
|
60
|
-
* @default '
|
60
|
+
* @default 'latest'
|
61
61
|
*/
|
62
62
|
blockTag?: BlockTag | undefined
|
63
63
|
}
|
@@ -194,7 +194,7 @@ export async function estimateGas<
|
|
194
194
|
return client.request({
|
195
195
|
method: 'eth_estimateGas',
|
196
196
|
params: rpcStateOverride
|
197
|
-
? [request, block ?? '
|
197
|
+
? [request, block ?? 'latest', rpcStateOverride]
|
198
198
|
: block
|
199
199
|
? [request, block]
|
200
200
|
: [request],
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const omni = defineChain({
|
4
|
+
id: 166,
|
5
|
+
name: 'Omni',
|
6
|
+
nativeCurrency: { name: 'Omni', symbol: 'OMNI', decimals: 18 },
|
7
|
+
rpcUrls: {
|
8
|
+
default: {
|
9
|
+
http: ['https://mainnet.omni.network'],
|
10
|
+
webSocket: ['wss://mainnet.omni.network'],
|
11
|
+
},
|
12
|
+
},
|
13
|
+
blockExplorers: {
|
14
|
+
default: {
|
15
|
+
name: 'OmniScan',
|
16
|
+
url: 'https://omniscan.network',
|
17
|
+
},
|
18
|
+
},
|
19
|
+
testnet: false,
|
20
|
+
})
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const omniOmega = /*#__PURE__*/ defineChain({
|
4
|
+
id: 164,
|
5
|
+
name: 'Omni Omega',
|
6
|
+
nativeCurrency: { name: 'Omni', symbol: 'OMNI', decimals: 18 },
|
7
|
+
rpcUrls: {
|
8
|
+
default: {
|
9
|
+
http: ['https://omega.omni.network'],
|
10
|
+
webSocket: ['wss://omega.omni.network'],
|
11
|
+
},
|
12
|
+
},
|
13
|
+
blockExplorers: {
|
14
|
+
default: {
|
15
|
+
name: 'Omega OmniScan',
|
16
|
+
url: 'https://omega.omniscan.network/',
|
17
|
+
},
|
18
|
+
},
|
19
|
+
testnet: true,
|
20
|
+
})
|
package/chains/index.ts
CHANGED
@@ -373,6 +373,8 @@ export { oasys } from './definitions/oasys.js'
|
|
373
373
|
export { odysseyTestnet } from './definitions/odysseyTestnet.js'
|
374
374
|
export { okc } from './definitions/okc.js'
|
375
375
|
export { omax } from './definitions/omax.js'
|
376
|
+
export { omni } from './definitions/omni.js'
|
377
|
+
export { omniOmega } from './definitions/omniOmega.js'
|
376
378
|
export { oneWorld } from './definitions/oneWorld.js'
|
377
379
|
export { oortMainnetDev } from './definitions/oortmainnetDev.js'
|
378
380
|
export { opBNB } from './definitions/opBNB.js'
|
@@ -1,10 +1,11 @@
|
|
1
|
+
import type { Address } from 'abitype'
|
1
2
|
import { RpcRequestError } from '../../errors/request.js'
|
2
3
|
import {
|
3
4
|
UrlRequiredError,
|
4
5
|
type UrlRequiredErrorType,
|
5
6
|
} from '../../errors/transport.js'
|
6
7
|
import type { ErrorType } from '../../errors/utils.js'
|
7
|
-
import type { Hash } from '../../types/misc.js'
|
8
|
+
import type { Hash, LogTopic } from '../../types/misc.js'
|
8
9
|
import type { RpcResponse } from '../../types/rpc.js'
|
9
10
|
import { getSocket } from '../../utils/rpc/compat.js'
|
10
11
|
import type { SocketRpcClient } from '../../utils/rpc/socket.js'
|
@@ -31,13 +32,27 @@ type WebSocketTransportSubscribeReturnType = {
|
|
31
32
|
|
32
33
|
type WebSocketTransportSubscribe = {
|
33
34
|
subscribe(
|
34
|
-
args: WebSocketTransportSubscribeParameters &
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
args: WebSocketTransportSubscribeParameters &
|
36
|
+
(
|
37
|
+
| {
|
38
|
+
params: ['newHeads']
|
39
|
+
}
|
40
|
+
| {
|
41
|
+
params: ['newPendingTransactions']
|
42
|
+
}
|
43
|
+
| {
|
44
|
+
params: [
|
45
|
+
'logs',
|
46
|
+
{
|
47
|
+
address?: Address | Address[]
|
48
|
+
topics?: LogTopic[]
|
49
|
+
},
|
50
|
+
]
|
51
|
+
}
|
52
|
+
| {
|
53
|
+
params: ['syncing']
|
54
|
+
}
|
55
|
+
),
|
41
56
|
): Promise<WebSocketTransportSubscribeReturnType>
|
42
57
|
}
|
43
58
|
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.30.
|
1
|
+
export const version = '2.30.6'
|
package/package.json
CHANGED
@@ -131,19 +131,24 @@ export function decodeEventLog<
|
|
131
131
|
const { name, inputs } = abiItem
|
132
132
|
const isUnnamed = inputs?.some((x) => !('name' in x && x.name))
|
133
133
|
|
134
|
-
|
134
|
+
const args: any = isUnnamed ? [] : {}
|
135
135
|
|
136
136
|
// Decode topics (indexed args).
|
137
|
-
const indexedInputs = inputs
|
137
|
+
const indexedInputs = inputs
|
138
|
+
.map((x, i) => [x, i] as const)
|
139
|
+
.filter(([x]) => 'indexed' in x && x.indexed)
|
138
140
|
for (let i = 0; i < indexedInputs.length; i++) {
|
139
|
-
const param = indexedInputs[i]
|
141
|
+
const [param, argIndex] = indexedInputs[i]
|
140
142
|
const topic = argTopics[i]
|
141
143
|
if (!topic)
|
142
144
|
throw new DecodeLogTopicsMismatch({
|
143
145
|
abiItem,
|
144
146
|
param: param as AbiParameter & { indexed: boolean },
|
145
147
|
})
|
146
|
-
args[isUnnamed ?
|
148
|
+
args[isUnnamed ? argIndex : param.name || argIndex] = decodeTopic({
|
149
|
+
param,
|
150
|
+
value: topic,
|
151
|
+
})
|
147
152
|
}
|
148
153
|
|
149
154
|
// Decode data (non-indexed args).
|
@@ -153,12 +158,12 @@ export function decodeEventLog<
|
|
153
158
|
try {
|
154
159
|
const decodedData = decodeAbiParameters(nonIndexedInputs, data)
|
155
160
|
if (decodedData) {
|
156
|
-
if (isUnnamed)
|
157
|
-
|
158
|
-
|
161
|
+
if (isUnnamed)
|
162
|
+
for (let i = 0; i < inputs.length; i++)
|
163
|
+
args[i] = args[i] ?? decodedData.shift()
|
164
|
+
else
|
165
|
+
for (let i = 0; i < nonIndexedInputs.length; i++)
|
159
166
|
args[nonIndexedInputs[i].name!] = decodedData[i]
|
160
|
-
}
|
161
|
-
}
|
162
167
|
}
|
163
168
|
} catch (err) {
|
164
169
|
if (strict) {
|