@avalabs/vm-module-types 0.0.8 → 0.0.9

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @avalabs/vm-module-types@0.0.8 lint /home/runner/work/vm-modules/vm-modules/packages/types
2
+ > @avalabs/vm-module-types@0.0.9 lint /home/runner/work/vm-modules/vm-modules/packages/types
3
3
  > eslint "src/**/*.ts"
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @avalabs/vm-module-types
2
2
 
3
+ ## 0.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 6ffa356: add module functions to evm-module
8
+
3
9
  ## 0.0.8
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avalabs/vm-module-types",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "main": "src/index.ts",
5
5
  "dependencies": {
6
6
  "zod": "3.23.8"
package/src/types.ts CHANGED
@@ -30,12 +30,50 @@ export type NetworkFees = {
30
30
  baseFee: bigint;
31
31
  };
32
32
 
33
+ export enum RpcMethod {
34
+ /* EVM */
35
+ ETH_SEND_TRANSACTION = 'eth_sendTransaction',
36
+ SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3',
37
+ SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4',
38
+ SIGN_TYPED_DATA_V1 = 'eth_signTypedData_v1',
39
+ SIGN_TYPED_DATA = 'eth_signTypedData',
40
+ PERSONAL_SIGN = 'personal_sign',
41
+ ETH_SIGN = 'eth_sign',
42
+ WALLET_ADD_ETHEREUM_CHAIN = 'wallet_addEthereumChain',
43
+ WALLET_SWITCH_ETHEREUM_CHAIN = 'wallet_switchEthereumChain',
44
+ WALLET_GET_ETHEREUM_CHAIN = 'wallet_getEthereumChain',
45
+ }
46
+
47
+ export type RpcRequest = {
48
+ method: RpcMethod;
49
+ params: unknown;
50
+ };
51
+
52
+ export type RpcResponse<R = unknown, E extends Error = Error> =
53
+ | {
54
+ result: R;
55
+ }
56
+ | {
57
+ error: E;
58
+ };
59
+
60
+ export type Chain = {
61
+ isTestnet?: boolean;
62
+ chainId?: string;
63
+ chainName?: string;
64
+ rpcUrl?: string;
65
+ multiContractAddress?: string;
66
+ };
67
+
68
+ export type GetNetworkFeeParams = Chain;
69
+
33
70
  export interface Module {
34
71
  getManifest: () => Manifest | undefined;
35
72
  getBalances: () => Promise<string>;
36
73
  getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>;
37
- getNetworkFee: () => Promise<NetworkFees>;
74
+ getNetworkFee: (params: GetNetworkFeeParams) => Promise<NetworkFees>;
38
75
  getAddress: () => Promise<string>;
76
+ onRpcRequest: (request: RpcRequest) => Promise<RpcResponse>;
39
77
  }
40
78
 
41
79
  export type GetTransactionHistory = {