viem 2.39.3 → 2.40.1
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 +24 -0
- package/_cjs/accounts/mnemonicToAccount.js +3 -3
- package/_cjs/accounts/mnemonicToAccount.js.map +1 -1
- package/_cjs/actions/index.js +5 -3
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/public/fillTransaction.js +118 -0
- package/_cjs/actions/public/fillTransaction.js.map +1 -0
- package/_cjs/actions/wallet/prepareTransactionRequest.js +45 -11
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/chains/definitions/hyperEvm.js +22 -0
- package/_cjs/chains/definitions/hyperEvm.js.map +1 -0
- package/_cjs/chains/definitions/katana.js +1 -1
- package/_cjs/chains/definitions/katana.js.map +1 -1
- package/_cjs/chains/definitions/monad.js +15 -3
- package/_cjs/chains/definitions/monad.js.map +1 -1
- package/_cjs/chains/index.js +12 -9
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/decorators/public.js +2 -0
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/clients/decorators/wallet.js +2 -0
- package/_cjs/clients/decorators/wallet.js.map +1 -1
- package/_cjs/errors/request.js +28 -0
- package/_cjs/errors/request.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/transaction/assertRequest.js +1 -6
- package/_cjs/utils/transaction/assertRequest.js.map +1 -1
- package/_esm/accounts/mnemonicToAccount.js +3 -3
- package/_esm/accounts/mnemonicToAccount.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/public/fillTransaction.js +145 -0
- package/_esm/actions/public/fillTransaction.js.map +1 -0
- package/_esm/actions/wallet/prepareTransactionRequest.js +49 -11
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/chains/definitions/hyperEvm.js +19 -0
- package/_esm/chains/definitions/hyperEvm.js.map +1 -0
- package/_esm/chains/definitions/katana.js +1 -1
- package/_esm/chains/definitions/katana.js.map +1 -1
- package/_esm/chains/definitions/monad.js +15 -3
- package/_esm/chains/definitions/monad.js.map +1 -1
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/decorators/public.js +2 -0
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/clients/decorators/wallet.js +2 -0
- package/_esm/clients/decorators/wallet.js.map +1 -1
- package/_esm/errors/request.js +28 -0
- package/_esm/errors/request.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/utils/transaction/assertRequest.js +1 -6
- package/_esm/utils/transaction/assertRequest.js.map +1 -1
- package/_types/accounts/mnemonicToAccount.d.ts +4 -2
- package/_types/accounts/mnemonicToAccount.d.ts.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/fillTransaction.d.ts +49 -0
- package/_types/actions/public/fillTransaction.d.ts.map +1 -0
- package/_types/actions/wallet/prepareTransactionRequest.d.ts +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/chains/definitions/hyperEvm.d.ts +39 -0
- package/_types/chains/definitions/hyperEvm.d.ts.map +1 -0
- package/_types/chains/definitions/katana.d.ts +1 -1
- package/_types/chains/definitions/monad.d.ts +15 -12
- package/_types/chains/definitions/monad.d.ts.map +1 -1
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +25 -0
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/clients/decorators/wallet.d.ts +26 -1
- package/_types/clients/decorators/wallet.d.ts.map +1 -1
- package/_types/errors/request.d.ts +4 -0
- package/_types/errors/request.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/eip1193.d.ts +30 -0
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/utils/transaction/assertRequest.d.ts +1 -1
- package/_types/utils/transaction/assertRequest.d.ts.map +1 -1
- package/accounts/mnemonicToAccount.ts +6 -4
- package/actions/index.ts +6 -0
- package/actions/public/fillTransaction.ts +250 -0
- package/actions/wallet/prepareTransactionRequest.ts +76 -10
- package/chains/definitions/hyperEvm.ts +19 -0
- package/chains/definitions/katana.ts +1 -1
- package/chains/definitions/monad.ts +15 -3
- package/chains/index.ts +1 -0
- package/clients/decorators/public.ts +40 -0
- package/clients/decorators/wallet.ts +41 -1
- package/errors/request.ts +8 -1
- package/errors/version.ts +1 -1
- package/index.ts +5 -0
- package/package.json +1 -1
- package/types/eip1193.ts +30 -0
- package/utils/transaction/assertRequest.ts +2 -17
package/package.json
CHANGED
package/types/eip1193.ts
CHANGED
|
@@ -753,6 +753,21 @@ export type PublicRpcSchema = [
|
|
|
753
753
|
]
|
|
754
754
|
ReturnType: Quantity
|
|
755
755
|
},
|
|
756
|
+
/**
|
|
757
|
+
* @description Fills a transaction with the necessary data to be signed.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* provider.request({ method: 'eth_fillTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
|
|
761
|
+
* // => '0x...'
|
|
762
|
+
*/
|
|
763
|
+
{
|
|
764
|
+
Method: 'eth_fillTransaction'
|
|
765
|
+
Parameters: [transaction: TransactionRequest]
|
|
766
|
+
ReturnType: {
|
|
767
|
+
raw: Hex
|
|
768
|
+
tx: Transaction
|
|
769
|
+
}
|
|
770
|
+
},
|
|
756
771
|
/**
|
|
757
772
|
* @description Returns a collection of historical gas information
|
|
758
773
|
*
|
|
@@ -1701,6 +1716,21 @@ export type WalletRpcSchema = [
|
|
|
1701
1716
|
]
|
|
1702
1717
|
ReturnType: Quantity
|
|
1703
1718
|
},
|
|
1719
|
+
/**
|
|
1720
|
+
* @description Fills a transaction with the necessary data to be signed.
|
|
1721
|
+
*
|
|
1722
|
+
* @example
|
|
1723
|
+
* provider.request({ method: 'eth_fillTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
|
|
1724
|
+
* // => '0x...'
|
|
1725
|
+
*/
|
|
1726
|
+
{
|
|
1727
|
+
Method: 'eth_fillTransaction'
|
|
1728
|
+
Parameters: [transaction: TransactionRequest]
|
|
1729
|
+
ReturnType: {
|
|
1730
|
+
raw: Hex
|
|
1731
|
+
tx: Transaction
|
|
1732
|
+
}
|
|
1733
|
+
},
|
|
1704
1734
|
/**
|
|
1705
1735
|
* @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
|
|
1706
1736
|
* @link https://eips.ethereum.org/EIPS/eip-1102
|
|
@@ -14,10 +14,7 @@ import {
|
|
|
14
14
|
TipAboveFeeCapError,
|
|
15
15
|
type TipAboveFeeCapErrorType,
|
|
16
16
|
} from '../../errors/node.js'
|
|
17
|
-
import {
|
|
18
|
-
FeeConflictError,
|
|
19
|
-
type FeeConflictErrorType,
|
|
20
|
-
} from '../../errors/transaction.js'
|
|
17
|
+
import type { FeeConflictErrorType } from '../../errors/transaction.js'
|
|
21
18
|
import type { ErrorType } from '../../errors/utils.js'
|
|
22
19
|
import type { Chain } from '../../types/chain.js'
|
|
23
20
|
import type { ExactPartial } from '../../types/utils.js'
|
|
@@ -36,23 +33,11 @@ export type AssertRequestErrorType =
|
|
|
36
33
|
| ErrorType
|
|
37
34
|
|
|
38
35
|
export function assertRequest(args: AssertRequestParameters) {
|
|
39
|
-
const {
|
|
40
|
-
account: account_,
|
|
41
|
-
gasPrice,
|
|
42
|
-
maxFeePerGas,
|
|
43
|
-
maxPriorityFeePerGas,
|
|
44
|
-
to,
|
|
45
|
-
} = args
|
|
36
|
+
const { account: account_, maxFeePerGas, maxPriorityFeePerGas, to } = args
|
|
46
37
|
const account = account_ ? parseAccount(account_) : undefined
|
|
47
38
|
if (account && !isAddress(account.address))
|
|
48
39
|
throw new InvalidAddressError({ address: account.address })
|
|
49
40
|
if (to && !isAddress(to)) throw new InvalidAddressError({ address: to })
|
|
50
|
-
if (
|
|
51
|
-
typeof gasPrice !== 'undefined' &&
|
|
52
|
-
(typeof maxFeePerGas !== 'undefined' ||
|
|
53
|
-
typeof maxPriorityFeePerGas !== 'undefined')
|
|
54
|
-
)
|
|
55
|
-
throw new FeeConflictError()
|
|
56
41
|
|
|
57
42
|
if (maxFeePerGas && maxFeePerGas > maxUint256)
|
|
58
43
|
throw new FeeCapTooHighError({ maxFeePerGas })
|