@avalabs/vm-module-types 0.1.11 → 0.1.12
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-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 +7 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/module.d.cts +0 -1
- package/dist/module.d.ts +0 -1
- 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 +1 -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 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,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('./chunk-AILYKQEY.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkLYK7OEFS_cjs = require('./chunk-LYK7OEFS.cjs');
|
|
5
5
|
var chunkIQNJXPS3_cjs = require('./chunk-IQNJXPS3.cjs');
|
|
6
6
|
var chunk2KGTZTXY_cjs = require('./chunk-2KGTZTXY.cjs');
|
|
7
7
|
var chunkB6DAZDIA_cjs = require('./chunk-B6DAZDIA.cjs');
|
|
@@ -18,11 +18,15 @@ require('./chunk-OGQBQHLH.cjs');
|
|
|
18
18
|
|
|
19
19
|
Object.defineProperty(exports, 'AlertType', {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkLYK7OEFS_cjs.c; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, 'DetailItemType', {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkLYK7OEFS_cjs.b; }
|
|
22
26
|
});
|
|
23
27
|
Object.defineProperty(exports, 'RpcMethod', {
|
|
24
28
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkLYK7OEFS_cjs.a; }
|
|
26
30
|
});
|
|
27
31
|
Object.defineProperty(exports, 'TxType', {
|
|
28
32
|
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 { 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';
|
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 { 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';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './chunk-7U2R34EQ.js';
|
|
2
|
-
export {
|
|
2
|
+
export { c as AlertType, b as DetailItemType, a as RpcMethod } from './chunk-LWDTKZK6.js';
|
|
3
3
|
export { a as TxType } from './chunk-2SJQLDBB.js';
|
|
4
4
|
export { a as TokenType } from './chunk-7Y6UGMPZ.js';
|
|
5
5
|
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;
|
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
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"]}
|