@avalabs/vm-module-types
Advanced tools
Comparing version 0.0.0-publicTypes-20240620175625 to 0.0.0-refactor-params-20240711144718
# @avalabs/vm-module-types | ||
## 0.0.0-publicTypes-20240620175625 | ||
## 0.0.0-refactor-params-20240711144718 | ||
### Patch Changes | ||
- 55240c4: Move types from packages-internal/types to packages/types | ||
- cd97708: fix: build types package | ||
## 0.0.11 | ||
## 0.0.10 | ||
### Patch Changes | ||
- 60f36fa: add getTokens function | ||
## 0.0.9 | ||
### Patch Changes | ||
- 6ffa356: add module functions to evm-module | ||
## 0.0.8 | ||
### Patch Changes | ||
- d1d080f: test release | ||
## 0.0.7 | ||
### Patch Changes | ||
- bb98621: Move types to @avalabs/vm-module-types | ||
## 0.0.6 | ||
### Patch Changes | ||
- 1122704: test release | ||
## 0.0.3 | ||
### Patch Changes | ||
- 0b0c52e: Move types to @avalabs/vm-module-types | ||
## 0.0.2 | ||
### Patch Changes | ||
- 4b7d5e9: Move types from packages-internal/types to packages/types |
{ | ||
"name": "@avalabs/vm-module-types", | ||
"version": "0.0.0-publicTypes-20240620175625", | ||
"main": "src/index.ts", | ||
"version": "0.0.0-refactor-params-20240711144718", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"type": "module", | ||
"dependencies": { | ||
"zod": "3.23.8" | ||
"zod": "3.23.8", | ||
"@metamask/rpc-errors": "6.3.0" | ||
}, | ||
"devDependencies": { | ||
"tsup": "7.2.0", | ||
"@internal/tsup-config": "0.0.1", | ||
"eslint-config-custom": "0.0.1" | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"lint": "eslint \"src/**/*.ts\"" | ||
} | ||
} |
import { object, string, boolean, z } from 'zod'; | ||
import type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors'; | ||
@@ -33,2 +34,54 @@ export enum TransactionType { | ||
export enum RpcMethod { | ||
/* EVM */ | ||
ETH_SEND_TRANSACTION = 'eth_sendTransaction', | ||
SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3', | ||
SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4', | ||
SIGN_TYPED_DATA_V1 = 'eth_signTypedData_v1', | ||
SIGN_TYPED_DATA = 'eth_signTypedData', | ||
PERSONAL_SIGN = 'personal_sign', | ||
ETH_SIGN = 'eth_sign', | ||
WALLET_ADD_ETHEREUM_CHAIN = 'wallet_addEthereumChain', | ||
WALLET_SWITCH_ETHEREUM_CHAIN = 'wallet_switchEthereumChain', | ||
WALLET_GET_ETHEREUM_CHAIN = 'wallet_getEthereumChain', | ||
} | ||
export type DappInfo = { | ||
name: string; | ||
url: string; | ||
icon: string; | ||
}; | ||
export type RpcRequest = { | ||
requestId: string; | ||
sessionId: string; | ||
method: RpcMethod; | ||
chainId: Caip2ChainId; | ||
params: unknown; | ||
dappInfo: DappInfo; | ||
}; | ||
export type RpcError = | ||
| JsonRpcError<OptionalDataWithOptionalCause> | ||
| EthereumProviderError<OptionalDataWithOptionalCause>; | ||
export type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> = | ||
| { | ||
result: R; | ||
} | ||
| { | ||
error: E; | ||
}; | ||
export type Network = { | ||
chainId: Caip2ChainId; | ||
chainName: string; | ||
rpcUrl: string; | ||
networkToken: NetworkToken; | ||
multiContractAddress?: string; | ||
logoUrl?: string; | ||
isTestnet?: boolean; | ||
explorerUrl?: string; | ||
}; | ||
export interface Module { | ||
@@ -38,15 +91,13 @@ getManifest: () => Manifest | undefined; | ||
getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>; | ||
getNetworkFee: () => Promise<NetworkFees>; | ||
getNetworkFee: (network: Network) => Promise<NetworkFees>; | ||
getAddress: () => Promise<string>; | ||
getTokens: (network: Network) => Promise<NetworkContractToken[]>; | ||
onRpcRequest: (request: RpcRequest, chain: Network) => Promise<RpcResponse>; | ||
} | ||
export type GetTransactionHistory = { | ||
chainId: number; | ||
isTestnet: boolean; | ||
networkToken: NetworkToken; | ||
explorerUrl: string; | ||
network: Network; | ||
address: string; | ||
nextPageToken?: string; | ||
offset?: number; | ||
glacierApiUrl?: string; | ||
}; | ||
@@ -120,2 +171,13 @@ | ||
export interface NetworkContractToken { | ||
address: string; | ||
chainId?: number; | ||
color?: string; | ||
contractType: string; | ||
decimals: number; | ||
logoUri?: string; | ||
name: string; | ||
symbol: string; | ||
} | ||
const sourceSchema = object({ | ||
@@ -159,1 +221,10 @@ checksum: string(), | ||
}; | ||
export type Caip2ChainId = string; | ||
export type Hex = `0x${string}`; | ||
export enum Environment { | ||
PRODUCTION = 'production', | ||
DEV = 'dev', | ||
} |
@@ -5,5 +5,5 @@ { | ||
"outDir": "./dist", | ||
"composite": true | ||
"tsBuildInfoFile": ".tsbuildinfo" | ||
}, | ||
"include": ["src"] | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
51585
25
721
Yes
32
47
10
2
3
3
1
+ Added@metamask/rpc-errors@6.3.0
+ Added@ethereumjs/common@3.2.0(transitive)
+ Added@ethereumjs/rlp@4.0.1(transitive)
+ Added@ethereumjs/tx@4.2.0(transitive)
+ Added@ethereumjs/util@8.1.0(transitive)
+ Added@metamask/rpc-errors@6.3.0(transitive)
+ Added@metamask/superstruct@3.1.0(transitive)
+ Added@metamask/utils@8.5.0(transitive)
+ Added@noble/curves@1.4.2(transitive)
+ Added@noble/hashes@1.4.01.7.1(transitive)
+ Added@scure/base@1.1.91.2.4(transitive)
+ Added@scure/bip32@1.4.0(transitive)
+ Added@scure/bip39@1.3.0(transitive)
+ Added@types/debug@4.1.12(transitive)
+ Added@types/ms@2.1.0(transitive)
+ Addedcrc-32@1.2.2(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedethereum-cryptography@2.2.1(transitive)
+ Addedfast-safe-stringify@2.1.1(transitive)
+ Addedmicro-ftch@0.3.1(transitive)
+ Addedms@2.1.3(transitive)
+ Addedpony-cause@2.1.11(transitive)
+ Addedsemver@7.7.0(transitive)
+ Addeduuid@9.0.1(transitive)