@avalabs/vm-module-types 0.1.11 → 0.3.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/chunk-4ZJ3LCH6.js +5 -0
- package/dist/chunk-4ZJ3LCH6.js.map +1 -0
- package/dist/chunk-JQSZ7QKK.cjs +7 -0
- package/dist/chunk-JQSZ7QKK.cjs.map +1 -0
- package/dist/chunk-LWDTKZK6.js +5 -0
- package/dist/chunk-LWDTKZK6.js.map +1 -0
- package/dist/chunk-LYK7OEFS.cjs +9 -0
- package/dist/chunk-LYK7OEFS.cjs.map +1 -0
- package/dist/coingecko.d.cts +4 -4
- package/dist/coingecko.d.ts +4 -4
- package/dist/index.cjs +12 -3
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/module.d.cts +0 -1
- package/dist/module.d.ts +0 -1
- package/dist/provider.cjs +12 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +62 -0
- package/dist/provider.d.ts +62 -0
- package/dist/provider.js +3 -0
- package/dist/provider.js.map +1 -0
- package/dist/rpc.cjs +7 -3
- package/dist/rpc.d.cts +46 -14
- package/dist/rpc.d.ts +46 -14
- package/dist/rpc.js +1 -1
- package/package.json +2 -1
- package/dist/chunk-7Z4WA2P6.cjs +0 -8
- package/dist/chunk-7Z4WA2P6.cjs.map +0 -1
- package/dist/chunk-ZVCTHYAU.js +0 -5
- package/dist/chunk-ZVCTHYAU.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var t=(e=>(e.CORE_WALLET_ANNOUNCE_PROVIDER="core-wallet:announceProvider",e.CORE_WALLET_REQUEST_PROVIDER="core-wallet:requestProvider",e.EIP6963_ANNOUNCE_PROVIDER="eip6963:announceProvider",e.EIP6963_REQUEST_PROVIDER="eip6963:requestProvider",e))(t||{});
|
|
2
|
+
|
|
3
|
+
export { t as a };
|
|
4
|
+
//# sourceMappingURL=out.js.map
|
|
5
|
+
//# sourceMappingURL=chunk-4ZJ3LCH6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/provider.ts"],"names":["EventNames"],"mappings":"AA4BO,IAAKA,OACVA,EAAA,8BAAgC,+BAChCA,EAAA,6BAA+B,8BAC/BA,EAAA,0BAA4B,2BAC5BA,EAAA,yBAA2B,0BAJjBA,OAAA","sourcesContent":["import type { Eip1193Provider } from 'ethers';\nimport type EventEmitter from 'events';\n\nexport interface ChainChangedEventData {\n chainId: string;\n networkVersion: string;\n}\n\nexport type AccountsChangedEventData = string[];\n\nexport interface UnlockStateChangedEventData {\n accounts: string[];\n isUnlocked: boolean;\n}\n\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n icon: string;\n rdns: string;\n description: string;\n}\n\nexport interface EIP6963ProviderDetail {\n info: EIP6963ProviderInfo;\n provider: Eip1193Provider;\n}\n\nexport enum EventNames {\n CORE_WALLET_ANNOUNCE_PROVIDER = 'core-wallet:announceProvider',\n CORE_WALLET_REQUEST_PROVIDER = 'core-wallet:requestProvider',\n EIP6963_ANNOUNCE_PROVIDER = 'eip6963:announceProvider',\n EIP6963_REQUEST_PROVIDER = 'eip6963:requestProvider',\n}\n\nexport interface DomainMetadata {\n domain: string;\n name?: string;\n icon?: string;\n tabId?: number;\n}\n\ninterface JsonRpcRequestPayloadBase<Method extends string> {\n readonly id: string;\n readonly method: Method;\n readonly site?: DomainMetadata;\n readonly tabId?: number;\n}\n\ninterface JsonRpcRequestPayloadWithParams<Method extends string, Params = unknown>\n extends JsonRpcRequestPayloadBase<Method> {\n readonly params: Params;\n}\n\ninterface JsonRpcRequestPayloadWithoutParams<Method extends string> extends JsonRpcRequestPayloadBase<Method> {\n readonly params?: never;\n}\n\nexport type JsonRpcRequestPayload<Method extends string, Params = unknown> = Params extends undefined\n ? JsonRpcRequestPayloadWithoutParams<Method>\n : JsonRpcRequestPayloadWithParams<Method, Params>;\n\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\nexport interface ChainAgnosticProvider extends EventEmitter {\n request({\n data,\n sessionId,\n chainId,\n }: {\n data: PartialBy<JsonRpcRequestPayload<string>, 'id' | 'params'>;\n sessionId: string;\n chainId: string | null;\n }): Promise<unknown>;\n\n subscribeToMessage(callback: ({ method, params }: { method: string; params: unknown }) => void): void;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var t=(e=>(e.CORE_WALLET_ANNOUNCE_PROVIDER="core-wallet:announceProvider",e.CORE_WALLET_REQUEST_PROVIDER="core-wallet:requestProvider",e.EIP6963_ANNOUNCE_PROVIDER="eip6963:announceProvider",e.EIP6963_REQUEST_PROVIDER="eip6963:requestProvider",e))(t||{});
|
|
4
|
+
|
|
5
|
+
exports.a = t;
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=chunk-JQSZ7QKK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/provider.ts"],"names":["EventNames"],"mappings":"AA4BO,IAAKA,OACVA,EAAA,8BAAgC,+BAChCA,EAAA,6BAA+B,8BAC/BA,EAAA,0BAA4B,2BAC5BA,EAAA,yBAA2B,0BAJjBA,OAAA","sourcesContent":["import type { Eip1193Provider } from 'ethers';\nimport type EventEmitter from 'events';\n\nexport interface ChainChangedEventData {\n chainId: string;\n networkVersion: string;\n}\n\nexport type AccountsChangedEventData = string[];\n\nexport interface UnlockStateChangedEventData {\n accounts: string[];\n isUnlocked: boolean;\n}\n\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n icon: string;\n rdns: string;\n description: string;\n}\n\nexport interface EIP6963ProviderDetail {\n info: EIP6963ProviderInfo;\n provider: Eip1193Provider;\n}\n\nexport enum EventNames {\n CORE_WALLET_ANNOUNCE_PROVIDER = 'core-wallet:announceProvider',\n CORE_WALLET_REQUEST_PROVIDER = 'core-wallet:requestProvider',\n EIP6963_ANNOUNCE_PROVIDER = 'eip6963:announceProvider',\n EIP6963_REQUEST_PROVIDER = 'eip6963:requestProvider',\n}\n\nexport interface DomainMetadata {\n domain: string;\n name?: string;\n icon?: string;\n tabId?: number;\n}\n\ninterface JsonRpcRequestPayloadBase<Method extends string> {\n readonly id: string;\n readonly method: Method;\n readonly site?: DomainMetadata;\n readonly tabId?: number;\n}\n\ninterface JsonRpcRequestPayloadWithParams<Method extends string, Params = unknown>\n extends JsonRpcRequestPayloadBase<Method> {\n readonly params: Params;\n}\n\ninterface JsonRpcRequestPayloadWithoutParams<Method extends string> extends JsonRpcRequestPayloadBase<Method> {\n readonly params?: never;\n}\n\nexport type JsonRpcRequestPayload<Method extends string, Params = unknown> = Params extends undefined\n ? JsonRpcRequestPayloadWithoutParams<Method>\n : JsonRpcRequestPayloadWithParams<Method, Params>;\n\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\nexport interface ChainAgnosticProvider extends EventEmitter {\n request({\n data,\n sessionId,\n chainId,\n }: {\n data: PartialBy<JsonRpcRequestPayload<string>, 'id' | 'params'>;\n sessionId: string;\n chainId: string | null;\n }): Promise<unknown>;\n\n subscribeToMessage(callback: ({ method, params }: { method: string; params: unknown }) => void): void;\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
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))(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-LWDTKZK6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OANGA,OAAA,IAiEAC,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}\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 DetailItem = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem;\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};\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 ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\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) => void;\n onTransactionReverted: (txHash: Hex) => void;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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))(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-LYK7OEFS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OANGA,OAAA,IAiEAC,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}\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 DetailItem = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem;\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};\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 ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\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) => void;\n onTransactionReverted: (txHash: Hex) => 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
|
-
price?: number | null | undefined;
|
|
10
|
-
change24?: number | null | undefined;
|
|
11
9
|
marketCap?: number | null | undefined;
|
|
10
|
+
change24?: number | null | undefined;
|
|
12
11
|
vol24?: number | null | undefined;
|
|
13
|
-
}, {
|
|
14
12
|
price?: number | null | undefined;
|
|
15
|
-
|
|
13
|
+
}, {
|
|
16
14
|
marketCap?: number | null | undefined;
|
|
15
|
+
change24?: number | null | undefined;
|
|
17
16
|
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
|
-
price?: number | null | undefined;
|
|
10
|
-
change24?: number | null | undefined;
|
|
11
9
|
marketCap?: number | null | undefined;
|
|
10
|
+
change24?: number | null | undefined;
|
|
12
11
|
vol24?: number | null | undefined;
|
|
13
|
-
}, {
|
|
14
12
|
price?: number | null | undefined;
|
|
15
|
-
|
|
13
|
+
}, {
|
|
16
14
|
marketCap?: number | null | undefined;
|
|
15
|
+
change24?: number | null | undefined;
|
|
17
16
|
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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('./chunk-AILYKQEY.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkJQSZ7QKK_cjs = require('./chunk-JQSZ7QKK.cjs');
|
|
5
|
+
var chunkLYK7OEFS_cjs = require('./chunk-LYK7OEFS.cjs');
|
|
5
6
|
var chunkIQNJXPS3_cjs = require('./chunk-IQNJXPS3.cjs');
|
|
6
7
|
var chunk2KGTZTXY_cjs = require('./chunk-2KGTZTXY.cjs');
|
|
7
8
|
var chunkB6DAZDIA_cjs = require('./chunk-B6DAZDIA.cjs');
|
|
@@ -16,13 +17,21 @@ require('./chunk-OGQBQHLH.cjs');
|
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
Object.defineProperty(exports, 'EventNames', {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkJQSZ7QKK_cjs.a; }
|
|
23
|
+
});
|
|
19
24
|
Object.defineProperty(exports, 'AlertType', {
|
|
20
25
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkLYK7OEFS_cjs.c; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, 'DetailItemType', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkLYK7OEFS_cjs.b; }
|
|
22
31
|
});
|
|
23
32
|
Object.defineProperty(exports, 'RpcMethod', {
|
|
24
33
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkLYK7OEFS_cjs.a; }
|
|
26
35
|
});
|
|
27
36
|
Object.defineProperty(exports, 'TxType', {
|
|
28
37
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -5,14 +5,16 @@ export { Error } from './error.cjs';
|
|
|
5
5
|
export { Manifest, parseManifest } from './manifest.cjs';
|
|
6
6
|
export { Module } from './module.cjs';
|
|
7
7
|
export { NetworkFees } from './network-fee.cjs';
|
|
8
|
-
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BitcoinTransactionData, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult,
|
|
8
|
+
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem, BitcoinTransactionData, CurrencyItem, DappInfo, DataItem, DateItem, DetailItem, DetailItemType, DetailSection, DisplayData, 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';
|
|
12
12
|
export { BtcWalletPolicyDetails, GetAddressParams, GetAddressResponse, PubKeyType, WalletType } from './account.cjs';
|
|
13
13
|
export { AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, BaseTx, BlockchainDetails, ChainDetails, CreateChainTx, CreateSubnetTx, ExportImportTxDetails, ExportTx, ImportTx, RemoveSubnetValidatorTx, StakingDetails, SubnetDetails, TxDetails, TxType, VM } from './staking.cjs';
|
|
14
|
+
export { AccountsChangedEventData, ChainAgnosticProvider, ChainChangedEventData, DomainMetadata, EIP6963ProviderDetail, EIP6963ProviderInfo, EventNames, JsonRpcRequestPayload, PartialBy, UnlockStateChangedEventData } from './provider.cjs';
|
|
14
15
|
import 'zod';
|
|
15
16
|
import '@avalabs/glacier-sdk';
|
|
16
17
|
import '@avalabs/core-wallets-sdk';
|
|
17
18
|
import 'ethers';
|
|
18
19
|
import '@metamask/rpc-errors';
|
|
20
|
+
import 'events';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,14 +5,16 @@ export { Error } from './error.js';
|
|
|
5
5
|
export { Manifest, parseManifest } from './manifest.js';
|
|
6
6
|
export { Module } from './module.js';
|
|
7
7
|
export { NetworkFees } from './network-fee.js';
|
|
8
|
-
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BitcoinTransactionData, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult,
|
|
8
|
+
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem, BitcoinTransactionData, CurrencyItem, DappInfo, DataItem, DateItem, DetailItem, DetailItemType, DetailSection, DisplayData, 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';
|
|
12
12
|
export { BtcWalletPolicyDetails, GetAddressParams, GetAddressResponse, PubKeyType, WalletType } from './account.js';
|
|
13
13
|
export { AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, BaseTx, BlockchainDetails, ChainDetails, CreateChainTx, CreateSubnetTx, ExportImportTxDetails, ExportTx, ImportTx, RemoveSubnetValidatorTx, StakingDetails, SubnetDetails, TxDetails, TxType, VM } from './staking.js';
|
|
14
|
+
export { AccountsChangedEventData, ChainAgnosticProvider, ChainChangedEventData, DomainMetadata, EIP6963ProviderDetail, EIP6963ProviderInfo, EventNames, JsonRpcRequestPayload, PartialBy, UnlockStateChangedEventData } from './provider.js';
|
|
14
15
|
import 'zod';
|
|
15
16
|
import '@avalabs/glacier-sdk';
|
|
16
17
|
import '@avalabs/core-wallets-sdk';
|
|
17
18
|
import 'ethers';
|
|
18
19
|
import '@metamask/rpc-errors';
|
|
20
|
+
import 'events';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './chunk-7U2R34EQ.js';
|
|
2
|
-
export {
|
|
2
|
+
export { a as EventNames } from './chunk-4ZJ3LCH6.js';
|
|
3
|
+
export { c as AlertType, b as DetailItemType, a as RpcMethod } from './chunk-LWDTKZK6.js';
|
|
3
4
|
export { a as TxType } from './chunk-2SJQLDBB.js';
|
|
4
5
|
export { a as TokenType } from './chunk-7Y6UGMPZ.js';
|
|
5
6
|
export { b as PChainTransactionType, a as TransactionType, c as XChainTransactionType } from './chunk-7JLXTNPE.js';
|
package/dist/module.d.cts
CHANGED
|
@@ -13,7 +13,6 @@ import 'zod';
|
|
|
13
13
|
import 'ethers';
|
|
14
14
|
import '@metamask/rpc-errors';
|
|
15
15
|
import './transaction-simulation.cjs';
|
|
16
|
-
import './staking.cjs';
|
|
17
16
|
|
|
18
17
|
interface Module {
|
|
19
18
|
getProvider: (network: Network) => JsonRpcBatchInternal | BitcoinProvider | Avalanche.JsonRpcProvider;
|
package/dist/module.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ import 'zod';
|
|
|
13
13
|
import 'ethers';
|
|
14
14
|
import '@metamask/rpc-errors';
|
|
15
15
|
import './transaction-simulation.js';
|
|
16
|
-
import './staking.js';
|
|
17
16
|
|
|
18
17
|
interface Module {
|
|
19
18
|
getProvider: (network: Network) => JsonRpcBatchInternal | BitcoinProvider | Avalanche.JsonRpcProvider;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkJQSZ7QKK_cjs = require('./chunk-JQSZ7QKK.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'EventNames', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkJQSZ7QKK_cjs.a; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=provider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Eip1193Provider } from 'ethers';
|
|
2
|
+
import EventEmitter from 'events';
|
|
3
|
+
|
|
4
|
+
interface ChainChangedEventData {
|
|
5
|
+
chainId: string;
|
|
6
|
+
networkVersion: string;
|
|
7
|
+
}
|
|
8
|
+
type AccountsChangedEventData = string[];
|
|
9
|
+
interface UnlockStateChangedEventData {
|
|
10
|
+
accounts: string[];
|
|
11
|
+
isUnlocked: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface EIP6963ProviderInfo {
|
|
14
|
+
uuid: string;
|
|
15
|
+
name: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
rdns: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}
|
|
20
|
+
interface EIP6963ProviderDetail {
|
|
21
|
+
info: EIP6963ProviderInfo;
|
|
22
|
+
provider: Eip1193Provider;
|
|
23
|
+
}
|
|
24
|
+
declare enum EventNames {
|
|
25
|
+
CORE_WALLET_ANNOUNCE_PROVIDER = "core-wallet:announceProvider",
|
|
26
|
+
CORE_WALLET_REQUEST_PROVIDER = "core-wallet:requestProvider",
|
|
27
|
+
EIP6963_ANNOUNCE_PROVIDER = "eip6963:announceProvider",
|
|
28
|
+
EIP6963_REQUEST_PROVIDER = "eip6963:requestProvider"
|
|
29
|
+
}
|
|
30
|
+
interface DomainMetadata {
|
|
31
|
+
domain: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
tabId?: number;
|
|
35
|
+
}
|
|
36
|
+
interface JsonRpcRequestPayloadBase<Method extends string> {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly method: Method;
|
|
39
|
+
readonly site?: DomainMetadata;
|
|
40
|
+
readonly tabId?: number;
|
|
41
|
+
}
|
|
42
|
+
interface JsonRpcRequestPayloadWithParams<Method extends string, Params = unknown> extends JsonRpcRequestPayloadBase<Method> {
|
|
43
|
+
readonly params: Params;
|
|
44
|
+
}
|
|
45
|
+
interface JsonRpcRequestPayloadWithoutParams<Method extends string> extends JsonRpcRequestPayloadBase<Method> {
|
|
46
|
+
readonly params?: never;
|
|
47
|
+
}
|
|
48
|
+
type JsonRpcRequestPayload<Method extends string, Params = unknown> = Params extends undefined ? JsonRpcRequestPayloadWithoutParams<Method> : JsonRpcRequestPayloadWithParams<Method, Params>;
|
|
49
|
+
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
50
|
+
interface ChainAgnosticProvider extends EventEmitter {
|
|
51
|
+
request({ data, sessionId, chainId, }: {
|
|
52
|
+
data: PartialBy<JsonRpcRequestPayload<string>, 'id' | 'params'>;
|
|
53
|
+
sessionId: string;
|
|
54
|
+
chainId: string | null;
|
|
55
|
+
}): Promise<unknown>;
|
|
56
|
+
subscribeToMessage(callback: ({ method, params }: {
|
|
57
|
+
method: string;
|
|
58
|
+
params: unknown;
|
|
59
|
+
}) => void): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { AccountsChangedEventData, ChainAgnosticProvider, ChainChangedEventData, DomainMetadata, EIP6963ProviderDetail, EIP6963ProviderInfo, EventNames, JsonRpcRequestPayload, PartialBy, UnlockStateChangedEventData };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Eip1193Provider } from 'ethers';
|
|
2
|
+
import EventEmitter from 'events';
|
|
3
|
+
|
|
4
|
+
interface ChainChangedEventData {
|
|
5
|
+
chainId: string;
|
|
6
|
+
networkVersion: string;
|
|
7
|
+
}
|
|
8
|
+
type AccountsChangedEventData = string[];
|
|
9
|
+
interface UnlockStateChangedEventData {
|
|
10
|
+
accounts: string[];
|
|
11
|
+
isUnlocked: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface EIP6963ProviderInfo {
|
|
14
|
+
uuid: string;
|
|
15
|
+
name: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
rdns: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}
|
|
20
|
+
interface EIP6963ProviderDetail {
|
|
21
|
+
info: EIP6963ProviderInfo;
|
|
22
|
+
provider: Eip1193Provider;
|
|
23
|
+
}
|
|
24
|
+
declare enum EventNames {
|
|
25
|
+
CORE_WALLET_ANNOUNCE_PROVIDER = "core-wallet:announceProvider",
|
|
26
|
+
CORE_WALLET_REQUEST_PROVIDER = "core-wallet:requestProvider",
|
|
27
|
+
EIP6963_ANNOUNCE_PROVIDER = "eip6963:announceProvider",
|
|
28
|
+
EIP6963_REQUEST_PROVIDER = "eip6963:requestProvider"
|
|
29
|
+
}
|
|
30
|
+
interface DomainMetadata {
|
|
31
|
+
domain: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
tabId?: number;
|
|
35
|
+
}
|
|
36
|
+
interface JsonRpcRequestPayloadBase<Method extends string> {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly method: Method;
|
|
39
|
+
readonly site?: DomainMetadata;
|
|
40
|
+
readonly tabId?: number;
|
|
41
|
+
}
|
|
42
|
+
interface JsonRpcRequestPayloadWithParams<Method extends string, Params = unknown> extends JsonRpcRequestPayloadBase<Method> {
|
|
43
|
+
readonly params: Params;
|
|
44
|
+
}
|
|
45
|
+
interface JsonRpcRequestPayloadWithoutParams<Method extends string> extends JsonRpcRequestPayloadBase<Method> {
|
|
46
|
+
readonly params?: never;
|
|
47
|
+
}
|
|
48
|
+
type JsonRpcRequestPayload<Method extends string, Params = unknown> = Params extends undefined ? JsonRpcRequestPayloadWithoutParams<Method> : JsonRpcRequestPayloadWithParams<Method, Params>;
|
|
49
|
+
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
50
|
+
interface ChainAgnosticProvider extends EventEmitter {
|
|
51
|
+
request({ data, sessionId, chainId, }: {
|
|
52
|
+
data: PartialBy<JsonRpcRequestPayload<string>, 'id' | 'params'>;
|
|
53
|
+
sessionId: string;
|
|
54
|
+
chainId: string | null;
|
|
55
|
+
}): Promise<unknown>;
|
|
56
|
+
subscribeToMessage(callback: ({ method, params }: {
|
|
57
|
+
method: string;
|
|
58
|
+
params: unknown;
|
|
59
|
+
}) => void): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { AccountsChangedEventData, ChainAgnosticProvider, ChainChangedEventData, DomainMetadata, EIP6963ProviderDetail, EIP6963ProviderInfo, EventNames, JsonRpcRequestPayload, PartialBy, UnlockStateChangedEventData };
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/rpc.cjs
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLYK7OEFS_cjs = require('./chunk-LYK7OEFS.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 chunkLYK7OEFS_cjs.c; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, 'DetailItemType', {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkLYK7OEFS_cjs.b; }
|
|
10
14
|
});
|
|
11
15
|
Object.defineProperty(exports, 'RpcMethod', {
|
|
12
16
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkLYK7OEFS_cjs.a; }
|
|
14
18
|
});
|
|
15
19
|
//# sourceMappingURL=out.js.map
|
|
16
20
|
//# sourceMappingURL=rpc.cjs.map
|
package/dist/rpc.d.cts
CHANGED
|
@@ -3,7 +3,6 @@ import { BitcoinInputUTXO, BitcoinOutputUTXO, Avalanche } from '@avalabs/core-wa
|
|
|
3
3
|
import { Caip2ChainId, Hex } from './common.cjs';
|
|
4
4
|
import { JsonRpcError, OptionalDataWithOptionalCause, EthereumProviderError } from '@metamask/rpc-errors';
|
|
5
5
|
import { BalanceChange, TokenApprovals } from './transaction-simulation.cjs';
|
|
6
|
-
import { ExportImportTxDetails, StakingDetails, ChainDetails, BlockchainDetails, SubnetDetails } from './staking.cjs';
|
|
7
6
|
import { TokenWithBalanceBTC } from './balance.cjs';
|
|
8
7
|
import './token.cjs';
|
|
9
8
|
import './error.cjs';
|
|
@@ -61,13 +60,49 @@ type TypedDataV1 = {
|
|
|
61
60
|
type: string;
|
|
62
61
|
value: unknown;
|
|
63
62
|
}[];
|
|
64
|
-
type
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
type DetailSection = {
|
|
64
|
+
title?: string;
|
|
65
|
+
items: DetailItem[];
|
|
66
|
+
};
|
|
67
|
+
type BaseDetailItem = {
|
|
68
|
+
label: string;
|
|
69
|
+
};
|
|
70
|
+
declare enum DetailItemType {
|
|
71
|
+
TEXT = "text",
|
|
72
|
+
ADDRESS = "address",
|
|
73
|
+
NODE_ID = "nodeID",
|
|
74
|
+
CURRENCY = "currency",
|
|
75
|
+
DATA = "data",
|
|
76
|
+
DATE = "date"
|
|
77
|
+
}
|
|
78
|
+
type TextItem = BaseDetailItem & {
|
|
79
|
+
type: DetailItemType.TEXT;
|
|
80
|
+
value: string;
|
|
81
|
+
alignment: 'vertical' | 'horizontal';
|
|
82
|
+
};
|
|
83
|
+
type AddressItem = BaseDetailItem & {
|
|
84
|
+
type: DetailItemType.ADDRESS;
|
|
85
|
+
value: string;
|
|
86
|
+
};
|
|
87
|
+
type NodeIDItem = BaseDetailItem & {
|
|
88
|
+
type: DetailItemType.NODE_ID;
|
|
89
|
+
value: string;
|
|
90
|
+
};
|
|
91
|
+
type CurrencyItem = BaseDetailItem & {
|
|
92
|
+
type: DetailItemType.CURRENCY;
|
|
93
|
+
value: bigint;
|
|
94
|
+
maxDecimals: number;
|
|
95
|
+
symbol: string;
|
|
96
|
+
};
|
|
97
|
+
type DataItem = BaseDetailItem & {
|
|
98
|
+
type: DetailItemType.DATA;
|
|
99
|
+
value: string;
|
|
100
|
+
};
|
|
101
|
+
type DateItem = BaseDetailItem & {
|
|
102
|
+
type: DetailItemType.DATE;
|
|
103
|
+
value: string;
|
|
70
104
|
};
|
|
105
|
+
type DetailItem = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem;
|
|
71
106
|
type DisplayData = {
|
|
72
107
|
title: string;
|
|
73
108
|
dAppInfo?: {
|
|
@@ -81,12 +116,7 @@ type DisplayData = {
|
|
|
81
116
|
logoUri?: string;
|
|
82
117
|
};
|
|
83
118
|
account?: string;
|
|
84
|
-
|
|
85
|
-
transactionDetails?: TransactionDetails | ExportImportTxDetails;
|
|
86
|
-
stakingDetails?: StakingDetails;
|
|
87
|
-
chainDetails?: ChainDetails;
|
|
88
|
-
blockchainDetails?: BlockchainDetails;
|
|
89
|
-
subnetDetails?: SubnetDetails;
|
|
119
|
+
details: DetailSection[];
|
|
90
120
|
networkFeeSelector?: boolean;
|
|
91
121
|
disclaimer?: string;
|
|
92
122
|
alert?: Alert;
|
|
@@ -150,6 +180,8 @@ type SigningData = {
|
|
|
150
180
|
unsignedTxJson: string;
|
|
151
181
|
data: Avalanche.Tx;
|
|
152
182
|
vm: 'EVM' | 'AVM' | 'PVM';
|
|
183
|
+
externalIndices?: number[];
|
|
184
|
+
internalIndices?: number[];
|
|
153
185
|
} | {
|
|
154
186
|
type: RpcMethod.AVALANCHE_SIGN_TRANSACTION;
|
|
155
187
|
unsignedTxJson: string;
|
|
@@ -189,4 +221,4 @@ interface ApprovalController {
|
|
|
189
221
|
onTransactionReverted: (txHash: Hex) => void;
|
|
190
222
|
}
|
|
191
223
|
|
|
192
|
-
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BitcoinTransactionData, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult,
|
|
224
|
+
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem, BitcoinTransactionData, CurrencyItem, DappInfo, DataItem, DateItem, DetailItem, DetailItemType, DetailSection, DisplayData, MessageTypeProperty, MessageTypes, NodeIDItem, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult, TextItem, TypedData, TypedDataV1 };
|
package/dist/rpc.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { BitcoinInputUTXO, BitcoinOutputUTXO, Avalanche } from '@avalabs/core-wa
|
|
|
3
3
|
import { Caip2ChainId, Hex } from './common.js';
|
|
4
4
|
import { JsonRpcError, OptionalDataWithOptionalCause, EthereumProviderError } from '@metamask/rpc-errors';
|
|
5
5
|
import { BalanceChange, TokenApprovals } from './transaction-simulation.js';
|
|
6
|
-
import { ExportImportTxDetails, StakingDetails, ChainDetails, BlockchainDetails, SubnetDetails } from './staking.js';
|
|
7
6
|
import { TokenWithBalanceBTC } from './balance.js';
|
|
8
7
|
import './token.js';
|
|
9
8
|
import './error.js';
|
|
@@ -61,13 +60,49 @@ type TypedDataV1 = {
|
|
|
61
60
|
type: string;
|
|
62
61
|
value: unknown;
|
|
63
62
|
}[];
|
|
64
|
-
type
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
type DetailSection = {
|
|
64
|
+
title?: string;
|
|
65
|
+
items: DetailItem[];
|
|
66
|
+
};
|
|
67
|
+
type BaseDetailItem = {
|
|
68
|
+
label: string;
|
|
69
|
+
};
|
|
70
|
+
declare enum DetailItemType {
|
|
71
|
+
TEXT = "text",
|
|
72
|
+
ADDRESS = "address",
|
|
73
|
+
NODE_ID = "nodeID",
|
|
74
|
+
CURRENCY = "currency",
|
|
75
|
+
DATA = "data",
|
|
76
|
+
DATE = "date"
|
|
77
|
+
}
|
|
78
|
+
type TextItem = BaseDetailItem & {
|
|
79
|
+
type: DetailItemType.TEXT;
|
|
80
|
+
value: string;
|
|
81
|
+
alignment: 'vertical' | 'horizontal';
|
|
82
|
+
};
|
|
83
|
+
type AddressItem = BaseDetailItem & {
|
|
84
|
+
type: DetailItemType.ADDRESS;
|
|
85
|
+
value: string;
|
|
86
|
+
};
|
|
87
|
+
type NodeIDItem = BaseDetailItem & {
|
|
88
|
+
type: DetailItemType.NODE_ID;
|
|
89
|
+
value: string;
|
|
90
|
+
};
|
|
91
|
+
type CurrencyItem = BaseDetailItem & {
|
|
92
|
+
type: DetailItemType.CURRENCY;
|
|
93
|
+
value: bigint;
|
|
94
|
+
maxDecimals: number;
|
|
95
|
+
symbol: string;
|
|
96
|
+
};
|
|
97
|
+
type DataItem = BaseDetailItem & {
|
|
98
|
+
type: DetailItemType.DATA;
|
|
99
|
+
value: string;
|
|
100
|
+
};
|
|
101
|
+
type DateItem = BaseDetailItem & {
|
|
102
|
+
type: DetailItemType.DATE;
|
|
103
|
+
value: string;
|
|
70
104
|
};
|
|
105
|
+
type DetailItem = string | TextItem | AddressItem | NodeIDItem | CurrencyItem | DataItem | DateItem;
|
|
71
106
|
type DisplayData = {
|
|
72
107
|
title: string;
|
|
73
108
|
dAppInfo?: {
|
|
@@ -81,12 +116,7 @@ type DisplayData = {
|
|
|
81
116
|
logoUri?: string;
|
|
82
117
|
};
|
|
83
118
|
account?: string;
|
|
84
|
-
|
|
85
|
-
transactionDetails?: TransactionDetails | ExportImportTxDetails;
|
|
86
|
-
stakingDetails?: StakingDetails;
|
|
87
|
-
chainDetails?: ChainDetails;
|
|
88
|
-
blockchainDetails?: BlockchainDetails;
|
|
89
|
-
subnetDetails?: SubnetDetails;
|
|
119
|
+
details: DetailSection[];
|
|
90
120
|
networkFeeSelector?: boolean;
|
|
91
121
|
disclaimer?: string;
|
|
92
122
|
alert?: Alert;
|
|
@@ -150,6 +180,8 @@ type SigningData = {
|
|
|
150
180
|
unsignedTxJson: string;
|
|
151
181
|
data: Avalanche.Tx;
|
|
152
182
|
vm: 'EVM' | 'AVM' | 'PVM';
|
|
183
|
+
externalIndices?: number[];
|
|
184
|
+
internalIndices?: number[];
|
|
153
185
|
} | {
|
|
154
186
|
type: RpcMethod.AVALANCHE_SIGN_TRANSACTION;
|
|
155
187
|
unsignedTxJson: string;
|
|
@@ -189,4 +221,4 @@ interface ApprovalController {
|
|
|
189
221
|
onTransactionReverted: (txHash: Hex) => void;
|
|
190
222
|
}
|
|
191
223
|
|
|
192
|
-
export { Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BitcoinTransactionData, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningResult,
|
|
224
|
+
export { AddressItem, Alert, AlertDetails, AlertType, ApprovalController, ApprovalParams, ApprovalResponse, BaseDetailItem, BitcoinTransactionData, CurrencyItem, DappInfo, DataItem, DateItem, DetailItem, DetailItemType, DetailSection, DisplayData, 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.3.0",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@avalabs/glacier-sdk": "3.1.0-alpha.1",
|
|
26
26
|
"@avalabs/core-utils-sdk": "3.1.0-alpha.1",
|
|
27
27
|
"@avalabs/core-wallets-sdk": "3.0.1-alpha.1",
|
|
28
|
+
"ethers": "6.8.1",
|
|
28
29
|
"@internal/tsup-config": "0.0.1",
|
|
29
30
|
"eslint-config-custom": "0.0.1"
|
|
30
31
|
},
|
package/dist/chunk-7Z4WA2P6.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var a=(t=>(t.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",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))(a||{}),n=(e=>(e.WARNING="Warning",e.DANGER="Danger",e.INFO="Info",e))(n||{});
|
|
4
|
-
|
|
5
|
-
exports.a = a;
|
|
6
|
-
exports.b = n;
|
|
7
|
-
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=chunk-7Z4WA2P6.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","AlertType"],"mappings":"AAQO,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,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 { StakingDetails, ExportImportTxDetails, ChainDetails, BlockchainDetails, SubnetDetails } from './staking';\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 TransactionDetails = {\n website: string;\n from: string;\n to: string;\n data?: string;\n type?: string;\n};\n\nexport type DisplayData = {\n title: string;\n dAppInfo?: {\n name: string;\n action: string;\n logoUri?: string;\n };\n network: {\n chainId: number;\n name: string;\n logoUri?: string;\n };\n account?: string;\n messageDetails?: string;\n transactionDetails?: TransactionDetails | ExportImportTxDetails;\n stakingDetails?: StakingDetails;\n chainDetails?: ChainDetails;\n blockchainDetails?: BlockchainDetails;\n subnetDetails?: SubnetDetails;\n networkFeeSelector?: boolean;\n disclaimer?: string;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n};\n\nexport enum AlertType {\n WARNING = 'Warning',\n DANGER = 'Danger',\n INFO = 'Info',\n}\n\nexport type AlertDetails = {\n title: string;\n description: string;\n detailedDescription?: string;\n actionTitles?: {\n proceed: string;\n reject: string;\n };\n};\n\nexport type Alert = {\n type: AlertType;\n details: AlertDetails;\n};\n\nexport type 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 }\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 ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\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) => void;\n onTransactionReverted: (txHash: Hex) => void;\n}\n"]}
|
package/dist/chunk-ZVCTHYAU.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var a=(t=>(t.BITCOIN_SEND_TRANSACTION="bitcoin_sendTransaction",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))(a||{}),n=(e=>(e.WARNING="Warning",e.DANGER="Danger",e.INFO="Info",e))(n||{});
|
|
2
|
-
|
|
3
|
-
export { a, n as b };
|
|
4
|
-
//# sourceMappingURL=out.js.map
|
|
5
|
-
//# sourceMappingURL=chunk-ZVCTHYAU.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","AlertType"],"mappings":"AAQO,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,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 { StakingDetails, ExportImportTxDetails, ChainDetails, BlockchainDetails, SubnetDetails } from './staking';\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 TransactionDetails = {\n website: string;\n from: string;\n to: string;\n data?: string;\n type?: string;\n};\n\nexport type DisplayData = {\n title: string;\n dAppInfo?: {\n name: string;\n action: string;\n logoUri?: string;\n };\n network: {\n chainId: number;\n name: string;\n logoUri?: string;\n };\n account?: string;\n messageDetails?: string;\n transactionDetails?: TransactionDetails | ExportImportTxDetails;\n stakingDetails?: StakingDetails;\n chainDetails?: ChainDetails;\n blockchainDetails?: BlockchainDetails;\n subnetDetails?: SubnetDetails;\n networkFeeSelector?: boolean;\n disclaimer?: string;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n};\n\nexport enum AlertType {\n WARNING = 'Warning',\n DANGER = 'Danger',\n INFO = 'Info',\n}\n\nexport type AlertDetails = {\n title: string;\n description: string;\n detailedDescription?: string;\n actionTitles?: {\n proceed: string;\n reject: string;\n };\n};\n\nexport type Alert = {\n type: AlertType;\n details: AlertDetails;\n};\n\nexport type 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 }\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 ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\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) => void;\n onTransactionReverted: (txHash: Hex) => void;\n}\n"]}
|