@metamask/transaction-controller 10.0.0 → 12.0.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/CHANGELOG.md +50 -4
- package/dist/EtherscanRemoteTransactionSource.d.ts +3 -3
- package/dist/EtherscanRemoteTransactionSource.d.ts.map +1 -1
- package/dist/EtherscanRemoteTransactionSource.js +48 -25
- package/dist/EtherscanRemoteTransactionSource.js.map +1 -1
- package/dist/IncomingTransactionHelper.d.ts +4 -3
- package/dist/IncomingTransactionHelper.d.ts.map +1 -1
- package/dist/IncomingTransactionHelper.js +41 -31
- package/dist/IncomingTransactionHelper.js.map +1 -1
- package/dist/TransactionController.d.ts +77 -26
- package/dist/TransactionController.d.ts.map +1 -1
- package/dist/TransactionController.js +241 -124
- package/dist/TransactionController.js.map +1 -1
- package/dist/constants.d.ts +5 -19
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +40 -45
- package/dist/constants.js.map +1 -1
- package/dist/etherscan.d.ts +5 -6
- package/dist/etherscan.d.ts.map +1 -1
- package/dist/etherscan.js +7 -14
- package/dist/etherscan.js.map +1 -1
- package/dist/external-transactions.js +5 -5
- package/dist/external-transactions.js.map +1 -1
- package/dist/history.d.ts +15 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +75 -0
- package/dist/history.js.map +1 -0
- package/dist/logger.d.ts +6 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +8 -0
- package/dist/logger.js.map +1 -0
- package/dist/transaction-type.d.ts +14 -0
- package/dist/transaction-type.d.ts.map +1 -0
- package/dist/transaction-type.js +114 -0
- package/dist/transaction-type.js.map +1 -0
- package/dist/types.d.ts +227 -27
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +99 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +16 -18
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +44 -48
- package/dist/utils.js.map +1 -1
- package/package.json +8 -4
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.determineTransactionType = exports.ESTIMATE_GAS_ERROR = void 0;
|
|
13
|
+
const abi_1 = require("@ethersproject/abi");
|
|
14
|
+
const controller_utils_1 = require("@metamask/controller-utils");
|
|
15
|
+
const metamask_eth_abis_1 = require("@metamask/metamask-eth-abis");
|
|
16
|
+
const types_1 = require("./types");
|
|
17
|
+
exports.ESTIMATE_GAS_ERROR = 'eth_estimateGas rpc method error';
|
|
18
|
+
const ERC20Interface = new abi_1.Interface(metamask_eth_abis_1.abiERC20);
|
|
19
|
+
const ERC721Interface = new abi_1.Interface(metamask_eth_abis_1.abiERC721);
|
|
20
|
+
const ERC1155Interface = new abi_1.Interface(metamask_eth_abis_1.abiERC1155);
|
|
21
|
+
/**
|
|
22
|
+
* Determines the type of the transaction by analyzing the txParams.
|
|
23
|
+
* It will never return TRANSACTION_TYPE_CANCEL or TRANSACTION_TYPE_RETRY as these
|
|
24
|
+
* represent specific events that we specify manually at transaction creation.
|
|
25
|
+
*
|
|
26
|
+
* @param txParams - Parameters for the transaction.
|
|
27
|
+
* @param ethQuery - EthQuery instance.
|
|
28
|
+
* @returns A object with the transaction type and the contract code response in Hex.
|
|
29
|
+
*/
|
|
30
|
+
function determineTransactionType(txParams, ethQuery) {
|
|
31
|
+
var _a;
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { data, to } = txParams;
|
|
34
|
+
const name = (_a = parseStandardTokenTransactionData(data)) === null || _a === void 0 ? void 0 : _a.name;
|
|
35
|
+
if (data && !to) {
|
|
36
|
+
return { type: types_1.TransactionType.deployContract, getCodeResponse: undefined };
|
|
37
|
+
}
|
|
38
|
+
const { contractCode: resultCode, isContractAddress } = yield readAddressAsContract(ethQuery, to);
|
|
39
|
+
if (!isContractAddress) {
|
|
40
|
+
return { type: types_1.TransactionType.simpleSend, getCodeResponse: resultCode };
|
|
41
|
+
}
|
|
42
|
+
const hasValue = txParams.value && Number(txParams.value) !== 0;
|
|
43
|
+
const tokenMethodName = [
|
|
44
|
+
types_1.TransactionType.tokenMethodApprove,
|
|
45
|
+
types_1.TransactionType.tokenMethodSetApprovalForAll,
|
|
46
|
+
types_1.TransactionType.tokenMethodTransfer,
|
|
47
|
+
types_1.TransactionType.tokenMethodTransferFrom,
|
|
48
|
+
types_1.TransactionType.tokenMethodSafeTransferFrom,
|
|
49
|
+
].find((methodName) => methodName.toLowerCase() === (name === null || name === void 0 ? void 0 : name.toLowerCase()));
|
|
50
|
+
if (data && tokenMethodName && !hasValue) {
|
|
51
|
+
return { type: tokenMethodName, getCodeResponse: resultCode };
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
type: types_1.TransactionType.contractInteraction,
|
|
55
|
+
getCodeResponse: resultCode,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.determineTransactionType = determineTransactionType;
|
|
60
|
+
/**
|
|
61
|
+
* Attempts to decode transaction data using ABIs for three different token standards: ERC20, ERC721, ERC1155.
|
|
62
|
+
* The data will decode correctly if the transaction is an interaction with a contract that matches one of these
|
|
63
|
+
* contract standards
|
|
64
|
+
*
|
|
65
|
+
* @param data - Encoded transaction data.
|
|
66
|
+
* @returns A representation of an ethereum contract call.
|
|
67
|
+
*/
|
|
68
|
+
function parseStandardTokenTransactionData(data) {
|
|
69
|
+
if (!data) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
return ERC20Interface.parseTransaction({ data });
|
|
74
|
+
}
|
|
75
|
+
catch (_a) {
|
|
76
|
+
// ignore and next try to parse with erc721 ABI
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return ERC721Interface.parseTransaction({ data });
|
|
80
|
+
}
|
|
81
|
+
catch (_b) {
|
|
82
|
+
// ignore and next try to parse with erc1155 ABI
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
return ERC1155Interface.parseTransaction({ data });
|
|
86
|
+
}
|
|
87
|
+
catch (_c) {
|
|
88
|
+
// ignore and return undefined
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Reads an Ethereum address and determines if it is a contract address.
|
|
94
|
+
*
|
|
95
|
+
* @param ethQuery - The Ethereum query object used to interact with the Ethereum blockchain.
|
|
96
|
+
* @param address - The Ethereum address.
|
|
97
|
+
* @returns An object containing the contract code and a boolean indicating if it is a contract address.
|
|
98
|
+
*/
|
|
99
|
+
function readAddressAsContract(ethQuery, address) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
let contractCode;
|
|
102
|
+
try {
|
|
103
|
+
contractCode = yield (0, controller_utils_1.query)(ethQuery, 'getCode', [address]);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
contractCode = null;
|
|
107
|
+
}
|
|
108
|
+
const isContractAddress = contractCode
|
|
109
|
+
? contractCode !== '0x' && contractCode !== '0x0'
|
|
110
|
+
: false;
|
|
111
|
+
return { contractCode, isContractAddress };
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=transaction-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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jD,CAAC,CAAC,KAAK,CAAC;QACV,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAC7C,CAAC;CAAA","sourcesContent":["import type { TransactionDescription } from '@ethersproject/abi';\nimport { Interface } from '@ethersproject/abi';\nimport { query } from '@metamask/controller-utils';\nimport type EthQuery from '@metamask/eth-query';\nimport { abiERC721, abiERC20, abiERC1155 } from '@metamask/metamask-eth-abis';\n\nimport type { InferTransactionTypeResult, TransactionParams } from './types';\nimport { TransactionType } from './types';\n\nexport const ESTIMATE_GAS_ERROR = 'eth_estimateGas rpc method error';\n\nconst ERC20Interface = new Interface(abiERC20);\nconst ERC721Interface = new Interface(abiERC721);\nconst ERC1155Interface = new Interface(abiERC1155);\n\n/**\n * Determines the type of the transaction by analyzing the txParams.\n * It will never return TRANSACTION_TYPE_CANCEL or TRANSACTION_TYPE_RETRY as these\n * represent specific events that we specify manually at transaction creation.\n *\n * @param txParams - Parameters for the transaction.\n * @param ethQuery - EthQuery instance.\n * @returns A object with the transaction type and the contract code response in Hex.\n */\nexport async function determineTransactionType(\n txParams: TransactionParams,\n ethQuery: EthQuery,\n): Promise<InferTransactionTypeResult> {\n const { data, to } = txParams;\n const name = parseStandardTokenTransactionData(data)?.name;\n\n if (data && !to) {\n return { type: TransactionType.deployContract, getCodeResponse: undefined };\n }\n\n const { contractCode: resultCode, isContractAddress } =\n await readAddressAsContract(ethQuery, to);\n\n if (!isContractAddress) {\n return { type: TransactionType.simpleSend, getCodeResponse: resultCode };\n }\n\n const hasValue = txParams.value && Number(txParams.value) !== 0;\n\n const tokenMethodName = [\n TransactionType.tokenMethodApprove,\n TransactionType.tokenMethodSetApprovalForAll,\n TransactionType.tokenMethodTransfer,\n TransactionType.tokenMethodTransferFrom,\n TransactionType.tokenMethodSafeTransferFrom,\n ].find((methodName) => methodName.toLowerCase() === name?.toLowerCase());\n\n if (data && tokenMethodName && !hasValue) {\n return { type: tokenMethodName, getCodeResponse: resultCode };\n }\n\n return {\n type: TransactionType.contractInteraction,\n getCodeResponse: resultCode,\n };\n}\n\n/**\n * Attempts to decode transaction data using ABIs for three different token standards: ERC20, ERC721, ERC1155.\n * The data will decode correctly if the transaction is an interaction with a contract that matches one of these\n * contract standards\n *\n * @param data - Encoded transaction data.\n * @returns A representation of an ethereum contract call.\n */\nfunction parseStandardTokenTransactionData(\n data?: string,\n): TransactionDescription | undefined {\n if (!data) {\n return undefined;\n }\n\n try {\n return ERC20Interface.parseTransaction({ data });\n } catch {\n // ignore and next try to parse with erc721 ABI\n }\n\n try {\n return ERC721Interface.parseTransaction({ data });\n } catch {\n // ignore and next try to parse with erc1155 ABI\n }\n\n try {\n return ERC1155Interface.parseTransaction({ data });\n } catch {\n // ignore and return undefined\n }\n\n return undefined;\n}\n\n/**\n * Reads an Ethereum address and determines if it is a contract address.\n *\n * @param ethQuery - The Ethereum query object used to interact with the Ethereum blockchain.\n * @param address - The Ethereum address.\n * @returns An object containing the contract code and a boolean indicating if it is a contract address.\n */\nasync function readAddressAsContract(\n ethQuery: EthQuery,\n address?: string,\n): Promise<{\n contractCode: string | null;\n isContractAddress: boolean;\n}> {\n let contractCode;\n try {\n contractCode = await query(ethQuery, 'getCode', [address]);\n } catch (e) {\n contractCode = null;\n }\n\n const isContractAddress = contractCode\n ? contractCode !== '0x' && contractCode !== '0x0'\n : false;\n return { contractCode, isContractAddress };\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Hex } from '@metamask/utils';
|
|
2
|
+
import type { Operation } from 'fast-json-patch';
|
|
2
3
|
/**
|
|
3
4
|
* Representation of transaction metadata.
|
|
4
5
|
*/
|
|
@@ -31,11 +32,15 @@ declare type TransactionMetaBase = {
|
|
|
31
32
|
/**
|
|
32
33
|
* Network code as per EIP-155 for this transaction.
|
|
33
34
|
*/
|
|
34
|
-
chainId
|
|
35
|
+
chainId: Hex;
|
|
35
36
|
/**
|
|
36
37
|
* Gas values provided by the dApp.
|
|
37
38
|
*/
|
|
38
39
|
dappSuggestedGasFees?: DappSuggestedGasFees;
|
|
40
|
+
/**
|
|
41
|
+
* The default estimate for gas.
|
|
42
|
+
*/
|
|
43
|
+
defaultGasEstimates?: string;
|
|
39
44
|
/**
|
|
40
45
|
* String to indicate what device the transaction was confirmed on.
|
|
41
46
|
*/
|
|
@@ -44,10 +49,22 @@ declare type TransactionMetaBase = {
|
|
|
44
49
|
* The estimated base fee of the transaction.
|
|
45
50
|
*/
|
|
46
51
|
estimatedBaseFee?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Which estimate level that the API suggested.
|
|
54
|
+
*/
|
|
55
|
+
estimateSuggested?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Which estimate level was used
|
|
58
|
+
*/
|
|
59
|
+
estimateUsed?: string;
|
|
47
60
|
/**
|
|
48
61
|
* A hex string of the transaction hash, used to identify the transaction on the network.
|
|
49
62
|
*/
|
|
50
63
|
hash?: string;
|
|
64
|
+
/**
|
|
65
|
+
* A history of mutations to TransactionMeta.
|
|
66
|
+
*/
|
|
67
|
+
history?: TransactionHistory;
|
|
51
68
|
/**
|
|
52
69
|
* Generated UUID associated with this transaction.
|
|
53
70
|
*/
|
|
@@ -57,13 +74,23 @@ declare type TransactionMetaBase = {
|
|
|
57
74
|
*/
|
|
58
75
|
isTransfer?: boolean;
|
|
59
76
|
/**
|
|
60
|
-
* Network code as per EIP-155 for this transaction
|
|
77
|
+
* Network code as per EIP-155 for this transaction
|
|
78
|
+
*
|
|
79
|
+
* @deprecated Use `chainId` instead.
|
|
61
80
|
*/
|
|
62
|
-
networkID?: string;
|
|
81
|
+
readonly networkID?: string;
|
|
63
82
|
/**
|
|
64
83
|
* Origin this transaction was sent from.
|
|
65
84
|
*/
|
|
66
85
|
origin?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The original gas estimation of the transaction.
|
|
88
|
+
*/
|
|
89
|
+
originalGasEstimate?: string;
|
|
90
|
+
/**
|
|
91
|
+
* The transaction's 'r' value as a hex string.
|
|
92
|
+
*/
|
|
93
|
+
r?: string;
|
|
67
94
|
/**
|
|
68
95
|
* Hex representation of the underlying transaction.
|
|
69
96
|
*/
|
|
@@ -76,6 +103,19 @@ declare type TransactionMetaBase = {
|
|
|
76
103
|
* When the transaction is dropped, this is the replacement transaction ID.
|
|
77
104
|
*/
|
|
78
105
|
replacedById?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The transaction's 's' value as a hex string.
|
|
108
|
+
*/
|
|
109
|
+
s?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Response from security validator.
|
|
112
|
+
*/
|
|
113
|
+
securityAlertResponse?: Record<string, unknown>;
|
|
114
|
+
/**
|
|
115
|
+
* An array of entries that describe the user's journey through the send flow.
|
|
116
|
+
* This is purely attached to state logs for troubleshooting and support.
|
|
117
|
+
*/
|
|
118
|
+
sendFlowHistory?: SendFlowHistoryEntry[];
|
|
79
119
|
/**
|
|
80
120
|
* The time the transaction was submitted to the network, in Unix epoch time (ms).
|
|
81
121
|
*/
|
|
@@ -88,14 +128,6 @@ declare type TransactionMetaBase = {
|
|
|
88
128
|
* Whether transaction recipient is a smart contract.
|
|
89
129
|
*/
|
|
90
130
|
toSmartContract?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Underlying Transaction object.
|
|
93
|
-
*/
|
|
94
|
-
transaction: Transaction;
|
|
95
|
-
/**
|
|
96
|
-
* Hash of a successful transaction.
|
|
97
|
-
*/
|
|
98
|
-
transactionHash?: string;
|
|
99
131
|
/**
|
|
100
132
|
* Additional transfer information.
|
|
101
133
|
*/
|
|
@@ -104,18 +136,44 @@ declare type TransactionMetaBase = {
|
|
|
104
136
|
decimals: number;
|
|
105
137
|
symbol: string;
|
|
106
138
|
};
|
|
139
|
+
/**
|
|
140
|
+
* Underlying Transaction object.
|
|
141
|
+
*/
|
|
142
|
+
txParams: TransactionParams;
|
|
107
143
|
/**
|
|
108
144
|
* Transaction receipt.
|
|
109
145
|
*/
|
|
110
146
|
txReceipt?: TransactionReceipt;
|
|
147
|
+
/**
|
|
148
|
+
* The type of transaction such as `cancel` or `swap`.
|
|
149
|
+
*/
|
|
150
|
+
type?: TransactionType;
|
|
151
|
+
/**
|
|
152
|
+
* The gas limit supplied by user.
|
|
153
|
+
*/
|
|
154
|
+
userEditedGasLimit?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Estimate level user selected.
|
|
157
|
+
*/
|
|
158
|
+
userFeeLevel?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The transaction's 'v' value as a hex string.
|
|
161
|
+
*/
|
|
162
|
+
v?: string;
|
|
111
163
|
/**
|
|
112
164
|
* Whether the transaction is verified on the blockchain.
|
|
113
165
|
*/
|
|
114
166
|
verifiedOnBlockchain?: boolean;
|
|
167
|
+
};
|
|
168
|
+
export declare type SendFlowHistoryEntry = {
|
|
115
169
|
/**
|
|
116
|
-
*
|
|
170
|
+
* String to indicate user interaction information.
|
|
117
171
|
*/
|
|
118
|
-
|
|
172
|
+
entry: string;
|
|
173
|
+
/**
|
|
174
|
+
* Timestamp associated with this entry.
|
|
175
|
+
*/
|
|
176
|
+
timestamp: number;
|
|
119
177
|
};
|
|
120
178
|
/**
|
|
121
179
|
* The status of the transaction. Each status represents the state of the transaction internally
|
|
@@ -141,10 +199,107 @@ export declare enum WalletDevice {
|
|
|
141
199
|
MM_EXTENSION = "metamask_extension",
|
|
142
200
|
OTHER = "other_device"
|
|
143
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* The type of the transaction.
|
|
204
|
+
*/
|
|
205
|
+
export declare enum TransactionType {
|
|
206
|
+
/**
|
|
207
|
+
* A transaction sending a network's native asset to a recipient.
|
|
208
|
+
*/
|
|
209
|
+
cancel = "cancel",
|
|
210
|
+
/**
|
|
211
|
+
* A transaction that is interacting with a smart contract's methods that we
|
|
212
|
+
* have not treated as a special case, such as approve, transfer, and
|
|
213
|
+
* transferfrom.
|
|
214
|
+
*/
|
|
215
|
+
contractInteraction = "contractInteraction",
|
|
216
|
+
/**
|
|
217
|
+
* A transaction that deployed a smart contract.
|
|
218
|
+
*/
|
|
219
|
+
deployContract = "contractDeployment",
|
|
220
|
+
/**
|
|
221
|
+
* A transaction for Ethereum decryption.
|
|
222
|
+
*/
|
|
223
|
+
ethDecrypt = "eth_decrypt",
|
|
224
|
+
/**
|
|
225
|
+
* A transaction for getting an encryption public key.
|
|
226
|
+
*/
|
|
227
|
+
ethGetEncryptionPublicKey = "eth_getEncryptionPublicKey",
|
|
228
|
+
/**
|
|
229
|
+
* An incoming (deposit) transaction.
|
|
230
|
+
*/
|
|
231
|
+
incoming = "incoming",
|
|
232
|
+
/**
|
|
233
|
+
* A transaction for personal sign.
|
|
234
|
+
*/
|
|
235
|
+
personalSign = "personal_sign",
|
|
236
|
+
/**
|
|
237
|
+
* When a transaction is failed it can be retried by
|
|
238
|
+
* resubmitting the same transaction with a higher gas fee. This type is also used
|
|
239
|
+
* to speed up pending transactions. This is accomplished by creating a new tx with
|
|
240
|
+
* the same nonce and higher gas fees.
|
|
241
|
+
*/
|
|
242
|
+
retry = "retry",
|
|
243
|
+
/**
|
|
244
|
+
* A transaction sending a network's native asset to a recipient.
|
|
245
|
+
*/
|
|
246
|
+
simpleSend = "simpleSend",
|
|
247
|
+
/**
|
|
248
|
+
* A transaction that is signing a message.
|
|
249
|
+
*/
|
|
250
|
+
sign = "eth_sign",
|
|
251
|
+
/**
|
|
252
|
+
* A transaction that is signing typed data.
|
|
253
|
+
*/
|
|
254
|
+
signTypedData = "eth_signTypedData",
|
|
255
|
+
/**
|
|
256
|
+
* A transaction sending a network's native asset to a recipient.
|
|
257
|
+
*/
|
|
258
|
+
smart = "smart",
|
|
259
|
+
/**
|
|
260
|
+
* A transaction swapping one token for another through MetaMask Swaps.
|
|
261
|
+
*/
|
|
262
|
+
swap = "swap",
|
|
263
|
+
/**
|
|
264
|
+
* Similar to the approve type, a swap approval is a special case of ERC20
|
|
265
|
+
* approve method that requests an allowance of the token to spend on behalf
|
|
266
|
+
* of the user for the MetaMask Swaps contract. The first swap for any token
|
|
267
|
+
* will have an accompanying swapApproval transaction.
|
|
268
|
+
*/
|
|
269
|
+
swapApproval = "swapApproval",
|
|
270
|
+
/**
|
|
271
|
+
* A token transaction requesting an allowance of the token to spend on
|
|
272
|
+
* behalf of the user.
|
|
273
|
+
*/
|
|
274
|
+
tokenMethodApprove = "approve",
|
|
275
|
+
/**
|
|
276
|
+
* A token transaction transferring tokens from an account that the sender
|
|
277
|
+
* has an allowance of. The method is prefixed with safe because when calling
|
|
278
|
+
* this method the contract checks to ensure that the receiver is an address
|
|
279
|
+
* capable of handling the token being sent.
|
|
280
|
+
*/
|
|
281
|
+
tokenMethodSafeTransferFrom = "safetransferfrom",
|
|
282
|
+
/**
|
|
283
|
+
* A token transaction where the user is sending tokens that they own to
|
|
284
|
+
* another address.
|
|
285
|
+
*/
|
|
286
|
+
tokenMethodTransfer = "transfer",
|
|
287
|
+
/**
|
|
288
|
+
* A token transaction transferring tokens from an account that the sender
|
|
289
|
+
* has an allowance of. For more information on allowances, see the approve
|
|
290
|
+
* type.
|
|
291
|
+
*/
|
|
292
|
+
tokenMethodTransferFrom = "transferfrom",
|
|
293
|
+
/**
|
|
294
|
+
* A token transaction requesting an allowance of all of a user's tokens to
|
|
295
|
+
* spend on behalf of the user.
|
|
296
|
+
*/
|
|
297
|
+
tokenMethodSetApprovalForAll = "setapprovalforall"
|
|
298
|
+
}
|
|
144
299
|
/**
|
|
145
300
|
* Standard data concerning a transaction to be processed by the blockchain.
|
|
146
301
|
*/
|
|
147
|
-
export interface
|
|
302
|
+
export interface TransactionParams {
|
|
148
303
|
/**
|
|
149
304
|
* Network ID as per EIP-155.
|
|
150
305
|
*/
|
|
@@ -166,11 +321,15 @@ export interface Transaction {
|
|
|
166
321
|
*/
|
|
167
322
|
from: string;
|
|
168
323
|
/**
|
|
169
|
-
*
|
|
324
|
+
* same as gasLimit?
|
|
170
325
|
*/
|
|
171
326
|
gas?: string;
|
|
172
327
|
/**
|
|
173
|
-
*
|
|
328
|
+
* Maxmimum number of units of gas to use for this transaction.
|
|
329
|
+
*/
|
|
330
|
+
gasLimit?: string;
|
|
331
|
+
/**
|
|
332
|
+
* Price per gas for legacy txs
|
|
174
333
|
*/
|
|
175
334
|
gasPrice?: string;
|
|
176
335
|
/**
|
|
@@ -178,11 +337,12 @@ export interface Transaction {
|
|
|
178
337
|
*/
|
|
179
338
|
gasUsed?: string;
|
|
180
339
|
/**
|
|
181
|
-
* Maximum
|
|
340
|
+
* Maximum amount per gas to pay for the transaction, including the priority
|
|
341
|
+
* fee.
|
|
182
342
|
*/
|
|
183
343
|
maxFeePerGas?: string;
|
|
184
344
|
/**
|
|
185
|
-
* Maximum
|
|
345
|
+
* Maximum amount per gas to give to validator as incentive.
|
|
186
346
|
*/
|
|
187
347
|
maxPriorityFeePerGas?: string;
|
|
188
348
|
/**
|
|
@@ -256,18 +416,10 @@ export interface RemoteTransactionSourceRequest {
|
|
|
256
416
|
* The address of the account to fetch transactions for.
|
|
257
417
|
*/
|
|
258
418
|
address: string;
|
|
259
|
-
/**
|
|
260
|
-
* API key if required by the remote source.
|
|
261
|
-
*/
|
|
262
|
-
apiKey?: string;
|
|
263
419
|
/**
|
|
264
420
|
* The chainId of the current network.
|
|
265
421
|
*/
|
|
266
422
|
currentChainId: Hex;
|
|
267
|
-
/**
|
|
268
|
-
* The networkId of the current network.
|
|
269
|
-
*/
|
|
270
|
-
currentNetworkId: string;
|
|
271
423
|
/**
|
|
272
424
|
* Block number to start fetching transactions from.
|
|
273
425
|
*/
|
|
@@ -282,7 +434,19 @@ export interface RemoteTransactionSourceRequest {
|
|
|
282
434
|
* Used by the IncomingTransactionHelper to retrieve remote transaction data.
|
|
283
435
|
*/
|
|
284
436
|
export interface RemoteTransactionSource {
|
|
285
|
-
|
|
437
|
+
/**
|
|
438
|
+
* @param chainId - The chainId of the current network.
|
|
439
|
+
* @returns Whether the remote transaction source supports the specified network.
|
|
440
|
+
*/
|
|
441
|
+
isSupportedNetwork: (chainId: Hex) => boolean;
|
|
442
|
+
/**
|
|
443
|
+
* @returns An array of additional keys to use when caching the last fetched block number.
|
|
444
|
+
*/
|
|
445
|
+
getLastBlockVariations?: () => string[];
|
|
446
|
+
/**
|
|
447
|
+
* @param request - A request object containing data such as the address and chain ID.
|
|
448
|
+
* @returns An array of transaction metadata for the retrieved transactions.
|
|
449
|
+
*/
|
|
286
450
|
fetchTransactions: (request: RemoteTransactionSourceRequest) => Promise<TransactionMeta[]>;
|
|
287
451
|
}
|
|
288
452
|
/**
|
|
@@ -294,5 +458,41 @@ export interface DappSuggestedGasFees {
|
|
|
294
458
|
maxFeePerGas?: string;
|
|
295
459
|
maxPriorityFeePerGas?: string;
|
|
296
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* A transaction history operation that includes a note and timestamp.
|
|
463
|
+
*/
|
|
464
|
+
declare type ExtendedHistoryOperation = Operation & {
|
|
465
|
+
note?: string;
|
|
466
|
+
timestamp?: number;
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* A transaction history entry that includes the ExtendedHistoryOperation as the first element.
|
|
470
|
+
*/
|
|
471
|
+
export declare type TransactionHistoryEntry = [
|
|
472
|
+
ExtendedHistoryOperation,
|
|
473
|
+
...Operation[]
|
|
474
|
+
];
|
|
475
|
+
/**
|
|
476
|
+
* A transaction history that includes the transaction meta as the first element.
|
|
477
|
+
* And the rest of the elements are the operation arrays that were applied to the transaction meta.
|
|
478
|
+
*/
|
|
479
|
+
export declare type TransactionHistory = [
|
|
480
|
+
TransactionMeta,
|
|
481
|
+
...TransactionHistoryEntry[]
|
|
482
|
+
];
|
|
483
|
+
/**
|
|
484
|
+
* Result of inferring the transaction type.
|
|
485
|
+
*/
|
|
486
|
+
export declare type InferTransactionTypeResult = {
|
|
487
|
+
/**
|
|
488
|
+
* The contract code, in hex format if it exists. '0x0' or
|
|
489
|
+
* '0x' are also indicators of non-existent contract code.
|
|
490
|
+
*/
|
|
491
|
+
getCodeResponse?: string | null;
|
|
492
|
+
/**
|
|
493
|
+
* The type of transaction
|
|
494
|
+
*/
|
|
495
|
+
type: TransactionType;
|
|
496
|
+
};
|
|
297
497
|
export {};
|
|
298
498
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;GAEG;AACH,oBAAY,eAAe,GACvB,CAAC;IACC,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAC9D,GAAG,mBAAmB,CAAC,GACxB,CAAC;IAAE,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG,mBAAmB,CAAC,CAAC;AAE/E;;GAEG;AACH,aAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,GAAG,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;IAEb;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAE5C;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,YAAY,CAAC;IAEjC;;OAEG;IACH,gBAAgB,CAAC,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B,EAAE;CAC7B,CAAC;AAEF;;GAEG;AACH,oBAAY,0BAA0B,GAAG;IACvC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WalletDevice = exports.TransactionStatus = void 0;
|
|
3
|
+
exports.TransactionType = exports.WalletDevice = exports.TransactionStatus = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* The status of the transaction. Each status represents the state of the transaction internally
|
|
6
6
|
* in the wallet. Some of these correspond with the state of the transaction on the network, but
|
|
@@ -27,4 +27,102 @@ var WalletDevice;
|
|
|
27
27
|
WalletDevice["MM_EXTENSION"] = "metamask_extension";
|
|
28
28
|
WalletDevice["OTHER"] = "other_device";
|
|
29
29
|
})(WalletDevice = exports.WalletDevice || (exports.WalletDevice = {}));
|
|
30
|
+
/**
|
|
31
|
+
* The type of the transaction.
|
|
32
|
+
*/
|
|
33
|
+
var TransactionType;
|
|
34
|
+
(function (TransactionType) {
|
|
35
|
+
/**
|
|
36
|
+
* A transaction sending a network's native asset to a recipient.
|
|
37
|
+
*/
|
|
38
|
+
TransactionType["cancel"] = "cancel";
|
|
39
|
+
/**
|
|
40
|
+
* A transaction that is interacting with a smart contract's methods that we
|
|
41
|
+
* have not treated as a special case, such as approve, transfer, and
|
|
42
|
+
* transferfrom.
|
|
43
|
+
*/
|
|
44
|
+
TransactionType["contractInteraction"] = "contractInteraction";
|
|
45
|
+
/**
|
|
46
|
+
* A transaction that deployed a smart contract.
|
|
47
|
+
*/
|
|
48
|
+
TransactionType["deployContract"] = "contractDeployment";
|
|
49
|
+
/**
|
|
50
|
+
* A transaction for Ethereum decryption.
|
|
51
|
+
*/
|
|
52
|
+
TransactionType["ethDecrypt"] = "eth_decrypt";
|
|
53
|
+
/**
|
|
54
|
+
* A transaction for getting an encryption public key.
|
|
55
|
+
*/
|
|
56
|
+
TransactionType["ethGetEncryptionPublicKey"] = "eth_getEncryptionPublicKey";
|
|
57
|
+
/**
|
|
58
|
+
* An incoming (deposit) transaction.
|
|
59
|
+
*/
|
|
60
|
+
TransactionType["incoming"] = "incoming";
|
|
61
|
+
/**
|
|
62
|
+
* A transaction for personal sign.
|
|
63
|
+
*/
|
|
64
|
+
TransactionType["personalSign"] = "personal_sign";
|
|
65
|
+
/**
|
|
66
|
+
* When a transaction is failed it can be retried by
|
|
67
|
+
* resubmitting the same transaction with a higher gas fee. This type is also used
|
|
68
|
+
* to speed up pending transactions. This is accomplished by creating a new tx with
|
|
69
|
+
* the same nonce and higher gas fees.
|
|
70
|
+
*/
|
|
71
|
+
TransactionType["retry"] = "retry";
|
|
72
|
+
/**
|
|
73
|
+
* A transaction sending a network's native asset to a recipient.
|
|
74
|
+
*/
|
|
75
|
+
TransactionType["simpleSend"] = "simpleSend";
|
|
76
|
+
/**
|
|
77
|
+
* A transaction that is signing a message.
|
|
78
|
+
*/
|
|
79
|
+
TransactionType["sign"] = "eth_sign";
|
|
80
|
+
/**
|
|
81
|
+
* A transaction that is signing typed data.
|
|
82
|
+
*/
|
|
83
|
+
TransactionType["signTypedData"] = "eth_signTypedData";
|
|
84
|
+
/**
|
|
85
|
+
* A transaction sending a network's native asset to a recipient.
|
|
86
|
+
*/
|
|
87
|
+
TransactionType["smart"] = "smart";
|
|
88
|
+
/**
|
|
89
|
+
* A transaction swapping one token for another through MetaMask Swaps.
|
|
90
|
+
*/
|
|
91
|
+
TransactionType["swap"] = "swap";
|
|
92
|
+
/**
|
|
93
|
+
* Similar to the approve type, a swap approval is a special case of ERC20
|
|
94
|
+
* approve method that requests an allowance of the token to spend on behalf
|
|
95
|
+
* of the user for the MetaMask Swaps contract. The first swap for any token
|
|
96
|
+
* will have an accompanying swapApproval transaction.
|
|
97
|
+
*/
|
|
98
|
+
TransactionType["swapApproval"] = "swapApproval";
|
|
99
|
+
/**
|
|
100
|
+
* A token transaction requesting an allowance of the token to spend on
|
|
101
|
+
* behalf of the user.
|
|
102
|
+
*/
|
|
103
|
+
TransactionType["tokenMethodApprove"] = "approve";
|
|
104
|
+
/**
|
|
105
|
+
* A token transaction transferring tokens from an account that the sender
|
|
106
|
+
* has an allowance of. The method is prefixed with safe because when calling
|
|
107
|
+
* this method the contract checks to ensure that the receiver is an address
|
|
108
|
+
* capable of handling the token being sent.
|
|
109
|
+
*/
|
|
110
|
+
TransactionType["tokenMethodSafeTransferFrom"] = "safetransferfrom";
|
|
111
|
+
/**
|
|
112
|
+
* A token transaction where the user is sending tokens that they own to
|
|
113
|
+
* another address.
|
|
114
|
+
*/
|
|
115
|
+
TransactionType["tokenMethodTransfer"] = "transfer";
|
|
116
|
+
/**
|
|
117
|
+
* A token transaction transferring tokens from an account that the sender
|
|
118
|
+
* has an allowance of. For more information on allowances, see the approve
|
|
119
|
+
* type.
|
|
120
|
+
*/
|
|
121
|
+
TransactionType["tokenMethodTransferFrom"] = "transferfrom";
|
|
122
|
+
/**
|
|
123
|
+
* A token transaction requesting an allowance of all of a user's tokens to
|
|
124
|
+
* spend on behalf of the user.
|
|
125
|
+
*/
|
|
126
|
+
TransactionType["tokenMethodSetApprovalForAll"] = "setapprovalforall";
|
|
127
|
+
})(TransactionType = exports.TransactionType || (exports.TransactionType = {}));
|
|
30
128
|
//# sourceMappingURL=types.js.map
|