@avalabs/vm-module-types 0.9.0 → 0.11.0
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/balance.d.cts +2 -1
- package/dist/balance.d.ts +2 -1
- package/dist/chunk-4OOCVJIU.js +5 -0
- package/dist/chunk-4OOCVJIU.js.map +1 -0
- package/dist/chunk-6I6K3HIC.cjs +9 -0
- package/dist/chunk-6I6K3HIC.cjs.map +1 -0
- package/dist/coingecko.d.cts +4 -4
- package/dist/coingecko.d.ts +4 -4
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rpc.cjs +4 -4
- package/dist/rpc.d.cts +20 -4
- package/dist/rpc.d.ts +20 -4
- package/dist/rpc.js +1 -1
- package/package.json +11 -11
- package/dist/chunk-CMFKXC63.cjs +0 -9
- package/dist/chunk-CMFKXC63.cjs.map +0 -1
- package/dist/chunk-LJDGVTTJ.js +0 -5
- package/dist/chunk-LJDGVTTJ.js.map +0 -1
package/dist/balance.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Network, Storage } from './common.cjs';
|
|
2
2
|
import { Error } from './error.cjs';
|
|
3
|
-
import {
|
|
3
|
+
import { TokenType, NetworkContractToken, NetworkToken } from './token.cjs';
|
|
4
4
|
import { PChainBalance, XChainBalances } from '@avalabs/glacier-sdk';
|
|
5
5
|
|
|
6
6
|
type GetBalancesParams = {
|
|
7
7
|
addresses: string[];
|
|
8
8
|
network: Network;
|
|
9
|
+
tokenTypes?: TokenType[];
|
|
9
10
|
customTokens?: NetworkContractToken[];
|
|
10
11
|
currency: string;
|
|
11
12
|
storage?: Storage;
|
package/dist/balance.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Network, Storage } from './common.js';
|
|
2
2
|
import { Error } from './error.js';
|
|
3
|
-
import {
|
|
3
|
+
import { TokenType, NetworkContractToken, NetworkToken } from './token.js';
|
|
4
4
|
import { PChainBalance, XChainBalances } from '@avalabs/glacier-sdk';
|
|
5
5
|
|
|
6
6
|
type GetBalancesParams = {
|
|
7
7
|
addresses: string[];
|
|
8
8
|
network: Network;
|
|
9
|
+
tokenTypes?: TokenType[];
|
|
9
10
|
customTokens?: NetworkContractToken[];
|
|
10
11
|
currency: string;
|
|
11
12
|
storage?: Storage;
|
|
@@ -0,0 +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.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))(n||{}),i=(e=>(e.TEXT="text",e.ADDRESS="address",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||{});
|
|
2
|
+
|
|
3
|
+
export { n as a, i as b, r as c };
|
|
4
|
+
//# sourceMappingURL=out.js.map
|
|
5
|
+
//# sourceMappingURL=chunk-4OOCVJIU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","DetailItemType","AlertType"],"mappings":"AAOO,IAAKA,OAEVA,EAAA,yBAA2B,0BAC3BA,EAAA,yBAA2B,0BAG3BA,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,4BAC7BA,EAAA,2BAA6B,4BAjBnBA,OAAA,IA4EAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,QAAU,SACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,iBAClBA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OARGA,OAAA,IA8FAC,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';\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 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\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 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 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 | 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 disclaimer?: string;\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.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 | {\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 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\nexport type EvmTxUpdateFn = (data: {\n maxFeeRate?: bigint;\n maxTipRate?: bigint;\n approvalLimit?: Hex; // as hexadecimal, 0x-prefixed\n}) => { displayData: DisplayData; signingData: Extract<SigningData, { type: RpcMethod.ETH_SEND_TRANSACTION }> };\n\nexport type BtcTxUpdateFn = (data: { feeRate?: number }) => {\n displayData: DisplayData;\n signingData: Extract<SigningData, { type: RpcMethod.BITCOIN_SEND_TRANSACTION }>;\n};\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n updateTx?: EvmTxUpdateFn | BtcTxUpdateFn;\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 */\nexport type SigningResult = { signedData: string } | { txHash: string };\n\nexport type ApprovalResponse =\n | {\n error: RpcError;\n }\n | SigningResult;\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex, requestId: string) => void;\n onTransactionReverted: (txHash: Hex, requestId: string) => void;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var n=(t=>(t.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",t.BITCOIN_SIGN_TRANSACTION="bitcoin_signTransaction",t.ETH_SEND_TRANSACTION="eth_sendTransaction",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))(n||{}),i=(e=>(e.TEXT="text",e.ADDRESS="address",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||{});
|
|
4
|
+
|
|
5
|
+
exports.a = n;
|
|
6
|
+
exports.b = i;
|
|
7
|
+
exports.c = r;
|
|
8
|
+
//# sourceMappingURL=out.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-6I6K3HIC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","DetailItemType","AlertType"],"mappings":"AAOO,IAAKA,OAEVA,EAAA,yBAA2B,0BAC3BA,EAAA,yBAA2B,0BAG3BA,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,4BAC7BA,EAAA,2BAA6B,4BAjBnBA,OAAA,IA4EAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,QAAU,SACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,iBAClBA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OARGA,OAAA,IA8FAC,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';\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 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\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 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 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 | 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 disclaimer?: string;\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.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 | {\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 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\nexport type EvmTxUpdateFn = (data: {\n maxFeeRate?: bigint;\n maxTipRate?: bigint;\n approvalLimit?: Hex; // as hexadecimal, 0x-prefixed\n}) => { displayData: DisplayData; signingData: Extract<SigningData, { type: RpcMethod.ETH_SEND_TRANSACTION }> };\n\nexport type BtcTxUpdateFn = (data: { feeRate?: number }) => {\n displayData: DisplayData;\n signingData: Extract<SigningData, { type: RpcMethod.BITCOIN_SEND_TRANSACTION }>;\n};\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n updateTx?: EvmTxUpdateFn | BtcTxUpdateFn;\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 */\nexport type SigningResult = { signedData: string } | { txHash: string };\n\nexport type ApprovalResponse =\n | {\n error: RpcError;\n }\n | SigningResult;\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex, requestId: string) => void;\n onTransactionReverted: (txHash: Hex, requestId: string) => void;\n}\n"]}
|
package/dist/coingecko.d.cts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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/coingecko.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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 chunkJQSZ7QKK_cjs = require('./chunk-JQSZ7QKK.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk6I6K3HIC_cjs = require('./chunk-6I6K3HIC.cjs');
|
|
6
6
|
var chunkIQNJXPS3_cjs = require('./chunk-IQNJXPS3.cjs');
|
|
7
7
|
var chunk2KGTZTXY_cjs = require('./chunk-2KGTZTXY.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
|
|
26
|
+
get: function () { return chunk6I6K3HIC_cjs.c; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, 'DetailItemType', {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk6I6K3HIC_cjs.b; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, 'RpcMethod', {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk6I6K3HIC_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 } from './network-fee.cjs';
|
|
8
|
-
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem,
|
|
8
|
+
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem, BitcoinExecuteTxData, BitcoingSignTxData, BtcTxUpdateFn, CurrencyItem, DappInfo, DataItem, DateItem, DetailItem, DetailItemType, DetailSection, DisplayData, EvmTxUpdateFn, FundsRecipientItem, LinkItem, LinkItemValue, MessageTypeProperty, MessageTypes, NodeIDItem, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult, TextItem, TypedData, TypedDataV1 } from './rpc.cjs';
|
|
9
9
|
export { ERC1155Token, ERC20Token, ERC721Token, NONERCToken, NetworkContractToken, NetworkToken, TokenType } from './token.cjs';
|
|
10
10
|
export { GetTransactionHistory, PChainTransactionType, Transaction, TransactionHistoryResponse, TransactionType, TxToken, XChainTransactionType } from './transaction-history.cjs';
|
|
11
11
|
export { BalanceChange, TokenApproval, TokenApprovals, TokenDiff, TokenDiffItem } from './transaction-simulation.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 } from './network-fee.js';
|
|
8
|
-
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem,
|
|
8
|
+
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem, BitcoinExecuteTxData, BitcoingSignTxData, BtcTxUpdateFn, CurrencyItem, DappInfo, DataItem, DateItem, DetailItem, DetailItemType, DetailSection, DisplayData, EvmTxUpdateFn, FundsRecipientItem, LinkItem, LinkItemValue, MessageTypeProperty, MessageTypes, NodeIDItem, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult, TextItem, TypedData, TypedDataV1 } from './rpc.js';
|
|
9
9
|
export { ERC1155Token, ERC20Token, ERC721Token, NONERCToken, NetworkContractToken, NetworkToken, TokenType } from './token.js';
|
|
10
10
|
export { GetTransactionHistory, PChainTransactionType, Transaction, TransactionHistoryResponse, TransactionType, TxToken, XChainTransactionType } from './transaction-history.js';
|
|
11
11
|
export { BalanceChange, TokenApproval, TokenApprovals, TokenDiff, TokenDiffItem } from './transaction-simulation.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './chunk-7U2R34EQ.js';
|
|
2
2
|
export { a as EventNames } from './chunk-4ZJ3LCH6.js';
|
|
3
|
-
export { c as AlertType, b as DetailItemType, a as RpcMethod } from './chunk-
|
|
3
|
+
export { c as AlertType, b as DetailItemType, a as RpcMethod } from './chunk-4OOCVJIU.js';
|
|
4
4
|
export { a as TxType } from './chunk-2SJQLDBB.js';
|
|
5
5
|
export { a as TokenType } from './chunk-7Y6UGMPZ.js';
|
|
6
6
|
export { b as PChainTransactionType, a as TransactionType, c as XChainTransactionType } from './chunk-7JLXTNPE.js';
|
package/dist/rpc.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6I6K3HIC_cjs = require('./chunk-6I6K3HIC.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 chunk6I6K3HIC_cjs.c; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, 'DetailItemType', {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk6I6K3HIC_cjs.b; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, 'RpcMethod', {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk6I6K3HIC_cjs.a; }
|
|
18
18
|
});
|
|
19
19
|
//# sourceMappingURL=out.js.map
|
|
20
20
|
//# sourceMappingURL=rpc.cjs.map
|
package/dist/rpc.d.cts
CHANGED
|
@@ -10,6 +10,7 @@ import '@avalabs/glacier-sdk';
|
|
|
10
10
|
|
|
11
11
|
declare enum RpcMethod {
|
|
12
12
|
BITCOIN_SEND_TRANSACTION = "bitcoin_sendTransaction",
|
|
13
|
+
BITCOIN_SIGN_TRANSACTION = "bitcoin_signTransaction",
|
|
13
14
|
ETH_SEND_TRANSACTION = "eth_sendTransaction",
|
|
14
15
|
SIGN_TYPED_DATA_V3 = "eth_signTypedData_v3",
|
|
15
16
|
SIGN_TYPED_DATA_V4 = "eth_signTypedData_v4",
|
|
@@ -72,10 +73,17 @@ declare enum DetailItemType {
|
|
|
72
73
|
ADDRESS = "address",
|
|
73
74
|
NODE_ID = "nodeID",
|
|
74
75
|
CURRENCY = "currency",
|
|
76
|
+
FUNDS_RECIPIENT = "fundsRecipient",
|
|
75
77
|
DATA = "data",
|
|
76
78
|
DATE = "date",
|
|
77
79
|
LINK = "link"
|
|
78
80
|
}
|
|
81
|
+
type FundsRecipientItem = BaseDetailItem & {
|
|
82
|
+
type: DetailItemType.FUNDS_RECIPIENT;
|
|
83
|
+
amount: bigint;
|
|
84
|
+
maxDecimals: number;
|
|
85
|
+
symbol: string;
|
|
86
|
+
};
|
|
79
87
|
type TextItem = BaseDetailItem & {
|
|
80
88
|
type: DetailItemType.TEXT;
|
|
81
89
|
value: string;
|
|
@@ -112,7 +120,7 @@ type LinkItem = BaseDetailItem & {
|
|
|
112
120
|
type: DetailItemType.LINK;
|
|
113
121
|
value: LinkItemValue;
|
|
114
122
|
};
|
|
115
|
-
type DetailItem = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem;
|
|
123
|
+
type DetailItem = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem | FundsRecipientItem;
|
|
116
124
|
type DisplayData = {
|
|
117
125
|
title: string;
|
|
118
126
|
dAppInfo?: {
|
|
@@ -152,7 +160,7 @@ type Alert = {
|
|
|
152
160
|
type: AlertType;
|
|
153
161
|
details: AlertDetails;
|
|
154
162
|
};
|
|
155
|
-
type
|
|
163
|
+
type BitcoinExecuteTxData = {
|
|
156
164
|
to: string;
|
|
157
165
|
amount: number;
|
|
158
166
|
feeRate: number;
|
|
@@ -162,10 +170,18 @@ type BitcoinTransactionData = {
|
|
|
162
170
|
inputs: BitcoinInputUTXO[];
|
|
163
171
|
outputs: BitcoinOutputUTXO[];
|
|
164
172
|
};
|
|
173
|
+
type BitcoingSignTxData = {
|
|
174
|
+
inputs: BitcoinInputUTXO[];
|
|
175
|
+
outputs: BitcoinOutputUTXO[];
|
|
176
|
+
};
|
|
165
177
|
type SigningData = {
|
|
166
178
|
type: RpcMethod.BITCOIN_SEND_TRANSACTION;
|
|
167
179
|
account: string;
|
|
168
|
-
data:
|
|
180
|
+
data: BitcoinExecuteTxData;
|
|
181
|
+
} | {
|
|
182
|
+
type: RpcMethod.BITCOIN_SIGN_TRANSACTION;
|
|
183
|
+
account: string;
|
|
184
|
+
data: BitcoingSignTxData;
|
|
169
185
|
} | {
|
|
170
186
|
type: RpcMethod.ETH_SEND_TRANSACTION;
|
|
171
187
|
account: string;
|
|
@@ -251,4 +267,4 @@ interface ApprovalController {
|
|
|
251
267
|
onTransactionReverted: (txHash: Hex, requestId: string) => void;
|
|
252
268
|
}
|
|
253
269
|
|
|
254
|
-
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem,
|
|
270
|
+
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem, BitcoinExecuteTxData, BitcoingSignTxData, BtcTxUpdateFn, CurrencyItem, DappInfo, DataItem, DateItem, DetailItem, DetailItemType, DetailSection, DisplayData, EvmTxUpdateFn, FundsRecipientItem, LinkItem, LinkItemValue, MessageTypeProperty, MessageTypes, NodeIDItem, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult, TextItem, TypedData, TypedDataV1 };
|
package/dist/rpc.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import '@avalabs/glacier-sdk';
|
|
|
10
10
|
|
|
11
11
|
declare enum RpcMethod {
|
|
12
12
|
BITCOIN_SEND_TRANSACTION = "bitcoin_sendTransaction",
|
|
13
|
+
BITCOIN_SIGN_TRANSACTION = "bitcoin_signTransaction",
|
|
13
14
|
ETH_SEND_TRANSACTION = "eth_sendTransaction",
|
|
14
15
|
SIGN_TYPED_DATA_V3 = "eth_signTypedData_v3",
|
|
15
16
|
SIGN_TYPED_DATA_V4 = "eth_signTypedData_v4",
|
|
@@ -72,10 +73,17 @@ declare enum DetailItemType {
|
|
|
72
73
|
ADDRESS = "address",
|
|
73
74
|
NODE_ID = "nodeID",
|
|
74
75
|
CURRENCY = "currency",
|
|
76
|
+
FUNDS_RECIPIENT = "fundsRecipient",
|
|
75
77
|
DATA = "data",
|
|
76
78
|
DATE = "date",
|
|
77
79
|
LINK = "link"
|
|
78
80
|
}
|
|
81
|
+
type FundsRecipientItem = BaseDetailItem & {
|
|
82
|
+
type: DetailItemType.FUNDS_RECIPIENT;
|
|
83
|
+
amount: bigint;
|
|
84
|
+
maxDecimals: number;
|
|
85
|
+
symbol: string;
|
|
86
|
+
};
|
|
79
87
|
type TextItem = BaseDetailItem & {
|
|
80
88
|
type: DetailItemType.TEXT;
|
|
81
89
|
value: string;
|
|
@@ -112,7 +120,7 @@ type LinkItem = BaseDetailItem & {
|
|
|
112
120
|
type: DetailItemType.LINK;
|
|
113
121
|
value: LinkItemValue;
|
|
114
122
|
};
|
|
115
|
-
type DetailItem = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem;
|
|
123
|
+
type DetailItem = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem | FundsRecipientItem;
|
|
116
124
|
type DisplayData = {
|
|
117
125
|
title: string;
|
|
118
126
|
dAppInfo?: {
|
|
@@ -152,7 +160,7 @@ type Alert = {
|
|
|
152
160
|
type: AlertType;
|
|
153
161
|
details: AlertDetails;
|
|
154
162
|
};
|
|
155
|
-
type
|
|
163
|
+
type BitcoinExecuteTxData = {
|
|
156
164
|
to: string;
|
|
157
165
|
amount: number;
|
|
158
166
|
feeRate: number;
|
|
@@ -162,10 +170,18 @@ type BitcoinTransactionData = {
|
|
|
162
170
|
inputs: BitcoinInputUTXO[];
|
|
163
171
|
outputs: BitcoinOutputUTXO[];
|
|
164
172
|
};
|
|
173
|
+
type BitcoingSignTxData = {
|
|
174
|
+
inputs: BitcoinInputUTXO[];
|
|
175
|
+
outputs: BitcoinOutputUTXO[];
|
|
176
|
+
};
|
|
165
177
|
type SigningData = {
|
|
166
178
|
type: RpcMethod.BITCOIN_SEND_TRANSACTION;
|
|
167
179
|
account: string;
|
|
168
|
-
data:
|
|
180
|
+
data: BitcoinExecuteTxData;
|
|
181
|
+
} | {
|
|
182
|
+
type: RpcMethod.BITCOIN_SIGN_TRANSACTION;
|
|
183
|
+
account: string;
|
|
184
|
+
data: BitcoingSignTxData;
|
|
169
185
|
} | {
|
|
170
186
|
type: RpcMethod.ETH_SEND_TRANSACTION;
|
|
171
187
|
account: string;
|
|
@@ -251,4 +267,4 @@ interface ApprovalController {
|
|
|
251
267
|
onTransactionReverted: (txHash: Hex, requestId: string) => void;
|
|
252
268
|
}
|
|
253
269
|
|
|
254
|
-
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem,
|
|
270
|
+
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem, BitcoinExecuteTxData, BitcoingSignTxData, BtcTxUpdateFn, CurrencyItem, DappInfo, DataItem, DateItem, DetailItem, DetailItemType, DetailSection, DisplayData, EvmTxUpdateFn, FundsRecipientItem, LinkItem, LinkItemValue, MessageTypeProperty, MessageTypes, NodeIDItem, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult, TextItem, TypedData, TypedDataV1 };
|
package/dist/rpc.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avalabs/vm-module-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -10,26 +10,26 @@
|
|
|
10
10
|
"manifest.json"
|
|
11
11
|
],
|
|
12
12
|
"license": "Limited Ecosystem License",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsup",
|
|
15
|
+
"lint": "eslint \"src/**/*.ts\""
|
|
16
|
+
},
|
|
13
17
|
"dependencies": {
|
|
14
|
-
"@avalabs/core-wallets-sdk": "3.1.0-alpha.
|
|
15
|
-
"@avalabs/glacier-sdk": "3.1.0-alpha.
|
|
18
|
+
"@avalabs/core-wallets-sdk": "3.1.0-alpha.8",
|
|
19
|
+
"@avalabs/glacier-sdk": "3.1.0-alpha.8",
|
|
16
20
|
"zod": "3.23.8",
|
|
17
21
|
"@metamask/rpc-errors": "6.3.0",
|
|
18
22
|
"bitcoinjs-lib": "5.2.0"
|
|
19
23
|
},
|
|
20
24
|
"devDependencies": {
|
|
21
25
|
"tsup": "7.2.0",
|
|
26
|
+
"@internal/tsup-config": "workspace:*",
|
|
22
27
|
"bn.js": "5.2.1",
|
|
23
28
|
"@types/bn.js": "5.1.5",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"eslint-config-custom": "0.0.1"
|
|
29
|
+
"eslint-config-custom": "workspace:*",
|
|
30
|
+
"ethers": "6.8.1"
|
|
27
31
|
},
|
|
28
32
|
"peerDependencies": {
|
|
29
33
|
"ethers": "6.8.1"
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tsup",
|
|
33
|
-
"lint": "eslint \"src/**/*.ts\""
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|
package/dist/chunk-CMFKXC63.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var n=(e=>(e.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",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.AVALANCHE_SIGN_TRANSACTION="avalanche_signTransaction",e))(n||{}),r=(t=>(t.TEXT="text",t.ADDRESS="address",t.NODE_ID="nodeID",t.CURRENCY="currency",t.DATA="data",t.DATE="date",t.LINK="link",t))(r||{}),i=(a=>(a.WARNING="Warning",a.DANGER="Danger",a.INFO="Info",a))(i||{});
|
|
4
|
-
|
|
5
|
-
exports.a = n;
|
|
6
|
-
exports.b = r;
|
|
7
|
-
exports.c = i;
|
|
8
|
-
//# sourceMappingURL=out.js.map
|
|
9
|
-
//# sourceMappingURL=chunk-CMFKXC63.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","DetailItemType","AlertType"],"mappings":"AAOO,IAAKA,OAEVA,EAAA,yBAA2B,0BAG3BA,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,4BAC7BA,EAAA,2BAA6B,4BAhBnBA,OAAA,IA2EAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,QAAU,SACVA,EAAA,SAAW,WACXA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OAPGA,OAAA,IA0EAC,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';\n\nexport enum RpcMethod {\n /* BTC */\n BITCOIN_SEND_TRANSACTION = 'bitcoin_sendTransaction',\n\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 AVALANCHE_SIGN_TRANSACTION = 'avalanche_signTransaction',\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 NODE_ID = 'nodeID',\n CURRENCY = 'currency',\n DATA = 'data',\n DATE = 'date',\n LINK = 'link',\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 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 = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem;\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 disclaimer?: string;\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 BitcoinTransactionData = {\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 SigningData =\n | {\n type: RpcMethod.BITCOIN_SEND_TRANSACTION;\n account: string;\n data: BitcoinTransactionData;\n }\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 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\nexport type EvmTxUpdateFn = (data: {\n maxFeeRate?: bigint;\n maxTipRate?: bigint;\n approvalLimit?: Hex; // as hexadecimal, 0x-prefixed\n}) => { displayData: DisplayData; signingData: Extract<SigningData, { type: RpcMethod.ETH_SEND_TRANSACTION }> };\n\nexport type BtcTxUpdateFn = (data: { feeRate?: number }) => {\n displayData: DisplayData;\n signingData: Extract<SigningData, { type: RpcMethod.BITCOIN_SEND_TRANSACTION }>;\n};\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n updateTx?: EvmTxUpdateFn | BtcTxUpdateFn;\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 */\nexport type SigningResult = { signedData: string } | { txHash: string };\n\nexport type ApprovalResponse =\n | {\n error: RpcError;\n }\n | SigningResult;\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex, requestId: string) => void;\n onTransactionReverted: (txHash: Hex, requestId: string) => void;\n}\n"]}
|
package/dist/chunk-LJDGVTTJ.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var n=(e=>(e.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",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.AVALANCHE_SIGN_TRANSACTION="avalanche_signTransaction",e))(n||{}),r=(t=>(t.TEXT="text",t.ADDRESS="address",t.NODE_ID="nodeID",t.CURRENCY="currency",t.DATA="data",t.DATE="date",t.LINK="link",t))(r||{}),i=(a=>(a.WARNING="Warning",a.DANGER="Danger",a.INFO="Info",a))(i||{});
|
|
2
|
-
|
|
3
|
-
export { n as a, r as b, i as c };
|
|
4
|
-
//# sourceMappingURL=out.js.map
|
|
5
|
-
//# sourceMappingURL=chunk-LJDGVTTJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","DetailItemType","AlertType"],"mappings":"AAOO,IAAKA,OAEVA,EAAA,yBAA2B,0BAG3BA,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,4BAC7BA,EAAA,2BAA6B,4BAhBnBA,OAAA,IA2EAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,QAAU,SACVA,EAAA,SAAW,WACXA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OAPGA,OAAA,IA0EAC,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';\n\nexport enum RpcMethod {\n /* BTC */\n BITCOIN_SEND_TRANSACTION = 'bitcoin_sendTransaction',\n\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 AVALANCHE_SIGN_TRANSACTION = 'avalanche_signTransaction',\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 NODE_ID = 'nodeID',\n CURRENCY = 'currency',\n DATA = 'data',\n DATE = 'date',\n LINK = 'link',\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 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 = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem | LinkItem;\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 disclaimer?: string;\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 BitcoinTransactionData = {\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 SigningData =\n | {\n type: RpcMethod.BITCOIN_SEND_TRANSACTION;\n account: string;\n data: BitcoinTransactionData;\n }\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 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\nexport type EvmTxUpdateFn = (data: {\n maxFeeRate?: bigint;\n maxTipRate?: bigint;\n approvalLimit?: Hex; // as hexadecimal, 0x-prefixed\n}) => { displayData: DisplayData; signingData: Extract<SigningData, { type: RpcMethod.ETH_SEND_TRANSACTION }> };\n\nexport type BtcTxUpdateFn = (data: { feeRate?: number }) => {\n displayData: DisplayData;\n signingData: Extract<SigningData, { type: RpcMethod.BITCOIN_SEND_TRANSACTION }>;\n};\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n updateTx?: EvmTxUpdateFn | BtcTxUpdateFn;\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 */\nexport type SigningResult = { signedData: string } | { txHash: string };\n\nexport type ApprovalResponse =\n | {\n error: RpcError;\n }\n | SigningResult;\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex, requestId: string) => void;\n onTransactionReverted: (txHash: Hex, requestId: string) => void;\n}\n"]}
|