viem 2.0.3 → 2.0.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 +26 -0
- package/_cjs/actions/wallet/writeContract.js.map +1 -1
- package/_cjs/chains/definitions/taikoJolnir.js +7 -0
- package/_cjs/chains/definitions/taikoJolnir.js.map +1 -1
- package/_cjs/chains/definitions/taikoKatla.js +25 -0
- package/_cjs/chains/definitions/taikoKatla.js.map +1 -0
- package/_cjs/chains/index.js +6 -6
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/transports/http.js +1 -1
- package/_cjs/clients/transports/http.js.map +1 -1
- package/_cjs/errors/abi.js +13 -1
- package/_cjs/errors/abi.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +5 -3
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/abi/decodeAbiParameters.js +2 -0
- package/_cjs/utils/abi/decodeAbiParameters.js.map +1 -1
- package/_esm/actions/wallet/writeContract.js.map +1 -1
- package/_esm/chains/definitions/taikoJolnir.js +7 -0
- package/_esm/chains/definitions/taikoJolnir.js.map +1 -1
- package/_esm/chains/definitions/taikoKatla.js +22 -0
- package/_esm/chains/definitions/taikoKatla.js.map +1 -0
- package/_esm/chains/index.js +1 -1
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/transports/http.js +1 -1
- package/_esm/clients/transports/http.js.map +1 -1
- package/_esm/errors/abi.js +11 -0
- package/_esm/errors/abi.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/utils/abi/decodeAbiParameters.js +3 -1
- package/_esm/utils/abi/decodeAbiParameters.js.map +1 -1
- package/_types/actions/wallet/writeContract.d.ts +1 -1
- package/_types/actions/wallet/writeContract.d.ts.map +1 -1
- package/_types/chains/definitions/taikoJolnir.d.ts +7 -9
- package/_types/chains/definitions/taikoJolnir.d.ts.map +1 -1
- package/_types/chains/definitions/taikoKatla.d.ts +38 -0
- package/_types/chains/definitions/taikoKatla.d.ts.map +1 -0
- package/_types/chains/index.d.ts +1 -1
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/abi.d.ts +10 -0
- package/_types/errors/abi.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/types/contract.d.ts +2 -1
- package/_types/types/contract.d.ts.map +1 -1
- package/_types/utils/abi/decodeAbiParameters.d.ts.map +1 -1
- package/actions/wallet/writeContract.ts +5 -1
- package/chains/definitions/taikoJolnir.ts +7 -0
- package/chains/definitions/taikoKatla.ts +22 -0
- package/chains/index.ts +1 -1
- package/clients/transports/http.ts +1 -1
- package/errors/abi.ts +13 -0
- package/errors/version.ts +1 -1
- package/index.ts +6 -0
- package/package.json +1 -1
- package/types/contract.ts +13 -12
- package/utils/abi/decodeAbiParameters.ts +4 -0
- package/_cjs/chains/definitions/celoCannoli.js +0 -34
- package/_cjs/chains/definitions/celoCannoli.js.map +0 -1
- package/_esm/chains/definitions/celoCannoli.js +0 -31
- package/_esm/chains/definitions/celoCannoli.js.map +0 -1
- package/_types/chains/definitions/celoCannoli.d.ts +0 -918
- package/_types/chains/definitions/celoCannoli.d.ts.map +0 -1
- package/chains/definitions/celoCannoli.ts +0 -31
@@ -15,4 +15,11 @@ export const taikoJolnir = /*#__PURE__*/ defineChain({
|
|
15
15
|
url: 'https://explorer.jolnir.taiko.xyz',
|
16
16
|
},
|
17
17
|
},
|
18
|
+
contracts: {
|
19
|
+
multicall3: {
|
20
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
21
|
+
blockCreated: 732706,
|
22
|
+
},
|
23
|
+
},
|
24
|
+
testnet: true,
|
18
25
|
})
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const taikoKatla = /*#__PURE__*/ defineChain({
|
4
|
+
id: 167008,
|
5
|
+
name: 'Taiko Katla (Alpha-6 Testnet)',
|
6
|
+
network: 'tko-katla',
|
7
|
+
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
8
|
+
rpcUrls: {
|
9
|
+
default: {
|
10
|
+
http: ['https://rpc.katla.taiko.xyz'],
|
11
|
+
},
|
12
|
+
public: {
|
13
|
+
http: ['https://rpc.katla.taiko.xyz'],
|
14
|
+
},
|
15
|
+
},
|
16
|
+
blockExplorers: {
|
17
|
+
default: {
|
18
|
+
name: 'blockscout',
|
19
|
+
url: 'https://explorer.katla.taiko.xyz',
|
20
|
+
},
|
21
|
+
},
|
22
|
+
})
|
package/chains/index.ts
CHANGED
@@ -30,7 +30,6 @@ export { canto } from './definitions/canto.js'
|
|
30
30
|
export { celo } from './definitions/celo.js'
|
31
31
|
export { celoAlfajores } from './definitions/celoAlfajores.js'
|
32
32
|
export { chiliz } from './definitions/chiliz.js'
|
33
|
-
export { celoCannoli } from './definitions/celoCannoli.js'
|
34
33
|
export { classic } from './definitions/classic.js'
|
35
34
|
export { confluxESpace } from './definitions/confluxESpace.js'
|
36
35
|
export { confluxESpaceTestnet } from './definitions/confluxESpaceTestnet.js'
|
@@ -162,6 +161,7 @@ export { syscoin } from './definitions/syscoin.js'
|
|
162
161
|
export { syscoinTestnet } from './definitions/syscoinTestnet.js'
|
163
162
|
export { taraxa } from './definitions/taraxa.js'
|
164
163
|
export { taikoJolnir } from './definitions/taikoJolnir.js'
|
164
|
+
export { taikoKatla } from './definitions/taikoKatla.js'
|
165
165
|
export { taikoTestnetSepolia } from './definitions/taikoTestnetSepolia.js'
|
166
166
|
export { taraxaTestnet } from './definitions/taraxaTestnet.js'
|
167
167
|
export { telos } from './definitions/telos.js'
|
package/errors/abi.ts
CHANGED
@@ -95,6 +95,19 @@ export class AbiDecodingDataSizeTooSmallError extends BaseError {
|
|
95
95
|
}
|
96
96
|
}
|
97
97
|
|
98
|
+
export type AbiDecodingOffsetOutOfBoundsErrorType =
|
99
|
+
AbiDecodingOffsetOutOfBoundsError & {
|
100
|
+
name: 'AbiDecodingOffsetOutOfBoundsError'
|
101
|
+
}
|
102
|
+
export class AbiDecodingOffsetOutOfBoundsError extends BaseError {
|
103
|
+
override name = 'AbiDecodingOffsetOutOfBoundsError'
|
104
|
+
constructor({ offset, position }: { offset: number; position: number }) {
|
105
|
+
super(
|
106
|
+
`Offset at "${offset}" is out-of-bounds (current position: "${position}").`,
|
107
|
+
)
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
98
111
|
export type AbiDecodingZeroDataErrorType = AbiDecodingZeroDataError & {
|
99
112
|
name: 'AbiDecodingZeroDataError'
|
100
113
|
}
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.0.
|
1
|
+
export const version = '2.0.6'
|
package/index.ts
CHANGED
@@ -1046,6 +1046,12 @@ export {
|
|
1046
1046
|
type EncodeFunctionResultReturnType,
|
1047
1047
|
encodeFunctionResult,
|
1048
1048
|
} from './utils/abi/encodeFunctionResult.js'
|
1049
|
+
export {
|
1050
|
+
type ParseEventLogsErrorType,
|
1051
|
+
type ParseEventLogsParameters,
|
1052
|
+
type ParseEventLogsReturnType,
|
1053
|
+
parseEventLogs,
|
1054
|
+
} from './utils/abi/parseEventLogs.js'
|
1049
1055
|
export {
|
1050
1056
|
type FormattedTransaction,
|
1051
1057
|
defineTransaction,
|
package/package.json
CHANGED
package/types/contract.ts
CHANGED
@@ -168,21 +168,22 @@ export type ExtractAbiFunctionForArgs<
|
|
168
168
|
? IsUnion<abiFunction> extends true // narrow overloads using `args` by converting to tuple and filtering out overloads that don't match
|
169
169
|
? UnionToTuple<abiFunction> extends infer abiFunctions extends
|
170
170
|
readonly AbiFunction[]
|
171
|
-
?
|
172
|
-
|
173
|
-
readonly [] extends args
|
174
|
-
? readonly [] // fallback to `readonly []` if `args` has no value (e.g. `args` property not provided)
|
175
|
-
: args
|
176
|
-
) extends AbiParametersToPrimitiveTypes<
|
177
|
-
abiFunctions[k]['inputs'],
|
178
|
-
'inputs'
|
179
|
-
>
|
180
|
-
? abiFunctions[k]
|
181
|
-
: never
|
182
|
-
}[number] // convert back to union (removes `never` tuple entries: `['foo', never, 'bar'][number]` => `'foo' | 'bar'`)
|
171
|
+
? // convert back to union (removes `never` tuple entries)
|
172
|
+
{ [k in keyof abiFunctions]: CheckArgs<abiFunctions[k], args> }[number]
|
183
173
|
: never
|
184
174
|
: abiFunction
|
185
175
|
: never
|
176
|
+
type CheckArgs<
|
177
|
+
abiFunction extends AbiFunction,
|
178
|
+
args,
|
179
|
+
///
|
180
|
+
targetArgs extends AbiParametersToPrimitiveTypes<
|
181
|
+
abiFunction['inputs'],
|
182
|
+
'inputs'
|
183
|
+
> = AbiParametersToPrimitiveTypes<abiFunction['inputs'], 'inputs'>,
|
184
|
+
> = (readonly [] extends args ? readonly [] : args) extends targetArgs // fallback to `readonly []` if `args` has no value (e.g. `args` property not provided)
|
185
|
+
? abiFunction
|
186
|
+
: never
|
186
187
|
|
187
188
|
export type ContractFunctionParameters<
|
188
189
|
abi extends Abi | readonly unknown[] = Abi,
|
@@ -7,6 +7,7 @@ import type {
|
|
7
7
|
import {
|
8
8
|
AbiDecodingDataSizeTooSmallError,
|
9
9
|
type AbiDecodingDataSizeTooSmallErrorType,
|
10
|
+
AbiDecodingOffsetOutOfBoundsError,
|
10
11
|
AbiDecodingZeroDataError,
|
11
12
|
type AbiDecodingZeroDataErrorType,
|
12
13
|
InvalidAbiDecodingTypeError,
|
@@ -185,6 +186,9 @@ function decodeArray<const TParam extends AbiParameter>(
|
|
185
186
|
const offset = hexToNumber(
|
186
187
|
slice(data, position, position + 32, { strict: true }),
|
187
188
|
)
|
189
|
+
if (offset < position)
|
190
|
+
throw new AbiDecodingOffsetOutOfBoundsError({ offset, position })
|
191
|
+
|
188
192
|
// Get the length of the array from the offset.
|
189
193
|
const length = hexToNumber(
|
190
194
|
slice(data, offset, offset + 32, { strict: true }),
|
@@ -1,34 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.celoCannoli = void 0;
|
4
|
-
const defineChain_js_1 = require("../../utils/chain/defineChain.js");
|
5
|
-
const chainConfig_js_1 = require("../celo/chainConfig.js");
|
6
|
-
exports.celoCannoli = (0, defineChain_js_1.defineChain)({
|
7
|
-
...chainConfig_js_1.chainConfig,
|
8
|
-
id: 17323,
|
9
|
-
name: 'Cannoli',
|
10
|
-
nativeCurrency: {
|
11
|
-
decimals: 18,
|
12
|
-
name: 'CELO',
|
13
|
-
symbol: 'C-CELO',
|
14
|
-
},
|
15
|
-
rpcUrls: {
|
16
|
-
default: {
|
17
|
-
http: ['https://forno.cannoli.celo-testnet.org'],
|
18
|
-
},
|
19
|
-
},
|
20
|
-
blockExplorers: {
|
21
|
-
default: {
|
22
|
-
name: 'Celo Explorer',
|
23
|
-
url: 'https://explorer.celo.org/cannoli',
|
24
|
-
},
|
25
|
-
},
|
26
|
-
contracts: {
|
27
|
-
multicall3: {
|
28
|
-
address: '0x5Acb0aa8BF4E8Ff0d882Ee187140713C12BF9718',
|
29
|
-
blockCreated: 87429,
|
30
|
-
},
|
31
|
-
},
|
32
|
-
testnet: true,
|
33
|
-
});
|
34
|
-
//# sourceMappingURL=celoCannoli.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"celoCannoli.js","sourceRoot":"","sources":["../../../chains/definitions/celoCannoli.ts"],"names":[],"mappings":";;;AAAA,qEAA8D;AAC9D,2DAAoD;AAEvC,QAAA,WAAW,GAAiB,IAAA,4BAAW,EAAC;IACnD,GAAG,4BAAW;IACd,EAAE,EAAE,KAAM;IACV,IAAI,EAAE,SAAS;IACf,cAAc,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;KACjB;IACD,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;KACF;IACD,cAAc,EAAE;QACd,OAAO,EAAE;YACP,IAAI,EAAE,eAAe;YACrB,GAAG,EAAE,mCAAmC;SACzC;KACF;IACD,SAAS,EAAE;QACT,UAAU,EAAE;YACV,OAAO,EAAE,4CAA4C;YACrD,YAAY,EAAE,KAAK;SACpB;KACF;IACD,OAAO,EAAE,IAAI;CACd,CAAC,CAAA"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { defineChain } from '../../utils/chain/defineChain.js';
|
2
|
-
import { chainConfig } from '../celo/chainConfig.js';
|
3
|
-
export const celoCannoli = /*#__PURE__*/ defineChain({
|
4
|
-
...chainConfig,
|
5
|
-
id: 17323,
|
6
|
-
name: 'Cannoli',
|
7
|
-
nativeCurrency: {
|
8
|
-
decimals: 18,
|
9
|
-
name: 'CELO',
|
10
|
-
symbol: 'C-CELO',
|
11
|
-
},
|
12
|
-
rpcUrls: {
|
13
|
-
default: {
|
14
|
-
http: ['https://forno.cannoli.celo-testnet.org'],
|
15
|
-
},
|
16
|
-
},
|
17
|
-
blockExplorers: {
|
18
|
-
default: {
|
19
|
-
name: 'Celo Explorer',
|
20
|
-
url: 'https://explorer.celo.org/cannoli',
|
21
|
-
},
|
22
|
-
},
|
23
|
-
contracts: {
|
24
|
-
multicall3: {
|
25
|
-
address: '0x5Acb0aa8BF4E8Ff0d882Ee187140713C12BF9718',
|
26
|
-
blockCreated: 87429,
|
27
|
-
},
|
28
|
-
},
|
29
|
-
testnet: true,
|
30
|
-
});
|
31
|
-
//# sourceMappingURL=celoCannoli.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"celoCannoli.js","sourceRoot":"","sources":["../../../chains/definitions/celoCannoli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;IACnD,GAAG,WAAW;IACd,EAAE,EAAE,KAAM;IACV,IAAI,EAAE,SAAS;IACf,cAAc,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;KACjB;IACD,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;KACF;IACD,cAAc,EAAE;QACd,OAAO,EAAE;YACP,IAAI,EAAE,eAAe;YACrB,GAAG,EAAE,mCAAmC;SACzC;KACF;IACD,SAAS,EAAE;QACT,UAAU,EAAE;YACV,OAAO,EAAE,4CAA4C;YACrD,YAAY,EAAE,KAAK;SACpB;KACF;IACD,OAAO,EAAE,IAAI;CACd,CAAC,CAAA"}
|