New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@avalabs/vm-module-types

Package Overview
Dependencies
Maintainers
0
Versions
532
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avalabs/vm-module-types - npm Package Compare versions

Comparing version 0.0.0-addFunctions-20240621170127 to 0.0.0-automate-20240712215427

.turbo/turbo-build.log

28

CHANGELOG.md
# @avalabs/vm-module-types
## 0.0.0-addFunctions-20240621170127
## 0.0.0-automate-20240712215427
### Patch Changes
- 2f39ec5: make module interface dynamic
- b09fcea: add module functions to evm-module
- af68c81: Add getTransactionHistory to avalanche module
- d9fa0f5: added getNetworkFee to avalanche module
## 0.0.12
### Patch Changes
- cd97708: fix: build types package
- d0c2cc9: make module interface more consistent
- 7bc6c6e: add eth_sendTransaction handler
## 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

@@ -11,0 +33,0 @@

19

package.json
{
"name": "@avalabs/vm-module-types",
"version": "0.0.0-addFunctions-20240621170127",
"main": "src/index.ts",
"version": "0.0.0-automate-20240712215427",
"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",
"ethers": "6.8.1"
},
"devDependencies": {
"eslint-config-custom": "0.0.1"
"tsup": "7.2.0",
"@internal/tsup-config": "0.0.1",
"eslint-config-custom": "0.0.2"
},
"peerDependencies": {
"ethers": "^6.8.1"
},
"scripts": {
"build": "tsup",
"lint": "eslint \"src/**/*.ts\""
}
}
import { object, string, boolean, z } from 'zod';
import type { TransactionRequest } from 'ethers';
import type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';

