@metamask-previews/client-utils 1.0.0-preview-1590150f2 → 1.0.0-preview-8fd5dfabc

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 CHANGED
@@ -7,10 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Map `assetActivation` and `assetDeactivation` activity types in transaction activity mappers ([#9440](https://github.com/MetaMask/core/pull/9440))
13
-
14
10
  ## [1.0.0]
15
11
 
16
12
  ### Added
@@ -1,28 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapKeyringTransaction = exports.CustomTransactionTypeLabel = void 0;
3
+ exports.mapKeyringTransaction = void 0;
4
4
  const keyring_api_1 = require("@metamask/keyring-api");
5
- /**
6
- * Custom labels for non-EVM transactions.
7
- *
8
- * The labels are used to map the transaction type to the title in the activity list and dialog.
9
- * The labels are defined in the `transaction.details.typeLabel` property.
10
- * For details: {@link https://github.com/MetaMask/metamask-extension/pull/38040}
11
- */
12
- var CustomTransactionTypeLabel;
13
- (function (CustomTransactionTypeLabel) {
14
- // Token requires one off approve to receive
15
- CustomTransactionTypeLabel["TrustlineApprove"] = "trustline-approve";
16
- // Token requires revoke the approve to stop receiving
17
- CustomTransactionTypeLabel["TrustlineDisapprove"] = "trustline-disapprove";
18
- })(CustomTransactionTypeLabel || (exports.CustomTransactionTypeLabel = CustomTransactionTypeLabel = {}));
19
- function hasTrustlineTypeLabel(details) {
20
- // A flag to indicate if the transaction is a trustline type.
21
- return [
22
- String(CustomTransactionTypeLabel.TrustlineApprove),
23
- String(CustomTransactionTypeLabel.TrustlineDisapprove),
24
- ].includes(details?.typeLabel ?? '');
25
- }
26
5
  function mapStatus(status) {
27
6
  switch (status) {
28
7
  case keyring_api_1.TransactionStatus.Confirmed:
@@ -134,17 +113,6 @@ function mapKeyringTransaction({ transaction, subjectAddress, }) {
134
113
  };
135
114
  case keyring_api_1.TransactionType.TokenApprove: {
136
115
  const rawToken = getToken(transaction.from, 'out');
137
- if (hasTrustlineTypeLabel(transaction.details)) {
138
- return {
139
- type: 'assetActivation',
140
- ...common,
141
- data: {
142
- from,
143
- token: rawToken ? { ...rawToken, amount: undefined } : rawToken,
144
- fees,
145
- },
146
- };
147
- }
148
116
  const isUnlimited = rawToken?.amount !== undefined &&
149
117
  rawToken.amount.split('.')[0].length > approveAmountMaxIntegerDigits;
150
118
  return {
@@ -159,29 +127,6 @@ function mapKeyringTransaction({ transaction, subjectAddress, }) {
159
127
  },
160
128
  };
161
129
  }
162
- case keyring_api_1.TransactionType.TokenDisapprove: {
163
- if (!hasTrustlineTypeLabel(transaction.details)) {
164
- return {
165
- type: 'contractInteraction',
166
- ...common,
167
- data: {
168
- from,
169
- to,
170
- fees,
171
- },
172
- };
173
- }
174
- const rawToken = getToken(transaction.from, 'out');
175
- return {
176
- type: 'assetDeactivation',
177
- ...common,
178
- data: {
179
- from,
180
- token: rawToken ? { ...rawToken, amount: undefined } : rawToken,
181
- fees,
182
- },
183
- };
184
- }
185
130
  default:
186
131
  return {
187
132
  type: 'contractInteraction',
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-transaction-mapper.cjs","sourceRoot":"","sources":["../../src/mappers/keyring-transaction-mapper.ts"],"names":[],"mappings":";;;AACA,uDAG+B;AAW/B;;;;;;GAMG;AACH,IAAY,0BAKX;AALD,WAAY,0BAA0B;IACpC,4CAA4C;IAC5C,oEAAsC,CAAA;IACtC,sDAAsD;IACtD,0EAA4C,CAAA;AAC9C,CAAC,EALW,0BAA0B,0CAA1B,0BAA0B,QAKrC;AAED,SAAS,qBAAqB,CAC5B,OAAsC;IAEtC,6DAA6D;IAC7D,OAAO;QACL,MAAM,CAAC,0BAA0B,CAAC,gBAAgB,CAAC;QACnD,MAAM,CAAC,0BAA0B,CAAC,mBAAmB,CAAC;KACvD,CAAC,Q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,CAAC,CAAC,QAAQ;oBAC/D,IAAI;iBACL;aACF,CAAC;QACJ,CAAC;QAED;YACE,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,GAAG,MAAM;gBACT,IAAI,EAAE;oBACJ,IAAI;oBACJ,EAAE;oBACF,IAAI;iBACL;aACF,CAAC;IACN,CAAC;AACH,CAAC;AA1ID,sDA0IC","sourcesContent":["import type { Transaction as KeyringTransaction } from '@metamask/keyring-api';\nimport {\n TransactionStatus,\n TransactionType as KeyringTransactionType,\n} from '@metamask/keyring-api';\n\nimport type { Fee, ActivityItem, Status, TokenAmount } from '../types';\n\ntype Movement = KeyringTransaction['from'][number];\ntype KeyringFee = KeyringTransaction['fees'][number];\ntype FungibleAsset = Extract<\n NonNullable<Movement['asset']>,\n { fungible: true }\n>;\n\n/**\n * Custom labels for non-EVM transactions.\n *\n * The labels are used to map the transaction type to the title in the activity list and dialog.\n * The labels are defined in the `transaction.details.typeLabel` property.\n * For details: {@link https://github.com/MetaMask/metamask-extension/pull/38040}\n */\nexport enum CustomTransactionTypeLabel {\n // Token requires one off approve to receive\n TrustlineApprove = 'trustline-approve',\n // Token requires revoke the approve to stop receiving\n TrustlineDisapprove = 'trustline-disapprove',\n}\n\nfunction hasTrustlineTypeLabel(\n details: KeyringTransaction['details'],\n): boolean {\n // A flag to indicate if the transaction is a trustline type.\n return [\n String(CustomTransactionTypeLabel.TrustlineApprove),\n String(CustomTransactionTypeLabel.TrustlineDisapprove),\n ].includes(details?.typeLabel ?? '');\n}\n\nfunction mapStatus(status: KeyringTransaction['status']): Status {\n switch (status) {\n case TransactionStatus.Confirmed:\n return 'success';\n case TransactionStatus.Failed:\n return 'failed';\n case TransactionStatus.Submitted:\n case TransactionStatus.Unconfirmed:\n default:\n return 'pending';\n }\n}\n\nfunction getAddress(movements: Movement[]): string {\n return movements[0]?.address ?? '';\n}\n\nfunction hasFungibleAsset(\n movement: Movement,\n): movement is Movement & { asset: FungibleAsset } {\n return movement.asset?.fungible === true;\n}\n\nfunction getToken(\n movements: Movement[],\n direction: TokenAmount['direction'],\n): TokenAmount | undefined {\n const movement = movements.find(hasFungibleAsset);\n\n if (!movement) {\n return undefined;\n }\n\n return {\n amount: movement.asset.amount,\n symbol: movement.asset.unit,\n assetId: movement.asset.type,\n direction,\n };\n}\n\nfunction getFee(fee: KeyringFee): Fee | undefined {\n const { asset } = fee;\n\n if (!asset.fungible) {\n return undefined;\n }\n\n return {\n type: fee.type,\n amount: asset.amount,\n symbol: asset.unit,\n assetId: asset.type,\n };\n}\n\nfunction getFees(transaction: KeyringTransaction): Fee[] {\n return transaction.fees.flatMap((fee) => {\n const mappedFee = getFee(fee);\n\n return mappedFee ? [mappedFee] : [];\n });\n}\n\nconst approveAmountMaxIntegerDigits = 15;\n\n/**\n * Maps a keyring transaction into the shared activity item shape.\n *\n * @param options - The mapping options.\n * @param options.transaction - The keyring transaction to map.\n * @param options.subjectAddress - Account address used for send/receive attribution.\n * @returns The normalized activity item.\n */\nexport function mapKeyringTransaction({\n transaction,\n subjectAddress,\n}: {\n transaction: KeyringTransaction;\n subjectAddress?: string;\n}): ActivityItem {\n const { type, id } = transaction;\n const status = mapStatus(transaction.status);\n const timestamp = transaction.timestamp ? transaction.timestamp * 1000 : 0;\n const chainId = transaction.chain;\n\n const from =\n type === KeyringTransactionType.Send && subjectAddress\n ? subjectAddress\n : getAddress(transaction.from);\n\n const to =\n type === KeyringTransactionType.Receive && subjectAddress\n ? subjectAddress\n : getAddress(transaction.to);\n\n const fees = getFees(transaction);\n const common = { chainId, status, timestamp, hash: id };\n\n switch (type) {\n case KeyringTransactionType.Send: {\n const fromToken = getToken(transaction.from, 'out');\n const token =\n !fromToken && chainId.startsWith('bip122:')\n ? getToken(transaction.to, 'out')\n : fromToken;\n\n return {\n type: 'send',\n ...common,\n data: {\n from,\n to,\n token,\n fees,\n },\n };\n }\n\n case KeyringTransactionType.Receive:\n return {\n type: 'receive',\n ...common,\n data: {\n from,\n to,\n token: getToken(transaction.to, 'in'),\n fees,\n },\n };\n\n case KeyringTransactionType.Swap:\n return {\n type: 'swap',\n ...common,\n data: {\n from,\n destinationToken: getToken(transaction.to, 'in'),\n sourceToken: getToken(transaction.from, 'out'),\n fees,\n },\n };\n\n case KeyringTransactionType.TokenApprove: {\n const rawToken = getToken(transaction.from, 'out');\n\n if (hasTrustlineTypeLabel(transaction.details)) {\n return {\n type: 'assetActivation',\n ...common,\n data: {\n from,\n token: rawToken ? { ...rawToken, amount: undefined } : rawToken,\n fees,\n },\n };\n }\n\n const isUnlimited =\n rawToken?.amount !== undefined &&\n rawToken.amount.split('.')[0].length > approveAmountMaxIntegerDigits;\n\n return {\n type: 'approveSpendingCap',\n ...common,\n data: {\n from,\n token: rawToken\n ? { ...rawToken, amount: isUnlimited ? undefined : rawToken.amount }\n : rawToken,\n fees,\n },\n };\n }\n\n case KeyringTransactionType.TokenDisapprove: {\n if (!hasTrustlineTypeLabel(transaction.details)) {\n return {\n type: 'contractInteraction',\n ...common,\n data: {\n from,\n to,\n fees,\n },\n };\n }\n\n const rawToken = getToken(transaction.from, 'out');\n\n return {\n type: 'assetDeactivation',\n ...common,\n data: {\n from,\n token: rawToken ? { ...rawToken, amount: undefined } : rawToken,\n fees,\n },\n };\n }\n\n default:\n return {\n type: 'contractInteraction',\n ...common,\n data: {\n from,\n to,\n fees,\n },\n };\n }\n}\n"]}
1
+ {"version":3,"file":"keyring-transaction-mapper.cjs","sourceRoot":"","sources":["../../src/mappers/keyring-transaction-mapper.ts"],"names":[],"mappings":";;;AACA,uDAG+B;AAW/B,SAAS,SAAS,CAAC,MAAoC;IACrD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,+BAAiB,CAAC,SAAS;YAC9B,OAAO,SAAS,CAAC;QACnB,KAAK,+BAAiB,CAAC,MAAM;YAC3B,OAAO,QAAQ,CAAC;QAClB,KAAK,+BAAiB,CAAC,SAAS,CAAC;QACjC,KAAK,+BAAiB,CAAC,WAAW,CAAC;QACnC;YACE,OAAO,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;oBACZ,IAAI;iBACL;aACF,CAAC;QACJ,CAAC;QAED;YACE,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,GAAG,MAAM;gBACT,IAAI,EAAE;oBACJ,IAAI;oBACJ,EAAE;oBACF,IAAI;iBACL;aACF,CAAC;IACN,CAAC;AACH,CAAC;AAnGD,sDAmGC","sourcesContent":["import type { Transaction as KeyringTransaction } from '@metamask/keyring-api';\nimport {\n TransactionStatus,\n TransactionType as KeyringTransactionType,\n} from '@metamask/keyring-api';\n\nimport type { Fee, ActivityItem, Status, TokenAmount } from '../types';\n\ntype Movement = KeyringTransaction['from'][number];\ntype KeyringFee = KeyringTransaction['fees'][number];\ntype FungibleAsset = Extract<\n NonNullable<Movement['asset']>,\n { fungible: true }\n>;\n\nfunction mapStatus(status: KeyringTransaction['status']): Status {\n switch (status) {\n case TransactionStatus.Confirmed:\n return 'success';\n case TransactionStatus.Failed:\n return 'failed';\n case TransactionStatus.Submitted:\n case TransactionStatus.Unconfirmed:\n default:\n return 'pending';\n }\n}\n\nfunction getAddress(movements: Movement[]): string {\n return movements[0]?.address ?? '';\n}\n\nfunction hasFungibleAsset(\n movement: Movement,\n): movement is Movement & { asset: FungibleAsset } {\n return movement.asset?.fungible === true;\n}\n\nfunction getToken(\n movements: Movement[],\n direction: TokenAmount['direction'],\n): TokenAmount | undefined {\n const movement = movements.find(hasFungibleAsset);\n\n if (!movement) {\n return undefined;\n }\n\n return {\n amount: movement.asset.amount,\n symbol: movement.asset.unit,\n assetId: movement.asset.type,\n direction,\n };\n}\n\nfunction getFee(fee: KeyringFee): Fee | undefined {\n const { asset } = fee;\n\n if (!asset.fungible) {\n return undefined;\n }\n\n return {\n type: fee.type,\n amount: asset.amount,\n symbol: asset.unit,\n assetId: asset.type,\n };\n}\n\nfunction getFees(transaction: KeyringTransaction): Fee[] {\n return transaction.fees.flatMap((fee) => {\n const mappedFee = getFee(fee);\n\n return mappedFee ? [mappedFee] : [];\n });\n}\n\nconst approveAmountMaxIntegerDigits = 15;\n\n/**\n * Maps a keyring transaction into the shared activity item shape.\n *\n * @param options - The mapping options.\n * @param options.transaction - The keyring transaction to map.\n * @param options.subjectAddress - Account address used for send/receive attribution.\n * @returns The normalized activity item.\n */\nexport function mapKeyringTransaction({\n transaction,\n subjectAddress,\n}: {\n transaction: KeyringTransaction;\n subjectAddress?: string;\n}): ActivityItem {\n const { type, id } = transaction;\n const status = mapStatus(transaction.status);\n const timestamp = transaction.timestamp ? transaction.timestamp * 1000 : 0;\n const chainId = transaction.chain;\n\n const from =\n type === KeyringTransactionType.Send && subjectAddress\n ? subjectAddress\n : getAddress(transaction.from);\n\n const to =\n type === KeyringTransactionType.Receive && subjectAddress\n ? subjectAddress\n : getAddress(transaction.to);\n\n const fees = getFees(transaction);\n const common = { chainId, status, timestamp, hash: id };\n\n switch (type) {\n case KeyringTransactionType.Send: {\n const fromToken = getToken(transaction.from, 'out');\n const token =\n !fromToken && chainId.startsWith('bip122:')\n ? getToken(transaction.to, 'out')\n : fromToken;\n\n return {\n type: 'send',\n ...common,\n data: {\n from,\n to,\n token,\n fees,\n },\n };\n }\n\n case KeyringTransactionType.Receive:\n return {\n type: 'receive',\n ...common,\n data: {\n from,\n to,\n token: getToken(transaction.to, 'in'),\n fees,\n },\n };\n\n case KeyringTransactionType.Swap:\n return {\n type: 'swap',\n ...common,\n data: {\n from,\n destinationToken: getToken(transaction.to, 'in'),\n sourceToken: getToken(transaction.from, 'out'),\n fees,\n },\n };\n\n case KeyringTransactionType.TokenApprove: {\n const rawToken = getToken(transaction.from, 'out');\n const isUnlimited =\n rawToken?.amount !== undefined &&\n rawToken.amount.split('.')[0].length > approveAmountMaxIntegerDigits;\n\n return {\n type: 'approveSpendingCap',\n ...common,\n data: {\n from,\n token: rawToken\n ? { ...rawToken, amount: isUnlimited ? undefined : rawToken.amount }\n : rawToken,\n fees,\n },\n };\n }\n\n default:\n return {\n type: 'contractInteraction',\n ...common,\n data: {\n from,\n to,\n fees,\n },\n };\n }\n}\n"]}
@@ -1,16 +1,5 @@
1
1
  import type { Transaction as KeyringTransaction } from "@metamask/keyring-api";
2
2
  import type { ActivityItem } from "../types.cjs";
3
- /**
4
- * Custom labels for non-EVM transactions.
5
- *
6
- * The labels are used to map the transaction type to the title in the activity list and dialog.
7
- * The labels are defined in the `transaction.details.typeLabel` property.
8
- * For details: {@link https://github.com/MetaMask/metamask-extension/pull/38040}
9
- */
10
- export declare enum CustomTransactionTypeLabel {
11
- TrustlineApprove = "trustline-approve",
12
- TrustlineDisapprove = "trustline-disapprove"
13
- }
14
3
  /**
15
4
  * Maps a keyring transaction into the shared activity item shape.
16
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-transaction-mapper.d.cts","sourceRoot":"","sources":["../../src/mappers/keyring-transaction-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,kBAAkB,EAAE,8BAA8B;AAM/E,OAAO,KAAK,EAAO,YAAY,EAAuB,qBAAiB;AASvE;;;;;;GAMG;AACH,oBAAY,0BAA0B;IAEpC,gBAAgB,sBAAsB;IAEtC,mBAAmB,yBAAyB;CAC7C;AA8ED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,cAAc,GACf,EAAE;IACD,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,YAAY,CAoIf"}
1
+ {"version":3,"file":"keyring-transaction-mapper.d.cts","sourceRoot":"","sources":["../../src/mappers/keyring-transaction-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,kBAAkB,EAAE,8BAA8B;AAM/E,OAAO,KAAK,EAAO,YAAY,EAAuB,qBAAiB;AA2EvE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,cAAc,GACf,EAAE;IACD,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,YAAY,CA6Ff"}
@@ -1,16 +1,5 @@
1
1
  import type { Transaction as KeyringTransaction } from "@metamask/keyring-api";
2
2
  import type { ActivityItem } from "../types.mjs";
3
- /**
4
- * Custom labels for non-EVM transactions.
5
- *
6
- * The labels are used to map the transaction type to the title in the activity list and dialog.
7
- * The labels are defined in the `transaction.details.typeLabel` property.
8
- * For details: {@link https://github.com/MetaMask/metamask-extension/pull/38040}
9
- */
10
- export declare enum CustomTransactionTypeLabel {
11
- TrustlineApprove = "trustline-approve",
12
- TrustlineDisapprove = "trustline-disapprove"
13
- }
14
3
  /**
15
4
  * Maps a keyring transaction into the shared activity item shape.
16
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-transaction-mapper.d.mts","sourceRoot":"","sources":["../../src/mappers/keyring-transaction-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,kBAAkB,EAAE,8BAA8B;AAM/E,OAAO,KAAK,EAAO,YAAY,EAAuB,qBAAiB;AASvE;;;;;;GAMG;AACH,oBAAY,0BAA0B;IAEpC,gBAAgB,sBAAsB;IAEtC,mBAAmB,yBAAyB;CAC7C;AA8ED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,cAAc,GACf,EAAE;IACD,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,YAAY,CAoIf"}
1
+ {"version":3,"file":"keyring-transaction-mapper.d.mts","sourceRoot":"","sources":["../../src/mappers/keyring-transaction-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,kBAAkB,EAAE,8BAA8B;AAM/E,OAAO,KAAK,EAAO,YAAY,EAAuB,qBAAiB;AA2EvE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,cAAc,GACf,EAAE;IACD,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,YAAY,CA6Ff"}
@@ -1,25 +1,4 @@
1
1
  import { TransactionStatus, TransactionType as KeyringTransactionType } from "@metamask/keyring-api";
2
- /**
3
- * Custom labels for non-EVM transactions.
4
- *
5
- * The labels are used to map the transaction type to the title in the activity list and dialog.
6
- * The labels are defined in the `transaction.details.typeLabel` property.
7
- * For details: {@link https://github.com/MetaMask/metamask-extension/pull/38040}
8
- */
9
- export var CustomTransactionTypeLabel;
10
- (function (CustomTransactionTypeLabel) {
11
- // Token requires one off approve to receive
12
- CustomTransactionTypeLabel["TrustlineApprove"] = "trustline-approve";
13
- // Token requires revoke the approve to stop receiving
14
- CustomTransactionTypeLabel["TrustlineDisapprove"] = "trustline-disapprove";
15
- })(CustomTransactionTypeLabel || (CustomTransactionTypeLabel = {}));
16
- function hasTrustlineTypeLabel(details) {
17
- // A flag to indicate if the transaction is a trustline type.
18
- return [
19
- String(CustomTransactionTypeLabel.TrustlineApprove),
20
- String(CustomTransactionTypeLabel.TrustlineDisapprove),
21
- ].includes(details?.typeLabel ?? '');
22
- }
23
2
  function mapStatus(status) {
24
3
  switch (status) {
25
4
  case TransactionStatus.Confirmed:
@@ -131,17 +110,6 @@ export function mapKeyringTransaction({ transaction, subjectAddress, }) {
131
110
  };
132
111
  case KeyringTransactionType.TokenApprove: {
133
112
  const rawToken = getToken(transaction.from, 'out');
134
- if (hasTrustlineTypeLabel(transaction.details)) {
135
- return {
136
- type: 'assetActivation',
137
- ...common,
138
- data: {
139
- from,
140
- token: rawToken ? { ...rawToken, amount: undefined } : rawToken,
141
- fees,
142
- },
143
- };
144
- }
145
113
  const isUnlimited = rawToken?.amount !== undefined &&
146
114
  rawToken.amount.split('.')[0].length > approveAmountMaxIntegerDigits;
147
115
  return {
@@ -156,29 +124,6 @@ export function mapKeyringTransaction({ transaction, subjectAddress, }) {
156
124
  },
157
125
  };
158
126
  }
159
- case KeyringTransactionType.TokenDisapprove: {
160
- if (!hasTrustlineTypeLabel(transaction.details)) {
161
- return {
162
- type: 'contractInteraction',
163
- ...common,
164
- data: {
165
- from,
166
- to,
167
- fees,
168
- },
169
- };
170
- }
171
- const rawToken = getToken(transaction.from, 'out');
172
- return {
173
- type: 'assetDeactivation',
174
- ...common,
175
- data: {
176
- from,
177
- token: rawToken ? { ...rawToken, amount: undefined } : rawToken,
178
- fees,
179
- },
180
- };
181
- }
182
127
  default:
183
128
  return {
184
129
  type: 'contractInteraction',
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-transaction-mapper.mjs","sourceRoot":"","sources":["../../src/mappers/keyring-transaction-mapper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,eAAe,IAAI,sBAAsB,EAC1C,8BAA8B;AAW/B;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,0BAKX;AALD,WAAY,0BAA0B;IACpC,4CAA4C;IAC5C,oEAAsC,CAAA;IACtC,sDAAsD;IACtD,0EAA4C,CAAA;AAC9C,CAAC,EALW,0BAA0B,KAA1B,0BAA0B,QAKrC;AAED,SAAS,qBAAqB,CAC5B,OAAsC;IAEtC,6DAA6D;IAC7D,OAAO;QACL,MAAM,CAAC,0BAA0B,CAAC,gBAAgB,CAAC;QACnD,MAAM,CAAC,0BAA0B,CAAC,mBAAmB,CAAC;KACvD,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,SAAS,CAAC,MAAoC;IACrD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,iBAAiB,CAAC,SAAS;YAC9B,OAAO,SAAS,CAAC;QACnB,KAAK,iBAAiB,CAAC,MAAM;YAC3B,OAAO,QAAQ,CAAC;QAClB,KAAK,iBAAiB,CAAC,SAAS,CAAC;QACjC,KAAK,iBAAiB,CAAC,WAAW,CAAC;QACnC;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,SAAqB;IACvC,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AAI,EAAE,oBAAoB;gBAC1B,GAAG,MAAM;gBACT,IAAI,EAAE;oBACJ,IAAI;oBACJ,KAAK,EAAE,QAAQ;wBACb,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE;wBACpE,CAAC,CAAC,QAAQ;oBACZ,IAAI;iBACL;aACF,CAAC;QACJ,CAAC;QAED,KAAK,sBAAsB,CAAC,eAAe,CAAC,CAAC,CAAC;YAC5C,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;gBAChD,OAAO;oBACL,IAAI,EAAE,qBAAqB;oBAC3B,GAAG,MAAM;oBACT,IAAI,EAAE;wBACJ,IAAI;wBACJ,EAAE;wBACF,IAAI;qBACL;iBACF,CAAC;YACJ,CAAC;YAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAEnD,OAAO;gBACL,IAAI,EAAE,mBAAmB;gBACzB,GAAG,MAAM;gBACT,IAAI,EAAE;oBACJ,IAAI;oBACJ,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,QAAQ;oBAC/D,IAAI;iBACL;aACF,CAAC;QACJ,CAAC;QAED;YACE,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,GAAG,MAAM;gBACT,IAAI,EAAE;oBACJ,IAAI;oBACJ,EAAE;oBACF,IAAI;iBACL;aACF,CAAC;IACN,CAAC;AACH,CAAC","sourcesContent":["import type { Transaction as KeyringTransaction } from '@metamask/keyring-api';\nimport {\n TransactionStatus,\n TransactionType as KeyringTransactionType,\n} from '@metamask/keyring-api';\n\nimport type { Fee, ActivityItem, Status, TokenAmount } from '../types';\n\ntype Movement = KeyringTransaction['from'][number];\ntype KeyringFee = KeyringTransaction['fees'][number];\ntype FungibleAsset = Extract<\n NonNullable<Movement['asset']>,\n { fungible: true }\n>;\n\n/**\n * Custom labels for non-EVM transactions.\n *\n * The labels are used to map the transaction type to the title in the activity list and dialog.\n * The labels are defined in the `transaction.details.typeLabel` property.\n * For details: {@link https://github.com/MetaMask/metamask-extension/pull/38040}\n */\nexport enum CustomTransactionTypeLabel {\n // Token requires one off approve to receive\n TrustlineApprove = 'trustline-approve',\n // Token requires revoke the approve to stop receiving\n TrustlineDisapprove = 'trustline-disapprove',\n}\n\nfunction hasTrustlineTypeLabel(\n details: KeyringTransaction['details'],\n): boolean {\n // A flag to indicate if the transaction is a trustline type.\n return [\n String(CustomTransactionTypeLabel.TrustlineApprove),\n String(CustomTransactionTypeLabel.TrustlineDisapprove),\n ].includes(details?.typeLabel ?? '');\n}\n\nfunction mapStatus(status: KeyringTransaction['status']): Status {\n switch (status) {\n case TransactionStatus.Confirmed:\n return 'success';\n case TransactionStatus.Failed:\n return 'failed';\n case TransactionStatus.Submitted:\n case TransactionStatus.Unconfirmed:\n default:\n return 'pending';\n }\n}\n\nfunction getAddress(movements: Movement[]): string {\n return movements[0]?.address ?? '';\n}\n\nfunction hasFungibleAsset(\n movement: Movement,\n): movement is Movement & { asset: FungibleAsset } {\n return movement.asset?.fungible === true;\n}\n\nfunction getToken(\n movements: Movement[],\n direction: TokenAmount['direction'],\n): TokenAmount | undefined {\n const movement = movements.find(hasFungibleAsset);\n\n if (!movement) {\n return undefined;\n }\n\n return {\n amount: movement.asset.amount,\n symbol: movement.asset.unit,\n assetId: movement.asset.type,\n direction,\n };\n}\n\nfunction getFee(fee: KeyringFee): Fee | undefined {\n const { asset } = fee;\n\n if (!asset.fungible) {\n return undefined;\n }\n\n return {\n type: fee.type,\n amount: asset.amount,\n symbol: asset.unit,\n assetId: asset.type,\n };\n}\n\nfunction getFees(transaction: KeyringTransaction): Fee[] {\n return transaction.fees.flatMap((fee) => {\n const mappedFee = getFee(fee);\n\n return mappedFee ? [mappedFee] : [];\n });\n}\n\nconst approveAmountMaxIntegerDigits = 15;\n\n/**\n * Maps a keyring transaction into the shared activity item shape.\n *\n * @param options - The mapping options.\n * @param options.transaction - The keyring transaction to map.\n * @param options.subjectAddress - Account address used for send/receive attribution.\n * @returns The normalized activity item.\n */\nexport function mapKeyringTransaction({\n transaction,\n subjectAddress,\n}: {\n transaction: KeyringTransaction;\n subjectAddress?: string;\n}): ActivityItem {\n const { type, id } = transaction;\n const status = mapStatus(transaction.status);\n const timestamp = transaction.timestamp ? transaction.timestamp * 1000 : 0;\n const chainId = transaction.chain;\n\n const from =\n type === KeyringTransactionType.Send && subjectAddress\n ? subjectAddress\n : getAddress(transaction.from);\n\n const to =\n type === KeyringTransactionType.Receive && subjectAddress\n ? subjectAddress\n : getAddress(transaction.to);\n\n const fees = getFees(transaction);\n const common = { chainId, status, timestamp, hash: id };\n\n switch (type) {\n case KeyringTransactionType.Send: {\n const fromToken = getToken(transaction.from, 'out');\n const token =\n !fromToken && chainId.startsWith('bip122:')\n ? getToken(transaction.to, 'out')\n : fromToken;\n\n return {\n type: 'send',\n ...common,\n data: {\n from,\n to,\n token,\n fees,\n },\n };\n }\n\n case KeyringTransactionType.Receive:\n return {\n type: 'receive',\n ...common,\n data: {\n from,\n to,\n token: getToken(transaction.to, 'in'),\n fees,\n },\n };\n\n case KeyringTransactionType.Swap:\n return {\n type: 'swap',\n ...common,\n data: {\n from,\n destinationToken: getToken(transaction.to, 'in'),\n sourceToken: getToken(transaction.from, 'out'),\n fees,\n },\n };\n\n case KeyringTransactionType.TokenApprove: {\n const rawToken = getToken(transaction.from, 'out');\n\n if (hasTrustlineTypeLabel(transaction.details)) {\n return {\n type: 'assetActivation',\n ...common,\n data: {\n from,\n token: rawToken ? { ...rawToken, amount: undefined } : rawToken,\n fees,\n },\n };\n }\n\n const isUnlimited =\n rawToken?.amount !== undefined &&\n rawToken.amount.split('.')[0].length > approveAmountMaxIntegerDigits;\n\n return {\n type: 'approveSpendingCap',\n ...common,\n data: {\n from,\n token: rawToken\n ? { ...rawToken, amount: isUnlimited ? undefined : rawToken.amount }\n : rawToken,\n fees,\n },\n };\n }\n\n case KeyringTransactionType.TokenDisapprove: {\n if (!hasTrustlineTypeLabel(transaction.details)) {\n return {\n type: 'contractInteraction',\n ...common,\n data: {\n from,\n to,\n fees,\n },\n };\n }\n\n const rawToken = getToken(transaction.from, 'out');\n\n return {\n type: 'assetDeactivation',\n ...common,\n data: {\n from,\n token: rawToken ? { ...rawToken, amount: undefined } : rawToken,\n fees,\n },\n };\n }\n\n default:\n return {\n type: 'contractInteraction',\n ...common,\n data: {\n from,\n to,\n fees,\n },\n };\n }\n}\n"]}
1
+ {"version":3,"file":"keyring-transaction-mapper.mjs","sourceRoot":"","sources":["../../src/mappers/keyring-transaction-mapper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,eAAe,IAAI,sBAAsB,EAC1C,8BAA8B;AAW/B,SAAS,SAAS,CAAC,MAAoC;IACrD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,iBAAiB,CAAC,SAAS;YAC9B,OAAO,SAAS,CAAC;QACnB,KAAK,iBAAiB,CAAC,MAAM;YAC3B,OAAO,QAAQ,CAAC;QAClB,KAAK,iBAAiB,CAAC,SAAS,CAAC;QACjC,KAAK,iBAAiB,CAAC,WAAW,CAAC;QACnC;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,SAAqB;IACvC,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,gBAAgB,CACvB,QAAkB;IAElB,OAAO,QAAQ,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AAC3C,CAAC;AAED,SAAS,QAAQ,CACf,SAAqB,EACrB,SAAmC;IAEnC,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IA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ACF,CAAC;QAEJ,KAAK,sBAAsB,CAAC,IAAI;YAC9B,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,GAAG,MAAM;gBACT,IAAI,EAAE;oBACJ,IAAI;oBACJ,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC;oBAChD,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;oBAC9C,IAAI;iBACL;aACF,CAAC;QAEJ,KAAK,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC;YACzC,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACnD,MAAM,WAAW,GACf,QAAQ,EAAE,MAAM,KAAK,SAAS;gBAC9B,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,6BAA6B,CAAC;YAEvE,OAAO;gBACL,IAAI,EAAE,oBAAoB;gBAC1B,GAAG,MAAM;gBACT,IAAI,EAAE;oBACJ,IAAI;oBACJ,KAAK,EAAE,QAAQ;wBACb,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE;wBACpE,CAAC,CAAC,QAAQ;oBACZ,IAAI;iBACL;aACF,CAAC;QACJ,CAAC;QAED;YACE,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,GAAG,MAAM;gBACT,IAAI,EAAE;oBACJ,IAAI;oBACJ,EAAE;oBACF,IAAI;iBACL;aACF,CAAC;IACN,CAAC;AACH,CAAC","sourcesContent":["import type { Transaction as KeyringTransaction } from '@metamask/keyring-api';\nimport {\n TransactionStatus,\n TransactionType as KeyringTransactionType,\n} from '@metamask/keyring-api';\n\nimport type { Fee, ActivityItem, Status, TokenAmount } from '../types';\n\ntype Movement = KeyringTransaction['from'][number];\ntype KeyringFee = KeyringTransaction['fees'][number];\ntype FungibleAsset = Extract<\n NonNullable<Movement['asset']>,\n { fungible: true }\n>;\n\nfunction mapStatus(status: KeyringTransaction['status']): Status {\n switch (status) {\n case TransactionStatus.Confirmed:\n return 'success';\n case TransactionStatus.Failed:\n return 'failed';\n case TransactionStatus.Submitted:\n case TransactionStatus.Unconfirmed:\n default:\n return 'pending';\n }\n}\n\nfunction getAddress(movements: Movement[]): string {\n return movements[0]?.address ?? '';\n}\n\nfunction hasFungibleAsset(\n movement: Movement,\n): movement is Movement & { asset: FungibleAsset } {\n return movement.asset?.fungible === true;\n}\n\nfunction getToken(\n movements: Movement[],\n direction: TokenAmount['direction'],\n): TokenAmount | undefined {\n const movement = movements.find(hasFungibleAsset);\n\n if (!movement) {\n return undefined;\n }\n\n return {\n amount: movement.asset.amount,\n symbol: movement.asset.unit,\n assetId: movement.asset.type,\n direction,\n };\n}\n\nfunction getFee(fee: KeyringFee): Fee | undefined {\n const { asset } = fee;\n\n if (!asset.fungible) {\n return undefined;\n }\n\n return {\n type: fee.type,\n amount: asset.amount,\n symbol: asset.unit,\n assetId: asset.type,\n };\n}\n\nfunction getFees(transaction: KeyringTransaction): Fee[] {\n return transaction.fees.flatMap((fee) => {\n const mappedFee = getFee(fee);\n\n return mappedFee ? [mappedFee] : [];\n });\n}\n\nconst approveAmountMaxIntegerDigits = 15;\n\n/**\n * Maps a keyring transaction into the shared activity item shape.\n *\n * @param options - The mapping options.\n * @param options.transaction - The keyring transaction to map.\n * @param options.subjectAddress - Account address used for send/receive attribution.\n * @returns The normalized activity item.\n */\nexport function mapKeyringTransaction({\n transaction,\n subjectAddress,\n}: {\n transaction: KeyringTransaction;\n subjectAddress?: string;\n}): ActivityItem {\n const { type, id } = transaction;\n const status = mapStatus(transaction.status);\n const timestamp = transaction.timestamp ? transaction.timestamp * 1000 : 0;\n const chainId = transaction.chain;\n\n const from =\n type === KeyringTransactionType.Send && subjectAddress\n ? subjectAddress\n : getAddress(transaction.from);\n\n const to =\n type === KeyringTransactionType.Receive && subjectAddress\n ? subjectAddress\n : getAddress(transaction.to);\n\n const fees = getFees(transaction);\n const common = { chainId, status, timestamp, hash: id };\n\n switch (type) {\n case KeyringTransactionType.Send: {\n const fromToken = getToken(transaction.from, 'out');\n const token =\n !fromToken && chainId.startsWith('bip122:')\n ? getToken(transaction.to, 'out')\n : fromToken;\n\n return {\n type: 'send',\n ...common,\n data: {\n from,\n to,\n token,\n fees,\n },\n };\n }\n\n case KeyringTransactionType.Receive:\n return {\n type: 'receive',\n ...common,\n data: {\n from,\n to,\n token: getToken(transaction.to, 'in'),\n fees,\n },\n };\n\n case KeyringTransactionType.Swap:\n return {\n type: 'swap',\n ...common,\n data: {\n from,\n destinationToken: getToken(transaction.to, 'in'),\n sourceToken: getToken(transaction.from, 'out'),\n fees,\n },\n };\n\n case KeyringTransactionType.TokenApprove: {\n const rawToken = getToken(transaction.from, 'out');\n const isUnlimited =\n rawToken?.amount !== undefined &&\n rawToken.amount.split('.')[0].length > approveAmountMaxIntegerDigits;\n\n return {\n type: 'approveSpendingCap',\n ...common,\n data: {\n from,\n token: rawToken\n ? { ...rawToken, amount: isUnlimited ? undefined : rawToken.amount }\n : rawToken,\n fees,\n },\n };\n }\n\n default:\n return {\n type: 'contractInteraction',\n ...common,\n data: {\n from,\n to,\n fees,\n },\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ValueTransfer as _ValueTransfer } from '@metamask/core-backend';\nimport type { CaipChainId } from '@metamask/utils';\n\nexport type ActivityKind =\n | 'receive'\n | 'sell'\n | 'buy'\n | 'deposit'\n | 'swap'\n | 'claim'\n | 'claimMusdBonus'\n | 'send'\n | 'wrap'\n | 'unwrap'\n | 'approveSpendingCap'\n | 'revokeSpendingCap'\n | 'increaseSpendingCap'\n | 'contractInteraction'\n | 'contractDeployment'\n | 'bridge'\n | 'convert'\n | 'nftBuy'\n | 'nftMint'\n | 'nftSell'\n | 'smartAccountUpgrade'\n | 'lendingDeposit'\n | 'lendingWithdrawal'\n | 'predictionsAddFunds'\n | 'predictionsWithdrawFunds'\n | 'predictionClaimWinnings'\n | 'predictionCashedOut'\n | 'predictionPlaced'\n | 'perpsAddFunds'\n | 'perpsWithdraw'\n | 'perpsOpenLong'\n | 'perpsCloseLong'\n | 'perpsCloseLongLiquidated'\n | 'perpsCloseLongStopLoss'\n | 'perpsOpenShort'\n | 'perpsCloseShort'\n | 'perpsCloseShortLiquidated'\n | 'perpsCloseShortStopLoss'\n | 'perpsPaidFundingFees'\n | 'perpsReceivedFundingFees'\n | 'perpsCloseShortTakeProfit'\n | 'perpsCloseLongTakeProfit'\n | 'marketShort'\n | 'stopMarketCloseShort'\n | 'marketCloseShort'\n | 'assetActivation'\n | 'assetDeactivation';\n\nexport type Status = 'pending' | 'success' | 'failed' | 'cancelled';\n\nexport type TokenAmount = {\n amount?: string;\n decimals?: number;\n symbol?: string;\n assetId?: string;\n direction: 'in' | 'out';\n};\n\nexport type FiatAmount = {\n amount: string;\n currency?: string;\n};\n\nexport type Fee = {\n type: string;\n amount?: string;\n decimals?: number;\n symbol?: string;\n assetId?: string;\n};\n\ntype ActivityData<Type extends ActivityKind, Data> = {\n type: Type;\n chainId: CaipChainId;\n status: Status;\n timestamp: number;\n hash?: string;\n data: Data;\n};\n\nexport type ActivityItem =\n | ActivityData<\n 'approveSpendingCap' | 'revokeSpendingCap' | 'increaseSpendingCap',\n {\n from?: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'assetActivation' | 'assetDeactivation',\n {\n from?: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'send' | 'receive',\n {\n from: string;\n to: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'nftBuy' | 'nftMint' | 'nftSell',\n {\n from?: string;\n to?: string;\n token?: TokenAmount;\n paymentToken?: TokenAmount;\n }\n >\n | ActivityData<\n | 'swap'\n | 'bridge'\n | 'convert'\n | 'lendingDeposit'\n | 'lendingWithdrawal'\n | 'wrap'\n | 'unwrap',\n {\n from?: string;\n sourceToken?: TokenAmount;\n destinationToken?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'buy' | 'claim' | 'deposit' | 'claimMusdBonus',\n {\n from?: string;\n token?: TokenAmount;\n }\n >\n | ActivityData<\n 'perpsAddFunds' | 'perpsWithdraw',\n {\n from?: string;\n fiat?: FiatAmount;\n networkFee?: FiatAmount;\n token?: TokenAmount;\n }\n >\n | ActivityData<\n 'contractInteraction',\n {\n from: string;\n to: string;\n token?: TokenAmount;\n fees?: Fee[];\n methodId?: string;\n transactionCategory?: string;\n transactionProtocol?: string;\n }\n >;\n\n// Note: Update core-backend\nexport type ValueTransfer = _ValueTransfer & {\n contractAddress: string;\n symbol: string;\n name: string;\n};\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ValueTransfer as _ValueTransfer } from '@metamask/core-backend';\nimport type { CaipChainId } from '@metamask/utils';\n\nexport type ActivityKind =\n | 'receive'\n | 'sell'\n | 'buy'\n | 'deposit'\n | 'swap'\n | 'claim'\n | 'claimMusdBonus'\n | 'send'\n | 'wrap'\n | 'unwrap'\n | 'approveSpendingCap'\n | 'revokeSpendingCap'\n | 'increaseSpendingCap'\n | 'contractInteraction'\n | 'contractDeployment'\n | 'bridge'\n | 'convert'\n | 'nftBuy'\n | 'nftMint'\n | 'nftSell'\n | 'smartAccountUpgrade'\n | 'lendingDeposit'\n | 'lendingWithdrawal'\n | 'predictionsAddFunds'\n | 'predictionsWithdrawFunds'\n | 'predictionClaimWinnings'\n | 'predictionCashedOut'\n | 'predictionPlaced'\n | 'perpsAddFunds'\n | 'perpsWithdraw'\n | 'perpsOpenLong'\n | 'perpsCloseLong'\n | 'perpsCloseLongLiquidated'\n | 'perpsCloseLongStopLoss'\n | 'perpsOpenShort'\n | 'perpsCloseShort'\n | 'perpsCloseShortLiquidated'\n | 'perpsCloseShortStopLoss'\n | 'perpsPaidFundingFees'\n | 'perpsReceivedFundingFees'\n | 'perpsCloseShortTakeProfit'\n | 'perpsCloseLongTakeProfit'\n | 'marketShort'\n | 'stopMarketCloseShort'\n | 'marketCloseShort';\n\nexport type Status = 'pending' | 'success' | 'failed' | 'cancelled';\n\nexport type TokenAmount = {\n amount?: string;\n decimals?: number;\n symbol?: string;\n assetId?: string;\n direction: 'in' | 'out';\n};\n\nexport type FiatAmount = {\n amount: string;\n currency?: string;\n};\n\nexport type Fee = {\n type: string;\n amount?: string;\n decimals?: number;\n symbol?: string;\n assetId?: string;\n};\n\ntype ActivityData<Type extends ActivityKind, Data> = {\n type: Type;\n chainId: CaipChainId;\n status: Status;\n timestamp: number;\n hash?: string;\n data: Data;\n};\n\nexport type ActivityItem =\n | ActivityData<\n 'approveSpendingCap' | 'revokeSpendingCap' | 'increaseSpendingCap',\n {\n from?: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'send' | 'receive',\n {\n from: string;\n to: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'nftBuy' | 'nftMint' | 'nftSell',\n {\n from?: string;\n to?: string;\n token?: TokenAmount;\n paymentToken?: TokenAmount;\n }\n >\n | ActivityData<\n | 'swap'\n | 'bridge'\n | 'convert'\n | 'lendingDeposit'\n | 'lendingWithdrawal'\n | 'wrap'\n | 'unwrap',\n {\n from?: string;\n sourceToken?: TokenAmount;\n destinationToken?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'buy' | 'claim' | 'deposit' | 'claimMusdBonus',\n {\n from?: string;\n token?: TokenAmount;\n }\n >\n | ActivityData<\n 'perpsAddFunds' | 'perpsWithdraw',\n {\n from?: string;\n fiat?: FiatAmount;\n networkFee?: FiatAmount;\n token?: TokenAmount;\n }\n >\n | ActivityData<\n 'contractInteraction',\n {\n from: string;\n to: string;\n token?: TokenAmount;\n fees?: Fee[];\n methodId?: string;\n transactionCategory?: string;\n transactionProtocol?: string;\n }\n >;\n\n// Note: Update core-backend\nexport type ValueTransfer = _ValueTransfer & {\n contractAddress: string;\n symbol: string;\n name: string;\n};\n"]}
package/dist/types.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ValueTransfer as _ValueTransfer } from "@metamask/core-backend";
2
2
  import type { CaipChainId } from "@metamask/utils";
3
- export type ActivityKind = 'receive' | 'sell' | 'buy' | 'deposit' | 'swap' | 'claim' | 'claimMusdBonus' | 'send' | 'wrap' | 'unwrap' | 'approveSpendingCap' | 'revokeSpendingCap' | 'increaseSpendingCap' | 'contractInteraction' | 'contractDeployment' | 'bridge' | 'convert' | 'nftBuy' | 'nftMint' | 'nftSell' | 'smartAccountUpgrade' | 'lendingDeposit' | 'lendingWithdrawal' | 'predictionsAddFunds' | 'predictionsWithdrawFunds' | 'predictionClaimWinnings' | 'predictionCashedOut' | 'predictionPlaced' | 'perpsAddFunds' | 'perpsWithdraw' | 'perpsOpenLong' | 'perpsCloseLong' | 'perpsCloseLongLiquidated' | 'perpsCloseLongStopLoss' | 'perpsOpenShort' | 'perpsCloseShort' | 'perpsCloseShortLiquidated' | 'perpsCloseShortStopLoss' | 'perpsPaidFundingFees' | 'perpsReceivedFundingFees' | 'perpsCloseShortTakeProfit' | 'perpsCloseLongTakeProfit' | 'marketShort' | 'stopMarketCloseShort' | 'marketCloseShort' | 'assetActivation' | 'assetDeactivation';
3
+ export type ActivityKind = 'receive' | 'sell' | 'buy' | 'deposit' | 'swap' | 'claim' | 'claimMusdBonus' | 'send' | 'wrap' | 'unwrap' | 'approveSpendingCap' | 'revokeSpendingCap' | 'increaseSpendingCap' | 'contractInteraction' | 'contractDeployment' | 'bridge' | 'convert' | 'nftBuy' | 'nftMint' | 'nftSell' | 'smartAccountUpgrade' | 'lendingDeposit' | 'lendingWithdrawal' | 'predictionsAddFunds' | 'predictionsWithdrawFunds' | 'predictionClaimWinnings' | 'predictionCashedOut' | 'predictionPlaced' | 'perpsAddFunds' | 'perpsWithdraw' | 'perpsOpenLong' | 'perpsCloseLong' | 'perpsCloseLongLiquidated' | 'perpsCloseLongStopLoss' | 'perpsOpenShort' | 'perpsCloseShort' | 'perpsCloseShortLiquidated' | 'perpsCloseShortStopLoss' | 'perpsPaidFundingFees' | 'perpsReceivedFundingFees' | 'perpsCloseShortTakeProfit' | 'perpsCloseLongTakeProfit' | 'marketShort' | 'stopMarketCloseShort' | 'marketCloseShort';
4
4
  export type Status = 'pending' | 'success' | 'failed' | 'cancelled';
5
5
  export type TokenAmount = {
6
6
  amount?: string;
@@ -32,10 +32,6 @@ export type ActivityItem = ActivityData<'approveSpendingCap' | 'revokeSpendingCa
32
32
  from?: string;
33
33
  token?: TokenAmount;
34
34
  fees?: Fee[];
35
- }> | ActivityData<'assetActivation' | 'assetDeactivation', {
36
- from?: string;
37
- token?: TokenAmount;
38
- fees?: Fee[];
39
35
  }> | ActivityData<'send' | 'receive', {
40
36
  from: string;
41
37
  to: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,cAAc,EAAE,+BAA+B;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB;AAEnD,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,MAAM,GACN,KAAK,GACL,SAAS,GACT,MAAM,GACN,OAAO,GACP,gBAAgB,GAChB,MAAM,GACN,MAAM,GACN,QAAQ,GACR,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,GACT,qBAAqB,GACrB,gBAAgB,GAChB,mBAAmB,GACnB,qBAAqB,GACrB,0BAA0B,GAC1B,yBAAy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M,CAAC;CAC9B,CACF,CAAC;AAGN,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
package/dist/types.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ValueTransfer as _ValueTransfer } from "@metamask/core-backend";
2
2
  import type { CaipChainId } from "@metamask/utils";
3
- export type ActivityKind = 'receive' | 'sell' | 'buy' | 'deposit' | 'swap' | 'claim' | 'claimMusdBonus' | 'send' | 'wrap' | 'unwrap' | 'approveSpendingCap' | 'revokeSpendingCap' | 'increaseSpendingCap' | 'contractInteraction' | 'contractDeployment' | 'bridge' | 'convert' | 'nftBuy' | 'nftMint' | 'nftSell' | 'smartAccountUpgrade' | 'lendingDeposit' | 'lendingWithdrawal' | 'predictionsAddFunds' | 'predictionsWithdrawFunds' | 'predictionClaimWinnings' | 'predictionCashedOut' | 'predictionPlaced' | 'perpsAddFunds' | 'perpsWithdraw' | 'perpsOpenLong' | 'perpsCloseLong' | 'perpsCloseLongLiquidated' | 'perpsCloseLongStopLoss' | 'perpsOpenShort' | 'perpsCloseShort' | 'perpsCloseShortLiquidated' | 'perpsCloseShortStopLoss' | 'perpsPaidFundingFees' | 'perpsReceivedFundingFees' | 'perpsCloseShortTakeProfit' | 'perpsCloseLongTakeProfit' | 'marketShort' | 'stopMarketCloseShort' | 'marketCloseShort' | 'assetActivation' | 'assetDeactivation';
3
+ export type ActivityKind = 'receive' | 'sell' | 'buy' | 'deposit' | 'swap' | 'claim' | 'claimMusdBonus' | 'send' | 'wrap' | 'unwrap' | 'approveSpendingCap' | 'revokeSpendingCap' | 'increaseSpendingCap' | 'contractInteraction' | 'contractDeployment' | 'bridge' | 'convert' | 'nftBuy' | 'nftMint' | 'nftSell' | 'smartAccountUpgrade' | 'lendingDeposit' | 'lendingWithdrawal' | 'predictionsAddFunds' | 'predictionsWithdrawFunds' | 'predictionClaimWinnings' | 'predictionCashedOut' | 'predictionPlaced' | 'perpsAddFunds' | 'perpsWithdraw' | 'perpsOpenLong' | 'perpsCloseLong' | 'perpsCloseLongLiquidated' | 'perpsCloseLongStopLoss' | 'perpsOpenShort' | 'perpsCloseShort' | 'perpsCloseShortLiquidated' | 'perpsCloseShortStopLoss' | 'perpsPaidFundingFees' | 'perpsReceivedFundingFees' | 'perpsCloseShortTakeProfit' | 'perpsCloseLongTakeProfit' | 'marketShort' | 'stopMarketCloseShort' | 'marketCloseShort';
4
4
  export type Status = 'pending' | 'success' | 'failed' | 'cancelled';
5
5
  export type TokenAmount = {
6
6
  amount?: string;
@@ -32,10 +32,6 @@ export type ActivityItem = ActivityData<'approveSpendingCap' | 'revokeSpendingCa
32
32
  from?: string;
33
33
  token?: TokenAmount;
34
34
  fees?: Fee[];
35
- }> | ActivityData<'assetActivation' | 'assetDeactivation', {
36
- from?: string;
37
- token?: TokenAmount;
38
- fees?: Fee[];
39
35
  }> | ActivityData<'send' | 'receive', {
40
36
  from: string;
41
37
  to: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,cAAc,EAAE,+BAA+B;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB;AAEnD,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,MAAM,GACN,KAAK,GACL,SAAS,GACT,MAAM,GACN,OAAO,GACP,gBAAgB,GAChB,MAAM,GACN,MAAM,GACN,QAAQ,GACR,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,GACT,qBAAqB,GACrB,gBAAgB,GAChB,mBAAmB,GACnB,qBAAqB,GACrB,0BAA0B,GAC1B,yBAAyB,GACzB,qBAAqB,GACrB,kBAAkB,GAClB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M,MAAM,aAAa,GAAG,cAAc,GAAG;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ValueTransfer as _ValueTransfer } from '@metamask/core-backend';\nimport type { CaipChainId } from '@metamask/utils';\n\nexport type ActivityKind =\n | 'receive'\n | 'sell'\n | 'buy'\n | 'deposit'\n | 'swap'\n | 'claim'\n | 'claimMusdBonus'\n | 'send'\n | 'wrap'\n | 'unwrap'\n | 'approveSpendingCap'\n | 'revokeSpendingCap'\n | 'increaseSpendingCap'\n | 'contractInteraction'\n | 'contractDeployment'\n | 'bridge'\n | 'convert'\n | 'nftBuy'\n | 'nftMint'\n | 'nftSell'\n | 'smartAccountUpgrade'\n | 'lendingDeposit'\n | 'lendingWithdrawal'\n | 'predictionsAddFunds'\n | 'predictionsWithdrawFunds'\n | 'predictionClaimWinnings'\n | 'predictionCashedOut'\n | 'predictionPlaced'\n | 'perpsAddFunds'\n | 'perpsWithdraw'\n | 'perpsOpenLong'\n | 'perpsCloseLong'\n | 'perpsCloseLongLiquidated'\n | 'perpsCloseLongStopLoss'\n | 'perpsOpenShort'\n | 'perpsCloseShort'\n | 'perpsCloseShortLiquidated'\n | 'perpsCloseShortStopLoss'\n | 'perpsPaidFundingFees'\n | 'perpsReceivedFundingFees'\n | 'perpsCloseShortTakeProfit'\n | 'perpsCloseLongTakeProfit'\n | 'marketShort'\n | 'stopMarketCloseShort'\n | 'marketCloseShort'\n | 'assetActivation'\n | 'assetDeactivation';\n\nexport type Status = 'pending' | 'success' | 'failed' | 'cancelled';\n\nexport type TokenAmount = {\n amount?: string;\n decimals?: number;\n symbol?: string;\n assetId?: string;\n direction: 'in' | 'out';\n};\n\nexport type FiatAmount = {\n amount: string;\n currency?: string;\n};\n\nexport type Fee = {\n type: string;\n amount?: string;\n decimals?: number;\n symbol?: string;\n assetId?: string;\n};\n\ntype ActivityData<Type extends ActivityKind, Data> = {\n type: Type;\n chainId: CaipChainId;\n status: Status;\n timestamp: number;\n hash?: string;\n data: Data;\n};\n\nexport type ActivityItem =\n | ActivityData<\n 'approveSpendingCap' | 'revokeSpendingCap' | 'increaseSpendingCap',\n {\n from?: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'assetActivation' | 'assetDeactivation',\n {\n from?: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'send' | 'receive',\n {\n from: string;\n to: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'nftBuy' | 'nftMint' | 'nftSell',\n {\n from?: string;\n to?: string;\n token?: TokenAmount;\n paymentToken?: TokenAmount;\n }\n >\n | ActivityData<\n | 'swap'\n | 'bridge'\n | 'convert'\n | 'lendingDeposit'\n | 'lendingWithdrawal'\n | 'wrap'\n | 'unwrap',\n {\n from?: string;\n sourceToken?: TokenAmount;\n destinationToken?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'buy' | 'claim' | 'deposit' | 'claimMusdBonus',\n {\n from?: string;\n token?: TokenAmount;\n }\n >\n | ActivityData<\n 'perpsAddFunds' | 'perpsWithdraw',\n {\n from?: string;\n fiat?: FiatAmount;\n networkFee?: FiatAmount;\n token?: TokenAmount;\n }\n >\n | ActivityData<\n 'contractInteraction',\n {\n from: string;\n to: string;\n token?: TokenAmount;\n fees?: Fee[];\n methodId?: string;\n transactionCategory?: string;\n transactionProtocol?: string;\n }\n >;\n\n// Note: Update core-backend\nexport type ValueTransfer = _ValueTransfer & {\n contractAddress: string;\n symbol: string;\n name: string;\n};\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ValueTransfer as _ValueTransfer } from '@metamask/core-backend';\nimport type { CaipChainId } from '@metamask/utils';\n\nexport type ActivityKind =\n | 'receive'\n | 'sell'\n | 'buy'\n | 'deposit'\n | 'swap'\n | 'claim'\n | 'claimMusdBonus'\n | 'send'\n | 'wrap'\n | 'unwrap'\n | 'approveSpendingCap'\n | 'revokeSpendingCap'\n | 'increaseSpendingCap'\n | 'contractInteraction'\n | 'contractDeployment'\n | 'bridge'\n | 'convert'\n | 'nftBuy'\n | 'nftMint'\n | 'nftSell'\n | 'smartAccountUpgrade'\n | 'lendingDeposit'\n | 'lendingWithdrawal'\n | 'predictionsAddFunds'\n | 'predictionsWithdrawFunds'\n | 'predictionClaimWinnings'\n | 'predictionCashedOut'\n | 'predictionPlaced'\n | 'perpsAddFunds'\n | 'perpsWithdraw'\n | 'perpsOpenLong'\n | 'perpsCloseLong'\n | 'perpsCloseLongLiquidated'\n | 'perpsCloseLongStopLoss'\n | 'perpsOpenShort'\n | 'perpsCloseShort'\n | 'perpsCloseShortLiquidated'\n | 'perpsCloseShortStopLoss'\n | 'perpsPaidFundingFees'\n | 'perpsReceivedFundingFees'\n | 'perpsCloseShortTakeProfit'\n | 'perpsCloseLongTakeProfit'\n | 'marketShort'\n | 'stopMarketCloseShort'\n | 'marketCloseShort';\n\nexport type Status = 'pending' | 'success' | 'failed' | 'cancelled';\n\nexport type TokenAmount = {\n amount?: string;\n decimals?: number;\n symbol?: string;\n assetId?: string;\n direction: 'in' | 'out';\n};\n\nexport type FiatAmount = {\n amount: string;\n currency?: string;\n};\n\nexport type Fee = {\n type: string;\n amount?: string;\n decimals?: number;\n symbol?: string;\n assetId?: string;\n};\n\ntype ActivityData<Type extends ActivityKind, Data> = {\n type: Type;\n chainId: CaipChainId;\n status: Status;\n timestamp: number;\n hash?: string;\n data: Data;\n};\n\nexport type ActivityItem =\n | ActivityData<\n 'approveSpendingCap' | 'revokeSpendingCap' | 'increaseSpendingCap',\n {\n from?: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'send' | 'receive',\n {\n from: string;\n to: string;\n token?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'nftBuy' | 'nftMint' | 'nftSell',\n {\n from?: string;\n to?: string;\n token?: TokenAmount;\n paymentToken?: TokenAmount;\n }\n >\n | ActivityData<\n | 'swap'\n | 'bridge'\n | 'convert'\n | 'lendingDeposit'\n | 'lendingWithdrawal'\n | 'wrap'\n | 'unwrap',\n {\n from?: string;\n sourceToken?: TokenAmount;\n destinationToken?: TokenAmount;\n fees?: Fee[];\n }\n >\n | ActivityData<\n 'buy' | 'claim' | 'deposit' | 'claimMusdBonus',\n {\n from?: string;\n token?: TokenAmount;\n }\n >\n | ActivityData<\n 'perpsAddFunds' | 'perpsWithdraw',\n {\n from?: string;\n fiat?: FiatAmount;\n networkFee?: FiatAmount;\n token?: TokenAmount;\n }\n >\n | ActivityData<\n 'contractInteraction',\n {\n from: string;\n to: string;\n token?: TokenAmount;\n fees?: Fee[];\n methodId?: string;\n transactionCategory?: string;\n transactionProtocol?: string;\n }\n >;\n\n// Note: Update core-backend\nexport type ValueTransfer = _ValueTransfer & {\n contractAddress: string;\n symbol: string;\n name: string;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/client-utils",
3
- "version": "1.0.0-preview-1590150f2",
3
+ "version": "1.0.0-preview-8fd5dfabc",
4
4
  "description": "Shared functions and utilities used across MetaMask clients (extension and mobile)",
5
5
  "keywords": [
6
6
  "Ethereum",