viem 1.6.7 → 1.8.0
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/README.md +6 -0
- package/dist/cjs/actions/index.js +8 -2
- package/dist/cjs/actions/index.js.map +1 -1
- package/dist/cjs/actions/public/estimateFeesPerGas.js +60 -0
- package/dist/cjs/actions/public/estimateFeesPerGas.js.map +1 -0
- package/dist/cjs/actions/public/estimateGas.js +2 -2
- package/dist/cjs/actions/public/estimateGas.js.map +1 -1
- package/dist/cjs/actions/public/estimateMaxPriorityFeePerGas.js +44 -0
- package/dist/cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/cjs/actions/public/verifyHash.js.map +1 -1
- package/dist/cjs/actions/public/verifyMessage.js.map +1 -1
- package/dist/cjs/actions/public/verifyTypedData.js.map +1 -1
- package/dist/cjs/actions/public/watchContractEvent.js +10 -7
- package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
- package/dist/cjs/actions/wallet/deployContract.js.map +1 -1
- package/dist/cjs/actions/wallet/prepareTransactionRequest.js +70 -0
- package/dist/cjs/actions/wallet/prepareTransactionRequest.js.map +1 -0
- package/dist/cjs/actions/wallet/sendRawTransaction.js +11 -0
- package/dist/cjs/actions/wallet/sendRawTransaction.js.map +1 -0
- package/dist/cjs/actions/wallet/sendTransaction.js +6 -6
- package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/dist/cjs/actions/wallet/signTransaction.js +47 -0
- package/dist/cjs/actions/wallet/signTransaction.js.map +1 -0
- package/dist/cjs/actions/wallet/writeContract.js.map +1 -1
- package/dist/cjs/chains/celo/formatters.js +4 -1
- package/dist/cjs/chains/celo/formatters.js.map +1 -1
- package/dist/cjs/clients/createTestClient.js.map +1 -1
- package/dist/cjs/clients/decorators/public.js +8 -0
- package/dist/cjs/clients/decorators/public.js.map +1 -1
- package/dist/cjs/clients/decorators/wallet.js +6 -0
- package/dist/cjs/clients/decorators/wallet.js.map +1 -1
- package/dist/cjs/errors/fee.js +42 -0
- package/dist/cjs/errors/fee.js.map +1 -0
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/index.js +9 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/public.js +5 -1
- package/dist/cjs/public.js.map +1 -1
- package/dist/cjs/utils/data/isBytesEqual.js +4 -3
- package/dist/cjs/utils/data/isBytesEqual.js.map +1 -1
- package/dist/cjs/utils/ens/encodedLabelToLabelhash.js +2 -2
- package/dist/cjs/utils/ens/encodedLabelToLabelhash.js.map +1 -1
- package/dist/cjs/utils/formatters/transactionRequest.js +9 -1
- package/dist/cjs/utils/formatters/transactionRequest.js.map +1 -1
- package/dist/cjs/utils/index.js +3 -3
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/actions/index.js +3 -0
- package/dist/esm/actions/index.js.map +1 -1
- package/dist/esm/actions/public/estimateFeesPerGas.js +78 -0
- package/dist/esm/actions/public/estimateFeesPerGas.js.map +1 -0
- package/dist/esm/actions/public/estimateGas.js +2 -2
- package/dist/esm/actions/public/estimateGas.js.map +1 -1
- package/dist/esm/actions/public/estimateMaxPriorityFeePerGas.js +64 -0
- package/dist/esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/actions/public/verifyHash.js.map +1 -1
- package/dist/esm/actions/public/verifyMessage.js.map +1 -1
- package/dist/esm/actions/public/verifyTypedData.js.map +1 -1
- package/dist/esm/actions/public/watchContractEvent.js +5 -2
- package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
- package/dist/esm/actions/wallet/deployContract.js.map +1 -1
- package/dist/esm/actions/wallet/prepareTransactionRequest.js +109 -0
- package/dist/esm/actions/wallet/prepareTransactionRequest.js.map +1 -0
- package/dist/esm/actions/wallet/sendRawTransaction.js +31 -0
- package/dist/esm/actions/wallet/sendRawTransaction.js.map +1 -0
- package/dist/esm/actions/wallet/sendTransaction.js +6 -6
- package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
- package/dist/esm/actions/wallet/signTransaction.js +87 -0
- package/dist/esm/actions/wallet/signTransaction.js.map +1 -0
- package/dist/esm/actions/wallet/writeContract.js.map +1 -1
- package/dist/esm/chains/celo/formatters.js +4 -1
- package/dist/esm/chains/celo/formatters.js.map +1 -1
- package/dist/esm/clients/createTestClient.js.map +1 -1
- package/dist/esm/clients/decorators/public.js +8 -0
- package/dist/esm/clients/decorators/public.js.map +1 -1
- package/dist/esm/clients/decorators/wallet.js +6 -0
- package/dist/esm/clients/decorators/wallet.js.map +1 -1
- package/dist/esm/errors/fee.js +36 -0
- package/dist/esm/errors/fee.js.map +1 -0
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/public.js +2 -0
- package/dist/esm/public.js.map +1 -1
- package/dist/esm/utils/data/isBytesEqual.js +2 -1
- package/dist/esm/utils/data/isBytesEqual.js.map +1 -1
- package/dist/esm/utils/ens/encodedLabelToLabelhash.js +1 -1
- package/dist/esm/utils/ens/encodedLabelToLabelhash.js.map +1 -1
- package/dist/esm/utils/formatters/transactionRequest.js +8 -0
- package/dist/esm/utils/formatters/transactionRequest.js.map +1 -1
- package/dist/esm/utils/index.js +3 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/types/actions/index.d.ts +3 -0
- package/dist/types/actions/index.d.ts.map +1 -1
- package/dist/types/actions/public/estimateFeesPerGas.d.ts +48 -0
- package/dist/types/actions/public/estimateFeesPerGas.d.ts.map +1 -0
- package/dist/types/actions/public/estimateMaxPriorityFeePerGas.d.ts +37 -0
- package/dist/types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/actions/public/verifyHash.d.ts +1 -1
- package/dist/types/actions/public/verifyHash.d.ts.map +1 -1
- package/dist/types/actions/public/verifyMessage.d.ts +2 -2
- package/dist/types/actions/public/verifyMessage.d.ts.map +1 -1
- package/dist/types/actions/public/verifyTypedData.d.ts +2 -2
- package/dist/types/actions/public/verifyTypedData.d.ts.map +1 -1
- package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/dist/types/actions/wallet/deployContract.d.ts +2 -1
- package/dist/types/actions/wallet/deployContract.d.ts.map +1 -1
- package/dist/types/actions/wallet/prepareTransactionRequest.d.ts +52 -0
- package/dist/types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -0
- package/dist/types/actions/wallet/sendRawTransaction.d.ts +38 -0
- package/dist/types/actions/wallet/sendRawTransaction.d.ts.map +1 -0
- package/dist/types/actions/wallet/sendTransaction.d.ts +2 -1
- package/dist/types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/dist/types/actions/wallet/signTransaction.d.ts +55 -0
- package/dist/types/actions/wallet/signTransaction.d.ts.map +1 -0
- package/dist/types/actions/wallet/writeContract.d.ts +2 -1
- package/dist/types/actions/wallet/writeContract.d.ts.map +1 -1
- package/dist/types/chains/celo/formatters.d.ts +303 -5
- package/dist/types/chains/celo/formatters.d.ts.map +1 -1
- package/dist/types/chains/celo/types.d.ts +43 -17
- package/dist/types/chains/celo/types.d.ts.map +1 -1
- package/dist/types/chains/index.d.ts +1084 -190
- package/dist/types/chains/index.d.ts.map +1 -1
- package/dist/types/chains/utils.d.ts +1 -1
- package/dist/types/chains/utils.d.ts.map +1 -1
- package/dist/types/clients/createTestClient.d.ts +1 -1
- package/dist/types/clients/createTestClient.d.ts.map +1 -1
- package/dist/types/clients/decorators/public.d.ts +112 -0
- package/dist/types/clients/decorators/public.d.ts.map +1 -1
- package/dist/types/clients/decorators/wallet.d.ts +111 -0
- package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
- package/dist/types/errors/fee.d.ts +16 -0
- package/dist/types/errors/fee.d.ts.map +1 -0
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/index.d.ts +22 -16
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/public.d.ts +2 -0
- package/dist/types/public.d.ts.map +1 -1
- package/dist/types/types/chain.d.ts +64 -11
- package/dist/types/types/chain.d.ts.map +1 -1
- package/dist/types/types/eip1193.d.ts +13 -1
- package/dist/types/types/eip1193.d.ts.map +1 -1
- package/dist/types/types/fee.d.ts +1 -0
- package/dist/types/types/fee.d.ts.map +1 -1
- package/dist/types/utils/data/isBytesEqual.d.ts +1 -1
- package/dist/types/utils/data/isBytesEqual.d.ts.map +1 -1
- package/dist/types/utils/ens/encodeLabelhash.d.ts +1 -1
- package/dist/types/utils/ens/encodeLabelhash.d.ts.map +1 -1
- package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts +1 -1
- package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts.map +1 -1
- package/dist/types/utils/formatters/transactionRequest.d.ts +5 -0
- package/dist/types/utils/formatters/transactionRequest.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +3 -1
- package/dist/types/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/actions/index.ts +15 -0
- package/src/actions/public/estimateFeesPerGas.ts +154 -0
- package/src/actions/public/estimateGas.ts +5 -5
- package/src/actions/public/estimateMaxPriorityFeePerGas.ts +98 -0
- package/src/actions/public/verifyHash.ts +1 -1
- package/src/actions/public/verifyMessage.ts +3 -2
- package/src/actions/public/verifyTypedData.ts +3 -2
- package/src/actions/public/watchContractEvent.ts +9 -6
- package/src/actions/wallet/deployContract.ts +2 -1
- package/src/actions/wallet/prepareTransactionRequest.ts +179 -0
- package/src/actions/wallet/sendRawTransaction.ts +48 -0
- package/src/actions/wallet/sendTransaction.ts +8 -7
- package/src/actions/wallet/signTransaction.ts +137 -0
- package/src/actions/wallet/writeContract.ts +2 -1
- package/src/chains/celo/formatters.ts +11 -12
- package/src/chains/celo/types.ts +86 -30
- package/src/chains/utils.ts +4 -4
- package/src/clients/createTestClient.ts +2 -1
- package/src/clients/decorators/public.ts +145 -0
- package/src/clients/decorators/wallet.ts +133 -0
- package/src/errors/fee.ts +27 -0
- package/src/errors/rpc.ts +1 -1
- package/src/errors/version.ts +1 -1
- package/src/index.ts +45 -25
- package/src/public.ts +10 -0
- package/src/types/chain.ts +80 -12
- package/src/types/eip1193.ts +13 -1
- package/src/types/fee.ts +2 -0
- package/src/utils/data/isBytesEqual.ts +4 -1
- package/src/utils/ens/encodeLabelhash.ts +1 -1
- package/src/utils/ens/encodedLabelToLabelhash.ts +2 -2
- package/src/utils/formatters/transactionRequest.ts +10 -0
- package/src/utils/index.ts +4 -1
- package/chains/dist/cjs/celo/formatters.js +0 -58
- package/chains/dist/cjs/celo/formatters.js.map +0 -1
- package/chains/dist/cjs/celo/parsers.js +0 -72
- package/chains/dist/cjs/celo/parsers.js.map +0 -1
- package/chains/dist/cjs/celo/serializers.js +0 -75
- package/chains/dist/cjs/celo/serializers.js.map +0 -1
- package/chains/dist/cjs/celo/types.js +0 -3
- package/chains/dist/cjs/celo/types.js.map +0 -1
- package/chains/dist/cjs/index.js +0 -135
- package/chains/dist/cjs/index.js.map +0 -1
- package/chains/dist/cjs/optimism/fees.js +0 -7
- package/chains/dist/cjs/optimism/fees.js.map +0 -1
- package/chains/dist/cjs/optimism/formatters.js +0 -52
- package/chains/dist/cjs/optimism/formatters.js.map +0 -1
- package/chains/dist/cjs/optimism/types.js +0 -3
- package/chains/dist/cjs/optimism/types.js.map +0 -1
- package/chains/dist/cjs/types.js +0 -3
- package/chains/dist/cjs/types.js.map +0 -1
- package/chains/dist/cjs/utils.js +0 -49
- package/chains/dist/cjs/utils.js.map +0 -1
- package/chains/dist/tsconfig.build.tsbuildinfo +0 -1
- package/chains/node_modules/.bin/tsc +0 -17
- package/chains/node_modules/.bin/tsserver +0 -17
- package/chains/tsconfig.tsbuildinfo +0 -1
- package/dist/cjs/utils/transaction/prepareRequest.js +0 -64
- package/dist/cjs/utils/transaction/prepareRequest.js.map +0 -1
- package/dist/esm/utils/transaction/prepareRequest.js +0 -64
- package/dist/esm/utils/transaction/prepareRequest.js.map +0 -1
- package/dist/types/utils/transaction/prepareRequest.d.ts +0 -20
- package/dist/types/utils/transaction/prepareRequest.d.ts.map +0 -1
- package/src/utils/transaction/prepareRequest.ts +0 -143
@@ -22,6 +22,11 @@ import {
|
|
22
22
|
type GetPermissionsReturnType,
|
23
23
|
getPermissions,
|
24
24
|
} from '../../actions/wallet/getPermissions.js'
|
25
|
+
import {
|
26
|
+
type PrepareTransactionRequestParameters,
|
27
|
+
type PrepareTransactionRequestReturnType,
|
28
|
+
prepareTransactionRequest,
|
29
|
+
} from '../../actions/wallet/prepareTransactionRequest.js'
|
25
30
|
import {
|
26
31
|
type RequestAddressesReturnType,
|
27
32
|
requestAddresses,
|
@@ -31,6 +36,11 @@ import {
|
|
31
36
|
type RequestPermissionsReturnType,
|
32
37
|
requestPermissions,
|
33
38
|
} from '../../actions/wallet/requestPermissions.js'
|
39
|
+
import {
|
40
|
+
type SendRawTransactionParameters,
|
41
|
+
type SendRawTransactionReturnType,
|
42
|
+
sendRawTransaction,
|
43
|
+
} from '../../actions/wallet/sendRawTransaction.js'
|
34
44
|
import {
|
35
45
|
type SendTransactionParameters,
|
36
46
|
type SendTransactionReturnType,
|
@@ -41,6 +51,11 @@ import {
|
|
41
51
|
type SignMessageReturnType,
|
42
52
|
signMessage,
|
43
53
|
} from '../../actions/wallet/signMessage.js'
|
54
|
+
import {
|
55
|
+
type SignTransactionParameters,
|
56
|
+
type SignTransactionReturnType,
|
57
|
+
signTransaction,
|
58
|
+
} from '../../actions/wallet/signTransaction.js'
|
44
59
|
import {
|
45
60
|
type SignTypedDataParameters,
|
46
61
|
type SignTypedDataReturnType,
|
@@ -175,6 +190,47 @@ export type WalletActions<
|
|
175
190
|
* const permissions = await client.getPermissions()
|
176
191
|
*/
|
177
192
|
getPermissions: () => Promise<GetPermissionsReturnType>
|
193
|
+
/**
|
194
|
+
* Prepares a transaction request for signing.
|
195
|
+
*
|
196
|
+
* - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html
|
197
|
+
*
|
198
|
+
* @param args - {@link PrepareTransactionRequestParameters}
|
199
|
+
* @returns The transaction request. {@link PrepareTransactionRequestReturnType}
|
200
|
+
*
|
201
|
+
* @example
|
202
|
+
* import { createWalletClient, custom } from 'viem'
|
203
|
+
* import { mainnet } from 'viem/chains'
|
204
|
+
*
|
205
|
+
* const client = createWalletClient({
|
206
|
+
* chain: mainnet,
|
207
|
+
* transport: custom(window.ethereum),
|
208
|
+
* })
|
209
|
+
* const request = await client.prepareTransactionRequest({
|
210
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
211
|
+
* to: '0x0000000000000000000000000000000000000000',
|
212
|
+
* value: 1n,
|
213
|
+
* })
|
214
|
+
*
|
215
|
+
* @example
|
216
|
+
* // Account Hoisting
|
217
|
+
* import { createWalletClient, http } from 'viem'
|
218
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
219
|
+
* import { mainnet } from 'viem/chains'
|
220
|
+
*
|
221
|
+
* const client = createWalletClient({
|
222
|
+
* account: privateKeyToAccount('0x…'),
|
223
|
+
* chain: mainnet,
|
224
|
+
* transport: custom(window.ethereum),
|
225
|
+
* })
|
226
|
+
* const request = await client.prepareTransactionRequest({
|
227
|
+
* to: '0x0000000000000000000000000000000000000000',
|
228
|
+
* value: 1n,
|
229
|
+
* })
|
230
|
+
*/
|
231
|
+
prepareTransactionRequest: <TChainOverride extends Chain | undefined,>(
|
232
|
+
args: PrepareTransactionRequestParameters<TChain, TAccount, TChainOverride>,
|
233
|
+
) => Promise<PrepareTransactionRequestReturnType>
|
178
234
|
/**
|
179
235
|
* Requests a list of accounts managed by a wallet.
|
180
236
|
*
|
@@ -222,6 +278,33 @@ export type WalletActions<
|
|
222
278
|
requestPermissions: (
|
223
279
|
args: RequestPermissionsParameters,
|
224
280
|
) => Promise<RequestPermissionsReturnType>
|
281
|
+
/**
|
282
|
+
* Sends a **signed** transaction to the network
|
283
|
+
*
|
284
|
+
* - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html
|
285
|
+
* - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
|
286
|
+
*
|
287
|
+
* @param client - Client to use
|
288
|
+
* @param parameters - {@link SendRawTransactionParameters}
|
289
|
+
* @returns The transaction hash. {@link SendRawTransactionReturnType}
|
290
|
+
*
|
291
|
+
* @example
|
292
|
+
* import { createWalletClient, custom } from 'viem'
|
293
|
+
* import { mainnet } from 'viem/chains'
|
294
|
+
* import { sendRawTransaction } from 'viem/wallet'
|
295
|
+
*
|
296
|
+
* const client = createWalletClient({
|
297
|
+
* chain: mainnet,
|
298
|
+
* transport: custom(window.ethereum),
|
299
|
+
* })
|
300
|
+
*
|
301
|
+
* const hash = await client.sendRawTransaction({
|
302
|
+
* serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
|
303
|
+
* })
|
304
|
+
*/
|
305
|
+
sendRawTransaction: (
|
306
|
+
args: SendRawTransactionParameters,
|
307
|
+
) => Promise<SendRawTransactionReturnType>
|
225
308
|
/**
|
226
309
|
* Creates, signs, and sends a new transaction to the network.
|
227
310
|
*
|
@@ -313,6 +396,52 @@ export type WalletActions<
|
|
313
396
|
signMessage: (
|
314
397
|
args: SignMessageParameters<TAccount>,
|
315
398
|
) => Promise<SignMessageReturnType>
|
399
|
+
/**
|
400
|
+
* Signs a transaction.
|
401
|
+
*
|
402
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signTransaction.html
|
403
|
+
* - JSON-RPC Methods:
|
404
|
+
* - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
|
405
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
406
|
+
*
|
407
|
+
* @param args - {@link SignTransactionParameters}
|
408
|
+
* @returns The signed message. {@link SignTransactionReturnType}
|
409
|
+
*
|
410
|
+
* @example
|
411
|
+
* import { createWalletClient, custom } from 'viem'
|
412
|
+
* import { mainnet } from 'viem/chains'
|
413
|
+
*
|
414
|
+
* const client = createWalletClient({
|
415
|
+
* chain: mainnet,
|
416
|
+
* transport: custom(window.ethereum),
|
417
|
+
* })
|
418
|
+
* const request = await client.prepareTransactionRequest({
|
419
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
420
|
+
* to: '0x0000000000000000000000000000000000000000',
|
421
|
+
* value: 1n,
|
422
|
+
* })
|
423
|
+
* const signature = await client.signTransaction(request)
|
424
|
+
*
|
425
|
+
* @example
|
426
|
+
* // Account Hoisting
|
427
|
+
* import { createWalletClient, http } from 'viem'
|
428
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
429
|
+
* import { mainnet } from 'viem/chains'
|
430
|
+
*
|
431
|
+
* const client = createWalletClient({
|
432
|
+
* account: privateKeyToAccount('0x…'),
|
433
|
+
* chain: mainnet,
|
434
|
+
* transport: custom(window.ethereum),
|
435
|
+
* })
|
436
|
+
* const request = await client.prepareTransactionRequest({
|
437
|
+
* to: '0x0000000000000000000000000000000000000000',
|
438
|
+
* value: 1n,
|
439
|
+
* })
|
440
|
+
* const signature = await client.signTransaction(request)
|
441
|
+
*/
|
442
|
+
signTransaction: <TChainOverride extends Chain | undefined,>(
|
443
|
+
args: SignTransactionParameters<TChain, TAccount, TChainOverride>,
|
444
|
+
) => Promise<SignTransactionReturnType>
|
316
445
|
/**
|
317
446
|
* Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
318
447
|
*
|
@@ -536,10 +665,14 @@ export function walletActions<
|
|
536
665
|
getAddresses: () => getAddresses(client),
|
537
666
|
getChainId: () => getChainId(client),
|
538
667
|
getPermissions: () => getPermissions(client),
|
668
|
+
prepareTransactionRequest: (args) =>
|
669
|
+
prepareTransactionRequest(client as any, args as any),
|
539
670
|
requestAddresses: () => requestAddresses(client),
|
540
671
|
requestPermissions: (args) => requestPermissions(client, args),
|
672
|
+
sendRawTransaction: (args) => sendRawTransaction(client, args),
|
541
673
|
sendTransaction: (args) => sendTransaction(client, args),
|
542
674
|
signMessage: (args) => signMessage(client, args),
|
675
|
+
signTransaction: (args) => signTransaction(client, args),
|
543
676
|
signTypedData: (args) => signTypedData(client, args),
|
544
677
|
switchChain: (args) => switchChain(client, args),
|
545
678
|
watchAsset: (args) => watchAsset(client, args),
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { formatGwei } from '../utils/unit/formatGwei.js'
|
2
|
+
import { BaseError } from './base.js'
|
3
|
+
|
4
|
+
export class BaseFeeScalarError extends BaseError {
|
5
|
+
override name = 'BaseFeeScalarError'
|
6
|
+
constructor() {
|
7
|
+
super('`baseFeeMultiplier` must be greater than 1.')
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
export class Eip1559FeesNotSupportedError extends BaseError {
|
12
|
+
override name = 'Eip1559FeesNotSupportedError'
|
13
|
+
constructor() {
|
14
|
+
super('Chain does not support EIP-1559 fees.')
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
export class MaxFeePerGasTooLowError extends BaseError {
|
19
|
+
override name = 'MaxFeePerGasTooLowError'
|
20
|
+
constructor({ maxPriorityFeePerGas }: { maxPriorityFeePerGas: bigint }) {
|
21
|
+
super(
|
22
|
+
`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${formatGwei(
|
23
|
+
maxPriorityFeePerGas,
|
24
|
+
)} gwei).`,
|
25
|
+
)
|
26
|
+
}
|
27
|
+
}
|
package/src/errors/rpc.ts
CHANGED
@@ -60,7 +60,7 @@ export type ProviderRpcErrorCode =
|
|
60
60
|
| 4200 // Unsupported Method
|
61
61
|
| 4900 // Disconnected
|
62
62
|
| 4901 // Chain Disconnected
|
63
|
-
| 4902 // Chain Not
|
63
|
+
| 4902 // Chain Not Recognized
|
64
64
|
|
65
65
|
/**
|
66
66
|
* Error subclass implementing Ethereum Provider errors per EIP-1193.
|
package/src/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '1.
|
1
|
+
export const version = '1.8.0'
|
package/src/index.ts
CHANGED
@@ -64,6 +64,14 @@ export type {
|
|
64
64
|
EstimateGasParameters,
|
65
65
|
EstimateGasReturnType,
|
66
66
|
} from './actions/public/estimateGas.js'
|
67
|
+
export type {
|
68
|
+
EstimateFeesPerGasParameters,
|
69
|
+
EstimateFeesPerGasReturnType,
|
70
|
+
} from './actions/public/estimateFeesPerGas.js'
|
71
|
+
export type {
|
72
|
+
EstimateMaxPriorityFeePerGasParameters,
|
73
|
+
EstimateMaxPriorityFeePerGasReturnType,
|
74
|
+
} from './actions/public/estimateMaxPriorityFeePerGas.js'
|
67
75
|
export type { GetAddressesReturnType } from './actions/wallet/getAddresses.js'
|
68
76
|
export type {
|
69
77
|
GetBalanceParameters,
|
@@ -195,6 +203,12 @@ export type {
|
|
195
203
|
SendTransactionParameters,
|
196
204
|
SendTransactionReturnType,
|
197
205
|
} from './actions/wallet/sendTransaction.js'
|
206
|
+
export type {
|
207
|
+
PrepareTransactionRequestParameters,
|
208
|
+
PrepareTransactionRequestReturnType,
|
209
|
+
/** @deprecated import `prepareTransactionRequest` from `viem/actions` instead. */
|
210
|
+
prepareTransactionRequest as prepareRequest,
|
211
|
+
} from './actions/wallet/prepareTransactionRequest.js'
|
198
212
|
export type {
|
199
213
|
SendUnsignedTransactionParameters,
|
200
214
|
SendUnsignedTransactionReturnType,
|
@@ -245,6 +259,29 @@ export type {
|
|
245
259
|
WriteContractParameters,
|
246
260
|
WriteContractReturnType,
|
247
261
|
} from './actions/wallet/writeContract.js'
|
262
|
+
export type {
|
263
|
+
Chain,
|
264
|
+
ChainContract,
|
265
|
+
ChainFees,
|
266
|
+
ChainFormatter,
|
267
|
+
/** @deprecated use `ChainFormatter` instead. */
|
268
|
+
ChainFormatter as Formatter,
|
269
|
+
ChainFormatters,
|
270
|
+
/** @deprecated use `ChainFormatters` instead. */
|
271
|
+
ChainFormatters as Formatters,
|
272
|
+
ChainSerializers,
|
273
|
+
/** @deprecated use `ChainSerializers` instead. */
|
274
|
+
ChainSerializers as Serializers,
|
275
|
+
ExtractChainFormatterExclude,
|
276
|
+
/** @deprecated use `ExtractChainFormatterExclude` instead. */
|
277
|
+
ExtractChainFormatterExclude as ExtractFormatterExclude,
|
278
|
+
ExtractChainFormatterParameters,
|
279
|
+
/** @deprecated use `ExtractChainFormatterParameters` instead. */
|
280
|
+
ExtractChainFormatterParameters as ExtractFormatterParameters,
|
281
|
+
ExtractChainFormatterReturnType,
|
282
|
+
/** @deprecated use `ExtractChainFormatterReturnType` instead. */
|
283
|
+
ExtractChainFormatterReturnType as ExtractFormatterReturnType,
|
284
|
+
} from './types/chain.js'
|
248
285
|
export {
|
249
286
|
type Client,
|
250
287
|
type ClientConfig,
|
@@ -435,6 +472,11 @@ export {
|
|
435
472
|
ContractFunctionZeroDataError,
|
436
473
|
RawContractError,
|
437
474
|
} from './errors/contract.js'
|
475
|
+
export {
|
476
|
+
BaseFeeScalarError,
|
477
|
+
Eip1559FeesNotSupportedError,
|
478
|
+
MaxFeePerGasTooLowError,
|
479
|
+
} from './errors/fee.js'
|
438
480
|
export {
|
439
481
|
ChainDisconnectedError,
|
440
482
|
InternalRpcError,
|
@@ -571,30 +613,7 @@ export type {
|
|
571
613
|
Signature,
|
572
614
|
SignableMessage,
|
573
615
|
} from './types/misc.js'
|
574
|
-
export type {
|
575
|
-
Chain,
|
576
|
-
ChainContract,
|
577
|
-
ChainFees,
|
578
|
-
ChainFormatter,
|
579
|
-
/** @deprecated use `ChainFormatter` instead. */
|
580
|
-
ChainFormatter as Formatter,
|
581
|
-
ChainFormatters,
|
582
|
-
/** @deprecated use `ChainFormatters` instead. */
|
583
|
-
ChainFormatters as Formatters,
|
584
|
-
ChainSerializers,
|
585
|
-
/** @deprecated use `ChainSerializers` instead. */
|
586
|
-
ChainSerializers as Serializers,
|
587
|
-
ExtractChainFormatterExclude,
|
588
|
-
/** @deprecated use `ExtractChainFormatterExclude` instead. */
|
589
|
-
ExtractChainFormatterExclude as ExtractFormatterExclude,
|
590
|
-
ExtractChainFormatterParameters,
|
591
|
-
/** @deprecated use `ExtractChainFormatterParameters` instead. */
|
592
|
-
ExtractChainFormatterParameters as ExtractFormatterParameters,
|
593
|
-
ExtractChainFormatterReturnType,
|
594
|
-
/** @deprecated use `ExtractChainFormatterReturnType` instead. */
|
595
|
-
ExtractChainFormatterReturnType as ExtractFormatterReturnType,
|
596
|
-
GetChain,
|
597
|
-
} from './types/chain.js'
|
616
|
+
export type { GetChain } from './types/chain.js'
|
598
617
|
export type {
|
599
618
|
AddEthereumChainParameter,
|
600
619
|
EIP1193EventMap,
|
@@ -621,6 +640,7 @@ export type {
|
|
621
640
|
FeeValues,
|
622
641
|
FeeValuesEIP1559,
|
623
642
|
FeeValuesLegacy,
|
643
|
+
FeeValuesType,
|
624
644
|
} from './types/fee.js'
|
625
645
|
export type { Filter } from './types/filter.js'
|
626
646
|
export type {
|
@@ -726,6 +746,7 @@ export {
|
|
726
746
|
type FormattedTransactionRequest,
|
727
747
|
defineTransactionRequest,
|
728
748
|
formatTransactionRequest,
|
749
|
+
rpcTransactionType,
|
729
750
|
} from './utils/formatters/transactionRequest.js'
|
730
751
|
export {
|
731
752
|
type GetAbiItemParameters,
|
@@ -848,7 +869,6 @@ export { parseEther } from './utils/unit/parseEther.js'
|
|
848
869
|
export { parseGwei } from './utils/unit/parseGwei.js'
|
849
870
|
export { parseTransaction } from './utils/transaction/parseTransaction.js'
|
850
871
|
export { parseUnits } from './utils/unit/parseUnits.js'
|
851
|
-
export { prepareRequest } from './utils/transaction/prepareRequest.js'
|
852
872
|
export { serializeAccessList } from './utils/transaction/serializeAccessList.js'
|
853
873
|
export {
|
854
874
|
serializeTransaction,
|
package/src/public.ts
CHANGED
@@ -53,6 +53,11 @@ export {
|
|
53
53
|
type GetFeeHistoryParameters,
|
54
54
|
type GetFeeHistoryReturnType,
|
55
55
|
} from './actions/public/getFeeHistory.js'
|
56
|
+
export {
|
57
|
+
estimateFeesPerGas,
|
58
|
+
type EstimateFeesPerGasParameters,
|
59
|
+
type EstimateFeesPerGasReturnType,
|
60
|
+
} from './actions/public/estimateFeesPerGas.js'
|
56
61
|
export {
|
57
62
|
getFilterChanges,
|
58
63
|
type GetFilterChangesParameters,
|
@@ -68,6 +73,11 @@ export {
|
|
68
73
|
getGasPrice,
|
69
74
|
type GetGasPriceReturnType,
|
70
75
|
} from './actions/public/getGasPrice.js'
|
76
|
+
export {
|
77
|
+
estimateMaxPriorityFeePerGas,
|
78
|
+
type EstimateMaxPriorityFeePerGasParameters,
|
79
|
+
type EstimateMaxPriorityFeePerGasReturnType,
|
80
|
+
} from './actions/public/estimateMaxPriorityFeePerGas.js'
|
71
81
|
export {
|
72
82
|
getTransaction,
|
73
83
|
type GetTransactionParameters,
|
package/src/types/chain.ts
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
import type { Address } from 'abitype'
|
2
2
|
|
3
|
-
import type {
|
4
|
-
import type {
|
5
|
-
import type {
|
3
|
+
import type { EstimateFeesPerGasReturnType } from '../actions/public/estimateFeesPerGas.js'
|
4
|
+
import type { PrepareTransactionRequestParameters } from '../actions/wallet/prepareTransactionRequest.js'
|
5
|
+
import type { Client } from '../clients/createClient.js'
|
6
|
+
import type { Transport } from '../clients/transports/createTransport.js'
|
7
|
+
import type { Account } from '../types/account.js'
|
8
|
+
import type { FeeValuesType } from '../types/fee.js'
|
6
9
|
import type {
|
7
10
|
TransactionSerializable,
|
8
11
|
TransactionSerializableGeneric,
|
9
|
-
} from '
|
10
|
-
import type { IsUndefined, Prettify } from '
|
12
|
+
} from '../types/transaction.js'
|
13
|
+
import type { IsUndefined, Prettify } from '../types/utils.js'
|
14
|
+
import type { FormattedBlock } from '../utils/formatters/block.js'
|
15
|
+
import type { SerializeTransactionFn } from '../utils/transaction/serializeTransaction.js'
|
11
16
|
|
12
17
|
export type Chain<
|
13
18
|
formatters extends ChainFormatters | undefined = ChainFormatters | undefined,
|
@@ -16,8 +21,14 @@ export type Chain<
|
|
16
21
|
export type ChainConfig<
|
17
22
|
formatters extends ChainFormatters | undefined = ChainFormatters | undefined,
|
18
23
|
> = {
|
24
|
+
/**
|
25
|
+
* Modifies how chain data structures (ie. Blocks, Transactions, etc)
|
26
|
+
* are formatted & typed.
|
27
|
+
*/
|
19
28
|
formatters?: formatters | undefined
|
29
|
+
/** Modifies how data (ie. Transactions) is serialized. */
|
20
30
|
serializers?: ChainSerializers<formatters> | undefined
|
31
|
+
/** Modifies how fees are derived. */
|
21
32
|
fees?: ChainFees<formatters> | undefined
|
22
33
|
}
|
23
34
|
|
@@ -29,20 +40,42 @@ export type ChainContract = {
|
|
29
40
|
export type ChainFees<
|
30
41
|
formatters extends ChainFormatters | undefined = ChainFormatters | undefined,
|
31
42
|
> = {
|
32
|
-
|
43
|
+
/**
|
44
|
+
* The fee multiplier to use to account for fee fluctuations.
|
45
|
+
* Used in the [`estimateFeesPerGas` Action](/docs/actions/public/estimateFeesPerGas).
|
46
|
+
*
|
47
|
+
* @default 1.2
|
48
|
+
*/
|
49
|
+
baseFeeMultiplier?:
|
50
|
+
| number
|
51
|
+
| ((args: ChainFeesFnParameters<formatters>) => Promise<number> | number)
|
52
|
+
/**
|
53
|
+
* The default `maxPriorityFeePerGas` to use when a priority
|
54
|
+
* fee is not defined upon sending a transaction.
|
55
|
+
*
|
56
|
+
* Overrides the return value in the [`estimateMaxPriorityFeePerGas` Action](/docs/actions/public/estimateMaxPriorityFeePerGas).
|
57
|
+
*/
|
58
|
+
defaultPriorityFee?:
|
33
59
|
| bigint
|
34
|
-
| ((args:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
60
|
+
| ((args: ChainFeesFnParameters<formatters>) => Promise<bigint> | bigint)
|
61
|
+
/**
|
62
|
+
* Allows customization of fee per gas values (e.g. `maxFeePerGas`/`maxPriorityFeePerGas`).
|
63
|
+
*
|
64
|
+
* Overrides the return value in the [`estimateFeesPerGas` Action](/docs/actions/public/estimateFeesPerGas).
|
65
|
+
*/
|
66
|
+
estimateFeesPerGas?: (
|
67
|
+
args: ChainEstimateFeesPerGasFnParameters<formatters>,
|
68
|
+
) => Promise<EstimateFeesPerGasReturnType> | bigint
|
40
69
|
}
|
41
70
|
|
42
71
|
export type ChainFormatters = {
|
72
|
+
/** Modifies how the Block structure is formatted & typed. */
|
43
73
|
block?: ChainFormatter<'block'>
|
74
|
+
/** Modifies how the Transaction structure is formatted & typed. */
|
44
75
|
transaction?: ChainFormatter<'transaction'>
|
76
|
+
/** Modifies how the TransactionReceipt structure is formatted & typed. */
|
45
77
|
transactionReceipt?: ChainFormatter<'transactionReceipt'>
|
78
|
+
/** Modifies how the TransactionRequest structure is formatted & typed. */
|
46
79
|
transactionRequest?: ChainFormatter<'transactionRequest'>
|
47
80
|
}
|
48
81
|
|
@@ -54,6 +87,7 @@ export type ChainFormatter<type extends string = string> = {
|
|
54
87
|
export type ChainSerializers<
|
55
88
|
formatters extends ChainFormatters | undefined = undefined,
|
56
89
|
> = {
|
90
|
+
/** Modifies how Transactions are serialized. */
|
57
91
|
transaction?: SerializeTransactionFn<
|
58
92
|
formatters extends ChainFormatters
|
59
93
|
? formatters['transactionRequest'] extends ChainFormatter
|
@@ -64,6 +98,40 @@ export type ChainSerializers<
|
|
64
98
|
>
|
65
99
|
}
|
66
100
|
|
101
|
+
/////////////////////////////////////////////////////////////////////
|
102
|
+
// Parameters
|
103
|
+
|
104
|
+
export type ChainFeesFnParameters<
|
105
|
+
formatters extends ChainFormatters | undefined = ChainFormatters | undefined,
|
106
|
+
> = {
|
107
|
+
/** The latest block. */
|
108
|
+
block: Prettify<FormattedBlock<{ formatters: formatters }>>
|
109
|
+
client: Client<Transport, Chain>
|
110
|
+
/**
|
111
|
+
* A transaction request. This value will be undefined if the caller
|
112
|
+
* is outside of a transaction request context (e.g. a direct call to
|
113
|
+
* the `estimateFeesPerGas` Action).
|
114
|
+
*/
|
115
|
+
request?: PrepareTransactionRequestParameters<
|
116
|
+
Omit<Chain, 'formatters'> & { formatters: formatters },
|
117
|
+
Account | undefined,
|
118
|
+
undefined
|
119
|
+
>
|
120
|
+
}
|
121
|
+
|
122
|
+
export type ChainEstimateFeesPerGasFnParameters<
|
123
|
+
formatters extends ChainFormatters | undefined = ChainFormatters | undefined,
|
124
|
+
> = {
|
125
|
+
/**
|
126
|
+
* A function to multiply the base fee based on the `baseFeeMultiplier` value.
|
127
|
+
*/
|
128
|
+
multiply(x: bigint): bigint
|
129
|
+
/**
|
130
|
+
* The type of fees to return.
|
131
|
+
*/
|
132
|
+
type: FeeValuesType
|
133
|
+
} & ChainFeesFnParameters<formatters>
|
134
|
+
|
67
135
|
/////////////////////////////////////////////////////////////////////
|
68
136
|
// Utils
|
69
137
|
|
package/src/types/eip1193.ts
CHANGED
@@ -571,6 +571,18 @@ export type PublicRpcSchema = [
|
|
571
571
|
Parameters: [block: BlockNumber | BlockTag]
|
572
572
|
ReturnType: Quantity
|
573
573
|
},
|
574
|
+
/**
|
575
|
+
* @description Returns the current maxPriorityFeePerGas in wei.
|
576
|
+
* @link https://ethereum.github.io/execution-apis/api-documentation/
|
577
|
+
* @example
|
578
|
+
* provider.request({ method: 'eth_maxPriorityFeePerGas' })
|
579
|
+
* // => '0x5f5e100'
|
580
|
+
*/
|
581
|
+
{
|
582
|
+
Method: 'eth_maxPriorityFeePerGas'
|
583
|
+
Parameters?: undefined
|
584
|
+
ReturnType: Quantity
|
585
|
+
},
|
574
586
|
/**
|
575
587
|
* @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges`
|
576
588
|
* @link https://eips.ethereum.org/EIPS/eip-1474
|
@@ -627,7 +639,7 @@ export type PublicRpcSchema = [
|
|
627
639
|
ReturnType: string
|
628
640
|
},
|
629
641
|
/**
|
630
|
-
* @description Sends
|
642
|
+
* @description Sends a **signed** transaction to the network
|
631
643
|
* @link https://eips.ethereum.org/EIPS/eip-1474
|
632
644
|
* @example
|
633
645
|
* provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
|
package/src/types/fee.ts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
import { type ByteArray, type Hex, isHex, toBytes } from '../../index.js'
|
2
1
|
import { equalBytes } from '@noble/curves/abstract/utils'
|
3
2
|
|
3
|
+
import type { ByteArray, Hex } from '../../types/misc.js'
|
4
|
+
import { toBytes } from '../encoding/toBytes.js'
|
5
|
+
import { isHex } from './isHex.js'
|
6
|
+
|
4
7
|
export function isBytesEqual(a_: ByteArray | Hex, b_: ByteArray | Hex) {
|
5
8
|
const a = isHex(a_) ? toBytes(a_) : a_
|
6
9
|
const b = isHex(b_) ? toBytes(b_) : b_
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { Hex } from '../../
|
2
|
-
import { isHex } from '../
|
1
|
+
import type { Hex } from '../../types/misc.js'
|
2
|
+
import { isHex } from '../data/isHex.js'
|
3
3
|
|
4
4
|
export function encodedLabelToLabelhash(label: string): Hex | null {
|
5
5
|
if (label.length !== 66) return null
|
@@ -15,6 +15,12 @@ export type FormattedTransactionRequest<
|
|
15
15
|
TransactionRequest
|
16
16
|
>
|
17
17
|
|
18
|
+
export const rpcTransactionType = {
|
19
|
+
legacy: '0x0',
|
20
|
+
eip2930: '0x1',
|
21
|
+
eip1559: '0x2',
|
22
|
+
} as const
|
23
|
+
|
18
24
|
export function formatTransactionRequest(
|
19
25
|
transactionRequest: Partial<TransactionRequest>,
|
20
26
|
) {
|
@@ -40,6 +46,10 @@ export function formatTransactionRequest(
|
|
40
46
|
typeof transactionRequest.nonce !== 'undefined'
|
41
47
|
? numberToHex(transactionRequest.nonce)
|
42
48
|
: undefined,
|
49
|
+
type:
|
50
|
+
typeof transactionRequest.type !== 'undefined'
|
51
|
+
? rpcTransactionType[transactionRequest.type]
|
52
|
+
: undefined,
|
43
53
|
value:
|
44
54
|
typeof transactionRequest.value !== 'undefined'
|
45
55
|
? numberToHex(transactionRequest.value)
|
package/src/utils/index.ts
CHANGED
@@ -230,7 +230,10 @@ export {
|
|
230
230
|
assertTransactionLegacy,
|
231
231
|
} from './transaction/assertTransaction.js'
|
232
232
|
export { parseTransaction } from './transaction/parseTransaction.js'
|
233
|
-
export {
|
233
|
+
export {
|
234
|
+
/** @deprecated import `prepareTransactionRequest` from `viem/actions` instead. */
|
235
|
+
prepareTransactionRequest,
|
236
|
+
} from '../actions/wallet/prepareTransactionRequest.js'
|
234
237
|
export {
|
235
238
|
serializeTransaction,
|
236
239
|
type SerializeTransactionFn,
|
@@ -1,58 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.formattersCelo = void 0;
|
4
|
-
const viem_1 = require("viem");
|
5
|
-
const utils_js_1 = require("../utils.js");
|
6
|
-
exports.formattersCelo = {
|
7
|
-
block: (0, utils_js_1.defineBlock)({
|
8
|
-
exclude: ['difficulty', 'gasLimit', 'mixHash', 'nonce', 'uncles'],
|
9
|
-
format(args) {
|
10
|
-
const transactions = args.transactions?.map((transaction) => {
|
11
|
-
if (typeof transaction === 'string')
|
12
|
-
return transaction;
|
13
|
-
return {
|
14
|
-
...(0, viem_1.formatTransaction)(transaction),
|
15
|
-
feeCurrency: transaction.feeCurrency,
|
16
|
-
gatewayFee: transaction.gatewayFee
|
17
|
-
? (0, viem_1.hexToBigInt)(transaction.gatewayFee)
|
18
|
-
: null,
|
19
|
-
gatewayFeeRecipient: transaction.gatewayFeeRecipient,
|
20
|
-
};
|
21
|
-
});
|
22
|
-
return {
|
23
|
-
randomness: args.randomness,
|
24
|
-
transactions,
|
25
|
-
};
|
26
|
-
},
|
27
|
-
}),
|
28
|
-
transaction: (0, utils_js_1.defineTransaction)({
|
29
|
-
format(args) {
|
30
|
-
return {
|
31
|
-
feeCurrency: args.feeCurrency,
|
32
|
-
gatewayFee: args.gatewayFee ? (0, viem_1.hexToBigInt)(args.gatewayFee) : null,
|
33
|
-
gatewayFeeRecipient: args.gatewayFeeRecipient,
|
34
|
-
};
|
35
|
-
},
|
36
|
-
}),
|
37
|
-
transactionReceipt: (0, utils_js_1.defineTransactionReceipt)({
|
38
|
-
format(args) {
|
39
|
-
return {
|
40
|
-
feeCurrency: args.feeCurrency,
|
41
|
-
gatewayFee: args.gatewayFee ? (0, viem_1.hexToBigInt)(args.gatewayFee) : null,
|
42
|
-
gatewayFeeRecipient: args.gatewayFeeRecipient,
|
43
|
-
};
|
44
|
-
},
|
45
|
-
}),
|
46
|
-
transactionRequest: (0, utils_js_1.defineTransactionRequest)({
|
47
|
-
format(args) {
|
48
|
-
return {
|
49
|
-
feeCurrency: args.feeCurrency,
|
50
|
-
gatewayFee: typeof args.gatewayFee !== 'undefined'
|
51
|
-
? (0, viem_1.numberToHex)(args.gatewayFee)
|
52
|
-
: undefined,
|
53
|
-
gatewayFeeRecipient: args.gatewayFeeRecipient,
|
54
|
-
};
|
55
|
-
},
|
56
|
-
}),
|
57
|
-
};
|
58
|
-
//# sourceMappingURL=formatters.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/celo/formatters.ts"],"names":[],"mappings":";;;AAAA,+BAA6E;AAG7E,0CAKoB;AAaP,QAAA,cAAc,GAAG;IAC5B,KAAK,EAAgB,IAAA,sBAAW,EAAC;QAC/B,OAAO,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC;QACjE,MAAM,CACJ,IAEC;YAID,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;gBAC1D,IAAI,OAAO,WAAW,KAAK,QAAQ;oBAAE,OAAO,WAAW,CAAA;gBACvD,OAAO;oBACL,GAAG,IAAA,wBAAiB,EAAC,WAAW,CAAC;oBACjC,WAAW,EAAE,WAAW,CAAC,WAAW;oBACpC,UAAU,EAAE,WAAW,CAAC,UAAU;wBAChC,CAAC,CAAC,IAAA,kBAAW,EAAC,WAAW,CAAC,UAAU,CAAC;wBACrC,CAAC,CAAC,IAAI;oBACR,mBAAmB,EAAE,WAAW,CAAC,mBAAmB;iBACrD,CAAA;YACH,CAAC,CAA+B,CAAA;YAChC,OAAO;gBACL,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,YAAY;aACb,CAAA;QACH,CAAC;KACF,CAAC;IACF,WAAW,EAAgB,IAAA,4BAAiB,EAAC;QAC3C,MAAM,CAAC,IAAiC;YACtC,OAAO;gBACL,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI;gBACjE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aAC9C,CAAA;QACH,CAAC;KACF,CAAC;IACF,kBAAkB,EAAgB,IAAA,mCAAwB,EAAC;QACzD,MAAM,CACJ,IAAwC;YAExC,OAAO;gBACL,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI;gBACjE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aAC9C,CAAA;QACH,CAAC;KACF,CAAC;IACF,kBAAkB,EAAgB,IAAA,mCAAwB,EAAC;QACzD,MAAM,CACJ,IAAqC;YAErC,OAAO;gBACL,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,UAAU,EACR,OAAO,IAAI,CAAC,UAAU,KAAK,WAAW;oBACpC,CAAC,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,UAAU,CAAC;oBAC9B,CAAC,CAAC,SAAS;gBACf,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aAC9C,CAAA;QACH,CAAC;KACF,CAAC;CACgC,CAAA"}
|