@avalabs/vm-module-types 1.9.2 → 1.9.4

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,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var n=(t=>(t.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",t.BITCOIN_SIGN_TRANSACTION="bitcoin_signTransaction",t.ETH_SEND_TRANSACTION="eth_sendTransaction",t.ETH_SEND_TRANSACTION_BATCH="eth_sendTransactionBatch",t.SIGN_TYPED_DATA_V3="eth_signTypedData_v3",t.SIGN_TYPED_DATA_V4="eth_signTypedData_v4",t.SIGN_TYPED_DATA_V1="eth_signTypedData_v1",t.SIGN_TYPED_DATA="eth_signTypedData",t.PERSONAL_SIGN="personal_sign",t.ETH_SIGN="eth_sign",t.AVALANCHE_SIGN_MESSAGE="avalanche_signMessage",t.AVALANCHE_SEND_TRANSACTION="avalanche_sendTransaction",t.AVALANCHE_SIGN_TRANSACTION="avalanche_signTransaction",t.HVM_SIGN_TRANSACTION="hvm_signTransaction",t.SOLANA_SIGN_TRANSACTION="solana_signTransaction",t.SOLANA_SIGN_AND_SEND_TRANSACTION="solana_signAndSendTransaction",t.SOLANA_SIGN_MESSAGE="solana_signMessage",t))(n||{}),i=(e=>(e.TEXT="text",e.ADDRESS="address",e.ADDRESS_LIST="addressList",e.NODE_ID="nodeID",e.CURRENCY="currency",e.FUNDS_RECIPIENT="fundsRecipient",e.DATA="data",e.DATE="date",e.LINK="link",e))(i||{}),r=(a=>(a.WARNING="Warning",a.DANGER="Danger",a.INFO="Info",a))(r||{});
3
+ var n=(t=>(t.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",t.BITCOIN_SIGN_TRANSACTION="bitcoin_signTransaction",t.ETH_SEND_TRANSACTION="eth_sendTransaction",t.ETH_SEND_TRANSACTION_BATCH="eth_sendTransactionBatch",t.SIGN_TYPED_DATA_V3="eth_signTypedData_v3",t.SIGN_TYPED_DATA_V4="eth_signTypedData_v4",t.SIGN_TYPED_DATA_V1="eth_signTypedData_v1",t.SIGN_TYPED_DATA="eth_signTypedData",t.PERSONAL_SIGN="personal_sign",t.ETH_SIGN="eth_sign",t.AVALANCHE_SIGN_MESSAGE="avalanche_signMessage",t.AVALANCHE_SEND_TRANSACTION="avalanche_sendTransaction",t.AVALANCHE_SIGN_TRANSACTION="avalanche_signTransaction",t.HVM_SIGN_TRANSACTION="hvm_signTransaction",t.SOLANA_SIGN_TRANSACTION="solana_signTransaction",t.SOLANA_SIGN_AND_SEND_TRANSACTION="solana_signAndSendTransaction",t.SOLANA_SIGN_MESSAGE="solana_signMessage",t))(n||{}),i=(e=>(e.TEXT="text",e.ADDRESS="address",e.ADDRESS_LIST="addressList",e.NODE_ID="nodeID",e.CURRENCY="currency",e.FUNDS_RECIPIENT="fundsRecipient",e.DATA="data",e.DATE="date",e.LINK="link",e.NETWORK="network",e))(i||{}),r=(a=>(a.WARNING="Warning",a.DANGER="Danger",a.INFO="Info",a))(r||{});
4
4
 
5
5
  exports.a = n;
6
6
  exports.b = i;
7
7
  exports.c = r;
8
8
  //# sourceMappingURL=out.js.map
9
- //# sourceMappingURL=chunk-FD447P2T.cjs.map
9
+ //# sourceMappingURL=chunk-3S6ORBIB.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","DetailItemType","AlertType"],"mappings":"AAQO,IAAKA,OAEVA,EAAA,yBAA2B,0BAC3BA,EAAA,yBAA2B,0BAG3BA,EAAA,qBAAuB,sBACvBA,EAAA,2BAA6B,2BAC7BA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAGXA,EAAA,uBAAyB,wBACzBA,EAAA,2BAA6B,4BAC7BA,EAAA,2BAA6B,4BAG7BA,EAAA,qBAAuB,sBAGvBA,EAAA,wBAA0B,yBAC1BA,EAAA,iCAAmC,gCACnCA,EAAA,oBAAsB,qBA1BZA,OAAA,IAqFAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,aAAe,cACfA,EAAA,QAAU,SACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,iBAClBA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,QAAU,UAVAA,OAAA,IAgHAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Avalanche, BitcoinInputUTXO, BitcoinOutputUTXO } from '@avalabs/core-wallets-sdk';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\nimport type { TokenWithBalanceBTC } from './balance';\nimport type { TransactionPayload, VMABI } from 'hypersdk-client';\n\nexport enum RpcMethod {\n /* BTC */\n BITCOIN_SEND_TRANSACTION = 'bitcoin_sendTransaction',\n BITCOIN_SIGN_TRANSACTION = 'bitcoin_signTransaction',\n\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n ETH_SEND_TRANSACTION_BATCH = 'eth_sendTransactionBatch',\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 AVALANCHE_SIGN_TRANSACTION = 'avalanche_signTransaction',\n\n /* HVM */\n HVM_SIGN_TRANSACTION = 'hvm_signTransaction',\n\n /* SOLANA */\n SOLANA_SIGN_TRANSACTION = 'solana_signTransaction',\n SOLANA_SIGN_AND_SEND_TRANSACTION = 'solana_signAndSendTransaction',\n SOLANA_SIGN_MESSAGE = 'solana_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 DetailSection = {\n title?: string;\n items: DetailItem[];\n};\n\nexport type BaseDetailItem = {\n label: string;\n};\n\nexport enum DetailItemType {\n TEXT = 'text',\n ADDRESS = 'address',\n ADDRESS_LIST = 'addressList',\n NODE_ID = 'nodeID',\n CURRENCY = 'currency',\n FUNDS_RECIPIENT = 'fundsRecipient',\n DATA = 'data',\n DATE = 'date',\n LINK = 'link',\n NETWORK = 'network',\n}\n\n// It's very similar as CurrencyItem, but we want the client apps\n// to treat the label as an address (recognize it if possible,\n// truncate otherwise).\nexport type FundsRecipientItem = BaseDetailItem & {\n type: DetailItemType.FUNDS_RECIPIENT;\n amount: bigint;\n maxDecimals: number;\n symbol: string;\n};\n\nexport type TextItem = BaseDetailItem & {\n type: DetailItemType.TEXT;\n value: string;\n alignment: 'vertical' | 'horizontal';\n};\n\nexport type AddressItem = BaseDetailItem & {\n type: DetailItemType.ADDRESS;\n value: string;\n};\n\nexport type AddressListItem = BaseDetailItem & {\n type: DetailItemType.ADDRESS_LIST;\n value: string[];\n};\n\nexport type NodeIDItem = BaseDetailItem & {\n type: DetailItemType.NODE_ID;\n value: string;\n};\n\nexport type CurrencyItem = BaseDetailItem & {\n type: DetailItemType.CURRENCY;\n value: bigint;\n maxDecimals: number;\n symbol: string;\n};\n\nexport type DataItem = BaseDetailItem & {\n type: DetailItemType.DATA;\n value: string;\n};\n\nexport type DateItem = BaseDetailItem & {\n type: DetailItemType.DATE;\n value: string;\n};\n\nexport type LinkItemValue = { url: string; name?: string; icon?: string };\n\nexport type LinkItem = BaseDetailItem & {\n type: DetailItemType.LINK;\n value: LinkItemValue;\n};\n\nexport type NetworkItemValue = {\n logoUri: string | undefined;\n name: string;\n};\n\nexport type NetworkItem = BaseDetailItem & {\n type: DetailItemType.NETWORK;\n value: NetworkItemValue;\n};\n\nexport type DetailItem =\n | string\n | TextItem\n | AddressItem\n | AddressListItem\n | NodeIDItem\n | CurrencyItem\n | DataItem\n | DateItem\n | LinkItem\n | FundsRecipientItem\n | NetworkItem;\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 details: DetailSection[];\n networkFeeSelector?: boolean;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n isSimulationSuccessful?: boolean;\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 BitcoinExecuteTxData = {\n to: string;\n amount: number;\n feeRate: number;\n fee: number;\n gasLimit: number;\n balance: TokenWithBalanceBTC;\n inputs: BitcoinInputUTXO[];\n outputs: BitcoinOutputUTXO[];\n};\n\nexport type BitcoingSignTxData = {\n inputs: BitcoinInputUTXO[];\n outputs: BitcoinOutputUTXO[];\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.SOLANA_SIGN_AND_SEND_TRANSACTION;\n account: string;\n data: string; // Base-64 encoded \"Wire Transaction\"\n }\n | {\n type: RpcMethod.SOLANA_SIGN_TRANSACTION;\n account: string;\n data: string; // Base-64 encoded \"Wire Transaction\"\n }\n | {\n type: RpcMethod.SOLANA_SIGN_MESSAGE;\n account: string;\n data: string; // Base-64 encoded message\n }\n | {\n type: RpcMethod.BITCOIN_SEND_TRANSACTION;\n account: string;\n data: BitcoinExecuteTxData;\n }\n | {\n type: RpcMethod.BITCOIN_SIGN_TRANSACTION;\n account: string;\n data: BitcoingSignTxData;\n }\n | SigningData_EthSendTx\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 externalIndices?: number[];\n internalIndices?: number[];\n }\n | {\n type: RpcMethod.AVALANCHE_SIGN_TRANSACTION;\n unsignedTxJson: string;\n data: Avalanche.Tx;\n vm: 'EVM' | 'AVM' | 'PVM';\n ownSignatureIndices: [number, number][];\n }\n | {\n type: RpcMethod.HVM_SIGN_TRANSACTION;\n data: {\n abi: VMABI;\n txPayload: TransactionPayload;\n };\n };\n\nexport type SigningData_EthSendTx = {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n data: TransactionRequest;\n};\n\nexport type EvmTxBatchUpdateFn = (\n data: { maxFeeRate?: bigint; maxTipRate?: bigint },\n txIndex: number,\n) => {\n displayData: DisplayData;\n signingRequests: {\n displayData: DisplayData;\n signingData: SigningData_EthSendTx;\n }[];\n};\n\nexport type EvmTxUpdateFn = (data: {\n maxFeeRate?: bigint;\n maxTipRate?: bigint;\n approvalLimit?: Hex; // as hexadecimal, 0x-prefixed\n}) => { displayData: DisplayData; signingData: SigningData_EthSendTx };\n\nexport type BtcTxUpdateFn = (data: { feeRate?: number }) => {\n displayData: DisplayData;\n signingData: Extract<SigningData, { type: RpcMethod.BITCOIN_SEND_TRANSACTION }>;\n};\n\nexport type SigningRequest<Data = SigningData> = {\n displayData: DisplayData;\n signingData: Data;\n updateTx?: EvmTxUpdateFn | BtcTxUpdateFn;\n};\n\nexport type ApprovalParams = {\n request: RpcRequest;\n} & SigningRequest;\n\nexport type BatchApprovalParams = {\n request: RpcRequest;\n signingRequests: SigningRequest<SigningData_EthSendTx>[];\n displayData: DisplayData;\n updateTx: EvmTxBatchUpdateFn;\n};\n\nexport type RequestPublicKeyParams = {\n secretId: string;\n curve: 'secp256k1' | 'ed25519';\n derivationPath?: string;\n};\n\n/**\n * We want to accept both a signed data (tx/message) and a tx hash as a response\n * coming in from the client apps, hence the XORs here.\n *\n * The reason we need to support both is because extension allows importing\n * external software wallets, such as Fireblocks or other apps that support\n * the WalletConnect protocol.\n *\n * My experience is that WalletConnect apps rarely, if ever, support\n * \"eth_signTransaction\" requests and more often only allow sending\n * \"eth_sendTransaction\" calls, which means that all we'll get in response\n * from them is the transaction hash (not a signed tx).\n */\ntype SignedData = { signedData: string };\ntype BroadcastedTx = { txHash: string };\n\nexport type SigningResult = SignedData | BroadcastedTx;\n\nexport type ApprovalResponse =\n | {\n error: RpcError;\n }\n | SigningResult;\n\nexport type BatchApprovalResponse =\n | { error: RpcError }\n | {\n result: SignedData[];\n };\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n requestPublicKey: (params: RequestPublicKeyParams) => Promise<string>;\n onTransactionPending: ({ txHash, request }: { txHash: Hex; request: RpcRequest }) => void;\n onTransactionConfirmed: ({\n txHash,\n explorerLink,\n request,\n }: {\n txHash: Hex;\n explorerLink: string;\n request: RpcRequest;\n }) => void;\n onTransactionReverted: ({ txHash, request }: { txHash: Hex; request: RpcRequest }) => void;\n}\n\nexport interface BatchApprovalController extends ApprovalController {\n requestBatchApproval: (params: BatchApprovalParams) => Promise<BatchApprovalResponse>;\n}\n"]}
@@ -1,5 +1,5 @@
1
- var n=(t=>(t.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",t.BITCOIN_SIGN_TRANSACTION="bitcoin_signTransaction",t.ETH_SEND_TRANSACTION="eth_sendTransaction",t.ETH_SEND_TRANSACTION_BATCH="eth_sendTransactionBatch",t.SIGN_TYPED_DATA_V3="eth_signTypedData_v3",t.SIGN_TYPED_DATA_V4="eth_signTypedData_v4",t.SIGN_TYPED_DATA_V1="eth_signTypedData_v1",t.SIGN_TYPED_DATA="eth_signTypedData",t.PERSONAL_SIGN="personal_sign",t.ETH_SIGN="eth_sign",t.AVALANCHE_SIGN_MESSAGE="avalanche_signMessage",t.AVALANCHE_SEND_TRANSACTION="avalanche_sendTransaction",t.AVALANCHE_SIGN_TRANSACTION="avalanche_signTransaction",t.HVM_SIGN_TRANSACTION="hvm_signTransaction",t.SOLANA_SIGN_TRANSACTION="solana_signTransaction",t.SOLANA_SIGN_AND_SEND_TRANSACTION="solana_signAndSendTransaction",t.SOLANA_SIGN_MESSAGE="solana_signMessage",t))(n||{}),i=(e=>(e.TEXT="text",e.ADDRESS="address",e.ADDRESS_LIST="addressList",e.NODE_ID="nodeID",e.CURRENCY="currency",e.FUNDS_RECIPIENT="fundsRecipient",e.DATA="data",e.DATE="date",e.LINK="link",e))(i||{}),r=(a=>(a.WARNING="Warning",a.DANGER="Danger",a.INFO="Info",a))(r||{});
1
+ var n=(t=>(t.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",t.BITCOIN_SIGN_TRANSACTION="bitcoin_signTransaction",t.ETH_SEND_TRANSACTION="eth_sendTransaction",t.ETH_SEND_TRANSACTION_BATCH="eth_sendTransactionBatch",t.SIGN_TYPED_DATA_V3="eth_signTypedData_v3",t.SIGN_TYPED_DATA_V4="eth_signTypedData_v4",t.SIGN_TYPED_DATA_V1="eth_signTypedData_v1",t.SIGN_TYPED_DATA="eth_signTypedData",t.PERSONAL_SIGN="personal_sign",t.ETH_SIGN="eth_sign",t.AVALANCHE_SIGN_MESSAGE="avalanche_signMessage",t.AVALANCHE_SEND_TRANSACTION="avalanche_sendTransaction",t.AVALANCHE_SIGN_TRANSACTION="avalanche_signTransaction",t.HVM_SIGN_TRANSACTION="hvm_signTransaction",t.SOLANA_SIGN_TRANSACTION="solana_signTransaction",t.SOLANA_SIGN_AND_SEND_TRANSACTION="solana_signAndSendTransaction",t.SOLANA_SIGN_MESSAGE="solana_signMessage",t))(n||{}),i=(e=>(e.TEXT="text",e.ADDRESS="address",e.ADDRESS_LIST="addressList",e.NODE_ID="nodeID",e.CURRENCY="currency",e.FUNDS_RECIPIENT="fundsRecipient",e.DATA="data",e.DATE="date",e.LINK="link",e.NETWORK="network",e))(i||{}),r=(a=>(a.WARNING="Warning",a.DANGER="Danger",a.INFO="Info",a))(r||{});
2
2
 
3
3
  export { n as a, i as b, r as c };
4
4
  //# sourceMappingURL=out.js.map
5
- //# sourceMappingURL=chunk-6CAZBOUG.js.map
5
+ //# sourceMappingURL=chunk-RRUQCW3O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","DetailItemType","AlertType"],"mappings":"AAQO,IAAKA,OAEVA,EAAA,yBAA2B,0BAC3BA,EAAA,yBAA2B,0BAG3BA,EAAA,qBAAuB,sBACvBA,EAAA,2BAA6B,2BAC7BA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAGXA,EAAA,uBAAyB,wBACzBA,EAAA,2BAA6B,4BAC7BA,EAAA,2BAA6B,4BAG7BA,EAAA,qBAAuB,sBAGvBA,EAAA,wBAA0B,yBAC1BA,EAAA,iCAAmC,gCACnCA,EAAA,oBAAsB,qBA1BZA,OAAA,IAqFAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,aAAe,cACfA,EAAA,QAAU,SACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,iBAClBA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,QAAU,UAVAA,OAAA,IAgHAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Avalanche, BitcoinInputUTXO, BitcoinOutputUTXO } from '@avalabs/core-wallets-sdk';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\nimport type { TokenWithBalanceBTC } from './balance';\nimport type { TransactionPayload, VMABI } from 'hypersdk-client';\n\nexport enum RpcMethod {\n /* BTC */\n BITCOIN_SEND_TRANSACTION = 'bitcoin_sendTransaction',\n BITCOIN_SIGN_TRANSACTION = 'bitcoin_signTransaction',\n\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n ETH_SEND_TRANSACTION_BATCH = 'eth_sendTransactionBatch',\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 AVALANCHE_SIGN_TRANSACTION = 'avalanche_signTransaction',\n\n /* HVM */\n HVM_SIGN_TRANSACTION = 'hvm_signTransaction',\n\n /* SOLANA */\n SOLANA_SIGN_TRANSACTION = 'solana_signTransaction',\n SOLANA_SIGN_AND_SEND_TRANSACTION = 'solana_signAndSendTransaction',\n SOLANA_SIGN_MESSAGE = 'solana_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 DetailSection = {\n title?: string;\n items: DetailItem[];\n};\n\nexport type BaseDetailItem = {\n label: string;\n};\n\nexport enum DetailItemType {\n TEXT = 'text',\n ADDRESS = 'address',\n ADDRESS_LIST = 'addressList',\n NODE_ID = 'nodeID',\n CURRENCY = 'currency',\n FUNDS_RECIPIENT = 'fundsRecipient',\n DATA = 'data',\n DATE = 'date',\n LINK = 'link',\n NETWORK = 'network',\n}\n\n// It's very similar as CurrencyItem, but we want the client apps\n// to treat the label as an address (recognize it if possible,\n// truncate otherwise).\nexport type FundsRecipientItem = BaseDetailItem & {\n type: DetailItemType.FUNDS_RECIPIENT;\n amount: bigint;\n maxDecimals: number;\n symbol: string;\n};\n\nexport type TextItem = BaseDetailItem & {\n type: DetailItemType.TEXT;\n value: string;\n alignment: 'vertical' | 'horizontal';\n};\n\nexport type AddressItem = BaseDetailItem & {\n type: DetailItemType.ADDRESS;\n value: string;\n};\n\nexport type AddressListItem = BaseDetailItem & {\n type: DetailItemType.ADDRESS_LIST;\n value: string[];\n};\n\nexport type NodeIDItem = BaseDetailItem & {\n type: DetailItemType.NODE_ID;\n value: string;\n};\n\nexport type CurrencyItem = BaseDetailItem & {\n type: DetailItemType.CURRENCY;\n value: bigint;\n maxDecimals: number;\n symbol: string;\n};\n\nexport type DataItem = BaseDetailItem & {\n type: DetailItemType.DATA;\n value: string;\n};\n\nexport type DateItem = BaseDetailItem & {\n type: DetailItemType.DATE;\n value: string;\n};\n\nexport type LinkItemValue = { url: string; name?: string; icon?: string };\n\nexport type LinkItem = BaseDetailItem & {\n type: DetailItemType.LINK;\n value: LinkItemValue;\n};\n\nexport type NetworkItemValue = {\n logoUri: string | undefined;\n name: string;\n};\n\nexport type NetworkItem = BaseDetailItem & {\n type: DetailItemType.NETWORK;\n value: NetworkItemValue;\n};\n\nexport type DetailItem =\n | string\n | TextItem\n | AddressItem\n | AddressListItem\n | NodeIDItem\n | CurrencyItem\n | DataItem\n | DateItem\n | LinkItem\n | FundsRecipientItem\n | NetworkItem;\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 details: DetailSection[];\n networkFeeSelector?: boolean;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n isSimulationSuccessful?: boolean;\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 BitcoinExecuteTxData = {\n to: string;\n amount: number;\n feeRate: number;\n fee: number;\n gasLimit: number;\n balance: TokenWithBalanceBTC;\n inputs: BitcoinInputUTXO[];\n outputs: BitcoinOutputUTXO[];\n};\n\nexport type BitcoingSignTxData = {\n inputs: BitcoinInputUTXO[];\n outputs: BitcoinOutputUTXO[];\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.SOLANA_SIGN_AND_SEND_TRANSACTION;\n account: string;\n data: string; // Base-64 encoded \"Wire Transaction\"\n }\n | {\n type: RpcMethod.SOLANA_SIGN_TRANSACTION;\n account: string;\n data: string; // Base-64 encoded \"Wire Transaction\"\n }\n | {\n type: RpcMethod.SOLANA_SIGN_MESSAGE;\n account: string;\n data: string; // Base-64 encoded message\n }\n | {\n type: RpcMethod.BITCOIN_SEND_TRANSACTION;\n account: string;\n data: BitcoinExecuteTxData;\n }\n | {\n type: RpcMethod.BITCOIN_SIGN_TRANSACTION;\n account: string;\n data: BitcoingSignTxData;\n }\n | SigningData_EthSendTx\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 externalIndices?: number[];\n internalIndices?: number[];\n }\n | {\n type: RpcMethod.AVALANCHE_SIGN_TRANSACTION;\n unsignedTxJson: string;\n data: Avalanche.Tx;\n vm: 'EVM' | 'AVM' | 'PVM';\n ownSignatureIndices: [number, number][];\n }\n | {\n type: RpcMethod.HVM_SIGN_TRANSACTION;\n data: {\n abi: VMABI;\n txPayload: TransactionPayload;\n };\n };\n\nexport type SigningData_EthSendTx = {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n data: TransactionRequest;\n};\n\nexport type EvmTxBatchUpdateFn = (\n data: { maxFeeRate?: bigint; maxTipRate?: bigint },\n txIndex: number,\n) => {\n displayData: DisplayData;\n signingRequests: {\n displayData: DisplayData;\n signingData: SigningData_EthSendTx;\n }[];\n};\n\nexport type EvmTxUpdateFn = (data: {\n maxFeeRate?: bigint;\n maxTipRate?: bigint;\n approvalLimit?: Hex; // as hexadecimal, 0x-prefixed\n}) => { displayData: DisplayData; signingData: SigningData_EthSendTx };\n\nexport type BtcTxUpdateFn = (data: { feeRate?: number }) => {\n displayData: DisplayData;\n signingData: Extract<SigningData, { type: RpcMethod.BITCOIN_SEND_TRANSACTION }>;\n};\n\nexport type SigningRequest<Data = SigningData> = {\n displayData: DisplayData;\n signingData: Data;\n updateTx?: EvmTxUpdateFn | BtcTxUpdateFn;\n};\n\nexport type ApprovalParams = {\n request: RpcRequest;\n} & SigningRequest;\n\nexport type BatchApprovalParams = {\n request: RpcRequest;\n signingRequests: SigningRequest<SigningData_EthSendTx>[];\n displayData: DisplayData;\n updateTx: EvmTxBatchUpdateFn;\n};\n\nexport type RequestPublicKeyParams = {\n secretId: string;\n curve: 'secp256k1' | 'ed25519';\n derivationPath?: string;\n};\n\n/**\n * We want to accept both a signed data (tx/message) and a tx hash as a response\n * coming in from the client apps, hence the XORs here.\n *\n * The reason we need to support both is because extension allows importing\n * external software wallets, such as Fireblocks or other apps that support\n * the WalletConnect protocol.\n *\n * My experience is that WalletConnect apps rarely, if ever, support\n * \"eth_signTransaction\" requests and more often only allow sending\n * \"eth_sendTransaction\" calls, which means that all we'll get in response\n * from them is the transaction hash (not a signed tx).\n */\ntype SignedData = { signedData: string };\ntype BroadcastedTx = { txHash: string };\n\nexport type SigningResult = SignedData | BroadcastedTx;\n\nexport type ApprovalResponse =\n | {\n error: RpcError;\n }\n | SigningResult;\n\nexport type BatchApprovalResponse =\n | { error: RpcError }\n | {\n result: SignedData[];\n };\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n requestPublicKey: (params: RequestPublicKeyParams) => Promise<string>;\n onTransactionPending: ({ txHash, request }: { txHash: Hex; request: RpcRequest }) => void;\n onTransactionConfirmed: ({\n txHash,\n explorerLink,\n request,\n }: {\n txHash: Hex;\n explorerLink: string;\n request: RpcRequest;\n }) => void;\n onTransactionReverted: ({ txHash, request }: { txHash: Hex; request: RpcRequest }) => void;\n}\n\nexport interface BatchApprovalController extends ApprovalController {\n requestBatchApproval: (params: BatchApprovalParams) => Promise<BatchApprovalResponse>;\n}\n"]}
@@ -6,15 +6,15 @@ declare const SimplePriceResponseSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.
6
6
  marketCap: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
7
7
  vol24: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
8
  }, "strip", z.ZodTypeAny, {
9
- marketCap?: number | null | undefined;
9
+ price?: number | null | undefined;
10
10
  change24?: number | null | undefined;
11
+ marketCap?: number | null | undefined;
11
12
  vol24?: number | null | undefined;
12
- price?: number | null | undefined;
13
13
  }, {
14
- marketCap?: number | null | undefined;
14
+ price?: number | null | undefined;
15
15
  change24?: number | null | undefined;
16
+ marketCap?: number | null | undefined;
16
17
  vol24?: number | null | undefined;
17
- price?: number | null | undefined;
18
18
  }>>>;
19
19
  type SimplePriceResponse = z.infer<typeof SimplePriceResponseSchema>;
20
20
  declare const RawSimplePriceResponseSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodNumber>>>>;
@@ -6,15 +6,15 @@ declare const SimplePriceResponseSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.
6
6
  marketCap: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
7
7
  vol24: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
8
  }, "strip", z.ZodTypeAny, {
9
- marketCap?: number | null | undefined;
9
+ price?: number | null | undefined;
10
10
  change24?: number | null | undefined;
11
+ marketCap?: number | null | undefined;
11
12
  vol24?: number | null | undefined;
12
- price?: number | null | undefined;
13
13
  }, {
14
- marketCap?: number | null | undefined;
14
+ price?: number | null | undefined;
15
15
  change24?: number | null | undefined;
16
+ marketCap?: number | null | undefined;
16
17
  vol24?: number | null | undefined;
17
- price?: number | null | undefined;
18
18
  }>>>;
19
19
  type SimplePriceResponse = z.infer<typeof SimplePriceResponseSchema>;
20
20
  declare const RawSimplePriceResponseSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodNumber>>>>;
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require('./chunk-AILYKQEY.cjs');
4
4
  var chunk4NMX4VK7_cjs = require('./chunk-4NMX4VK7.cjs');
5
- var chunkFD447P2T_cjs = require('./chunk-FD447P2T.cjs');
5
+ var chunk3S6ORBIB_cjs = require('./chunk-3S6ORBIB.cjs');
6
6
  var chunkPX3B6TJZ_cjs = require('./chunk-PX3B6TJZ.cjs');
7
7
  var chunkN7PCIGVW_cjs = require('./chunk-N7PCIGVW.cjs');
8
8
  var chunkB6DAZDIA_cjs = require('./chunk-B6DAZDIA.cjs');
@@ -23,15 +23,15 @@ Object.defineProperty(exports, 'EventNames', {
23
23
  });
24
24
  Object.defineProperty(exports, 'AlertType', {
25
25
  enumerable: true,
26
- get: function () { return chunkFD447P2T_cjs.c; }
26
+ get: function () { return chunk3S6ORBIB_cjs.c; }
27
27
  });
28
28
  Object.defineProperty(exports, 'DetailItemType', {
29
29
  enumerable: true,
30
- get: function () { return chunkFD447P2T_cjs.b; }
30
+ get: function () { return chunk3S6ORBIB_cjs.b; }
31
31
  });
32
32
  Object.defineProperty(exports, 'RpcMethod', {
33
33
  enumerable: true,
34
- get: function () { return chunkFD447P2T_cjs.a; }
34
+ get: function () { return chunk3S6ORBIB_cjs.a; }
35
35
  });
36
36
  Object.defineProperty(exports, 'TxType', {
37
37
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -5,7 +5,7 @@ export { Error } from './error.cjs';
5
5
  export { Manifest, parseManifest } from './manifest.cjs';
6
6
  export { AppInfo, ConstructorParams, Module, NetworkFeeParam } from './module.cjs';
7
7
  export { NetworkFees, SuggestGasPriceOptionsResponse } from './network-fee.cjs';
8
- export { A as AddressItem, i as AddressListItem, q as Alert, p as AlertDetails, o as AlertType, J as ApprovalController, x as ApprovalParams, H as ApprovalResponse, O as BalanceChange, B as BaseDetailItem, K as BatchApprovalController, y as BatchApprovalParams, I as BatchApprovalResponse, r as BitcoinExecuteTxData, s as BitcoingSignTxData, v as BtcTxUpdateFn, C as CurrencyItem, D as DappInfo, j as DataItem, k as DateItem, m as DetailItem, g as DetailItemType, f as DetailSection, n as DisplayData, E as EvmTxBatchUpdateFn, u as EvmTxUpdateFn, F as FundsRecipientItem, l as LinkItem, L as LinkItemValue, M as MessageTypeProperty, d as MessageTypes, N as NodeIDItem, z as RequestPublicKeyParams, b as RpcError, R as RpcMethod, a as RpcRequest, c as RpcResponse, S as SigningData, t as SigningData_EthSendTx, w as SigningRequest, G as SigningResult, h as TextItem, U as TokenApproval, V as TokenApprovals, P as TokenDiff, Q as TokenDiffItem, W as TransactionSimulationResult, T as TypedData, e as TypedDataV1 } from './rpc-21f2b3b8.js';
8
+ export { A as AddressItem, i as AddressListItem, s as Alert, r as AlertDetails, q as AlertType, O as ApprovalController, z as ApprovalParams, J as ApprovalResponse, Q as BalanceChange, B as BaseDetailItem, P as BatchApprovalController, G as BatchApprovalParams, K as BatchApprovalResponse, t as BitcoinExecuteTxData, u as BitcoingSignTxData, x as BtcTxUpdateFn, C as CurrencyItem, D as DappInfo, j as DataItem, k as DateItem, o as DetailItem, g as DetailItemType, f as DetailSection, p as DisplayData, E as EvmTxBatchUpdateFn, w as EvmTxUpdateFn, F as FundsRecipientItem, l as LinkItem, L as LinkItemValue, M as MessageTypeProperty, d as MessageTypes, n as NetworkItem, m as NetworkItemValue, N as NodeIDItem, H as RequestPublicKeyParams, b as RpcError, R as RpcMethod, a as RpcRequest, c as RpcResponse, S as SigningData, v as SigningData_EthSendTx, y as SigningRequest, I as SigningResult, h as TextItem, W as TokenApproval, X as TokenApprovals, U as TokenDiff, V as TokenDiffItem, Y as TransactionSimulationResult, T as TypedData, e as TypedDataV1 } from './rpc-74d451fa.js';
9
9
  export { ERC1155Token, ERC20Token, ERC721Token, NONERCToken, NetworkContractToken, NetworkToken, SPLToken, TokenType } from './token.cjs';
10
10
  export { GetTransactionHistory, PChainTransactionType, Transaction, TransactionHistoryResponse, TransactionType, TxToken, XChainTransactionType } from './transaction-history.cjs';
11
11
  export { BtcWalletPolicyDetails, BuildDerivationPathParams, BuildDerivationPathResponse, DerivationPathType, DeriveAddressParams, DeriveAddressResponse, DetailedDeriveAddressParams, GetAddressParams, GetAddressResponse, PubKeyType, SimpleDeriveAddressParams, WalletType } from './account.cjs';
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { Error } from './error.js';
5
5
  export { Manifest, parseManifest } from './manifest.js';
6
6
  export { AppInfo, ConstructorParams, Module, NetworkFeeParam } from './module.js';
7
7
  export { NetworkFees, SuggestGasPriceOptionsResponse } from './network-fee.js';
8
- export { A as AddressItem, i as AddressListItem, q as Alert, p as AlertDetails, o as AlertType, J as ApprovalController, x as ApprovalParams, H as ApprovalResponse, O as BalanceChange, B as BaseDetailItem, K as BatchApprovalController, y as BatchApprovalParams, I as BatchApprovalResponse, r as BitcoinExecuteTxData, s as BitcoingSignTxData, v as BtcTxUpdateFn, C as CurrencyItem, D as DappInfo, j as DataItem, k as DateItem, m as DetailItem, g as DetailItemType, f as DetailSection, n as DisplayData, E as EvmTxBatchUpdateFn, u as EvmTxUpdateFn, F as FundsRecipientItem, l as LinkItem, L as LinkItemValue, M as MessageTypeProperty, d as MessageTypes, N as NodeIDItem, z as RequestPublicKeyParams, b as RpcError, R as RpcMethod, a as RpcRequest, c as RpcResponse, S as SigningData, t as SigningData_EthSendTx, w as SigningRequest, G as SigningResult, h as TextItem, U as TokenApproval, V as TokenApprovals, P as TokenDiff, Q as TokenDiffItem, W as TransactionSimulationResult, T as TypedData, e as TypedDataV1 } from './rpc-6598b5fc.js';
8
+ export { A as AddressItem, i as AddressListItem, s as Alert, r as AlertDetails, q as AlertType, O as ApprovalController, z as ApprovalParams, J as ApprovalResponse, Q as BalanceChange, B as BaseDetailItem, P as BatchApprovalController, G as BatchApprovalParams, K as BatchApprovalResponse, t as BitcoinExecuteTxData, u as BitcoingSignTxData, x as BtcTxUpdateFn, C as CurrencyItem, D as DappInfo, j as DataItem, k as DateItem, o as DetailItem, g as DetailItemType, f as DetailSection, p as DisplayData, E as EvmTxBatchUpdateFn, w as EvmTxUpdateFn, F as FundsRecipientItem, l as LinkItem, L as LinkItemValue, M as MessageTypeProperty, d as MessageTypes, n as NetworkItem, m as NetworkItemValue, N as NodeIDItem, H as RequestPublicKeyParams, b as RpcError, R as RpcMethod, a as RpcRequest, c as RpcResponse, S as SigningData, v as SigningData_EthSendTx, y as SigningRequest, I as SigningResult, h as TextItem, W as TokenApproval, X as TokenApprovals, U as TokenDiff, V as TokenDiffItem, Y as TransactionSimulationResult, T as TypedData, e as TypedDataV1 } from './rpc-019c80d4.js';
9
9
  export { ERC1155Token, ERC20Token, ERC721Token, NONERCToken, NetworkContractToken, NetworkToken, SPLToken, TokenType } from './token.js';
10
10
  export { GetTransactionHistory, PChainTransactionType, Transaction, TransactionHistoryResponse, TransactionType, TxToken, XChainTransactionType } from './transaction-history.js';
11
11
  export { BtcWalletPolicyDetails, BuildDerivationPathParams, BuildDerivationPathResponse, DerivationPathType, DeriveAddressParams, DeriveAddressResponse, DetailedDeriveAddressParams, GetAddressParams, GetAddressResponse, PubKeyType, SimpleDeriveAddressParams, WalletType } from './account.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import './chunk-7U2R34EQ.js';
2
2
  export { a as EventNames } from './chunk-6ZLXXGIV.js';
3
- export { c as AlertType, b as DetailItemType, a as RpcMethod } from './chunk-6CAZBOUG.js';
3
+ export { c as AlertType, b as DetailItemType, a as RpcMethod } from './chunk-RRUQCW3O.js';
4
4
  export { a as TxType } from './chunk-FGMDBV23.js';
5
5
  export { a as TokenType } from './chunk-GMF7R4KJ.js';
6
6
  export { b as PChainTransactionType, a as TransactionType, c as XChainTransactionType } from './chunk-7JLXTNPE.js';
package/dist/module.d.cts CHANGED
@@ -4,7 +4,7 @@ import { GetBalancesParams, GetBalancesResponse } from './balance.cjs';
4
4
  import { AppName, Environment, Network } from './common.cjs';
5
5
  import { Manifest } from './manifest.cjs';
6
6
  import { NetworkFees } from './network-fee.cjs';
7
- import { J as ApprovalController, a as RpcRequest, c as RpcResponse } from './rpc-21f2b3b8.js';
7
+ import { O as ApprovalController, a as RpcRequest, c as RpcResponse } from './rpc-74d451fa.js';
8
8
  import { NetworkContractToken } from './token.cjs';
9
9
  import { GetTransactionHistory, TransactionHistoryResponse } from './transaction-history.cjs';
10
10
  import { HyperSDKClient } from 'hypersdk-client';
package/dist/module.d.ts CHANGED
@@ -4,7 +4,7 @@ import { GetBalancesParams, GetBalancesResponse } from './balance.js';
4
4
  import { AppName, Environment, Network } from './common.js';
5
5
  import { Manifest } from './manifest.js';
6
6
  import { NetworkFees } from './network-fee.js';
7
- import { J as ApprovalController, a as RpcRequest, c as RpcResponse } from './rpc-6598b5fc.js';
7
+ import { O as ApprovalController, a as RpcRequest, c as RpcResponse } from './rpc-019c80d4.js';
8
8
  import { NetworkContractToken } from './token.js';
9
9
  import { GetTransactionHistory, TransactionHistoryResponse } from './transaction-history.js';
10
10
  import { HyperSDKClient } from 'hypersdk-client';
@@ -111,7 +111,8 @@ declare enum DetailItemType {
111
111
  FUNDS_RECIPIENT = "fundsRecipient",
112
112
  DATA = "data",
113
113
  DATE = "date",
114
- LINK = "link"
114
+ LINK = "link",
115
+ NETWORK = "network"
115
116
  }
116
117
  type FundsRecipientItem = BaseDetailItem & {
117
118
  type: DetailItemType.FUNDS_RECIPIENT;
@@ -159,7 +160,15 @@ type LinkItem = BaseDetailItem & {
159
160
  type: DetailItemType.LINK;
160
161
  value: LinkItemValue;
161
162
  };
162
- type DetailItem = string | TextItem | AddressItem | AddressListItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem | FundsRecipientItem;
163
+ type NetworkItemValue = {
164
+ logoUri: string | undefined;
165
+ name: string;
166
+ };
167
+ type NetworkItem = BaseDetailItem & {
168
+ type: DetailItemType.NETWORK;
169
+ value: NetworkItemValue;
170
+ };
171
+ type DetailItem = string | TextItem | AddressItem | AddressListItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem | FundsRecipientItem | NetworkItem;
163
172
  type DisplayData = {
164
173
  title: string;
165
174
  dAppInfo?: {
@@ -167,7 +176,7 @@ type DisplayData = {
167
176
  action: string;
168
177
  logoUri?: string;
169
178
  };
170
- network: {
179
+ network?: {
171
180
  chainId: number;
172
181
  name: string;
173
182
  logoUri?: string;
@@ -349,11 +358,22 @@ type BatchApprovalResponse = {
349
358
  interface ApprovalController {
350
359
  requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
351
360
  requestPublicKey: (params: RequestPublicKeyParams) => Promise<string>;
352
- onTransactionConfirmed: (txHash: Hex, requestId: string) => void;
353
- onTransactionReverted: (txHash: Hex, requestId: string) => void;
361
+ onTransactionPending: ({ txHash, request }: {
362
+ txHash: Hex;
363
+ request: RpcRequest;
364
+ }) => void;
365
+ onTransactionConfirmed: ({ txHash, explorerLink, request, }: {
366
+ txHash: Hex;
367
+ explorerLink: string;
368
+ request: RpcRequest;
369
+ }) => void;
370
+ onTransactionReverted: ({ txHash, request }: {
371
+ txHash: Hex;
372
+ request: RpcRequest;
373
+ }) => void;
354
374
  }
355
375
  interface BatchApprovalController extends ApprovalController {
356
376
  requestBatchApproval: (params: BatchApprovalParams) => Promise<BatchApprovalResponse>;
357
377
  }
358
378
 
359
- export { AddressItem as A, BaseDetailItem as B, CurrencyItem as C, DappInfo as D, EvmTxBatchUpdateFn as E, FundsRecipientItem as F, SigningResult as G, ApprovalResponse as H, BatchApprovalResponse as I, ApprovalController as J, BatchApprovalController as K, LinkItemValue as L, MessageTypeProperty as M, NodeIDItem as N, BalanceChange as O, TokenDiff as P, TokenDiffItem as Q, RpcMethod as R, SigningData as S, TypedData as T, TokenApproval as U, TokenApprovals as V, TransactionSimulationResult as W, RpcRequest as a, RpcError as b, RpcResponse as c, MessageTypes as d, TypedDataV1 as e, DetailSection as f, DetailItemType as g, TextItem as h, AddressListItem as i, DataItem as j, DateItem as k, LinkItem as l, DetailItem as m, DisplayData as n, AlertType as o, AlertDetails as p, Alert as q, BitcoinExecuteTxData as r, BitcoingSignTxData as s, SigningData_EthSendTx as t, EvmTxUpdateFn as u, BtcTxUpdateFn as v, SigningRequest as w, ApprovalParams as x, BatchApprovalParams as y, RequestPublicKeyParams as z };
379
+ export { AddressItem as A, BaseDetailItem as B, CurrencyItem as C, DappInfo as D, EvmTxBatchUpdateFn as E, FundsRecipientItem as F, BatchApprovalParams as G, RequestPublicKeyParams as H, SigningResult as I, ApprovalResponse as J, BatchApprovalResponse as K, LinkItemValue as L, MessageTypeProperty as M, NodeIDItem as N, ApprovalController as O, BatchApprovalController as P, BalanceChange as Q, RpcMethod as R, SigningData as S, TypedData as T, TokenDiff as U, TokenDiffItem as V, TokenApproval as W, TokenApprovals as X, TransactionSimulationResult as Y, RpcRequest as a, RpcError as b, RpcResponse as c, MessageTypes as d, TypedDataV1 as e, DetailSection as f, DetailItemType as g, TextItem as h, AddressListItem as i, DataItem as j, DateItem as k, LinkItem as l, NetworkItemValue as m, NetworkItem as n, DetailItem as o, DisplayData as p, AlertType as q, AlertDetails as r, Alert as s, BitcoinExecuteTxData as t, BitcoingSignTxData as u, SigningData_EthSendTx as v, EvmTxUpdateFn as w, BtcTxUpdateFn as x, SigningRequest as y, ApprovalParams as z };
@@ -111,7 +111,8 @@ declare enum DetailItemType {
111
111
  FUNDS_RECIPIENT = "fundsRecipient",
112
112
  DATA = "data",
113
113
  DATE = "date",
114
- LINK = "link"
114
+ LINK = "link",
115
+ NETWORK = "network"
115
116
  }
116
117
  type FundsRecipientItem = BaseDetailItem & {
117
118
  type: DetailItemType.FUNDS_RECIPIENT;
@@ -159,7 +160,15 @@ type LinkItem = BaseDetailItem & {
159
160
  type: DetailItemType.LINK;
160
161
  value: LinkItemValue;
161
162
  };
162
- type DetailItem = string | TextItem | AddressItem | AddressListItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem | FundsRecipientItem;
163
+ type NetworkItemValue = {
164
+ logoUri: string | undefined;
165
+ name: string;
166
+ };
167
+ type NetworkItem = BaseDetailItem & {
168
+ type: DetailItemType.NETWORK;
169
+ value: NetworkItemValue;
170
+ };
171
+ type DetailItem = string | TextItem | AddressItem | AddressListItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem | FundsRecipientItem | NetworkItem;
163
172
  type DisplayData = {
164
173
  title: string;
165
174
  dAppInfo?: {
@@ -167,7 +176,7 @@ type DisplayData = {
167
176
  action: string;
168
177
  logoUri?: string;
169
178
  };
170
- network: {
179
+ network?: {
171
180
  chainId: number;
172
181
  name: string;
173
182
  logoUri?: string;
@@ -349,11 +358,22 @@ type BatchApprovalResponse = {
349
358
  interface ApprovalController {
350
359
  requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
351
360
  requestPublicKey: (params: RequestPublicKeyParams) => Promise<string>;
352
- onTransactionConfirmed: (txHash: Hex, requestId: string) => void;
353
- onTransactionReverted: (txHash: Hex, requestId: string) => void;
361
+ onTransactionPending: ({ txHash, request }: {
362
+ txHash: Hex;
363
+ request: RpcRequest;
364
+ }) => void;
365
+ onTransactionConfirmed: ({ txHash, explorerLink, request, }: {
366
+ txHash: Hex;
367
+ explorerLink: string;
368
+ request: RpcRequest;
369
+ }) => void;
370
+ onTransactionReverted: ({ txHash, request }: {
371
+ txHash: Hex;
372
+ request: RpcRequest;
373
+ }) => void;
354
374
  }
355
375
  interface BatchApprovalController extends ApprovalController {
356
376
  requestBatchApproval: (params: BatchApprovalParams) => Promise<BatchApprovalResponse>;
357
377
  }
358
378
 
359
- export { AddressItem as A, BaseDetailItem as B, CurrencyItem as C, DappInfo as D, EvmTxBatchUpdateFn as E, FundsRecipientItem as F, SigningResult as G, ApprovalResponse as H, BatchApprovalResponse as I, ApprovalController as J, BatchApprovalController as K, LinkItemValue as L, MessageTypeProperty as M, NodeIDItem as N, BalanceChange as O, TokenDiff as P, TokenDiffItem as Q, RpcMethod as R, SigningData as S, TypedData as T, TokenApproval as U, TokenApprovals as V, TransactionSimulationResult as W, RpcRequest as a, RpcError as b, RpcResponse as c, MessageTypes as d, TypedDataV1 as e, DetailSection as f, DetailItemType as g, TextItem as h, AddressListItem as i, DataItem as j, DateItem as k, LinkItem as l, DetailItem as m, DisplayData as n, AlertType as o, AlertDetails as p, Alert as q, BitcoinExecuteTxData as r, BitcoingSignTxData as s, SigningData_EthSendTx as t, EvmTxUpdateFn as u, BtcTxUpdateFn as v, SigningRequest as w, ApprovalParams as x, BatchApprovalParams as y, RequestPublicKeyParams as z };
379
+ export { AddressItem as A, BaseDetailItem as B, CurrencyItem as C, DappInfo as D, EvmTxBatchUpdateFn as E, FundsRecipientItem as F, BatchApprovalParams as G, RequestPublicKeyParams as H, SigningResult as I, ApprovalResponse as J, BatchApprovalResponse as K, LinkItemValue as L, MessageTypeProperty as M, NodeIDItem as N, ApprovalController as O, BatchApprovalController as P, BalanceChange as Q, RpcMethod as R, SigningData as S, TypedData as T, TokenDiff as U, TokenDiffItem as V, TokenApproval as W, TokenApprovals as X, TransactionSimulationResult as Y, RpcRequest as a, RpcError as b, RpcResponse as c, MessageTypes as d, TypedDataV1 as e, DetailSection as f, DetailItemType as g, TextItem as h, AddressListItem as i, DataItem as j, DateItem as k, LinkItem as l, NetworkItemValue as m, NetworkItem as n, DetailItem as o, DisplayData as p, AlertType as q, AlertDetails as r, Alert as s, BitcoinExecuteTxData as t, BitcoingSignTxData as u, SigningData_EthSendTx as v, EvmTxUpdateFn as w, BtcTxUpdateFn as x, SigningRequest as y, ApprovalParams as z };
package/dist/rpc.cjs CHANGED
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkFD447P2T_cjs = require('./chunk-FD447P2T.cjs');
3
+ var chunk3S6ORBIB_cjs = require('./chunk-3S6ORBIB.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, 'AlertType', {
8
8
  enumerable: true,
9
- get: function () { return chunkFD447P2T_cjs.c; }
9
+ get: function () { return chunk3S6ORBIB_cjs.c; }
10
10
  });
11
11
  Object.defineProperty(exports, 'DetailItemType', {
12
12
  enumerable: true,
13
- get: function () { return chunkFD447P2T_cjs.b; }
13
+ get: function () { return chunk3S6ORBIB_cjs.b; }
14
14
  });
15
15
  Object.defineProperty(exports, 'RpcMethod', {
16
16
  enumerable: true,
17
- get: function () { return chunkFD447P2T_cjs.a; }
17
+ get: function () { return chunk3S6ORBIB_cjs.a; }
18
18
  });
19
19
  //# sourceMappingURL=out.js.map
20
20
  //# sourceMappingURL=rpc.cjs.map
package/dist/rpc.d.cts CHANGED
@@ -2,7 +2,7 @@ import 'ethers';
2
2
  import '@avalabs/core-wallets-sdk';
3
3
  import './common.cjs';
4
4
  import '@metamask/rpc-errors';
5
- export { A as AddressItem, i as AddressListItem, q as Alert, p as AlertDetails, o as AlertType, J as ApprovalController, x as ApprovalParams, H as ApprovalResponse, B as BaseDetailItem, K as BatchApprovalController, y as BatchApprovalParams, I as BatchApprovalResponse, r as BitcoinExecuteTxData, s as BitcoingSignTxData, v as BtcTxUpdateFn, C as CurrencyItem, D as DappInfo, j as DataItem, k as DateItem, m as DetailItem, g as DetailItemType, f as DetailSection, n as DisplayData, E as EvmTxBatchUpdateFn, u as EvmTxUpdateFn, F as FundsRecipientItem, l as LinkItem, L as LinkItemValue, M as MessageTypeProperty, d as MessageTypes, N as NodeIDItem, z as RequestPublicKeyParams, b as RpcError, R as RpcMethod, a as RpcRequest, c as RpcResponse, S as SigningData, t as SigningData_EthSendTx, w as SigningRequest, G as SigningResult, h as TextItem, T as TypedData, e as TypedDataV1 } from './rpc-21f2b3b8.js';
5
+ export { A as AddressItem, i as AddressListItem, s as Alert, r as AlertDetails, q as AlertType, O as ApprovalController, z as ApprovalParams, J as ApprovalResponse, B as BaseDetailItem, P as BatchApprovalController, G as BatchApprovalParams, K as BatchApprovalResponse, t as BitcoinExecuteTxData, u as BitcoingSignTxData, x as BtcTxUpdateFn, C as CurrencyItem, D as DappInfo, j as DataItem, k as DateItem, o as DetailItem, g as DetailItemType, f as DetailSection, p as DisplayData, E as EvmTxBatchUpdateFn, w as EvmTxUpdateFn, F as FundsRecipientItem, l as LinkItem, L as LinkItemValue, M as MessageTypeProperty, d as MessageTypes, n as NetworkItem, m as NetworkItemValue, N as NodeIDItem, H as RequestPublicKeyParams, b as RpcError, R as RpcMethod, a as RpcRequest, c as RpcResponse, S as SigningData, v as SigningData_EthSendTx, y as SigningRequest, I as SigningResult, h as TextItem, T as TypedData, e as TypedDataV1 } from './rpc-74d451fa.js';
6
6
  import './balance.cjs';
7
7
  import 'hypersdk-client';
8
8
  import './token.cjs';
package/dist/rpc.d.ts CHANGED
@@ -2,7 +2,7 @@ import 'ethers';
2
2
  import '@avalabs/core-wallets-sdk';
3
3
  import './common.js';
4
4
  import '@metamask/rpc-errors';
5
- export { A as AddressItem, i as AddressListItem, q as Alert, p as AlertDetails, o as AlertType, J as ApprovalController, x as ApprovalParams, H as ApprovalResponse, B as BaseDetailItem, K as BatchApprovalController, y as BatchApprovalParams, I as BatchApprovalResponse, r as BitcoinExecuteTxData, s as BitcoingSignTxData, v as BtcTxUpdateFn, C as CurrencyItem, D as DappInfo, j as DataItem, k as DateItem, m as DetailItem, g as DetailItemType, f as DetailSection, n as DisplayData, E as EvmTxBatchUpdateFn, u as EvmTxUpdateFn, F as FundsRecipientItem, l as LinkItem, L as LinkItemValue, M as MessageTypeProperty, d as MessageTypes, N as NodeIDItem, z as RequestPublicKeyParams, b as RpcError, R as RpcMethod, a as RpcRequest, c as RpcResponse, S as SigningData, t as SigningData_EthSendTx, w as SigningRequest, G as SigningResult, h as TextItem, T as TypedData, e as TypedDataV1 } from './rpc-6598b5fc.js';
5
+ export { A as AddressItem, i as AddressListItem, s as Alert, r as AlertDetails, q as AlertType, O as ApprovalController, z as ApprovalParams, J as ApprovalResponse, B as BaseDetailItem, P as BatchApprovalController, G as BatchApprovalParams, K as BatchApprovalResponse, t as BitcoinExecuteTxData, u as BitcoingSignTxData, x as BtcTxUpdateFn, C as CurrencyItem, D as DappInfo, j as DataItem, k as DateItem, o as DetailItem, g as DetailItemType, f as DetailSection, p as DisplayData, E as EvmTxBatchUpdateFn, w as EvmTxUpdateFn, F as FundsRecipientItem, l as LinkItem, L as LinkItemValue, M as MessageTypeProperty, d as MessageTypes, n as NetworkItem, m as NetworkItemValue, N as NodeIDItem, H as RequestPublicKeyParams, b as RpcError, R as RpcMethod, a as RpcRequest, c as RpcResponse, S as SigningData, v as SigningData_EthSendTx, y as SigningRequest, I as SigningResult, h as TextItem, T as TypedData, e as TypedDataV1 } from './rpc-019c80d4.js';
6
6
  import './balance.js';
7
7
  import 'hypersdk-client';
8
8
  import './token.js';
package/dist/rpc.js CHANGED
@@ -1,3 +1,3 @@
1
- export { c as AlertType, b as DetailItemType, a as RpcMethod } from './chunk-6CAZBOUG.js';
1
+ export { c as AlertType, b as DetailItemType, a as RpcMethod } from './chunk-RRUQCW3O.js';
2
2
  //# sourceMappingURL=out.js.map
3
3
  //# sourceMappingURL=rpc.js.map
@@ -1,4 +1,4 @@
1
- export { O as BalanceChange, U as TokenApproval, V as TokenApprovals, P as TokenDiff, Q as TokenDiffItem, W as TransactionSimulationResult } from './rpc-21f2b3b8.js';
1
+ export { Q as BalanceChange, W as TokenApproval, X as TokenApprovals, U as TokenDiff, V as TokenDiffItem, Y as TransactionSimulationResult } from './rpc-74d451fa.js';
2
2
  import './token.cjs';
3
3
  import 'ethers';
4
4
  import '@avalabs/core-wallets-sdk';
@@ -1,4 +1,4 @@
1
- export { O as BalanceChange, U as TokenApproval, V as TokenApprovals, P as TokenDiff, Q as TokenDiffItem, W as TransactionSimulationResult } from './rpc-6598b5fc.js';
1
+ export { Q as BalanceChange, W as TokenApproval, X as TokenApprovals, U as TokenDiff, V as TokenDiffItem, Y as TransactionSimulationResult } from './rpc-019c80d4.js';
2
2
  import './token.js';
3
3
  import 'ethers';
4
4
  import '@avalabs/core-wallets-sdk';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avalabs/vm-module-types",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","DetailItemType","AlertType"],"mappings":"AAQO,IAAKA,OAEVA,EAAA,yBAA2B,0BAC3BA,EAAA,yBAA2B,0BAG3BA,EAAA,qBAAuB,sBACvBA,EAAA,2BAA6B,2BAC7BA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAGXA,EAAA,uBAAyB,wBACzBA,EAAA,2BAA6B,4BAC7BA,EAAA,2BAA6B,4BAG7BA,EAAA,qBAAuB,sBAGvBA,EAAA,wBAA0B,yBAC1BA,EAAA,iCAAmC,gCACnCA,EAAA,oBAAsB,qBA1BZA,OAAA,IAqFAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,aAAe,cACfA,EAAA,QAAU,SACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,iBAClBA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OATGA,OAAA,IAoGAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Avalanche, BitcoinInputUTXO, BitcoinOutputUTXO } from '@avalabs/core-wallets-sdk';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\nimport type { TokenWithBalanceBTC } from './balance';\nimport type { TransactionPayload, VMABI } from 'hypersdk-client';\n\nexport enum RpcMethod {\n /* BTC */\n BITCOIN_SEND_TRANSACTION = 'bitcoin_sendTransaction',\n BITCOIN_SIGN_TRANSACTION = 'bitcoin_signTransaction',\n\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n ETH_SEND_TRANSACTION_BATCH = 'eth_sendTransactionBatch',\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 AVALANCHE_SIGN_TRANSACTION = 'avalanche_signTransaction',\n\n /* HVM */\n HVM_SIGN_TRANSACTION = 'hvm_signTransaction',\n\n /* SOLANA */\n SOLANA_SIGN_TRANSACTION = 'solana_signTransaction',\n SOLANA_SIGN_AND_SEND_TRANSACTION = 'solana_signAndSendTransaction',\n SOLANA_SIGN_MESSAGE = 'solana_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 DetailSection = {\n title?: string;\n items: DetailItem[];\n};\n\nexport type BaseDetailItem = {\n label: string;\n};\n\nexport enum DetailItemType {\n TEXT = 'text',\n ADDRESS = 'address',\n ADDRESS_LIST = 'addressList',\n NODE_ID = 'nodeID',\n CURRENCY = 'currency',\n FUNDS_RECIPIENT = 'fundsRecipient',\n DATA = 'data',\n DATE = 'date',\n LINK = 'link',\n}\n\n// It's very similar as CurrencyItem, but we want the client apps\n// to treat the label as an address (recognize it if possible,\n// truncate otherwise).\nexport type FundsRecipientItem = BaseDetailItem & {\n type: DetailItemType.FUNDS_RECIPIENT;\n amount: bigint;\n maxDecimals: number;\n symbol: string;\n};\n\nexport type TextItem = BaseDetailItem & {\n type: DetailItemType.TEXT;\n value: string;\n alignment: 'vertical' | 'horizontal';\n};\n\nexport type AddressItem = BaseDetailItem & {\n type: DetailItemType.ADDRESS;\n value: string;\n};\n\nexport type AddressListItem = BaseDetailItem & {\n type: DetailItemType.ADDRESS_LIST;\n value: string[];\n};\n\nexport type NodeIDItem = BaseDetailItem & {\n type: DetailItemType.NODE_ID;\n value: string;\n};\n\nexport type CurrencyItem = BaseDetailItem & {\n type: DetailItemType.CURRENCY;\n value: bigint;\n maxDecimals: number;\n symbol: string;\n};\n\nexport type DataItem = BaseDetailItem & {\n type: DetailItemType.DATA;\n value: string;\n};\n\nexport type DateItem = BaseDetailItem & {\n type: DetailItemType.DATE;\n value: string;\n};\n\nexport type LinkItemValue = { url: string; name?: string; icon?: string };\n\nexport type LinkItem = BaseDetailItem & {\n type: DetailItemType.LINK;\n value: LinkItemValue;\n};\n\nexport type DetailItem =\n | string\n | TextItem\n | AddressItem\n | AddressListItem\n | NodeIDItem\n | CurrencyItem\n | DataItem\n | DateItem\n | LinkItem\n | FundsRecipientItem;\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 details: DetailSection[];\n networkFeeSelector?: boolean;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n isSimulationSuccessful?: boolean;\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 BitcoinExecuteTxData = {\n to: string;\n amount: number;\n feeRate: number;\n fee: number;\n gasLimit: number;\n balance: TokenWithBalanceBTC;\n inputs: BitcoinInputUTXO[];\n outputs: BitcoinOutputUTXO[];\n};\n\nexport type BitcoingSignTxData = {\n inputs: BitcoinInputUTXO[];\n outputs: BitcoinOutputUTXO[];\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.SOLANA_SIGN_AND_SEND_TRANSACTION;\n account: string;\n data: string; // Base-64 encoded \"Wire Transaction\"\n }\n | {\n type: RpcMethod.SOLANA_SIGN_TRANSACTION;\n account: string;\n data: string; // Base-64 encoded \"Wire Transaction\"\n }\n | {\n type: RpcMethod.SOLANA_SIGN_MESSAGE;\n account: string;\n data: string; // Base-64 encoded message\n }\n | {\n type: RpcMethod.BITCOIN_SEND_TRANSACTION;\n account: string;\n data: BitcoinExecuteTxData;\n }\n | {\n type: RpcMethod.BITCOIN_SIGN_TRANSACTION;\n account: string;\n data: BitcoingSignTxData;\n }\n | SigningData_EthSendTx\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 externalIndices?: number[];\n internalIndices?: number[];\n }\n | {\n type: RpcMethod.AVALANCHE_SIGN_TRANSACTION;\n unsignedTxJson: string;\n data: Avalanche.Tx;\n vm: 'EVM' | 'AVM' | 'PVM';\n ownSignatureIndices: [number, number][];\n }\n | {\n type: RpcMethod.HVM_SIGN_TRANSACTION;\n data: {\n abi: VMABI;\n txPayload: TransactionPayload;\n };\n };\n\nexport type SigningData_EthSendTx = {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n data: TransactionRequest;\n};\n\nexport type EvmTxBatchUpdateFn = (\n data: { maxFeeRate?: bigint; maxTipRate?: bigint },\n txIndex: number,\n) => {\n displayData: DisplayData;\n signingRequests: {\n displayData: DisplayData;\n signingData: SigningData_EthSendTx;\n }[];\n};\n\nexport type EvmTxUpdateFn = (data: {\n maxFeeRate?: bigint;\n maxTipRate?: bigint;\n approvalLimit?: Hex; // as hexadecimal, 0x-prefixed\n}) => { displayData: DisplayData; signingData: SigningData_EthSendTx };\n\nexport type BtcTxUpdateFn = (data: { feeRate?: number }) => {\n displayData: DisplayData;\n signingData: Extract<SigningData, { type: RpcMethod.BITCOIN_SEND_TRANSACTION }>;\n};\n\nexport type SigningRequest<Data = SigningData> = {\n displayData: DisplayData;\n signingData: Data;\n updateTx?: EvmTxUpdateFn | BtcTxUpdateFn;\n};\n\nexport type ApprovalParams = {\n request: RpcRequest;\n} & SigningRequest;\n\nexport type BatchApprovalParams = {\n request: RpcRequest;\n signingRequests: SigningRequest<SigningData_EthSendTx>[];\n displayData: DisplayData;\n updateTx: EvmTxBatchUpdateFn;\n};\n\nexport type RequestPublicKeyParams = {\n secretId: string;\n curve: 'secp256k1' | 'ed25519';\n derivationPath?: string;\n};\n\n/**\n * We want to accept both a signed data (tx/message) and a tx hash as a response\n * coming in from the client apps, hence the XORs here.\n *\n * The reason we need to support both is because extension allows importing\n * external software wallets, such as Fireblocks or other apps that support\n * the WalletConnect protocol.\n *\n * My experience is that WalletConnect apps rarely, if ever, support\n * \"eth_signTransaction\" requests and more often only allow sending\n * \"eth_sendTransaction\" calls, which means that all we'll get in response\n * from them is the transaction hash (not a signed tx).\n */\ntype SignedData = { signedData: string };\ntype BroadcastedTx = { txHash: string };\n\nexport type SigningResult = SignedData | BroadcastedTx;\n\nexport type ApprovalResponse =\n | {\n error: RpcError;\n }\n | SigningResult;\n\nexport type BatchApprovalResponse =\n | { error: RpcError }\n | {\n result: SignedData[];\n };\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n requestPublicKey: (params: RequestPublicKeyParams) => Promise<string>;\n onTransactionConfirmed: (txHash: Hex, requestId: string) => void;\n onTransactionReverted: (txHash: Hex, requestId: string) => void;\n}\n\nexport interface BatchApprovalController extends ApprovalController {\n requestBatchApproval: (params: BatchApprovalParams) => Promise<BatchApprovalResponse>;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","DetailItemType","AlertType"],"mappings":"AAQO,IAAKA,OAEVA,EAAA,yBAA2B,0BAC3BA,EAAA,yBAA2B,0BAG3BA,EAAA,qBAAuB,sBACvBA,EAAA,2BAA6B,2BAC7BA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAGXA,EAAA,uBAAyB,wBACzBA,EAAA,2BAA6B,4BAC7BA,EAAA,2BAA6B,4BAG7BA,EAAA,qBAAuB,sBAGvBA,EAAA,wBAA0B,yBAC1BA,EAAA,iCAAmC,gCACnCA,EAAA,oBAAsB,qBA1BZA,OAAA,IAqFAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,aAAe,cACfA,EAAA,QAAU,SACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,iBAClBA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OATGA,OAAA,IAoGAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Avalanche, BitcoinInputUTXO, BitcoinOutputUTXO } from '@avalabs/core-wallets-sdk';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\nimport type { TokenWithBalanceBTC } from './balance';\nimport type { TransactionPayload, VMABI } from 'hypersdk-client';\n\nexport enum RpcMethod {\n /* BTC */\n BITCOIN_SEND_TRANSACTION = 'bitcoin_sendTransaction',\n BITCOIN_SIGN_TRANSACTION = 'bitcoin_signTransaction',\n\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n ETH_SEND_TRANSACTION_BATCH = 'eth_sendTransactionBatch',\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 AVALANCHE_SIGN_TRANSACTION = 'avalanche_signTransaction',\n\n /* HVM */\n HVM_SIGN_TRANSACTION = 'hvm_signTransaction',\n\n /* SOLANA */\n SOLANA_SIGN_TRANSACTION = 'solana_signTransaction',\n SOLANA_SIGN_AND_SEND_TRANSACTION = 'solana_signAndSendTransaction',\n SOLANA_SIGN_MESSAGE = 'solana_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 DetailSection = {\n title?: string;\n items: DetailItem[];\n};\n\nexport type BaseDetailItem = {\n label: string;\n};\n\nexport enum DetailItemType {\n TEXT = 'text',\n ADDRESS = 'address',\n ADDRESS_LIST = 'addressList',\n NODE_ID = 'nodeID',\n CURRENCY = 'currency',\n FUNDS_RECIPIENT = 'fundsRecipient',\n DATA = 'data',\n DATE = 'date',\n LINK = 'link',\n}\n\n// It's very similar as CurrencyItem, but we want the client apps\n// to treat the label as an address (recognize it if possible,\n// truncate otherwise).\nexport type FundsRecipientItem = BaseDetailItem & {\n type: DetailItemType.FUNDS_RECIPIENT;\n amount: bigint;\n maxDecimals: number;\n symbol: string;\n};\n\nexport type TextItem = BaseDetailItem & {\n type: DetailItemType.TEXT;\n value: string;\n alignment: 'vertical' | 'horizontal';\n};\n\nexport type AddressItem = BaseDetailItem & {\n type: DetailItemType.ADDRESS;\n value: string;\n};\n\nexport type AddressListItem = BaseDetailItem & {\n type: DetailItemType.ADDRESS_LIST;\n value: string[];\n};\n\nexport type NodeIDItem = BaseDetailItem & {\n type: DetailItemType.NODE_ID;\n value: string;\n};\n\nexport type CurrencyItem = BaseDetailItem & {\n type: DetailItemType.CURRENCY;\n value: bigint;\n maxDecimals: number;\n symbol: string;\n};\n\nexport type DataItem = BaseDetailItem & {\n type: DetailItemType.DATA;\n value: string;\n};\n\nexport type DateItem = BaseDetailItem & {\n type: DetailItemType.DATE;\n value: string;\n};\n\nexport type LinkItemValue = { url: string; name?: string; icon?: string };\n\nexport type LinkItem = BaseDetailItem & {\n type: DetailItemType.LINK;\n value: LinkItemValue;\n};\n\nexport type DetailItem =\n | string\n | TextItem\n | AddressItem\n | AddressListItem\n | NodeIDItem\n | CurrencyItem\n | DataItem\n | DateItem\n | LinkItem\n | FundsRecipientItem;\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 details: DetailSection[];\n networkFeeSelector?: boolean;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n isSimulationSuccessful?: boolean;\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 BitcoinExecuteTxData = {\n to: string;\n amount: number;\n feeRate: number;\n fee: number;\n gasLimit: number;\n balance: TokenWithBalanceBTC;\n inputs: BitcoinInputUTXO[];\n outputs: BitcoinOutputUTXO[];\n};\n\nexport type BitcoingSignTxData = {\n inputs: BitcoinInputUTXO[];\n outputs: BitcoinOutputUTXO[];\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.SOLANA_SIGN_AND_SEND_TRANSACTION;\n account: string;\n data: string; // Base-64 encoded \"Wire Transaction\"\n }\n | {\n type: RpcMethod.SOLANA_SIGN_TRANSACTION;\n account: string;\n data: string; // Base-64 encoded \"Wire Transaction\"\n }\n | {\n type: RpcMethod.SOLANA_SIGN_MESSAGE;\n account: string;\n data: string; // Base-64 encoded message\n }\n | {\n type: RpcMethod.BITCOIN_SEND_TRANSACTION;\n account: string;\n data: BitcoinExecuteTxData;\n }\n | {\n type: RpcMethod.BITCOIN_SIGN_TRANSACTION;\n account: string;\n data: BitcoingSignTxData;\n }\n | SigningData_EthSendTx\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 externalIndices?: number[];\n internalIndices?: number[];\n }\n | {\n type: RpcMethod.AVALANCHE_SIGN_TRANSACTION;\n unsignedTxJson: string;\n data: Avalanche.Tx;\n vm: 'EVM' | 'AVM' | 'PVM';\n ownSignatureIndices: [number, number][];\n }\n | {\n type: RpcMethod.HVM_SIGN_TRANSACTION;\n data: {\n abi: VMABI;\n txPayload: TransactionPayload;\n };\n };\n\nexport type SigningData_EthSendTx = {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n data: TransactionRequest;\n};\n\nexport type EvmTxBatchUpdateFn = (\n data: { maxFeeRate?: bigint; maxTipRate?: bigint },\n txIndex: number,\n) => {\n displayData: DisplayData;\n signingRequests: {\n displayData: DisplayData;\n signingData: SigningData_EthSendTx;\n }[];\n};\n\nexport type EvmTxUpdateFn = (data: {\n maxFeeRate?: bigint;\n maxTipRate?: bigint;\n approvalLimit?: Hex; // as hexadecimal, 0x-prefixed\n}) => { displayData: DisplayData; signingData: SigningData_EthSendTx };\n\nexport type BtcTxUpdateFn = (data: { feeRate?: number }) => {\n displayData: DisplayData;\n signingData: Extract<SigningData, { type: RpcMethod.BITCOIN_SEND_TRANSACTION }>;\n};\n\nexport type SigningRequest<Data = SigningData> = {\n displayData: DisplayData;\n signingData: Data;\n updateTx?: EvmTxUpdateFn | BtcTxUpdateFn;\n};\n\nexport type ApprovalParams = {\n request: RpcRequest;\n} & SigningRequest;\n\nexport type BatchApprovalParams = {\n request: RpcRequest;\n signingRequests: SigningRequest<SigningData_EthSendTx>[];\n displayData: DisplayData;\n updateTx: EvmTxBatchUpdateFn;\n};\n\nexport type RequestPublicKeyParams = {\n secretId: string;\n curve: 'secp256k1' | 'ed25519';\n derivationPath?: string;\n};\n\n/**\n * We want to accept both a signed data (tx/message) and a tx hash as a response\n * coming in from the client apps, hence the XORs here.\n *\n * The reason we need to support both is because extension allows importing\n * external software wallets, such as Fireblocks or other apps that support\n * the WalletConnect protocol.\n *\n * My experience is that WalletConnect apps rarely, if ever, support\n * \"eth_signTransaction\" requests and more often only allow sending\n * \"eth_sendTransaction\" calls, which means that all we'll get in response\n * from them is the transaction hash (not a signed tx).\n */\ntype SignedData = { signedData: string };\ntype BroadcastedTx = { txHash: string };\n\nexport type SigningResult = SignedData | BroadcastedTx;\n\nexport type ApprovalResponse =\n | {\n error: RpcError;\n }\n | SigningResult;\n\nexport type BatchApprovalResponse =\n | { error: RpcError }\n | {\n result: SignedData[];\n };\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n requestPublicKey: (params: RequestPublicKeyParams) => Promise<string>;\n onTransactionConfirmed: (txHash: Hex, requestId: string) => void;\n onTransactionReverted: (txHash: Hex, requestId: string) => void;\n}\n\nexport interface BatchApprovalController extends ApprovalController {\n requestBatchApproval: (params: BatchApprovalParams) => Promise<BatchApprovalResponse>;\n}\n"]}