viem 2.21.26 → 2.21.27
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/_cjs/chains/definitions/chang.js +25 -0
- package/_cjs/chains/definitions/chang.js.map +1 -0
- package/_cjs/chains/definitions/hela.js +26 -0
- package/_cjs/chains/definitions/hela.js.map +1 -0
- package/_cjs/chains/definitions/ql1.js +31 -0
- package/_cjs/chains/definitions/ql1.js.map +1 -0
- package/_cjs/chains/index.js +14 -7
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/experimental/eip7702/actions/signAuthorization.js +9 -2
- package/_cjs/experimental/eip7702/actions/signAuthorization.js.map +1 -1
- package/_cjs/utils/formatters/transaction.js +3 -9
- package/_cjs/utils/formatters/transaction.js.map +1 -1
- package/_esm/chains/definitions/chang.js +22 -0
- package/_esm/chains/definitions/chang.js.map +1 -0
- package/_esm/chains/definitions/hela.js +23 -0
- package/_esm/chains/definitions/hela.js.map +1 -0
- package/_esm/chains/definitions/ql1.js +28 -0
- package/_esm/chains/definitions/ql1.js.map +1 -0
- package/_esm/chains/index.js +3 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/experimental/eip7702/actions/signAuthorization.js +9 -2
- package/_esm/experimental/eip7702/actions/signAuthorization.js.map +1 -1
- package/_esm/utils/formatters/transaction.js +3 -9
- package/_esm/utils/formatters/transaction.js.map +1 -1
- package/_types/chains/definitions/chang.d.ts +37 -0
- package/_types/chains/definitions/chang.d.ts.map +1 -0
- package/_types/chains/definitions/hela.d.ts +37 -0
- package/_types/chains/definitions/hela.d.ts.map +1 -0
- package/_types/chains/definitions/ql1.d.ts +32 -0
- package/_types/chains/definitions/ql1.d.ts.map +1 -0
- package/_types/chains/index.d.ts +3 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/experimental/eip7702/actions/signAuthorization.d.ts +7 -2
- package/_types/experimental/eip7702/actions/signAuthorization.d.ts.map +1 -1
- package/_types/experimental/eip7702/types/rpc.d.ts +8 -2
- package/_types/experimental/eip7702/types/rpc.d.ts.map +1 -1
- package/_types/types/eip1193.d.ts +12 -0
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/types/transaction.d.ts +1 -1
- package/_types/types/transaction.d.ts.map +1 -1
- package/chains/definitions/chang.ts +22 -0
- package/chains/definitions/hela.ts +23 -0
- package/chains/definitions/ql1.ts +28 -0
- package/chains/index.ts +3 -0
- package/errors/version.ts +1 -1
- package/experimental/eip7702/actions/signAuthorization.ts +16 -4
- package/experimental/eip7702/types/rpc.ts +8 -2
- package/package.json +1 -1
- package/types/eip1193.ts +12 -0
- package/types/transaction.ts +1 -1
- package/utils/formatters/transaction.ts +8 -17
@@ -0,0 +1,28 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const ql1 = /*#__PURE__*/ defineChain({
|
4
|
+
id: 766,
|
5
|
+
name: 'QL1',
|
6
|
+
nativeCurrency: {
|
7
|
+
decimals: 18,
|
8
|
+
name: 'QOM',
|
9
|
+
symbol: 'QOM',
|
10
|
+
},
|
11
|
+
rpcUrls: {
|
12
|
+
default: {
|
13
|
+
http: ['https://rpc.qom.one'],
|
14
|
+
},
|
15
|
+
},
|
16
|
+
blockExplorers: {
|
17
|
+
default: {
|
18
|
+
name: 'Ql1 Explorer',
|
19
|
+
url: 'https://scan.qom.one',
|
20
|
+
},
|
21
|
+
},
|
22
|
+
contracts: {
|
23
|
+
multicall3: {
|
24
|
+
address: '0x7A52370716ea730585884F5BDB0f6E60C39b8C64',
|
25
|
+
},
|
26
|
+
},
|
27
|
+
testnet: false,
|
28
|
+
})
|
package/chains/index.ts
CHANGED
@@ -70,6 +70,7 @@ export { cannon } from './definitions/cannon.js'
|
|
70
70
|
export { canto } from './definitions/canto.js'
|
71
71
|
export { celo } from './definitions/celo.js'
|
72
72
|
export { celoAlfajores } from './definitions/celoAlfajores.js'
|
73
|
+
export { chang } from './definitions/chang.js'
|
73
74
|
export { chiliz } from './definitions/chiliz.js'
|
74
75
|
export { chips } from './definitions/chips.js'
|
75
76
|
export { classic } from './definitions/classic.js'
|
@@ -165,6 +166,7 @@ export { haqqTestedge2 } from './definitions/haqqTestedge2.js'
|
|
165
166
|
export { hedera } from './definitions/hedera.js'
|
166
167
|
export { hederaTestnet } from './definitions/hederaTestnet.js'
|
167
168
|
export { hederaPreviewnet } from './definitions/hederaPreviewnet.js'
|
169
|
+
export { hela } from './definitions/hela.js'
|
168
170
|
export { hemiSepolia } from './definitions/hemiSepolia.js'
|
169
171
|
export { holesky } from './definitions/holesky.js'
|
170
172
|
export { hychain } from './definitions/hychain.js'
|
@@ -274,6 +276,7 @@ export { polygonZkEvmCardona } from './definitions/polygonZkEvmCardona.js'
|
|
274
276
|
export { polygonZkEvmTestnet } from './definitions/polygonZkEvmTestnet.js'
|
275
277
|
export { pulsechain } from './definitions/pulsechain.js'
|
276
278
|
export { pulsechainV4 } from './definitions/pulsechainV4.js'
|
279
|
+
export { ql1 } from './definitions/ql1.js'
|
277
280
|
export { qMainnet } from './definitions/qMainnet.js'
|
278
281
|
export { qTestnet } from './definitions/qTestnet.js'
|
279
282
|
export { real } from './definitions/real.js'
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.21.
|
1
|
+
export const version = '2.21.27'
|
@@ -31,8 +31,13 @@ export type SignAuthorizationParameters<
|
|
31
31
|
account extends Account | undefined = Account | undefined,
|
32
32
|
> = GetAccountParameter<account> &
|
33
33
|
PartialBy<Authorization, 'chainId' | 'nonce'> & {
|
34
|
-
/**
|
35
|
-
|
34
|
+
/**
|
35
|
+
* Whether the EIP-7702 Transaction will be executed by another Account.
|
36
|
+
*
|
37
|
+
* If not specified, it will be assumed that the EIP-7702 Transaction will
|
38
|
+
* be executed by the Account that signed the Authorization.
|
39
|
+
*/
|
40
|
+
delegate?: true | Address | Account | undefined
|
36
41
|
}
|
37
42
|
|
38
43
|
export type SignAuthorizationReturnType = SignAuthorizationReturnType_account
|
@@ -108,7 +113,11 @@ export async function signAuthorization<
|
|
108
113
|
})
|
109
114
|
const account = parseAccount(account_)
|
110
115
|
|
111
|
-
const delegate =
|
116
|
+
const delegate = (() => {
|
117
|
+
if (typeof delegate_ === 'boolean') return delegate_
|
118
|
+
if (delegate_) return parseAccount(delegate_)
|
119
|
+
return undefined
|
120
|
+
})()
|
112
121
|
|
113
122
|
if (!account.experimental_signAuthorization)
|
114
123
|
throw new AccountTypeNotSupportedError({
|
@@ -139,7 +148,10 @@ export async function signAuthorization<
|
|
139
148
|
address: account.address,
|
140
149
|
blockTag: 'pending',
|
141
150
|
})
|
142
|
-
if (
|
151
|
+
if (
|
152
|
+
!delegate ||
|
153
|
+
(delegate !== true && isAddressEqual(account.address, delegate.address))
|
154
|
+
)
|
143
155
|
authorization.nonce += 1
|
144
156
|
}
|
145
157
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Address } from 'abitype'
|
2
|
-
import type { Hex
|
2
|
+
import type { Hex } from '../../../types/misc.js'
|
3
3
|
|
4
4
|
export type RpcAuthorization = {
|
5
5
|
/** Address of the contract to set as code for the Authority. */
|
@@ -8,5 +8,11 @@ export type RpcAuthorization = {
|
|
8
8
|
chainId: Hex
|
9
9
|
/** Nonce of the Authority to authorize. */
|
10
10
|
nonce: Hex
|
11
|
-
|
11
|
+
/** ECDSA r value. */
|
12
|
+
r: Hex
|
13
|
+
/** ECDSA s value. */
|
14
|
+
s: Hex
|
15
|
+
/** y parity. */
|
16
|
+
yParity: Hex
|
17
|
+
}
|
12
18
|
export type RpcAuthorizationList = readonly RpcAuthorization[]
|
package/package.json
CHANGED
package/types/eip1193.ts
CHANGED
@@ -1780,6 +1780,18 @@ export type WalletRpcSchema = [
|
|
1780
1780
|
Parameters?: WalletSendCallsParameters
|
1781
1781
|
ReturnType: string
|
1782
1782
|
},
|
1783
|
+
/**
|
1784
|
+
* @description Creates, signs, and sends a new transaction to the network
|
1785
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1786
|
+
* @example
|
1787
|
+
* provider.request({ method: 'wallet_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
|
1788
|
+
* // => '0x...'
|
1789
|
+
*/
|
1790
|
+
{
|
1791
|
+
Method: 'wallet_sendTransaction'
|
1792
|
+
Parameters: [transaction: TransactionRequest]
|
1793
|
+
ReturnType: Hash
|
1794
|
+
},
|
1783
1795
|
/**
|
1784
1796
|
* @description Requests for the wallet to show information about a call batch
|
1785
1797
|
* that was sent via `wallet_sendCalls`.
|
package/types/transaction.ts
CHANGED
@@ -275,7 +275,7 @@ export type TransactionRequestEIP7702<
|
|
275
275
|
> = TransactionRequestBase<quantity, index, type> &
|
276
276
|
ExactPartial<FeeValuesEIP1559<quantity>> & {
|
277
277
|
accessList?: AccessList | undefined
|
278
|
-
authorizationList
|
278
|
+
authorizationList?: AuthorizationList<index, boolean> | undefined
|
279
279
|
}
|
280
280
|
|
281
281
|
export type TransactionRequest<quantity = bigint, index = number> = OneOf<
|
@@ -127,21 +127,12 @@ export const defineTransaction = /*#__PURE__*/ defineFormatter(
|
|
127
127
|
function formatAuthorizationList(
|
128
128
|
authorizationList: RpcAuthorizationList,
|
129
129
|
): SignedAuthorizationList {
|
130
|
-
return authorizationList.map(
|
131
|
-
(authorization)
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
...(typeof authorization.yParity !== 'undefined'
|
139
|
-
? { yParity: Number(authorization.yParity) }
|
140
|
-
: {}),
|
141
|
-
...(typeof authorization.v !== 'undefined' &&
|
142
|
-
typeof authorization.yParity === 'undefined'
|
143
|
-
? { v: Number(authorization.v) }
|
144
|
-
: {}),
|
145
|
-
}) as any,
|
146
|
-
) as SignedAuthorizationList
|
130
|
+
return authorizationList.map((authorization) => ({
|
131
|
+
contractAddress: (authorization as any).address,
|
132
|
+
chainId: Number(authorization.chainId),
|
133
|
+
nonce: Number(authorization.nonce),
|
134
|
+
r: authorization.r,
|
135
|
+
s: authorization.s,
|
136
|
+
yParity: Number(authorization.yParity),
|
137
|
+
})) as SignedAuthorizationList
|
147
138
|
}
|