@avalabs/vm-module-types 0.1.4 → 0.1.5
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/dist/chunk-2SJQLDBB.js +5 -0
- package/dist/chunk-2SJQLDBB.js.map +1 -0
- package/dist/{chunk-MYV3O6EL.cjs → chunk-HN4DUGTT.cjs} +4 -4
- package/dist/chunk-HN4DUGTT.cjs.map +1 -0
- package/dist/chunk-IQNJXPS3.cjs +7 -0
- package/dist/chunk-IQNJXPS3.cjs.map +1 -0
- package/dist/{chunk-X3MYG3BR.js → chunk-OER2CERE.js} +3 -3
- package/dist/chunk-OER2CERE.js.map +1 -0
- package/dist/index.cjs +8 -3
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/module.d.cts +2 -0
- package/dist/module.d.ts +2 -0
- package/dist/rpc.cjs +3 -3
- package/dist/rpc.d.cts +22 -9
- package/dist/rpc.d.ts +22 -9
- package/dist/rpc.js +1 -1
- package/dist/staking.cjs +12 -0
- package/dist/staking.cjs.map +1 -0
- package/dist/staking.d.cts +112 -0
- package/dist/staking.d.ts +112 -0
- package/dist/staking.js +3 -0
- package/dist/staking.js.map +1 -0
- package/package.json +3 -2
- package/dist/chunk-MYV3O6EL.cjs.map +0 -1
- package/dist/chunk-X3MYG3BR.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var e=(t=>(t.Base="base",t.AddValidator="add_validator",t.AddDelegator="add_delegator",t.Export="export",t.Import="import",t.CreateSubnet="create_subnet",t.CreateChain="create_chain",t.AddSubnetValidator="add_subnet_validator",t.RemoveSubnetValidator="remove_subnet_validator",t.AddPermissionlessValidator="add_permissionless_validator",t.AddPermissionlessDelegator="add_permissionless_delegator",t.TransformSubnet="transform_subnet",t.TransferSubnetOwnership="transfer_subnet_ownership",t.Unknown="unknown",t))(e||{});
|
|
2
|
+
|
|
3
|
+
export { e as a };
|
|
4
|
+
//# sourceMappingURL=out.js.map
|
|
5
|
+
//# sourceMappingURL=chunk-2SJQLDBB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/staking.ts"],"names":["TxType"],"mappings":"AA6GO,IAAKA,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,aAAe,gBACfA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,aAAe,gBACfA,EAAA,YAAc,eACdA,EAAA,mBAAqB,uBACrBA,EAAA,sBAAwB,0BACxBA,EAAA,2BAA6B,+BAC7BA,EAAA,2BAA6B,+BAC7BA,EAAA,gBAAkB,mBAClBA,EAAA,wBAA0B,4BAC1BA,EAAA,QAAU,UAdAA,OAAA","sourcesContent":["import type { NetworkVMType } from './common';\n\nexport type TxDetails = StakingDetails | ExportImportTxDetails | ChainDetails | BlockchainDetails | SubnetDetails;\n\nexport type StakingDetails =\n | AddPermissionlessDelegatorTx\n | AddPermissionlessValidatorTx\n | AddSubnetValidatorTx\n | RemoveSubnetValidatorTx;\nexport type ExportImportTxDetails = ExportTx | ImportTx;\nexport type ChainDetails = BaseTx;\nexport type BlockchainDetails = CreateChainTx;\nexport type SubnetDetails = CreateSubnetTx;\n\nexport type VM = NetworkVMType.AVM | NetworkVMType.EVM | NetworkVMType.PVM;\n\nexport type AddPermissionlessDelegatorTx = {\n type: TxType.AddPermissionlessDelegator;\n nodeID: string;\n subnetID: string;\n stake: bigint;\n start: string;\n end: string;\n txFee: bigint;\n};\n\nexport type AddPermissionlessValidatorTx = {\n type: TxType.AddPermissionlessValidator;\n nodeID: string;\n subnetID: string;\n stake: bigint;\n delegationFee: number;\n start: string;\n end: string;\n txFee: bigint;\n publicKey?: string;\n signature?: string;\n};\n\nexport interface ExportTx {\n type: TxType.Export;\n destination: VM;\n amount: bigint;\n chain: VM;\n txFee: bigint;\n}\n\nexport interface ImportTx {\n type: TxType.Import;\n source: VM;\n amount: bigint;\n chain: VM;\n txFee: bigint;\n}\n\nexport interface BaseTx {\n type: TxType.Base;\n chain: VM;\n outputs: {\n assetId: string;\n locktime: bigint;\n threshold: bigint;\n amount: bigint;\n assetDescription?: {\n assetID: string;\n name: string;\n symbol: string;\n denomination: number;\n };\n owners: string[];\n isAvax: boolean;\n }[];\n memo?: string;\n txFee: bigint;\n}\n\nexport type AddSubnetValidatorTx = {\n type: TxType.AddSubnetValidator;\n nodeID: string;\n subnetID: string;\n stake: bigint;\n start: string;\n end: string;\n txFee: bigint;\n};\n\nexport type CreateChainTx = {\n type: TxType.CreateChain;\n chainName: string;\n chainID: string;\n vmID: string;\n genesisData: string;\n txFee: bigint;\n};\n\nexport type CreateSubnetTx = {\n type: TxType.CreateSubnet;\n threshold: number;\n controlKeys: string[];\n txFee: bigint;\n};\n\nexport type RemoveSubnetValidatorTx = {\n type: TxType.RemoveSubnetValidator;\n nodeID: string;\n subnetID: string;\n txFee: bigint;\n};\n\nexport enum TxType {\n Base = 'base',\n AddValidator = 'add_validator',\n AddDelegator = 'add_delegator',\n Export = 'export',\n Import = 'import',\n CreateSubnet = 'create_subnet',\n CreateChain = 'create_chain',\n AddSubnetValidator = 'add_subnet_validator',\n RemoveSubnetValidator = 'remove_subnet_validator',\n AddPermissionlessValidator = 'add_permissionless_validator',\n AddPermissionlessDelegator = 'add_permissionless_delegator',\n TransformSubnet = 'transform_subnet',\n TransferSubnetOwnership = 'transfer_subnet_ownership',\n Unknown = 'unknown',\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var a=(e=>(e.ETH_SEND_TRANSACTION="eth_sendTransaction",e.SIGN_TYPED_DATA_V3="eth_signTypedData_v3",e.SIGN_TYPED_DATA_V4="eth_signTypedData_v4",e.SIGN_TYPED_DATA_V1="eth_signTypedData_v1",e.SIGN_TYPED_DATA="eth_signTypedData",e.PERSONAL_SIGN="personal_sign",e.ETH_SIGN="eth_sign",e.AVALANCHE_SIGN_MESSAGE="avalanche_signMessage",e.AVALANCHE_SEND_TRANSACTION="avalanche_sendTransaction",e))(a||{}),n=(t=>(t.WARNING="Warning",t.DANGER="Danger",t.INFO="Info",t))(n||{});
|
|
4
4
|
|
|
5
|
-
exports.a =
|
|
6
|
-
exports.b =
|
|
5
|
+
exports.a = a;
|
|
6
|
+
exports.b = n;
|
|
7
7
|
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-HN4DUGTT.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","AlertType"],"mappings":"AAOO,IAAKA,OAEVA,EAAA,qBAAuB,sBACvBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAGXA,EAAA,uBAAyB,wBACzBA,EAAA,2BAA6B,4BAZnBA,OAAA,IAgGAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\nimport type { Avalanche } from '@avalabs/core-wallets-sdk';\nimport type { StakingDetails, ExportImportTxDetails, ChainDetails, BlockchainDetails, SubnetDetails } from './staking';\n\nexport enum RpcMethod {\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3',\n SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4',\n SIGN_TYPED_DATA_V1 = 'eth_signTypedData_v1',\n SIGN_TYPED_DATA = 'eth_signTypedData',\n PERSONAL_SIGN = 'personal_sign',\n ETH_SIGN = 'eth_sign',\n\n /* AVALANCHE */\n AVALANCHE_SIGN_MESSAGE = 'avalanche_signMessage',\n AVALANCHE_SEND_TRANSACTION = 'avalanche_sendTransaction',\n}\n\nexport type DappInfo = {\n name: string;\n url: string;\n icon: string;\n};\n\nexport type RpcRequest = {\n requestId: string;\n sessionId: string;\n method: RpcMethod;\n chainId: Caip2ChainId;\n params: unknown;\n dappInfo: DappInfo;\n context?: Record<string, unknown>; // for storing additional context information that's only relevant to the consumer\n};\n\nexport type RpcError =\n | JsonRpcError<OptionalDataWithOptionalCause>\n | EthereumProviderError<OptionalDataWithOptionalCause>;\n\nexport type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> =\n | {\n result: R;\n }\n | {\n error: E;\n };\n\nexport interface MessageTypeProperty {\n name: string;\n type: string;\n}\n\nexport interface MessageTypes {\n EIP712Domain: MessageTypeProperty[];\n [additionalProperties: string]: MessageTypeProperty[];\n}\n\nexport interface TypedData<T extends MessageTypes> {\n types: T;\n primaryType: keyof T;\n domain: Record<string, unknown>;\n message: Record<string, unknown>;\n}\n\nexport type TypedDataV1 = { name: string; type: string; value: unknown }[];\n\nexport type TransactionDetails = {\n website: string;\n from: string;\n to: string;\n data?: string;\n type?: string;\n};\n\nexport type DisplayData = {\n title: string;\n dAppInfo?: {\n name: string;\n action: string;\n logoUri?: string;\n };\n network: {\n chainId: number;\n name: string;\n logoUri?: string;\n };\n account?: string;\n messageDetails?: string;\n transactionDetails?: TransactionDetails | ExportImportTxDetails;\n stakingDetails?: StakingDetails;\n chainDetails?: ChainDetails;\n blockchainDetails?: BlockchainDetails;\n subnetDetails?: SubnetDetails;\n networkFeeSelector?: boolean;\n disclaimer?: string;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n};\n\nexport enum AlertType {\n WARNING = 'Warning',\n DANGER = 'Danger',\n INFO = 'Info',\n}\n\nexport type AlertDetails = {\n title: string;\n description: string;\n detailedDescription?: string;\n actionTitles?: {\n proceed: string;\n reject: string;\n };\n};\n\nexport type Alert = {\n type: AlertType;\n details: AlertDetails;\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n data: TransactionRequest;\n }\n | {\n type: RpcMethod.ETH_SIGN | RpcMethod.PERSONAL_SIGN;\n account: string;\n data: string;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA | RpcMethod.SIGN_TYPED_DATA_V1;\n account: string;\n data: TypedData<MessageTypes> | TypedDataV1;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA_V3 | RpcMethod.SIGN_TYPED_DATA_V4;\n account: string;\n data: TypedData<MessageTypes>;\n }\n | {\n type: RpcMethod.AVALANCHE_SIGN_MESSAGE;\n data: string;\n accountIndex?: number;\n }\n | {\n type: RpcMethod.AVALANCHE_SEND_TRANSACTION;\n unsignedTxJson: string;\n data: Avalanche.Tx;\n vm: 'EVM' | 'AVM' | 'PVM';\n };\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n};\n\nexport type ApprovalResponse =\n | {\n result: Hex;\n }\n | {\n error: RpcError;\n };\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex) => void;\n onTransactionReverted: (txHash: Hex) => void;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var e=(t=>(t.Base="base",t.AddValidator="add_validator",t.AddDelegator="add_delegator",t.Export="export",t.Import="import",t.CreateSubnet="create_subnet",t.CreateChain="create_chain",t.AddSubnetValidator="add_subnet_validator",t.RemoveSubnetValidator="remove_subnet_validator",t.AddPermissionlessValidator="add_permissionless_validator",t.AddPermissionlessDelegator="add_permissionless_delegator",t.TransformSubnet="transform_subnet",t.TransferSubnetOwnership="transfer_subnet_ownership",t.Unknown="unknown",t))(e||{});
|
|
4
|
+
|
|
5
|
+
exports.a = e;
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=chunk-IQNJXPS3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/staking.ts"],"names":["TxType"],"mappings":"AA6GO,IAAKA,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,aAAe,gBACfA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,aAAe,gBACfA,EAAA,YAAc,eACdA,EAAA,mBAAqB,uBACrBA,EAAA,sBAAwB,0BACxBA,EAAA,2BAA6B,+BAC7BA,EAAA,2BAA6B,+BAC7BA,EAAA,gBAAkB,mBAClBA,EAAA,wBAA0B,4BAC1BA,EAAA,QAAU,UAdAA,OAAA","sourcesContent":["import type { NetworkVMType } from './common';\n\nexport type TxDetails = StakingDetails | ExportImportTxDetails | ChainDetails | BlockchainDetails | SubnetDetails;\n\nexport type StakingDetails =\n | AddPermissionlessDelegatorTx\n | AddPermissionlessValidatorTx\n | AddSubnetValidatorTx\n | RemoveSubnetValidatorTx;\nexport type ExportImportTxDetails = ExportTx | ImportTx;\nexport type ChainDetails = BaseTx;\nexport type BlockchainDetails = CreateChainTx;\nexport type SubnetDetails = CreateSubnetTx;\n\nexport type VM = NetworkVMType.AVM | NetworkVMType.EVM | NetworkVMType.PVM;\n\nexport type AddPermissionlessDelegatorTx = {\n type: TxType.AddPermissionlessDelegator;\n nodeID: string;\n subnetID: string;\n stake: bigint;\n start: string;\n end: string;\n txFee: bigint;\n};\n\nexport type AddPermissionlessValidatorTx = {\n type: TxType.AddPermissionlessValidator;\n nodeID: string;\n subnetID: string;\n stake: bigint;\n delegationFee: number;\n start: string;\n end: string;\n txFee: bigint;\n publicKey?: string;\n signature?: string;\n};\n\nexport interface ExportTx {\n type: TxType.Export;\n destination: VM;\n amount: bigint;\n chain: VM;\n txFee: bigint;\n}\n\nexport interface ImportTx {\n type: TxType.Import;\n source: VM;\n amount: bigint;\n chain: VM;\n txFee: bigint;\n}\n\nexport interface BaseTx {\n type: TxType.Base;\n chain: VM;\n outputs: {\n assetId: string;\n locktime: bigint;\n threshold: bigint;\n amount: bigint;\n assetDescription?: {\n assetID: string;\n name: string;\n symbol: string;\n denomination: number;\n };\n owners: string[];\n isAvax: boolean;\n }[];\n memo?: string;\n txFee: bigint;\n}\n\nexport type AddSubnetValidatorTx = {\n type: TxType.AddSubnetValidator;\n nodeID: string;\n subnetID: string;\n stake: bigint;\n start: string;\n end: string;\n txFee: bigint;\n};\n\nexport type CreateChainTx = {\n type: TxType.CreateChain;\n chainName: string;\n chainID: string;\n vmID: string;\n genesisData: string;\n txFee: bigint;\n};\n\nexport type CreateSubnetTx = {\n type: TxType.CreateSubnet;\n threshold: number;\n controlKeys: string[];\n txFee: bigint;\n};\n\nexport type RemoveSubnetValidatorTx = {\n type: TxType.RemoveSubnetValidator;\n nodeID: string;\n subnetID: string;\n txFee: bigint;\n};\n\nexport enum TxType {\n Base = 'base',\n AddValidator = 'add_validator',\n AddDelegator = 'add_delegator',\n Export = 'export',\n Import = 'import',\n CreateSubnet = 'create_subnet',\n CreateChain = 'create_chain',\n AddSubnetValidator = 'add_subnet_validator',\n RemoveSubnetValidator = 'remove_subnet_validator',\n AddPermissionlessValidator = 'add_permissionless_validator',\n AddPermissionlessDelegator = 'add_permissionless_delegator',\n TransformSubnet = 'transform_subnet',\n TransferSubnetOwnership = 'transfer_subnet_ownership',\n Unknown = 'unknown',\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=(e=>(e.ETH_SEND_TRANSACTION="eth_sendTransaction",e.SIGN_TYPED_DATA_V3="eth_signTypedData_v3",e.SIGN_TYPED_DATA_V4="eth_signTypedData_v4",e.SIGN_TYPED_DATA_V1="eth_signTypedData_v1",e.SIGN_TYPED_DATA="eth_signTypedData",e.PERSONAL_SIGN="personal_sign",e.ETH_SIGN="eth_sign",e.AVALANCHE_SIGN_MESSAGE="avalanche_signMessage",e.AVALANCHE_SEND_TRANSACTION="avalanche_sendTransaction",e))(a||{}),n=(t=>(t.WARNING="Warning",t.DANGER="Danger",t.INFO="Info",t))(n||{});
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { a, n as b };
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-OER2CERE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","AlertType"],"mappings":"AAOO,IAAKA,OAEVA,EAAA,qBAAuB,sBACvBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAGXA,EAAA,uBAAyB,wBACzBA,EAAA,2BAA6B,4BAZnBA,OAAA,IAgGAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\nimport type { Avalanche } from '@avalabs/core-wallets-sdk';\nimport type { StakingDetails, ExportImportTxDetails, ChainDetails, BlockchainDetails, SubnetDetails } from './staking';\n\nexport enum RpcMethod {\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3',\n SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4',\n SIGN_TYPED_DATA_V1 = 'eth_signTypedData_v1',\n SIGN_TYPED_DATA = 'eth_signTypedData',\n PERSONAL_SIGN = 'personal_sign',\n ETH_SIGN = 'eth_sign',\n\n /* AVALANCHE */\n AVALANCHE_SIGN_MESSAGE = 'avalanche_signMessage',\n AVALANCHE_SEND_TRANSACTION = 'avalanche_sendTransaction',\n}\n\nexport type DappInfo = {\n name: string;\n url: string;\n icon: string;\n};\n\nexport type RpcRequest = {\n requestId: string;\n sessionId: string;\n method: RpcMethod;\n chainId: Caip2ChainId;\n params: unknown;\n dappInfo: DappInfo;\n context?: Record<string, unknown>; // for storing additional context information that's only relevant to the consumer\n};\n\nexport type RpcError =\n | JsonRpcError<OptionalDataWithOptionalCause>\n | EthereumProviderError<OptionalDataWithOptionalCause>;\n\nexport type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> =\n | {\n result: R;\n }\n | {\n error: E;\n };\n\nexport interface MessageTypeProperty {\n name: string;\n type: string;\n}\n\nexport interface MessageTypes {\n EIP712Domain: MessageTypeProperty[];\n [additionalProperties: string]: MessageTypeProperty[];\n}\n\nexport interface TypedData<T extends MessageTypes> {\n types: T;\n primaryType: keyof T;\n domain: Record<string, unknown>;\n message: Record<string, unknown>;\n}\n\nexport type TypedDataV1 = { name: string; type: string; value: unknown }[];\n\nexport type TransactionDetails = {\n website: string;\n from: string;\n to: string;\n data?: string;\n type?: string;\n};\n\nexport type DisplayData = {\n title: string;\n dAppInfo?: {\n name: string;\n action: string;\n logoUri?: string;\n };\n network: {\n chainId: number;\n name: string;\n logoUri?: string;\n };\n account?: string;\n messageDetails?: string;\n transactionDetails?: TransactionDetails | ExportImportTxDetails;\n stakingDetails?: StakingDetails;\n chainDetails?: ChainDetails;\n blockchainDetails?: BlockchainDetails;\n subnetDetails?: SubnetDetails;\n networkFeeSelector?: boolean;\n disclaimer?: string;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n};\n\nexport enum AlertType {\n WARNING = 'Warning',\n DANGER = 'Danger',\n INFO = 'Info',\n}\n\nexport type AlertDetails = {\n title: string;\n description: string;\n detailedDescription?: string;\n actionTitles?: {\n proceed: string;\n reject: string;\n };\n};\n\nexport type Alert = {\n type: AlertType;\n details: AlertDetails;\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n data: TransactionRequest;\n }\n | {\n type: RpcMethod.ETH_SIGN | RpcMethod.PERSONAL_SIGN;\n account: string;\n data: string;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA | RpcMethod.SIGN_TYPED_DATA_V1;\n account: string;\n data: TypedData<MessageTypes> | TypedDataV1;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA_V3 | RpcMethod.SIGN_TYPED_DATA_V4;\n account: string;\n data: TypedData<MessageTypes>;\n }\n | {\n type: RpcMethod.AVALANCHE_SIGN_MESSAGE;\n data: string;\n accountIndex?: number;\n }\n | {\n type: RpcMethod.AVALANCHE_SEND_TRANSACTION;\n unsignedTxJson: string;\n data: Avalanche.Tx;\n vm: 'EVM' | 'AVM' | 'PVM';\n };\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n};\n\nexport type ApprovalResponse =\n | {\n result: Hex;\n }\n | {\n error: RpcError;\n };\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex) => void;\n onTransactionReverted: (txHash: Hex) => void;\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHN4DUGTT_cjs = require('./chunk-HN4DUGTT.cjs');
|
|
4
|
+
var chunkIQNJXPS3_cjs = require('./chunk-IQNJXPS3.cjs');
|
|
4
5
|
var chunk2KGTZTXY_cjs = require('./chunk-2KGTZTXY.cjs');
|
|
5
6
|
var chunkB6DAZDIA_cjs = require('./chunk-B6DAZDIA.cjs');
|
|
6
7
|
require('./chunk-47KTBBRA.cjs');
|
|
@@ -16,11 +17,15 @@ require('./chunk-AILYKQEY.cjs');
|
|
|
16
17
|
|
|
17
18
|
Object.defineProperty(exports, 'AlertType', {
|
|
18
19
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkHN4DUGTT_cjs.b; }
|
|
20
21
|
});
|
|
21
22
|
Object.defineProperty(exports, 'RpcMethod', {
|
|
22
23
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkHN4DUGTT_cjs.a; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, 'TxType', {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunkIQNJXPS3_cjs.a; }
|
|
24
29
|
});
|
|
25
30
|
Object.defineProperty(exports, 'TokenType', {
|
|
26
31
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -4,12 +4,14 @@ export { GetBalancesParams, GetBalancesResponse, NetworkTokenWithBalance, NftTok
|
|
|
4
4
|
export { Manifest, parseManifest } from './manifest.cjs';
|
|
5
5
|
export { Module } from './module.cjs';
|
|
6
6
|
export { NetworkFees } from './network-fee.cjs';
|
|
7
|
-
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TypedData, TypedDataV1 } from './rpc.cjs';
|
|
7
|
+
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TransactionDetails, TypedData, TypedDataV1 } from './rpc.cjs';
|
|
8
8
|
export { ERC1155Token, ERC20Token, ERC721Token, NONERCToken, NetworkContractToken, NetworkToken, TokenType } from './token.cjs';
|
|
9
9
|
export { GetTransactionHistory, PChainTransactionType, Transaction, TransactionHistoryResponse, TransactionType, TxToken, XChainTransactionType } from './transaction-history.cjs';
|
|
10
10
|
export { BalanceChange, TokenApproval, TokenApprovals, TokenDiff, TokenDiffItem } from './transaction-simulation.cjs';
|
|
11
11
|
export { BtcWalletPolicyDetails, GetAddressParams, GetAddressResponse, PubKeyType, WalletType } from './account.cjs';
|
|
12
|
+
export { AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, BaseTx, BlockchainDetails, ChainDetails, CreateChainTx, CreateSubnetTx, ExportImportTxDetails, ExportTx, ImportTx, RemoveSubnetValidatorTx, StakingDetails, SubnetDetails, TxDetails, TxType, VM } from './staking.cjs';
|
|
12
13
|
import 'zod';
|
|
13
14
|
import '@avalabs/glacier-sdk';
|
|
14
15
|
import 'ethers';
|
|
15
16
|
import '@metamask/rpc-errors';
|
|
17
|
+
import '@avalabs/core-wallets-sdk';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ export { GetBalancesParams, GetBalancesResponse, NetworkTokenWithBalance, NftTok
|
|
|
4
4
|
export { Manifest, parseManifest } from './manifest.js';
|
|
5
5
|
export { Module } from './module.js';
|
|
6
6
|
export { NetworkFees } from './network-fee.js';
|
|
7
|
-
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TypedData, TypedDataV1 } from './rpc.js';
|
|
7
|
+
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TransactionDetails, TypedData, TypedDataV1 } from './rpc.js';
|
|
8
8
|
export { ERC1155Token, ERC20Token, ERC721Token, NONERCToken, NetworkContractToken, NetworkToken, TokenType } from './token.js';
|
|
9
9
|
export { GetTransactionHistory, PChainTransactionType, Transaction, TransactionHistoryResponse, TransactionType, TxToken, XChainTransactionType } from './transaction-history.js';
|
|
10
10
|
export { BalanceChange, TokenApproval, TokenApprovals, TokenDiff, TokenDiffItem } from './transaction-simulation.js';
|
|
11
11
|
export { BtcWalletPolicyDetails, GetAddressParams, GetAddressResponse, PubKeyType, WalletType } from './account.js';
|
|
12
|
+
export { AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, BaseTx, BlockchainDetails, ChainDetails, CreateChainTx, CreateSubnetTx, ExportImportTxDetails, ExportTx, ImportTx, RemoveSubnetValidatorTx, StakingDetails, SubnetDetails, TxDetails, TxType, VM } from './staking.js';
|
|
12
13
|
import 'zod';
|
|
13
14
|
import '@avalabs/glacier-sdk';
|
|
14
15
|
import 'ethers';
|
|
15
16
|
import '@metamask/rpc-errors';
|
|
17
|
+
import '@avalabs/core-wallets-sdk';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { b as AlertType, a as RpcMethod } from './chunk-
|
|
1
|
+
export { b as AlertType, a as RpcMethod } from './chunk-OER2CERE.js';
|
|
2
|
+
export { a as TxType } from './chunk-2SJQLDBB.js';
|
|
2
3
|
export { a as TokenType } from './chunk-7Y6UGMPZ.js';
|
|
3
4
|
export { b as PChainTransactionType, a as TransactionType, c as XChainTransactionType } from './chunk-7JLXTNPE.js';
|
|
4
5
|
import './chunk-P6AM7I3B.js';
|
package/dist/module.d.cts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/rpc.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHN4DUGTT_cjs = require('./chunk-HN4DUGTT.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, 'AlertType', {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkHN4DUGTT_cjs.b; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, 'RpcMethod', {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkHN4DUGTT_cjs.a; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=out.js.map
|
|
16
16
|
//# sourceMappingURL=rpc.cjs.map
|
package/dist/rpc.d.cts
CHANGED
|
@@ -2,6 +2,8 @@ import { TransactionRequest } from 'ethers';
|
|
|
2
2
|
import { Caip2ChainId, Hex } from './common.cjs';
|
|
3
3
|
import { JsonRpcError, OptionalDataWithOptionalCause, EthereumProviderError } from '@metamask/rpc-errors';
|
|
4
4
|
import { BalanceChange, TokenApprovals } from './transaction-simulation.cjs';
|
|
5
|
+
import { Avalanche } from '@avalabs/core-wallets-sdk';
|
|
6
|
+
import { ExportImportTxDetails, StakingDetails, ChainDetails, BlockchainDetails, SubnetDetails } from './staking.cjs';
|
|
5
7
|
import './token.cjs';
|
|
6
8
|
|
|
7
9
|
declare enum RpcMethod {
|
|
@@ -12,7 +14,8 @@ declare enum RpcMethod {
|
|
|
12
14
|
SIGN_TYPED_DATA = "eth_signTypedData",
|
|
13
15
|
PERSONAL_SIGN = "personal_sign",
|
|
14
16
|
ETH_SIGN = "eth_sign",
|
|
15
|
-
AVALANCHE_SIGN_MESSAGE = "avalanche_signMessage"
|
|
17
|
+
AVALANCHE_SIGN_MESSAGE = "avalanche_signMessage",
|
|
18
|
+
AVALANCHE_SEND_TRANSACTION = "avalanche_sendTransaction"
|
|
16
19
|
}
|
|
17
20
|
type DappInfo = {
|
|
18
21
|
name: string;
|
|
@@ -53,6 +56,13 @@ type TypedDataV1 = {
|
|
|
53
56
|
type: string;
|
|
54
57
|
value: unknown;
|
|
55
58
|
}[];
|
|
59
|
+
type TransactionDetails = {
|
|
60
|
+
website: string;
|
|
61
|
+
from: string;
|
|
62
|
+
to: string;
|
|
63
|
+
data?: string;
|
|
64
|
+
type?: string;
|
|
65
|
+
};
|
|
56
66
|
type DisplayData = {
|
|
57
67
|
title: string;
|
|
58
68
|
dAppInfo?: {
|
|
@@ -67,13 +77,11 @@ type DisplayData = {
|
|
|
67
77
|
};
|
|
68
78
|
account?: string;
|
|
69
79
|
messageDetails?: string;
|
|
70
|
-
transactionDetails?:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
type?: string;
|
|
76
|
-
};
|
|
80
|
+
transactionDetails?: TransactionDetails | ExportImportTxDetails;
|
|
81
|
+
stakingDetails?: StakingDetails;
|
|
82
|
+
chainDetails?: ChainDetails;
|
|
83
|
+
blockchainDetails?: BlockchainDetails;
|
|
84
|
+
subnetDetails?: SubnetDetails;
|
|
77
85
|
networkFeeSelector?: boolean;
|
|
78
86
|
disclaimer?: string;
|
|
79
87
|
alert?: Alert;
|
|
@@ -118,6 +126,11 @@ type SigningData = {
|
|
|
118
126
|
type: RpcMethod.AVALANCHE_SIGN_MESSAGE;
|
|
119
127
|
data: string;
|
|
120
128
|
accountIndex?: number;
|
|
129
|
+
} | {
|
|
130
|
+
type: RpcMethod.AVALANCHE_SEND_TRANSACTION;
|
|
131
|
+
unsignedTxJson: string;
|
|
132
|
+
data: Avalanche.Tx;
|
|
133
|
+
vm: 'EVM' | 'AVM' | 'PVM';
|
|
121
134
|
};
|
|
122
135
|
type ApprovalParams = {
|
|
123
136
|
request: RpcRequest;
|
|
@@ -135,4 +148,4 @@ interface ApprovalController {
|
|
|
135
148
|
onTransactionReverted: (txHash: Hex) => void;
|
|
136
149
|
}
|
|
137
150
|
|
|
138
|
-
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TypedData, TypedDataV1 };
|
|
151
|
+
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TransactionDetails, TypedData, TypedDataV1 };
|
package/dist/rpc.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { TransactionRequest } from 'ethers';
|
|
|
2
2
|
import { Caip2ChainId, Hex } from './common.js';
|
|
3
3
|
import { JsonRpcError, OptionalDataWithOptionalCause, EthereumProviderError } from '@metamask/rpc-errors';
|
|
4
4
|
import { BalanceChange, TokenApprovals } from './transaction-simulation.js';
|
|
5
|
+
import { Avalanche } from '@avalabs/core-wallets-sdk';
|
|
6
|
+
import { ExportImportTxDetails, StakingDetails, ChainDetails, BlockchainDetails, SubnetDetails } from './staking.js';
|
|
5
7
|
import './token.js';
|
|
6
8
|
|
|
7
9
|
declare enum RpcMethod {
|
|
@@ -12,7 +14,8 @@ declare enum RpcMethod {
|
|
|
12
14
|
SIGN_TYPED_DATA = "eth_signTypedData",
|
|
13
15
|
PERSONAL_SIGN = "personal_sign",
|
|
14
16
|
ETH_SIGN = "eth_sign",
|
|
15
|
-
AVALANCHE_SIGN_MESSAGE = "avalanche_signMessage"
|
|
17
|
+
AVALANCHE_SIGN_MESSAGE = "avalanche_signMessage",
|
|
18
|
+
AVALANCHE_SEND_TRANSACTION = "avalanche_sendTransaction"
|
|
16
19
|
}
|
|
17
20
|
type DappInfo = {
|
|
18
21
|
name: string;
|
|
@@ -53,6 +56,13 @@ type TypedDataV1 = {
|
|
|
53
56
|
type: string;
|
|
54
57
|
value: unknown;
|
|
55
58
|
}[];
|
|
59
|
+
type TransactionDetails = {
|
|
60
|
+
website: string;
|
|
61
|
+
from: string;
|
|
62
|
+
to: string;
|
|
63
|
+
data?: string;
|
|
64
|
+
type?: string;
|
|
65
|
+
};
|
|
56
66
|
type DisplayData = {
|
|
57
67
|
title: string;
|
|
58
68
|
dAppInfo?: {
|
|
@@ -67,13 +77,11 @@ type DisplayData = {
|
|
|
67
77
|
};
|
|
68
78
|
account?: string;
|
|
69
79
|
messageDetails?: string;
|
|
70
|
-
transactionDetails?:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
type?: string;
|
|
76
|
-
};
|
|
80
|
+
transactionDetails?: TransactionDetails | ExportImportTxDetails;
|
|
81
|
+
stakingDetails?: StakingDetails;
|
|
82
|
+
chainDetails?: ChainDetails;
|
|
83
|
+
blockchainDetails?: BlockchainDetails;
|
|
84
|
+
subnetDetails?: SubnetDetails;
|
|
77
85
|
networkFeeSelector?: boolean;
|
|
78
86
|
disclaimer?: string;
|
|
79
87
|
alert?: Alert;
|
|
@@ -118,6 +126,11 @@ type SigningData = {
|
|
|
118
126
|
type: RpcMethod.AVALANCHE_SIGN_MESSAGE;
|
|
119
127
|
data: string;
|
|
120
128
|
accountIndex?: number;
|
|
129
|
+
} | {
|
|
130
|
+
type: RpcMethod.AVALANCHE_SEND_TRANSACTION;
|
|
131
|
+
unsignedTxJson: string;
|
|
132
|
+
data: Avalanche.Tx;
|
|
133
|
+
vm: 'EVM' | 'AVM' | 'PVM';
|
|
121
134
|
};
|
|
122
135
|
type ApprovalParams = {
|
|
123
136
|
request: RpcRequest;
|
|
@@ -135,4 +148,4 @@ interface ApprovalController {
|
|
|
135
148
|
onTransactionReverted: (txHash: Hex) => void;
|
|
136
149
|
}
|
|
137
150
|
|
|
138
|
-
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TypedData, TypedDataV1 };
|
|
151
|
+
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TransactionDetails, TypedData, TypedDataV1 };
|
package/dist/rpc.js
CHANGED
package/dist/staking.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkIQNJXPS3_cjs = require('./chunk-IQNJXPS3.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'TxType', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkIQNJXPS3_cjs.a; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=staking.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { NetworkVMType } from './common.cjs';
|
|
2
|
+
import './token.cjs';
|
|
3
|
+
|
|
4
|
+
type TxDetails = StakingDetails | ExportImportTxDetails | ChainDetails | BlockchainDetails | SubnetDetails;
|
|
5
|
+
type StakingDetails = AddPermissionlessDelegatorTx | AddPermissionlessValidatorTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx;
|
|
6
|
+
type ExportImportTxDetails = ExportTx | ImportTx;
|
|
7
|
+
type ChainDetails = BaseTx;
|
|
8
|
+
type BlockchainDetails = CreateChainTx;
|
|
9
|
+
type SubnetDetails = CreateSubnetTx;
|
|
10
|
+
type VM = NetworkVMType.AVM | NetworkVMType.EVM | NetworkVMType.PVM;
|
|
11
|
+
type AddPermissionlessDelegatorTx = {
|
|
12
|
+
type: TxType.AddPermissionlessDelegator;
|
|
13
|
+
nodeID: string;
|
|
14
|
+
subnetID: string;
|
|
15
|
+
stake: bigint;
|
|
16
|
+
start: string;
|
|
17
|
+
end: string;
|
|
18
|
+
txFee: bigint;
|
|
19
|
+
};
|
|
20
|
+
type AddPermissionlessValidatorTx = {
|
|
21
|
+
type: TxType.AddPermissionlessValidator;
|
|
22
|
+
nodeID: string;
|
|
23
|
+
subnetID: string;
|
|
24
|
+
stake: bigint;
|
|
25
|
+
delegationFee: number;
|
|
26
|
+
start: string;
|
|
27
|
+
end: string;
|
|
28
|
+
txFee: bigint;
|
|
29
|
+
publicKey?: string;
|
|
30
|
+
signature?: string;
|
|
31
|
+
};
|
|
32
|
+
interface ExportTx {
|
|
33
|
+
type: TxType.Export;
|
|
34
|
+
destination: VM;
|
|
35
|
+
amount: bigint;
|
|
36
|
+
chain: VM;
|
|
37
|
+
txFee: bigint;
|
|
38
|
+
}
|
|
39
|
+
interface ImportTx {
|
|
40
|
+
type: TxType.Import;
|
|
41
|
+
source: VM;
|
|
42
|
+
amount: bigint;
|
|
43
|
+
chain: VM;
|
|
44
|
+
txFee: bigint;
|
|
45
|
+
}
|
|
46
|
+
interface BaseTx {
|
|
47
|
+
type: TxType.Base;
|
|
48
|
+
chain: VM;
|
|
49
|
+
outputs: {
|
|
50
|
+
assetId: string;
|
|
51
|
+
locktime: bigint;
|
|
52
|
+
threshold: bigint;
|
|
53
|
+
amount: bigint;
|
|
54
|
+
assetDescription?: {
|
|
55
|
+
assetID: string;
|
|
56
|
+
name: string;
|
|
57
|
+
symbol: string;
|
|
58
|
+
denomination: number;
|
|
59
|
+
};
|
|
60
|
+
owners: string[];
|
|
61
|
+
isAvax: boolean;
|
|
62
|
+
}[];
|
|
63
|
+
memo?: string;
|
|
64
|
+
txFee: bigint;
|
|
65
|
+
}
|
|
66
|
+
type AddSubnetValidatorTx = {
|
|
67
|
+
type: TxType.AddSubnetValidator;
|
|
68
|
+
nodeID: string;
|
|
69
|
+
subnetID: string;
|
|
70
|
+
stake: bigint;
|
|
71
|
+
start: string;
|
|
72
|
+
end: string;
|
|
73
|
+
txFee: bigint;
|
|
74
|
+
};
|
|
75
|
+
type CreateChainTx = {
|
|
76
|
+
type: TxType.CreateChain;
|
|
77
|
+
chainName: string;
|
|
78
|
+
chainID: string;
|
|
79
|
+
vmID: string;
|
|
80
|
+
genesisData: string;
|
|
81
|
+
txFee: bigint;
|
|
82
|
+
};
|
|
83
|
+
type CreateSubnetTx = {
|
|
84
|
+
type: TxType.CreateSubnet;
|
|
85
|
+
threshold: number;
|
|
86
|
+
controlKeys: string[];
|
|
87
|
+
txFee: bigint;
|
|
88
|
+
};
|
|
89
|
+
type RemoveSubnetValidatorTx = {
|
|
90
|
+
type: TxType.RemoveSubnetValidator;
|
|
91
|
+
nodeID: string;
|
|
92
|
+
subnetID: string;
|
|
93
|
+
txFee: bigint;
|
|
94
|
+
};
|
|
95
|
+
declare enum TxType {
|
|
96
|
+
Base = "base",
|
|
97
|
+
AddValidator = "add_validator",
|
|
98
|
+
AddDelegator = "add_delegator",
|
|
99
|
+
Export = "export",
|
|
100
|
+
Import = "import",
|
|
101
|
+
CreateSubnet = "create_subnet",
|
|
102
|
+
CreateChain = "create_chain",
|
|
103
|
+
AddSubnetValidator = "add_subnet_validator",
|
|
104
|
+
RemoveSubnetValidator = "remove_subnet_validator",
|
|
105
|
+
AddPermissionlessValidator = "add_permissionless_validator",
|
|
106
|
+
AddPermissionlessDelegator = "add_permissionless_delegator",
|
|
107
|
+
TransformSubnet = "transform_subnet",
|
|
108
|
+
TransferSubnetOwnership = "transfer_subnet_ownership",
|
|
109
|
+
Unknown = "unknown"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, BaseTx, BlockchainDetails, ChainDetails, CreateChainTx, CreateSubnetTx, ExportImportTxDetails, ExportTx, ImportTx, RemoveSubnetValidatorTx, StakingDetails, SubnetDetails, TxDetails, TxType, VM };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { NetworkVMType } from './common.js';
|
|
2
|
+
import './token.js';
|
|
3
|
+
|
|
4
|
+
type TxDetails = StakingDetails | ExportImportTxDetails | ChainDetails | BlockchainDetails | SubnetDetails;
|
|
5
|
+
type StakingDetails = AddPermissionlessDelegatorTx | AddPermissionlessValidatorTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx;
|
|
6
|
+
type ExportImportTxDetails = ExportTx | ImportTx;
|
|
7
|
+
type ChainDetails = BaseTx;
|
|
8
|
+
type BlockchainDetails = CreateChainTx;
|
|
9
|
+
type SubnetDetails = CreateSubnetTx;
|
|
10
|
+
type VM = NetworkVMType.AVM | NetworkVMType.EVM | NetworkVMType.PVM;
|
|
11
|
+
type AddPermissionlessDelegatorTx = {
|
|
12
|
+
type: TxType.AddPermissionlessDelegator;
|
|
13
|
+
nodeID: string;
|
|
14
|
+
subnetID: string;
|
|
15
|
+
stake: bigint;
|
|
16
|
+
start: string;
|
|
17
|
+
end: string;
|
|
18
|
+
txFee: bigint;
|
|
19
|
+
};
|
|
20
|
+
type AddPermissionlessValidatorTx = {
|
|
21
|
+
type: TxType.AddPermissionlessValidator;
|
|
22
|
+
nodeID: string;
|
|
23
|
+
subnetID: string;
|
|
24
|
+
stake: bigint;
|
|
25
|
+
delegationFee: number;
|
|
26
|
+
start: string;
|
|
27
|
+
end: string;
|
|
28
|
+
txFee: bigint;
|
|
29
|
+
publicKey?: string;
|
|
30
|
+
signature?: string;
|
|
31
|
+
};
|
|
32
|
+
interface ExportTx {
|
|
33
|
+
type: TxType.Export;
|
|
34
|
+
destination: VM;
|
|
35
|
+
amount: bigint;
|
|
36
|
+
chain: VM;
|
|
37
|
+
txFee: bigint;
|
|
38
|
+
}
|
|
39
|
+
interface ImportTx {
|
|
40
|
+
type: TxType.Import;
|
|
41
|
+
source: VM;
|
|
42
|
+
amount: bigint;
|
|
43
|
+
chain: VM;
|
|
44
|
+
txFee: bigint;
|
|
45
|
+
}
|
|
46
|
+
interface BaseTx {
|
|
47
|
+
type: TxType.Base;
|
|
48
|
+
chain: VM;
|
|
49
|
+
outputs: {
|
|
50
|
+
assetId: string;
|
|
51
|
+
locktime: bigint;
|
|
52
|
+
threshold: bigint;
|
|
53
|
+
amount: bigint;
|
|
54
|
+
assetDescription?: {
|
|
55
|
+
assetID: string;
|
|
56
|
+
name: string;
|
|
57
|
+
symbol: string;
|
|
58
|
+
denomination: number;
|
|
59
|
+
};
|
|
60
|
+
owners: string[];
|
|
61
|
+
isAvax: boolean;
|
|
62
|
+
}[];
|
|
63
|
+
memo?: string;
|
|
64
|
+
txFee: bigint;
|
|
65
|
+
}
|
|
66
|
+
type AddSubnetValidatorTx = {
|
|
67
|
+
type: TxType.AddSubnetValidator;
|
|
68
|
+
nodeID: string;
|
|
69
|
+
subnetID: string;
|
|
70
|
+
stake: bigint;
|
|
71
|
+
start: string;
|
|
72
|
+
end: string;
|
|
73
|
+
txFee: bigint;
|
|
74
|
+
};
|
|
75
|
+
type CreateChainTx = {
|
|
76
|
+
type: TxType.CreateChain;
|
|
77
|
+
chainName: string;
|
|
78
|
+
chainID: string;
|
|
79
|
+
vmID: string;
|
|
80
|
+
genesisData: string;
|
|
81
|
+
txFee: bigint;
|
|
82
|
+
};
|
|
83
|
+
type CreateSubnetTx = {
|
|
84
|
+
type: TxType.CreateSubnet;
|
|
85
|
+
threshold: number;
|
|
86
|
+
controlKeys: string[];
|
|
87
|
+
txFee: bigint;
|
|
88
|
+
};
|
|
89
|
+
type RemoveSubnetValidatorTx = {
|
|
90
|
+
type: TxType.RemoveSubnetValidator;
|
|
91
|
+
nodeID: string;
|
|
92
|
+
subnetID: string;
|
|
93
|
+
txFee: bigint;
|
|
94
|
+
};
|
|
95
|
+
declare enum TxType {
|
|
96
|
+
Base = "base",
|
|
97
|
+
AddValidator = "add_validator",
|
|
98
|
+
AddDelegator = "add_delegator",
|
|
99
|
+
Export = "export",
|
|
100
|
+
Import = "import",
|
|
101
|
+
CreateSubnet = "create_subnet",
|
|
102
|
+
CreateChain = "create_chain",
|
|
103
|
+
AddSubnetValidator = "add_subnet_validator",
|
|
104
|
+
RemoveSubnetValidator = "remove_subnet_validator",
|
|
105
|
+
AddPermissionlessValidator = "add_permissionless_validator",
|
|
106
|
+
AddPermissionlessDelegator = "add_permissionless_delegator",
|
|
107
|
+
TransformSubnet = "transform_subnet",
|
|
108
|
+
TransferSubnetOwnership = "transfer_subnet_ownership",
|
|
109
|
+
Unknown = "unknown"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, BaseTx, BlockchainDetails, ChainDetails, CreateChainTx, CreateSubnetTx, ExportImportTxDetails, ExportTx, ImportTx, RemoveSubnetValidatorTx, StakingDetails, SubnetDetails, TxDetails, TxType, VM };
|
package/dist/staking.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avalabs/vm-module-types",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"zod": "3.23.8",
|
|
15
15
|
"@metamask/rpc-errors": "6.3.0",
|
|
16
|
-
"ethers": "6.8.1"
|
|
16
|
+
"ethers": "6.8.1",
|
|
17
|
+
"@avalabs/core-wallets-sdk": "3.0.1-alpha.1"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
20
|
"tsup": "7.2.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","AlertType"],"mappings":"AAKO,IAAKA,OAEVA,EAAA,qBAAuB,sBACvBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAGXA,EAAA,uBAAyB,wBAXfA,OAAA,IAyFAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\n\nexport enum RpcMethod {\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3',\n SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4',\n SIGN_TYPED_DATA_V1 = 'eth_signTypedData_v1',\n SIGN_TYPED_DATA = 'eth_signTypedData',\n PERSONAL_SIGN = 'personal_sign',\n ETH_SIGN = 'eth_sign',\n\n /* AVALANCHE */\n AVALANCHE_SIGN_MESSAGE = 'avalanche_signMessage',\n}\n\nexport type DappInfo = {\n name: string;\n url: string;\n icon: string;\n};\n\nexport type RpcRequest = {\n requestId: string;\n sessionId: string;\n method: RpcMethod;\n chainId: Caip2ChainId;\n params: unknown;\n dappInfo: DappInfo;\n context?: Record<string, unknown>; // for storing additional context information that's only relevant to the consumer\n};\n\nexport type RpcError =\n | JsonRpcError<OptionalDataWithOptionalCause>\n | EthereumProviderError<OptionalDataWithOptionalCause>;\n\nexport type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> =\n | {\n result: R;\n }\n | {\n error: E;\n };\n\nexport interface MessageTypeProperty {\n name: string;\n type: string;\n}\n\nexport interface MessageTypes {\n EIP712Domain: MessageTypeProperty[];\n [additionalProperties: string]: MessageTypeProperty[];\n}\n\nexport interface TypedData<T extends MessageTypes> {\n types: T;\n primaryType: keyof T;\n domain: Record<string, unknown>;\n message: Record<string, unknown>;\n}\n\nexport type TypedDataV1 = { name: string; type: string; value: unknown }[];\n\nexport type DisplayData = {\n title: string;\n dAppInfo?: {\n name: string;\n action: string;\n logoUri?: string;\n };\n network: {\n chainId: number;\n name: string;\n logoUri?: string;\n };\n account?: string;\n messageDetails?: string;\n transactionDetails?: {\n website: string;\n from: string;\n to: string;\n data?: string;\n type?: string;\n };\n networkFeeSelector?: boolean;\n disclaimer?: string;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n};\n\nexport enum AlertType {\n WARNING = 'Warning',\n DANGER = 'Danger',\n INFO = 'Info',\n}\n\nexport type AlertDetails = {\n title: string;\n description: string;\n detailedDescription?: string;\n actionTitles?: {\n proceed: string;\n reject: string;\n };\n};\n\nexport type Alert = {\n type: AlertType;\n details: AlertDetails;\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n data: TransactionRequest;\n }\n | {\n type: RpcMethod.ETH_SIGN | RpcMethod.PERSONAL_SIGN;\n account: string;\n data: string;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA | RpcMethod.SIGN_TYPED_DATA_V1;\n account: string;\n data: TypedData<MessageTypes> | TypedDataV1;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA_V3 | RpcMethod.SIGN_TYPED_DATA_V4;\n account: string;\n data: TypedData<MessageTypes>;\n }\n | {\n type: RpcMethod.AVALANCHE_SIGN_MESSAGE;\n data: string;\n accountIndex?: number;\n };\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n};\n\nexport type ApprovalResponse =\n | {\n result: Hex;\n }\n | {\n error: RpcError;\n };\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex) => void;\n onTransactionReverted: (txHash: Hex) => void;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","AlertType"],"mappings":"AAKO,IAAKA,OAEVA,EAAA,qBAAuB,sBACvBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAGXA,EAAA,uBAAyB,wBAXfA,OAAA,IAyFAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\n\nexport enum RpcMethod {\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3',\n SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4',\n SIGN_TYPED_DATA_V1 = 'eth_signTypedData_v1',\n SIGN_TYPED_DATA = 'eth_signTypedData',\n PERSONAL_SIGN = 'personal_sign',\n ETH_SIGN = 'eth_sign',\n\n /* AVALANCHE */\n AVALANCHE_SIGN_MESSAGE = 'avalanche_signMessage',\n}\n\nexport type DappInfo = {\n name: string;\n url: string;\n icon: string;\n};\n\nexport type RpcRequest = {\n requestId: string;\n sessionId: string;\n method: RpcMethod;\n chainId: Caip2ChainId;\n params: unknown;\n dappInfo: DappInfo;\n context?: Record<string, unknown>; // for storing additional context information that's only relevant to the consumer\n};\n\nexport type RpcError =\n | JsonRpcError<OptionalDataWithOptionalCause>\n | EthereumProviderError<OptionalDataWithOptionalCause>;\n\nexport type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> =\n | {\n result: R;\n }\n | {\n error: E;\n };\n\nexport interface MessageTypeProperty {\n name: string;\n type: string;\n}\n\nexport interface MessageTypes {\n EIP712Domain: MessageTypeProperty[];\n [additionalProperties: string]: MessageTypeProperty[];\n}\n\nexport interface TypedData<T extends MessageTypes> {\n types: T;\n primaryType: keyof T;\n domain: Record<string, unknown>;\n message: Record<string, unknown>;\n}\n\nexport type TypedDataV1 = { name: string; type: string; value: unknown }[];\n\nexport type DisplayData = {\n title: string;\n dAppInfo?: {\n name: string;\n action: string;\n logoUri?: string;\n };\n network: {\n chainId: number;\n name: string;\n logoUri?: string;\n };\n account?: string;\n messageDetails?: string;\n transactionDetails?: {\n website: string;\n from: string;\n to: string;\n data?: string;\n type?: string;\n };\n networkFeeSelector?: boolean;\n disclaimer?: string;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n};\n\nexport enum AlertType {\n WARNING = 'Warning',\n DANGER = 'Danger',\n INFO = 'Info',\n}\n\nexport type AlertDetails = {\n title: string;\n description: string;\n detailedDescription?: string;\n actionTitles?: {\n proceed: string;\n reject: string;\n };\n};\n\nexport type Alert = {\n type: AlertType;\n details: AlertDetails;\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n data: TransactionRequest;\n }\n | {\n type: RpcMethod.ETH_SIGN | RpcMethod.PERSONAL_SIGN;\n account: string;\n data: string;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA | RpcMethod.SIGN_TYPED_DATA_V1;\n account: string;\n data: TypedData<MessageTypes> | TypedDataV1;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA_V3 | RpcMethod.SIGN_TYPED_DATA_V4;\n account: string;\n data: TypedData<MessageTypes>;\n }\n | {\n type: RpcMethod.AVALANCHE_SIGN_MESSAGE;\n data: string;\n accountIndex?: number;\n };\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n};\n\nexport type ApprovalResponse =\n | {\n result: Hex;\n }\n | {\n error: RpcError;\n };\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex) => void;\n onTransactionReverted: (txHash: Hex) => void;\n}\n"]}
|