viem 2.21.39 → 2.21.40
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -0
- package/_cjs/chains/definitions/godwoken.js +28 -0
- package/_cjs/chains/definitions/godwoken.js.map +1 -0
- package/_cjs/chains/definitions/zeniq.js +22 -0
- package/_cjs/chains/definitions/zeniq.js.map +1 -0
- package/_cjs/chains/index.js +10 -6
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/base.js +4 -1
- package/_cjs/errors/base.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_esm/actions/public/getBlock.js +1 -1
- package/_esm/actions/public/getLogs.js +1 -1
- package/_esm/actions/public/getTransaction.js +1 -1
- package/_esm/actions/public/getTransactionConfirmations.js +1 -1
- package/_esm/actions/public/getTransactionReceipt.js +1 -1
- package/_esm/actions/public/readContract.js +1 -1
- package/_esm/actions/public/simulateContract.js +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +1 -1
- package/_esm/actions/public/watchBlockNumber.js +1 -1
- package/_esm/actions/public/watchBlocks.js +1 -1
- package/_esm/actions/wallet/deployContract.js +1 -1
- package/_esm/actions/wallet/sendTransaction.js +1 -1
- package/_esm/actions/wallet/writeContract.js +1 -1
- package/_esm/chains/definitions/godwoken.js +25 -0
- package/_esm/chains/definitions/godwoken.js.map +1 -0
- package/_esm/chains/definitions/zeniq.js +19 -0
- package/_esm/chains/definitions/zeniq.js.map +1 -0
- package/_esm/chains/index.js +2 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/base.js +4 -1
- package/_esm/errors/base.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_types/actions/public/getBlock.d.ts +1 -1
- package/_types/actions/public/getLogs.d.ts +1 -1
- package/_types/actions/public/getTransaction.d.ts +1 -1
- package/_types/actions/public/getTransactionConfirmations.d.ts +1 -1
- package/_types/actions/public/getTransactionReceipt.d.ts +1 -1
- package/_types/actions/public/readContract.d.ts +1 -1
- package/_types/actions/public/simulateContract.d.ts +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts +1 -1
- package/_types/actions/public/watchBlocks.d.ts +1 -1
- package/_types/actions/wallet/deployContract.d.ts +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts +1 -1
- package/_types/actions/wallet/writeContract.d.ts +1 -1
- package/_types/chains/definitions/godwoken.d.ts +33 -0
- package/_types/chains/definitions/godwoken.d.ts.map +1 -0
- package/_types/chains/definitions/zeniq.d.ts +37 -0
- package/_types/chains/definitions/zeniq.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/decorators/public.d.ts +11 -11
- package/_types/clients/decorators/wallet.d.ts +3 -3
- package/_types/errors/version.d.ts +1 -1
- package/_types/zksync/decorators/eip712.d.ts +2 -2
- package/actions/public/getBlock.ts +1 -1
- package/actions/public/getLogs.ts +1 -1
- package/actions/public/getTransaction.ts +1 -1
- package/actions/public/getTransactionConfirmations.ts +1 -1
- package/actions/public/getTransactionReceipt.ts +1 -1
- package/actions/public/readContract.ts +1 -1
- package/actions/public/simulateContract.ts +1 -1
- package/actions/public/waitForTransactionReceipt.ts +1 -1
- package/actions/public/watchBlockNumber.ts +1 -1
- package/actions/public/watchBlocks.ts +1 -1
- package/actions/wallet/deployContract.ts +1 -1
- package/actions/wallet/sendTransaction.ts +1 -1
- package/actions/wallet/writeContract.ts +1 -1
- package/chains/definitions/godwoken.ts +25 -0
- package/chains/definitions/zeniq.ts +19 -0
- package/chains/index.ts +2 -0
- package/clients/decorators/public.ts +11 -11
- package/clients/decorators/wallet.ts +3 -3
- package/errors/base.ts +6 -1
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/zksync/decorators/eip712.ts +2 -2
@@ -104,7 +104,7 @@ export type SendTransactionErrorType =
|
|
104
104
|
* Creates, signs, and sends a new transaction to the network.
|
105
105
|
*
|
106
106
|
* - Docs: https://viem.sh/docs/actions/wallet/sendTransaction
|
107
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
107
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
|
108
108
|
* - JSON-RPC Methods:
|
109
109
|
* - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
|
110
110
|
* - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
|
@@ -103,7 +103,7 @@ export type WriteContractErrorType =
|
|
103
103
|
* Executes a write function on a contract.
|
104
104
|
*
|
105
105
|
* - Docs: https://viem.sh/docs/contract/writeContract
|
106
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
106
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
|
107
107
|
*
|
108
108
|
* A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state.
|
109
109
|
*
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const godwoken = /*#__PURE__*/ defineChain({
|
4
|
+
id: 71402,
|
5
|
+
name: 'Godwoken Mainnet',
|
6
|
+
nativeCurrency: { decimals: 18, name: 'pCKB', symbol: 'pCKB' },
|
7
|
+
rpcUrls: {
|
8
|
+
default: {
|
9
|
+
http: ['https://v1.mainnet.godwoken.io/rpc'],
|
10
|
+
},
|
11
|
+
},
|
12
|
+
blockExplorers: {
|
13
|
+
default: {
|
14
|
+
name: 'GW Scan',
|
15
|
+
url: 'https://v1.gwscan.com',
|
16
|
+
},
|
17
|
+
},
|
18
|
+
contracts: {
|
19
|
+
multicall3: {
|
20
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
21
|
+
blockCreated: 15034,
|
22
|
+
},
|
23
|
+
},
|
24
|
+
testnet: false,
|
25
|
+
})
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const zeniq = /*#__PURE__*/ defineChain({
|
4
|
+
id: 383414847825,
|
5
|
+
name: 'Zeniq Mainnet',
|
6
|
+
nativeCurrency: { name: 'ZENIQ', symbol: 'ZENIQ', decimals: 18 },
|
7
|
+
rpcUrls: {
|
8
|
+
default: {
|
9
|
+
http: ['https://api.zeniq.network'],
|
10
|
+
},
|
11
|
+
},
|
12
|
+
blockExplorers: {
|
13
|
+
default: {
|
14
|
+
name: 'Zeniq Explorer',
|
15
|
+
url: 'https://zeniqscan.com',
|
16
|
+
},
|
17
|
+
},
|
18
|
+
testnet: false,
|
19
|
+
})
|
package/chains/index.ts
CHANGED
@@ -158,6 +158,7 @@ export { gnosis } from './definitions/gnosis.js'
|
|
158
158
|
export { gnosisChiado } from './definitions/gnosisChiado.js'
|
159
159
|
export { gobi } from './definitions/gobi.js'
|
160
160
|
export { goChain } from './definitions/goChain.js'
|
161
|
+
export { godwoken } from './definitions/godwoken.js'
|
161
162
|
export { goerli } from './definitions/goerli.js'
|
162
163
|
export { gravity } from './definitions/gravity.js'
|
163
164
|
export { guruTestnet } from './definitions/guruTestnet.js'
|
@@ -416,6 +417,7 @@ export { xrSepolia } from './definitions/xrSepolia.js'
|
|
416
417
|
export { yooldoVerse } from './definitions/yooldoVerse.js'
|
417
418
|
export { yooldoVerseTestnet } from './definitions/yooldoVerseTestnet.js'
|
418
419
|
export { zenchainTestnet } from './definitions/zenchainTestnet.js'
|
420
|
+
export { zeniq } from './definitions/zeniq.js'
|
419
421
|
export { zetachain } from './definitions/zetachain.js'
|
420
422
|
export { zetachainAthensTestnet } from './definitions/zetachainAthensTestnet.js'
|
421
423
|
export { zhejiang } from './definitions/zhejiang.js'
|
@@ -552,7 +552,7 @@ export type PublicActions<
|
|
552
552
|
* Returns information about a block at a block number, hash, or tag.
|
553
553
|
*
|
554
554
|
* - Docs: https://viem.sh/docs/actions/public/getBlock
|
555
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
555
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
|
556
556
|
* - JSON-RPC Methods:
|
557
557
|
* - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.
|
558
558
|
* - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.
|
@@ -580,7 +580,7 @@ export type PublicActions<
|
|
580
580
|
* Returns the number of the most recent block seen.
|
581
581
|
*
|
582
582
|
* - Docs: https://viem.sh/docs/actions/public/getBlockNumber
|
583
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
583
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
|
584
584
|
* - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)
|
585
585
|
*
|
586
586
|
* @param args - {@link GetBlockNumberParameters}
|
@@ -1110,7 +1110,7 @@ export type PublicActions<
|
|
1110
1110
|
* Returns a list of event logs matching the provided parameters.
|
1111
1111
|
*
|
1112
1112
|
* - Docs: https://viem.sh/docs/actions/public/getLogs
|
1113
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1113
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/logs_event-logs
|
1114
1114
|
* - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
|
1115
1115
|
*
|
1116
1116
|
* @param args - {@link GetLogsParameters}
|
@@ -1224,7 +1224,7 @@ export type PublicActions<
|
|
1224
1224
|
* Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.
|
1225
1225
|
*
|
1226
1226
|
* - Docs: https://viem.sh/docs/actions/public/getTransaction
|
1227
|
-
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1227
|
+
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
|
1228
1228
|
* - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)
|
1229
1229
|
*
|
1230
1230
|
* @param args - {@link GetTransactionParameters}
|
@@ -1249,7 +1249,7 @@ export type PublicActions<
|
|
1249
1249
|
* Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
|
1250
1250
|
*
|
1251
1251
|
* - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations
|
1252
|
-
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1252
|
+
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
|
1253
1253
|
* - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations)
|
1254
1254
|
*
|
1255
1255
|
* @param args - {@link GetTransactionConfirmationsParameters}
|
@@ -1298,7 +1298,7 @@ export type PublicActions<
|
|
1298
1298
|
* Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash.
|
1299
1299
|
*
|
1300
1300
|
* - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt
|
1301
|
-
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1301
|
+
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
|
1302
1302
|
* - JSON-RPC Methods: [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt)
|
1303
1303
|
*
|
1304
1304
|
* @param args - {@link GetTransactionReceiptParameters}
|
@@ -1428,7 +1428,7 @@ export type PublicActions<
|
|
1428
1428
|
* Calls a read-only function on a contract, and returns the response.
|
1429
1429
|
*
|
1430
1430
|
* - Docs: https://viem.sh/docs/contract/readContract
|
1431
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1431
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_reading-contracts
|
1432
1432
|
*
|
1433
1433
|
* @remarks
|
1434
1434
|
* A "read-only" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.
|
@@ -1493,7 +1493,7 @@ export type PublicActions<
|
|
1493
1493
|
* Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
|
1494
1494
|
*
|
1495
1495
|
* - Docs: https://viem.sh/docs/contract/simulateContract
|
1496
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1496
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
|
1497
1497
|
*
|
1498
1498
|
* @remarks
|
1499
1499
|
* This function does not require gas to execute and _**does not**_ change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract), but also supports contract write functions.
|
@@ -1615,7 +1615,7 @@ export type PublicActions<
|
|
1615
1615
|
* Waits for the [Transaction](https://viem.sh/docs/glossary/terms#transaction) to be included on a [Block](https://viem.sh/docs/glossary/terms#block) (one confirmation), and then returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt). If the Transaction reverts, then the action will throw an error.
|
1616
1616
|
*
|
1617
1617
|
* - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt
|
1618
|
-
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1618
|
+
* - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
|
1619
1619
|
* - JSON-RPC Methods:
|
1620
1620
|
* - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
|
1621
1621
|
* - If a Transaction has been replaced:
|
@@ -1656,7 +1656,7 @@ export type PublicActions<
|
|
1656
1656
|
* Watches and returns incoming block numbers.
|
1657
1657
|
*
|
1658
1658
|
* - Docs: https://viem.sh/docs/actions/public/watchBlockNumber
|
1659
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1659
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
|
1660
1660
|
* - JSON-RPC Methods:
|
1661
1661
|
* - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
|
1662
1662
|
* - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
|
@@ -1683,7 +1683,7 @@ export type PublicActions<
|
|
1683
1683
|
* Watches and returns information for incoming blocks.
|
1684
1684
|
*
|
1685
1685
|
* - Docs: https://viem.sh/docs/actions/public/watchBlocks
|
1686
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
1686
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
|
1687
1687
|
* - JSON-RPC Methods:
|
1688
1688
|
* - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
|
1689
1689
|
* - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
|
@@ -112,7 +112,7 @@ export type WalletActions<
|
|
112
112
|
* Deploys a contract to the network, given bytecode and constructor arguments.
|
113
113
|
*
|
114
114
|
* - Docs: https://viem.sh/docs/contract/deployContract
|
115
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
115
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts
|
116
116
|
*
|
117
117
|
* @param args - {@link DeployContractParameters}
|
118
118
|
* @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType}
|
@@ -337,7 +337,7 @@ export type WalletActions<
|
|
337
337
|
* Creates, signs, and sends a new transaction to the network.
|
338
338
|
*
|
339
339
|
* - Docs: https://viem.sh/docs/actions/wallet/sendTransaction
|
340
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
340
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
|
341
341
|
* - JSON-RPC Methods:
|
342
342
|
* - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
|
343
343
|
* - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
|
@@ -631,7 +631,7 @@ export type WalletActions<
|
|
631
631
|
* Executes a write function on a contract.
|
632
632
|
*
|
633
633
|
* - Docs: https://viem.sh/docs/contract/writeContract
|
634
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
634
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
|
635
635
|
*
|
636
636
|
* A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state.
|
637
637
|
*
|
package/errors/base.ts
CHANGED
@@ -87,7 +87,12 @@ function walk(
|
|
87
87
|
fn?: ((err: unknown) => boolean) | undefined,
|
88
88
|
): unknown {
|
89
89
|
if (fn?.(err)) return err
|
90
|
-
if (
|
90
|
+
if (
|
91
|
+
err &&
|
92
|
+
typeof err === 'object' &&
|
93
|
+
'cause' in err &&
|
94
|
+
err.cause !== undefined
|
95
|
+
)
|
91
96
|
return walk(err.cause, fn)
|
92
97
|
return fn ? null : err
|
93
98
|
}
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.21.
|
1
|
+
export const version = '2.21.40'
|
package/package.json
CHANGED
@@ -127,7 +127,7 @@ export type Eip712WalletActions<
|
|
127
127
|
* Deploys a contract to the network, given bytecode and constructor arguments using EIP712 transaction.
|
128
128
|
*
|
129
129
|
* - Docs: https://viem.sh/docs/contract/deployContract
|
130
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
130
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts
|
131
131
|
*
|
132
132
|
* @param args - {@link DeployContractParameters}
|
133
133
|
* @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType}
|
@@ -167,7 +167,7 @@ export type Eip712WalletActions<
|
|
167
167
|
* Executes a write function on a contract.
|
168
168
|
*
|
169
169
|
* - Docs: https://viem.sh/docs/contract/writeContract
|
170
|
-
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/
|
170
|
+
* - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
|
171
171
|
*
|
172
172
|
* A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state.
|
173
173
|
*
|