@@ -19,2 +21,30 @@ export enum TransactionType {

export enum PChainTransactionType {
ADD_VALIDATOR_TX = 'AddValidatorTx',
ADD_SUBNET_VALIDATOR_TX = 'AddSubnetValidatorTx',
ADD_DELEGATOR_TX = 'AddDelegatorTx',
CREATE_CHAIN_TX = 'CreateChainTx',
CREATE_SUBNET_TX = 'CreateSubnetTx',
IMPORT_TX = 'ImportTx',
EXPORT_TX = 'ExportTx',
ADVANCE_TIME_TX = 'AdvanceTimeTx',
REWARD_VALIDATOR_TX = 'RewardValidatorTx',
REMOVE_SUBNET_VALIDATOR_TX = 'RemoveSubnetValidatorTx',
TRANSFORM_SUBNET_TX = 'TransformSubnetTx',
ADD_PERMISSIONLESS_VALIDATOR_TX = 'AddPermissionlessValidatorTx',
ADD_PERMISSIONLESS_DELEGATOR_TX = 'AddPermissionlessDelegatorTx',
BASE_TX = 'BaseTx',
TRANSFER_SUBNET_OWNERSHIP_TX = 'TransferSubnetOwnershipTx',
UNKNOWN = 'UNKNOWN',
}
export enum XChainTransactionType {
BASE_TX = 'BaseTx',
CREATE_ASSET_TX = 'CreateAssetTx',
OPERATION_TX = 'OperationTx',
IMPORT_TX = 'ImportTx',
EXPORT_TX = 'ExportTx',
UNKNOWN = 'UNKNOWN',
}
export enum TokenType {

@@ -28,6 +58,7 @@ NATIVE = 'NATIVE',

export type NetworkFees = {
low: { maxPriorityFeePerGas: bigint; maxFeePerGas: bigint };
medium: { maxPriorityFeePerGas: bigint; maxFeePerGas: bigint };
high: { maxPriorityFeePerGas: bigint; maxFeePerGas: bigint };
low: { maxFeePerGas: bigint; maxPriorityFeePerGas?: bigint };
medium: { maxFeePerGas: bigint; maxPriorityFeePerGas?: bigint };
high: { maxFeePerGas: bigint; maxPriorityFeePerGas?: bigint };
baseFee: bigint;
isFixedFee: boolean;
};

@@ -44,13 +75,25 @@

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;
context?: Record<string, unknown>; // for storing additional context information that's only relevant to the consumer
};
export type RpcResponse<R = unknown, E extends Error = Error> =
export type RpcError =
| JsonRpcError<OptionalDataWithOptionalCause>
| EthereumProviderError<OptionalDataWithOptionalCause>;
export type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> =
| {

@@ -63,20 +106,30 @@ result: R;

export type Network = {
chainId: number;
chainName: string;
rpcUrl: string;
networkToken: NetworkToken;
utilityAddresses?: {
multicall: string;
};
logoUrl?: string;
isTestnet?: boolean;
explorerUrl?: string;
};
export interface Module {
getManifest: () => Manifest | undefined;
getNetworkFee: () => Promise<RpcResponse<NetworkFees>>;
getTransactionHistory: (params: GetTransactionHistory) => Promise<RpcResponse<TransactionHistoryResponse>>;
getBalances: () => Promise<string>;
getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>;
getNetworkFee: (network: Network) => Promise<NetworkFees>;
getAddress: () => Promise<string>;
getBalances: () => Promise<string>;
onRpcRequest: (request: RpcRequest) => Promise<RpcResponse>;
getTokens: (network: Network) => Promise<NetworkContractToken[]>;
onRpcRequest: (request: RpcRequest, network: Network) => Promise<RpcResponse>;
}
export type GetTransactionHistory = {
chainId: number;
isTestnet: boolean;
networkToken: NetworkToken;
explorerUrl: string;
network: Network;
address: string;
nextPageToken?: string;
offset?: number;
glacierApiUrl?: string;
};

@@ -101,3 +154,3 @@

gasUsed: string;
txType?: TransactionType;
txType?: TransactionType | PChainTransactionType | XChainTransactionType;
chainId: string; // chainId from ActiveNetwork used to fetch tx

@@ -151,2 +204,13 @@ method?: string;

export interface NetworkContractToken {
address: string;
chainId?: number;
color?: string;
contractType: string;
decimals: number;
logoUri?: string;
name: string;
symbol: string;
}
const sourceSchema = object({

@@ -190,1 +254,82 @@ checksum: string(),

};
export type Caip2ChainId = string;
export type Hex = `0x${string}`;
export enum Environment {
PRODUCTION = 'production',
DEV = 'dev',
}
export type DisplayData = {
title: string;
network: {
chainId: number;
name: string;
logoUrl?: string;
};
messageDetails?: string;
transactionDetails?: {
website: string;
from: string;
to: string;
data?: string;
};
networkFeeSelector?: boolean;
};
/**
* Enum for different types of signing data.
*/
export enum SigningDataType {
// EVM signing data types
EVM_TRANSACTION = 'evm_transaction',
EVM_MESSAGE_ETH_SIGN = 'evm_message_eth_sign',
EVM_MESSAGE_PERSONAL_SIGN = 'evm_message_personal_sign',
EVM_MESSAGE_ETH_SIGN_TYPED_DATA = 'evm_message_eth_sign_typed_data',
EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V1 = 'evm_message_eth_sign_typed_data_v1',
EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V3 = 'evm_message_eth_sign_typed_data_v3',
EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V4 = 'evm_message_eth_sign_typed_data_v4',
// Avalanche signing data types
AVALANCHE_TRANSACTION = 'avalanche_transaction',
AVALANCHE_MESSAGE = 'avalanche_message',
// Bitcoin signing data types
BTC_TRANSACTION = 'btc_transaction',
}
export type SigningData =
| {
type: SigningDataType.EVM_TRANSACTION;
account: string;
chainId: number;
data: TransactionRequest;
}
| {
type: SigningDataType.EVM_MESSAGE_ETH_SIGN;
account: string;
chainId: number;
data: string;
};
export type ApprovalParams = {
request: RpcRequest;
displayData: DisplayData;
signingData: SigningData;
};
export type ApprovalResponse =
| {
result: Hex;
}
| {
error: RpcError;
};
export interface ApprovalController {
requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
onTransactionConfirmed: (txHash: Hex) => void;
onTransactionReverted: (txHash: Hex) => void;
}

@@ -5,5 +5,5 @@ {

"outDir": "./dist",
"composite": true
"tsBuildInfoFile": ".tsbuildinfo"
},
"include": ["src"]
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc