viem 1.7.0 → 1.8.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/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 +3 -2
- package/dist/cjs/actions/public/estimateFeesPerGas.js.map +1 -1
- 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 +3 -3
- package/dist/cjs/actions/public/estimateMaxPriorityFeePerGas.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/{utils/transaction/prepareRequest.js → actions/wallet/prepareTransactionRequest.js} +19 -10
- 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/chains/celo/formatters.js +4 -1
- package/dist/cjs/chains/celo/formatters.js.map +1 -1
- package/dist/cjs/chains/index.js +3 -2
- package/dist/cjs/chains/index.js.map +1 -1
- package/dist/cjs/clients/decorators/public.js +4 -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/version.js +1 -1
- package/dist/cjs/index.js +4 -5
- package/dist/cjs/index.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 +3 -2
- package/dist/esm/actions/public/estimateFeesPerGas.js.map +1 -1
- 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 +3 -3
- package/dist/esm/actions/public/estimateMaxPriorityFeePerGas.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/{utils/transaction/prepareRequest.js → actions/wallet/prepareTransactionRequest.js} +58 -9
- 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/chains/celo/formatters.js +4 -1
- package/dist/esm/chains/celo/formatters.js.map +1 -1
- package/dist/esm/chains/index.js +1 -0
- package/dist/esm/chains/index.js.map +1 -1
- package/dist/esm/clients/decorators/public.js +4 -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/version.js +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.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 +2 -2
- package/dist/types/actions/public/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/actions/public/estimateMaxPriorityFeePerGas.d.ts +4 -2
- package/dist/types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/dist/types/actions/public/watchContractEvent.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.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/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 +958 -19
- 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/decorators/public.d.ts +66 -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/version.d.ts +1 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/chain.d.ts +2 -2
- package/dist/types/types/chain.d.ts.map +1 -1
- package/dist/types/types/eip1193.d.ts +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 +6 -4
- package/src/actions/public/estimateGas.ts +5 -5
- package/src/actions/public/estimateMaxPriorityFeePerGas.ts +7 -5
- package/src/actions/public/watchContractEvent.ts +9 -6
- package/src/{utils/transaction/prepareRequest.ts → actions/wallet/prepareTransactionRequest.ts} +80 -36
- package/src/actions/wallet/sendRawTransaction.ts +48 -0
- package/src/actions/wallet/sendTransaction.ts +6 -6
- package/src/actions/wallet/signTransaction.ts +137 -0
- package/src/chains/celo/formatters.ts +11 -12
- package/src/chains/celo/types.ts +86 -30
- package/src/chains/index.ts +1 -0
- package/src/chains/utils.ts +4 -4
- package/src/clients/decorators/public.ts +81 -0
- package/src/clients/decorators/wallet.ts +133 -0
- package/src/errors/rpc.ts +1 -1
- package/src/errors/version.ts +1 -1
- package/src/index.ts +7 -1
- package/src/types/chain.ts +2 -2
- package/src/types/eip1193.ts +1 -1
- 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/dist/cjs/utils/transaction/prepareRequest.js.map +0 -1
- package/dist/esm/utils/transaction/prepareRequest.js.map +0 -1
- package/dist/types/utils/transaction/prepareRequest.d.ts +0 -21
- package/dist/types/utils/transaction/prepareRequest.d.ts.map +0 -1
@@ -0,0 +1,52 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { GetAccountParameter } from '../../types/account.js';
|
5
|
+
import type { Chain } from '../../types/chain.js';
|
6
|
+
import type { GetChain } from '../../types/chain.js';
|
7
|
+
import type { UnionOmit } from '../../types/utils.js';
|
8
|
+
import type { FormattedTransactionRequest } from '../../utils/formatters/transactionRequest.js';
|
9
|
+
export type PrepareTransactionRequestParameters<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = UnionOmit<FormattedTransactionRequest<TChainOverride extends Chain ? TChainOverride : TChain>, 'from'> & GetAccountParameter<TAccount> & GetChain<TChain, TChainOverride>;
|
10
|
+
export type PrepareTransactionRequestReturnType<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = UnionOmit<FormattedTransactionRequest<TChainOverride extends Chain ? TChainOverride : TChain>, 'from'> & GetAccountParameter<TAccount> & GetChain<TChain, TChainOverride>;
|
11
|
+
/**
|
12
|
+
* Prepares a transaction request for signing.
|
13
|
+
*
|
14
|
+
* - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html
|
15
|
+
*
|
16
|
+
* @param args - {@link PrepareTransactionRequestParameters}
|
17
|
+
* @returns The transaction request. {@link PrepareTransactionRequestReturnType}
|
18
|
+
*
|
19
|
+
* @example
|
20
|
+
* import { createWalletClient, custom } from 'viem'
|
21
|
+
* import { mainnet } from 'viem/chains'
|
22
|
+
* import { prepareTransactionRequest } from 'viem/actions'
|
23
|
+
*
|
24
|
+
* const client = createWalletClient({
|
25
|
+
* chain: mainnet,
|
26
|
+
* transport: custom(window.ethereum),
|
27
|
+
* })
|
28
|
+
* const request = await prepareTransactionRequest(client, {
|
29
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
30
|
+
* to: '0x0000000000000000000000000000000000000000',
|
31
|
+
* value: 1n,
|
32
|
+
* })
|
33
|
+
*
|
34
|
+
* @example
|
35
|
+
* // Account Hoisting
|
36
|
+
* import { createWalletClient, http } from 'viem'
|
37
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
38
|
+
* import { mainnet } from 'viem/chains'
|
39
|
+
* import { prepareTransactionRequest } from 'viem/actions'
|
40
|
+
*
|
41
|
+
* const client = createWalletClient({
|
42
|
+
* account: privateKeyToAccount('0x…'),
|
43
|
+
* chain: mainnet,
|
44
|
+
* transport: custom(window.ethereum),
|
45
|
+
* })
|
46
|
+
* const request = await prepareTransactionRequest(client, {
|
47
|
+
* to: '0x0000000000000000000000000000000000000000',
|
48
|
+
* value: 1n,
|
49
|
+
* })
|
50
|
+
*/
|
51
|
+
export declare function prepareTransactionRequest<TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined>(client: Client<Transport, TChain, TAccount>, args: PrepareTransactionRequestParameters<TChain, TAccount, TChainOverride>): Promise<PrepareTransactionRequestReturnType<TChain, TAccount, TChainOverride>>;
|
52
|
+
//# sourceMappingURL=prepareTransactionRequest.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"prepareTransactionRequest.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/prepareTransactionRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAStD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAM5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAA;AAK/F,MAAM,MAAM,mCAAmC,CAC7C,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAC1D,SAAS,CACX,2BAA2B,CACzB,cAAc,SAAS,KAAK,GAAG,cAAc,GAAG,MAAM,CACvD,EACD,MAAM,CACP,GACC,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAElC,MAAM,MAAM,mCAAmC,CAC7C,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAC1D,SAAS,CACX,2BAA2B,CACzB,cAAc,SAAS,KAAK,GAAG,cAAc,GAAG,MAAM,CACvD,EACD,MAAM,CACP,GACC,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EACpC,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,IAAI,EAAE,mCAAmC,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,GAC1E,OAAO,CACR,mCAAmC,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CACtE,CA6EA"}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { Client } from '../../clients/createClient.js';
|
2
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
3
|
+
import type { Chain } from '../../types/chain.js';
|
4
|
+
import type { Hash } from '../../types/misc.js';
|
5
|
+
import type { TransactionSerialized } from '../../types/transaction.js';
|
6
|
+
export type SendRawTransactionParameters = {
|
7
|
+
/**
|
8
|
+
* The signed serialized tranasction.
|
9
|
+
*/
|
10
|
+
serializedTransaction: TransactionSerialized;
|
11
|
+
};
|
12
|
+
export type SendRawTransactionReturnType = Hash;
|
13
|
+
/**
|
14
|
+
* Sends a **signed** transaction to the network
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html
|
17
|
+
* - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
|
18
|
+
*
|
19
|
+
* @param client - Client to use
|
20
|
+
* @param parameters - {@link SendRawTransactionParameters}
|
21
|
+
* @returns The transaction hash. {@link SendRawTransactionReturnType}
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* import { createWalletClient, custom } from 'viem'
|
25
|
+
* import { mainnet } from 'viem/chains'
|
26
|
+
* import { sendRawTransaction } from 'viem/wallet'
|
27
|
+
*
|
28
|
+
* const client = createWalletClient({
|
29
|
+
* chain: mainnet,
|
30
|
+
* transport: custom(window.ethereum),
|
31
|
+
* })
|
32
|
+
*
|
33
|
+
* const hash = await sendRawTransaction(client, {
|
34
|
+
* serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'
|
35
|
+
* })
|
36
|
+
*/
|
37
|
+
export declare function sendRawTransaction<TChain extends Chain | undefined>(client: Client<Transport, TChain>, { serializedTransaction }: SendRawTransactionParameters): Promise<SendRawTransactionReturnType>;
|
38
|
+
//# sourceMappingURL=sendRawTransaction.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sendRawTransaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/sendRawTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAEvE,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,qBAAqB,EAAE,qBAAqB,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,EACvE,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EACjC,EAAE,qBAAqB,EAAE,EAAE,4BAA4B,GACtD,OAAO,CAAC,4BAA4B,CAAC,CAKvC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sendTransaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/sendTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAK/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,8CAA8C,CAAA;
|
1
|
+
{"version":3,"file":"sendTransaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/sendTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAK/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,8CAA8C,CAAA;AASrD,MAAM,MAAM,yBAAyB,CACnC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAC1D,SAAS,CACX,2BAA2B,CACzB,cAAc,SAAS,KAAK,GAAG,cAAc,GAAG,MAAM,CACvD,EACD,MAAM,CACP,GACC,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAElC,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAsB,eAAe,CACnC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EACpC,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,IAAI,EAAE,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,GAChE,OAAO,CAAC,yBAAyB,CAAC,CA6FpC"}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { GetAccountParameter } from '../../types/account.js';
|
5
|
+
import type { Chain, GetChain } from '../../types/chain.js';
|
6
|
+
import type { TransactionSerialized } from '../../types/transaction.js';
|
7
|
+
import type { UnionOmit } from '../../types/utils.js';
|
8
|
+
import { type FormattedTransactionRequest } from '../../utils/formatters/transactionRequest.js';
|
9
|
+
export type SignTransactionParameters<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = UnionOmit<FormattedTransactionRequest<TChainOverride extends Chain ? TChainOverride : TChain>, 'from'> & GetAccountParameter<TAccount> & GetChain<TChain, TChainOverride>;
|
10
|
+
export type SignTransactionReturnType = TransactionSerialized;
|
11
|
+
/**
|
12
|
+
* Signs a transaction.
|
13
|
+
*
|
14
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signTransaction.html
|
15
|
+
* - JSON-RPC Methods:
|
16
|
+
* - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)
|
17
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
18
|
+
*
|
19
|
+
* @param args - {@link SignTransactionParameters}
|
20
|
+
* @returns The signed serialized tranasction. {@link SignTransactionReturnType}
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* import { createWalletClient, custom } from 'viem'
|
24
|
+
* import { mainnet } from 'viem/chains'
|
25
|
+
* import { signTransaction } from 'viem/actions'
|
26
|
+
*
|
27
|
+
* const client = createWalletClient({
|
28
|
+
* chain: mainnet,
|
29
|
+
* transport: custom(window.ethereum),
|
30
|
+
* })
|
31
|
+
* const signature = await signTransaction(client, {
|
32
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
33
|
+
* to: '0x0000000000000000000000000000000000000000',
|
34
|
+
* value: 1n,
|
35
|
+
* })
|
36
|
+
*
|
37
|
+
* @example
|
38
|
+
* // Account Hoisting
|
39
|
+
* import { createWalletClient, http } from 'viem'
|
40
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
41
|
+
* import { mainnet } from 'viem/chains'
|
42
|
+
* import { signTransaction } from 'viem/actions'
|
43
|
+
*
|
44
|
+
* const client = createWalletClient({
|
45
|
+
* account: privateKeyToAccount('0x…'),
|
46
|
+
* chain: mainnet,
|
47
|
+
* transport: custom(window.ethereum),
|
48
|
+
* })
|
49
|
+
* const signature = await signTransaction(client, {
|
50
|
+
* to: '0x0000000000000000000000000000000000000000',
|
51
|
+
* value: 1n,
|
52
|
+
* })
|
53
|
+
*/
|
54
|
+
export declare function signTransaction<TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined>(client: Client<Transport, TChain, TAccount>, args: SignTransactionParameters<TChain, TAccount, TChainOverride>): Promise<SignTransactionReturnType>;
|
55
|
+
//# sourceMappingURL=signTransaction.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signTransaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/signTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAE5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE3D,OAAO,KAAK,EAGV,qBAAqB,EACtB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,8CAA8C,CAAA;AAKrD,MAAM,MAAM,yBAAyB,CACnC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAC1D,SAAS,CACX,2BAA2B,CACzB,cAAc,SAAS,KAAK,GAAG,cAAc,GAAG,MAAM,CACvD,EACD,MAAM,CACP,GACC,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAElC,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,eAAe,CACnC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EACpC,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,IAAI,EAAE,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,GAChE,OAAO,CAAC,yBAAyB,CAAC,CAgDpC"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { Hash } from '../../types/misc.js';
|
2
|
-
import type { CeloBlockOverrides, CeloRpcTransaction,
|
2
|
+
import type { CeloBlockOverrides, CeloRpcTransaction, CeloRpcTransactionReceiptOverrides, CeloTransaction, CeloTransactionRequest } from './types.js';
|
3
3
|
export declare const formattersCelo: {
|
4
4
|
readonly block: {
|
5
5
|
exclude: ("nonce" | "difficulty" | "gasLimit" | "mixHash" | "uncles")[] | undefined;
|
6
|
-
format: (args: import("../../types/utils.js").Assign<Partial<import("../../
|
6
|
+
format: (args: import("../../types/utils.js").Assign<Partial<import("../../types/rpc.js").RpcBlock>, CeloBlockOverrides & {
|
7
7
|
transactions: Hash[] | CeloRpcTransaction[];
|
8
8
|
}>) => {
|
9
9
|
baseFeePerGas: bigint | null;
|
@@ -43,7 +43,50 @@ export declare const formattersCelo: {
|
|
43
43
|
};
|
44
44
|
readonly transaction: {
|
45
45
|
exclude: [] | undefined;
|
46
|
-
format: (args: import("../../types/utils.js").
|
46
|
+
format: (args: (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionLegacy<`0x${string}`, `0x${string}`, boolean, "0x0">, "typeHex">>, CeloRpcTransaction> & Omit<import("../../index.js").TransactionLegacy<`0x${string}`, `0x${string}`, boolean, "0x0">, "typeHex"> & {
|
47
|
+
feeCurrency: `0x${string}` | null;
|
48
|
+
gatewayFee: `0x${string}` | null;
|
49
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
50
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionLegacy<`0x${string}`, `0x${string}`, boolean, "0x0">, "typeHex">>, CeloRpcTransaction> & import("../../index.js").TransactionBase<`0x${string}`, `0x${string}`, boolean> & import("../../index.js").FeeValuesEIP1559<`0x${string}`> & {
|
51
|
+
feeCurrency: `0x${string}` | null;
|
52
|
+
gatewayFee: `0x${string}` | null;
|
53
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
54
|
+
type: "0x7c";
|
55
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionEIP2930<`0x${string}`, `0x${string}`, boolean, "0x1">, "typeHex">>, CeloRpcTransaction> & Omit<import("../../index.js").TransactionLegacy<`0x${string}`, `0x${string}`, boolean, "0x0">, "typeHex"> & {
|
56
|
+
feeCurrency: `0x${string}` | null;
|
57
|
+
gatewayFee: `0x${string}` | null;
|
58
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
59
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionEIP2930<`0x${string}`, `0x${string}`, boolean, "0x1">, "typeHex">>, CeloRpcTransaction> & Omit<import("../../index.js").TransactionEIP2930<`0x${string}`, `0x${string}`, boolean, "0x1">, "typeHex"> & {
|
60
|
+
feeCurrency: `0x${string}` | null;
|
61
|
+
gatewayFee: `0x${string}` | null;
|
62
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
63
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionEIP2930<`0x${string}`, `0x${string}`, boolean, "0x1">, "typeHex">>, CeloRpcTransaction> & Omit<import("../../index.js").TransactionEIP1559<`0x${string}`, `0x${string}`, boolean, "0x2">, "typeHex"> & {
|
64
|
+
feeCurrency: `0x${string}` | null;
|
65
|
+
gatewayFee: `0x${string}` | null;
|
66
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
67
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionEIP2930<`0x${string}`, `0x${string}`, boolean, "0x1">, "typeHex">>, CeloRpcTransaction> & import("../../index.js").TransactionBase<`0x${string}`, `0x${string}`, boolean> & import("../../index.js").FeeValuesEIP1559<`0x${string}`> & {
|
68
|
+
feeCurrency: `0x${string}` | null;
|
69
|
+
gatewayFee: `0x${string}` | null;
|
70
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
71
|
+
type: "0x7c";
|
72
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionEIP1559<`0x${string}`, `0x${string}`, boolean, "0x2">, "typeHex">>, CeloRpcTransaction> & Omit<import("../../index.js").TransactionLegacy<`0x${string}`, `0x${string}`, boolean, "0x0">, "typeHex"> & {
|
73
|
+
feeCurrency: `0x${string}` | null;
|
74
|
+
gatewayFee: `0x${string}` | null;
|
75
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
76
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionEIP1559<`0x${string}`, `0x${string}`, boolean, "0x2">, "typeHex">>, CeloRpcTransaction> & Omit<import("../../index.js").TransactionEIP2930<`0x${string}`, `0x${string}`, boolean, "0x1">, "typeHex"> & {
|
77
|
+
feeCurrency: `0x${string}` | null;
|
78
|
+
gatewayFee: `0x${string}` | null;
|
79
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
80
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionEIP1559<`0x${string}`, `0x${string}`, boolean, "0x2">, "typeHex">>, CeloRpcTransaction> & Omit<import("../../index.js").TransactionEIP1559<`0x${string}`, `0x${string}`, boolean, "0x2">, "typeHex"> & {
|
81
|
+
feeCurrency: `0x${string}` | null;
|
82
|
+
gatewayFee: `0x${string}` | null;
|
83
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
84
|
+
}) | (import("../../types/utils.js").Assign_<Partial<Omit<import("../../index.js").TransactionEIP1559<`0x${string}`, `0x${string}`, boolean, "0x2">, "typeHex">>, CeloRpcTransaction> & import("../../index.js").TransactionBase<`0x${string}`, `0x${string}`, boolean> & import("../../index.js").FeeValuesEIP1559<`0x${string}`> & {
|
85
|
+
feeCurrency: `0x${string}` | null;
|
86
|
+
gatewayFee: `0x${string}` | null;
|
87
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
88
|
+
type: "0x7c";
|
89
|
+
})) => ({
|
47
90
|
blockHash: `0x${string}` | null;
|
48
91
|
blockNumber: bigint | null;
|
49
92
|
from: `0x${string}`;
|
@@ -67,6 +110,30 @@ export declare const formattersCelo: {
|
|
67
110
|
feeCurrency: `0x${string}` | null;
|
68
111
|
gatewayFee: bigint | null;
|
69
112
|
gatewayFeeRecipient: `0x${string}` | null;
|
113
|
+
} | {
|
114
|
+
blockHash: `0x${string}` | null;
|
115
|
+
blockNumber: bigint | null;
|
116
|
+
from: `0x${string}`;
|
117
|
+
gas: bigint;
|
118
|
+
hash: `0x${string}`;
|
119
|
+
input: `0x${string}`;
|
120
|
+
nonce: number;
|
121
|
+
r: `0x${string}`;
|
122
|
+
s: `0x${string}`;
|
123
|
+
to: `0x${string}` | null;
|
124
|
+
transactionIndex: number | null;
|
125
|
+
typeHex: `0x${string}` | null;
|
126
|
+
v: bigint;
|
127
|
+
value: bigint;
|
128
|
+
gasPrice: undefined;
|
129
|
+
maxFeePerGas: bigint;
|
130
|
+
maxPriorityFeePerGas: bigint;
|
131
|
+
accessList?: undefined;
|
132
|
+
chainId?: number | undefined;
|
133
|
+
type: "cip42";
|
134
|
+
feeCurrency: `0x${string}` | null;
|
135
|
+
gatewayFee: bigint | null;
|
136
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
70
137
|
} | {
|
71
138
|
blockHash: `0x${string}` | null;
|
72
139
|
blockNumber: bigint | null;
|
@@ -91,6 +158,78 @@ export declare const formattersCelo: {
|
|
91
158
|
feeCurrency: `0x${string}` | null;
|
92
159
|
gatewayFee: bigint | null;
|
93
160
|
gatewayFeeRecipient: `0x${string}` | null;
|
161
|
+
} | {
|
162
|
+
blockHash: `0x${string}` | null;
|
163
|
+
blockNumber: bigint | null;
|
164
|
+
from: `0x${string}`;
|
165
|
+
gas: bigint;
|
166
|
+
hash: `0x${string}`;
|
167
|
+
input: `0x${string}`;
|
168
|
+
nonce: number;
|
169
|
+
r: `0x${string}`;
|
170
|
+
s: `0x${string}`;
|
171
|
+
to: `0x${string}` | null;
|
172
|
+
transactionIndex: number | null;
|
173
|
+
typeHex: `0x${string}` | null;
|
174
|
+
v: bigint;
|
175
|
+
value: bigint;
|
176
|
+
gasPrice: undefined;
|
177
|
+
maxFeePerGas: bigint;
|
178
|
+
maxPriorityFeePerGas: bigint;
|
179
|
+
accessList: import("../../index.js").AccessList;
|
180
|
+
chainId: number;
|
181
|
+
type: "eip1559";
|
182
|
+
feeCurrency: `0x${string}` | null;
|
183
|
+
gatewayFee: bigint | null;
|
184
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
185
|
+
} | {
|
186
|
+
blockHash: `0x${string}` | null;
|
187
|
+
blockNumber: bigint | null;
|
188
|
+
from: `0x${string}`;
|
189
|
+
gas: bigint;
|
190
|
+
hash: `0x${string}`;
|
191
|
+
input: `0x${string}`;
|
192
|
+
nonce: number;
|
193
|
+
r: `0x${string}`;
|
194
|
+
s: `0x${string}`;
|
195
|
+
to: `0x${string}` | null;
|
196
|
+
transactionIndex: number | null;
|
197
|
+
typeHex: `0x${string}` | null;
|
198
|
+
v: bigint;
|
199
|
+
value: bigint;
|
200
|
+
gasPrice: undefined;
|
201
|
+
maxFeePerGas: bigint;
|
202
|
+
maxPriorityFeePerGas: bigint;
|
203
|
+
accessList: import("../../index.js").AccessList;
|
204
|
+
chainId: number;
|
205
|
+
type: "cip42";
|
206
|
+
feeCurrency: `0x${string}` | null;
|
207
|
+
gatewayFee: bigint | null;
|
208
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
209
|
+
} | {
|
210
|
+
blockHash: `0x${string}` | null;
|
211
|
+
blockNumber: bigint | null;
|
212
|
+
from: `0x${string}`;
|
213
|
+
gas: bigint;
|
214
|
+
hash: `0x${string}`;
|
215
|
+
input: `0x${string}`;
|
216
|
+
nonce: number;
|
217
|
+
r: `0x${string}`;
|
218
|
+
s: `0x${string}`;
|
219
|
+
to: `0x${string}` | null;
|
220
|
+
transactionIndex: number | null;
|
221
|
+
typeHex: `0x${string}` | null;
|
222
|
+
v: bigint;
|
223
|
+
value: bigint;
|
224
|
+
gasPrice: bigint;
|
225
|
+
maxFeePerGas: undefined;
|
226
|
+
maxPriorityFeePerGas: undefined;
|
227
|
+
accessList: import("../../index.js").AccessList;
|
228
|
+
chainId: number;
|
229
|
+
type: "eip2930";
|
230
|
+
feeCurrency: `0x${string}` | null;
|
231
|
+
gatewayFee: bigint | null;
|
232
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
94
233
|
} | {
|
95
234
|
blockHash: `0x${string}` | null;
|
96
235
|
blockNumber: bigint | null;
|
@@ -115,12 +254,36 @@ export declare const formattersCelo: {
|
|
115
254
|
feeCurrency: `0x${string}` | null;
|
116
255
|
gatewayFee: bigint | null;
|
117
256
|
gatewayFeeRecipient: `0x${string}` | null;
|
257
|
+
} | {
|
258
|
+
blockHash: `0x${string}` | null;
|
259
|
+
blockNumber: bigint | null;
|
260
|
+
from: `0x${string}`;
|
261
|
+
gas: bigint;
|
262
|
+
hash: `0x${string}`;
|
263
|
+
input: `0x${string}`;
|
264
|
+
nonce: number;
|
265
|
+
r: `0x${string}`;
|
266
|
+
s: `0x${string}`;
|
267
|
+
to: `0x${string}` | null;
|
268
|
+
transactionIndex: number | null;
|
269
|
+
typeHex: `0x${string}` | null;
|
270
|
+
v: bigint;
|
271
|
+
value: bigint;
|
272
|
+
gasPrice?: undefined;
|
273
|
+
maxFeePerGas: bigint;
|
274
|
+
maxPriorityFeePerGas: bigint;
|
275
|
+
accessList: import("../../index.js").AccessList;
|
276
|
+
chainId: number;
|
277
|
+
type: "cip42";
|
278
|
+
feeCurrency: `0x${string}` | null;
|
279
|
+
gatewayFee: bigint | null;
|
280
|
+
gatewayFeeRecipient: `0x${string}` | null;
|
118
281
|
}) & {};
|
119
282
|
type: "transaction";
|
120
283
|
};
|
121
284
|
readonly transactionReceipt: {
|
122
285
|
exclude: [] | undefined;
|
123
|
-
format: (args: import("../../types/utils.js").Assign<Partial<import("../../
|
286
|
+
format: (args: import("../../types/utils.js").Assign<Partial<import("../../types/rpc.js").RpcTransactionReceipt>, CeloRpcTransactionReceiptOverrides>) => {
|
124
287
|
blockHash: `0x${string}`;
|
125
288
|
blockNumber: bigint;
|
126
289
|
contractAddress: `0x${string}` | null;
|
@@ -143,7 +306,7 @@ export declare const formattersCelo: {
|
|
143
306
|
};
|
144
307
|
readonly transactionRequest: {
|
145
308
|
exclude: [] | undefined;
|
146
|
-
format: (args: import("../../types/utils.js").Assign<Partial<import("../../index.js").TransactionRequest>,
|
309
|
+
format: (args: import("../../types/utils.js").Assign<Partial<import("../../index.js").TransactionRequest>, CeloTransactionRequest>) => ({
|
147
310
|
data?: `0x${string}` | undefined;
|
148
311
|
from: `0x${string}`;
|
149
312
|
gas?: `0x${string}` | undefined;
|
@@ -188,6 +351,141 @@ export declare const formattersCelo: {
|
|
188
351
|
feeCurrency?: `0x${string}` | undefined;
|
189
352
|
gatewayFee?: `0x${string}` | undefined;
|
190
353
|
gatewayFeeRecipient?: `0x${string}` | undefined;
|
354
|
+
} | {
|
355
|
+
data?: `0x${string}` | undefined;
|
356
|
+
from: `0x${string}`;
|
357
|
+
gas?: `0x${string}` | undefined;
|
358
|
+
nonce?: `0x${string}` | undefined;
|
359
|
+
to?: `0x${string}` | undefined;
|
360
|
+
value?: `0x${string}` | undefined;
|
361
|
+
gasPrice?: undefined;
|
362
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
363
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
364
|
+
accessList?: import("../../index.js").AccessList | undefined;
|
365
|
+
type?: "0x7c" | undefined;
|
366
|
+
feeCurrency?: `0x${string}` | undefined;
|
367
|
+
gatewayFee?: `0x${string}` | undefined;
|
368
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
369
|
+
} | {
|
370
|
+
data?: `0x${string}` | undefined;
|
371
|
+
from: `0x${string}`;
|
372
|
+
gas?: `0x${string}` | undefined;
|
373
|
+
nonce?: `0x${string}` | undefined;
|
374
|
+
to?: `0x${string}` | undefined;
|
375
|
+
value?: `0x${string}` | undefined;
|
376
|
+
gasPrice?: `0x${string}` | undefined;
|
377
|
+
maxFeePerGas?: undefined;
|
378
|
+
maxPriorityFeePerGas?: undefined;
|
379
|
+
accessList?: undefined;
|
380
|
+
type?: "0x0" | undefined;
|
381
|
+
feeCurrency?: `0x${string}` | undefined;
|
382
|
+
gatewayFee?: `0x${string}` | undefined;
|
383
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
384
|
+
} | {
|
385
|
+
data?: `0x${string}` | undefined;
|
386
|
+
from: `0x${string}`;
|
387
|
+
gas?: `0x${string}` | undefined;
|
388
|
+
nonce?: `0x${string}` | undefined;
|
389
|
+
to?: `0x${string}` | undefined;
|
390
|
+
value?: `0x${string}` | undefined;
|
391
|
+
gasPrice?: `0x${string}` | undefined;
|
392
|
+
maxFeePerGas?: undefined;
|
393
|
+
maxPriorityFeePerGas?: undefined;
|
394
|
+
accessList?: import("../../index.js").AccessList | undefined;
|
395
|
+
type?: "0x1" | undefined;
|
396
|
+
feeCurrency?: `0x${string}` | undefined;
|
397
|
+
gatewayFee?: `0x${string}` | undefined;
|
398
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
399
|
+
} | {
|
400
|
+
data?: `0x${string}` | undefined;
|
401
|
+
from: `0x${string}`;
|
402
|
+
gas?: `0x${string}` | undefined;
|
403
|
+
nonce?: `0x${string}` | undefined;
|
404
|
+
to?: `0x${string}` | undefined;
|
405
|
+
value?: `0x${string}` | undefined;
|
406
|
+
gasPrice?: undefined;
|
407
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
408
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
409
|
+
accessList?: import("../../index.js").AccessList | undefined;
|
410
|
+
type?: "0x2" | undefined;
|
411
|
+
feeCurrency?: `0x${string}` | undefined;
|
412
|
+
gatewayFee?: `0x${string}` | undefined;
|
413
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
414
|
+
} | {
|
415
|
+
data?: `0x${string}` | undefined;
|
416
|
+
from: `0x${string}`;
|
417
|
+
gas?: `0x${string}` | undefined;
|
418
|
+
nonce?: `0x${string}` | undefined;
|
419
|
+
to?: `0x${string}` | undefined;
|
420
|
+
value?: `0x${string}` | undefined;
|
421
|
+
gasPrice?: undefined;
|
422
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
423
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
424
|
+
accessList?: import("../../index.js").AccessList | undefined;
|
425
|
+
type?: "0x7c" | undefined;
|
426
|
+
feeCurrency?: `0x${string}` | undefined;
|
427
|
+
gatewayFee?: `0x${string}` | undefined;
|
428
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
429
|
+
} | {
|
430
|
+
data?: `0x${string}` | undefined;
|
431
|
+
from: `0x${string}`;
|
432
|
+
gas?: `0x${string}` | undefined;
|
433
|
+
nonce?: `0x${string}` | undefined;
|
434
|
+
to?: `0x${string}` | undefined;
|
435
|
+
value?: `0x${string}` | undefined;
|
436
|
+
gasPrice?: `0x${string}` | undefined;
|
437
|
+
maxFeePerGas?: undefined;
|
438
|
+
maxPriorityFeePerGas?: undefined;
|
439
|
+
accessList?: undefined;
|
440
|
+
type?: "0x0" | undefined;
|
441
|
+
feeCurrency?: `0x${string}` | undefined;
|
442
|
+
gatewayFee?: `0x${string}` | undefined;
|
443
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
444
|
+
} | {
|
445
|
+
data?: `0x${string}` | undefined;
|
446
|
+
from: `0x${string}`;
|
447
|
+
gas?: `0x${string}` | undefined;
|
448
|
+
nonce?: `0x${string}` | undefined;
|
449
|
+
to?: `0x${string}` | undefined;
|
450
|
+
value?: `0x${string}` | undefined;
|
451
|
+
gasPrice?: `0x${string}` | undefined;
|
452
|
+
maxFeePerGas?: undefined;
|
453
|
+
maxPriorityFeePerGas?: undefined;
|
454
|
+
accessList?: import("../../index.js").AccessList | undefined;
|
455
|
+
type?: "0x1" | undefined;
|
456
|
+
feeCurrency?: `0x${string}` | undefined;
|
457
|
+
gatewayFee?: `0x${string}` | undefined;
|
458
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
459
|
+
} | {
|
460
|
+
data?: `0x${string}` | undefined;
|
461
|
+
from: `0x${string}`;
|
462
|
+
gas?: `0x${string}` | undefined;
|
463
|
+
nonce?: `0x${string}` | undefined;
|
464
|
+
to?: `0x${string}` | undefined;
|
465
|
+
value?: `0x${string}` | undefined;
|
466
|
+
gasPrice?: undefined;
|
467
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
468
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
469
|
+
accessList?: import("../../index.js").AccessList | undefined;
|
470
|
+
type?: "0x2" | undefined;
|
471
|
+
feeCurrency?: `0x${string}` | undefined;
|
472
|
+
gatewayFee?: `0x${string}` | undefined;
|
473
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
474
|
+
} | {
|
475
|
+
data?: `0x${string}` | undefined;
|
476
|
+
from: `0x${string}`;
|
477
|
+
gas?: `0x${string}` | undefined;
|
478
|
+
nonce?: `0x${string}` | undefined;
|
479
|
+
to?: `0x${string}` | undefined;
|
480
|
+
value?: `0x${string}` | undefined;
|
481
|
+
gasPrice?: undefined;
|
482
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
483
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
484
|
+
accessList?: import("../../index.js").AccessList | undefined;
|
485
|
+
type?: "0x7c" | undefined;
|
486
|
+
feeCurrency?: `0x${string}` | undefined;
|
487
|
+
gatewayFee?: `0x${string}` | undefined;
|
488
|
+
gatewayFeeRecipient?: `0x${string}` | undefined;
|
191
489
|
}) & {};
|
192
490
|
type: "transactionRequest";
|
193
491
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../src/chains/celo/formatters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../src/chains/celo/formatters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAW/C,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kCAAkC,EAElC,eAAe,EAEf,sBAAsB,EACvB,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,cAAc;;;;0BAKL,IAAI,EAAE,GAAG,kBAAkB,EAAE;;;;;;;;;;;;;;;;;;;;;0BAG/B,IAAI,EAAE,GAAG,eAAe,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDV,CAAA"}
|
@@ -2,8 +2,8 @@ import type { Address } from 'abitype';
|
|
2
2
|
import type { Block, BlockTag } from '../../types/block.js';
|
3
3
|
import type { FeeValuesEIP1559 } from '../../types/fee.js';
|
4
4
|
import type { Hex } from '../../types/misc.js';
|
5
|
-
import type { RpcBlock, RpcTransaction, RpcTransactionReceipt, RpcTransactionRequest, TransactionType } from '../../types/rpc.js';
|
6
|
-
import type { AccessList, Transaction, TransactionReceipt, TransactionRequest, TransactionSerializable, TransactionSerializableBase, TransactionSerialized } from '../../types/transaction.js';
|
5
|
+
import type { Index, Quantity, RpcBlock, RpcTransaction as RpcTransaction_, RpcTransactionReceipt, RpcTransactionRequest as RpcTransactionRequest_, TransactionType } from '../../types/rpc.js';
|
6
|
+
import type { AccessList, Transaction as Transaction_, TransactionBase, TransactionReceipt, TransactionRequest as TransactionRequest_, TransactionRequestBase, TransactionSerializable, TransactionSerializableBase, TransactionSerialized } from '../../types/transaction.js';
|
7
7
|
import type { NeverBy } from '../../types/utils.js';
|
8
8
|
import type { OptimismRpcTransaction } from '../optimism/types.js';
|
9
9
|
type CeloBlockExclude = 'difficulty' | 'gasLimit' | 'mixHash' | 'nonce' | 'uncles';
|
@@ -21,45 +21,71 @@ export type CeloRpcBlockOverrides = {
|
|
21
21
|
};
|
22
22
|
};
|
23
23
|
export type CeloRpcBlock<TBlockTag extends BlockTag = BlockTag, TIncludeTransactions extends boolean = boolean> = NeverBy<RpcBlock<TBlockTag, TIncludeTransactions, OptimismRpcTransaction<TBlockTag extends 'pending' ? true : false>>, CeloBlockExclude> & CeloRpcBlockOverrides;
|
24
|
-
export type
|
24
|
+
export type CeloRpcTransaction<TPending extends boolean = boolean> = RpcTransaction<TPending> | RpcTransactionCIP42<TPending>;
|
25
|
+
export type CeloRpcTransactionReceiptOverrides = {
|
25
26
|
feeCurrency: Address | null;
|
26
27
|
gatewayFee: Hex | null;
|
27
28
|
gatewayFeeRecipient: Address | null;
|
28
29
|
};
|
29
|
-
export type
|
30
|
-
export type
|
30
|
+
export type CeloRpcTransactionReceipt = RpcTransactionReceipt & CeloRpcTransactionReceiptOverrides;
|
31
|
+
export type CeloRpcTransactionRequest = RpcTransactionRequest | RpcTransactionRequestCIP42;
|
32
|
+
export type CeloTransaction<TPending extends boolean = boolean> = Transaction<TPending> | TransactionCIP42<TPending>;
|
33
|
+
export type CeloTransactionReceiptOverrides = {
|
34
|
+
feeCurrency: Address | null;
|
35
|
+
gatewayFee: bigint | null;
|
36
|
+
gatewayFeeRecipient: Address | null;
|
37
|
+
};
|
38
|
+
export type CeloTransactionReceipt = TransactionReceipt & CeloTransactionReceiptOverrides;
|
39
|
+
export type CeloTransactionRequest = TransactionRequest | TransactionRequestCIP42;
|
40
|
+
export type CeloTransactionSerializable = TransactionSerializableCIP42 | TransactionSerializable;
|
41
|
+
export type CeloTransactionSerialized<TType extends CeloTransactionType = 'legacy'> = TransactionSerialized<TType> | TransactionSerializedCIP42;
|
42
|
+
export type CeloTransactionType = TransactionType | 'cip42';
|
43
|
+
type RpcTransaction<TPending extends boolean = boolean> = RpcTransaction_<TPending> & {
|
31
44
|
feeCurrency: Address | null;
|
32
45
|
gatewayFee: Hex | null;
|
33
46
|
gatewayFeeRecipient: Address | null;
|
34
47
|
};
|
35
|
-
|
36
|
-
export type CeloRpcTransactionRequestOverrides = {
|
48
|
+
type RpcTransactionRequest = RpcTransactionRequest_ & {
|
37
49
|
feeCurrency?: Address;
|
38
50
|
gatewayFee?: Hex;
|
39
51
|
gatewayFeeRecipient?: Address;
|
40
52
|
};
|
41
|
-
export type
|
42
|
-
|
53
|
+
export type RpcTransactionCIP42<TPending extends boolean = boolean> = TransactionBase<Quantity, Index, TPending> & FeeValuesEIP1559<Quantity> & {
|
54
|
+
feeCurrency: Address | null;
|
55
|
+
gatewayFee: Hex | null;
|
56
|
+
gatewayFeeRecipient: Address | null;
|
57
|
+
type: '0x7c';
|
58
|
+
};
|
59
|
+
export type RpcTransactionRequestCIP42 = TransactionRequestBase<Quantity, Index> & Partial<FeeValuesEIP1559<Quantity>> & {
|
60
|
+
accessList?: AccessList;
|
61
|
+
feeCurrency?: Address;
|
62
|
+
gatewayFee?: Hex;
|
63
|
+
gatewayFeeRecipient?: Address;
|
64
|
+
type?: '0x7c';
|
65
|
+
};
|
66
|
+
type Transaction<TPending extends boolean = boolean> = Transaction_<bigint, number, TPending> & {
|
43
67
|
feeCurrency: Address | null;
|
44
68
|
gatewayFee: bigint | null;
|
45
69
|
gatewayFeeRecipient: Address | null;
|
46
70
|
};
|
47
|
-
export type
|
48
|
-
export type CeloTransactionReceiptOverrides = {
|
71
|
+
export type TransactionCIP42<TPending extends boolean = boolean> = TransactionBase<bigint, number, TPending> & FeeValuesEIP1559 & {
|
49
72
|
feeCurrency: Address | null;
|
50
73
|
gatewayFee: bigint | null;
|
51
74
|
gatewayFeeRecipient: Address | null;
|
75
|
+
type: 'cip42';
|
52
76
|
};
|
53
|
-
|
54
|
-
export type CeloTransactionRequestOverrides = {
|
77
|
+
type TransactionRequest = TransactionRequest_ & {
|
55
78
|
feeCurrency?: Address;
|
56
79
|
gatewayFee?: bigint;
|
57
80
|
gatewayFeeRecipient?: Address;
|
58
81
|
};
|
59
|
-
export type
|
60
|
-
|
61
|
-
|
62
|
-
|
82
|
+
export type TransactionRequestCIP42 = TransactionRequestBase & Partial<FeeValuesEIP1559> & {
|
83
|
+
accessList?: AccessList;
|
84
|
+
feeCurrency?: Address;
|
85
|
+
gatewayFee?: bigint;
|
86
|
+
gatewayFeeRecipient?: Address;
|
87
|
+
type?: 'cip42';
|
88
|
+
};
|
63
89
|
export type TransactionSerializableCIP42<TQuantity = bigint, TIndex = number> = TransactionSerializableBase<TQuantity, TIndex> & FeeValuesEIP1559<TQuantity> & {
|
64
90
|
accessList?: AccessList;
|
65
91
|
gasPrice?: never;
|