@metamask/keyring-api 17.1.0 → 17.2.1
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 +20 -1
- package/dist/api/request.d.cts +1 -1
- package/dist/api/request.d.mts +1 -1
- package/dist/api/transaction.cjs +12 -1
- package/dist/api/transaction.cjs.map +1 -1
- package/dist/api/transaction.d.cts +16 -7
- package/dist/api/transaction.d.cts.map +1 -1
- package/dist/api/transaction.d.mts +16 -7
- package/dist/api/transaction.d.mts.map +1 -1
- package/dist/api/transaction.mjs +12 -1
- package/dist/api/transaction.mjs.map +1 -1
- package/dist/events.cjs +9 -0
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +14 -3
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +14 -3
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +9 -0
- package/dist/events.mjs.map +1 -1
- package/dist/rpc.d.cts +8 -7
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +8 -7
- package/dist/rpc.d.mts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [17.2.1]
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
- Add missing `Transaction.status` for `'swap'` ([#229](https://github.com/MetaMask/accounts/pull/229))
|
15
|
+
|
16
|
+
## [17.2.0]
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
- Add `swap` transaction type ([#218](https://github.com/MetaMask/accounts/pull/218))
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
|
24
|
+
- Use `ts-bridge/cli@0.6.3` ([#214](https://github.com/MetaMask/accounts/pull/214))
|
25
|
+
- This new version fixes a bug regarding some missing exports.
|
26
|
+
|
10
27
|
## [17.1.0]
|
11
28
|
|
12
29
|
### Added
|
@@ -529,7 +546,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
529
546
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
530
547
|
- Helper functions to create keyring handler in the snap.
|
531
548
|
|
532
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.1
|
549
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.2.1...HEAD
|
550
|
+
[17.2.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.2.0...@metamask/keyring-api@17.2.1
|
551
|
+
[17.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.1.0...@metamask/keyring-api@17.2.0
|
533
552
|
[17.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.0.0...@metamask/keyring-api@17.1.0
|
534
553
|
[17.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@16.1.0...@metamask/keyring-api@17.0.0
|
535
554
|
[16.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@16.0.0...@metamask/keyring-api@16.1.0
|
package/dist/api/request.d.cts
CHANGED
@@ -28,7 +28,7 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
|
|
28
28
|
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
29
29
|
}, {
|
30
30
|
method: import("@metamask/superstruct").Struct<string, null>;
|
31
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/
|
31
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
32
32
|
}>;
|
33
33
|
}>;
|
34
34
|
/**
|
package/dist/api/request.d.mts
CHANGED
@@ -28,7 +28,7 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
|
|
28
28
|
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
29
29
|
}, {
|
30
30
|
method: import("@metamask/superstruct").Struct<string, null>;
|
31
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/
|
31
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
32
32
|
}>;
|
33
33
|
}>;
|
34
34
|
/**
|
package/dist/api/transaction.cjs
CHANGED
@@ -124,6 +124,13 @@ var TransactionType;
|
|
124
124
|
* another account.
|
125
125
|
*/
|
126
126
|
TransactionType["Receive"] = "receive";
|
127
|
+
/**
|
128
|
+
* The transaction is a swap. It decreases the balance of one asset and
|
129
|
+
* increases the balance of another asset in a single transaction.
|
130
|
+
*
|
131
|
+
* A swap transaction must be originated by the account.
|
132
|
+
*/
|
133
|
+
TransactionType["Swap"] = "swap";
|
127
134
|
})(TransactionType || (exports.TransactionType = TransactionType = {}));
|
128
135
|
/**
|
129
136
|
* This struct represents a transaction event.
|
@@ -232,7 +239,11 @@ exports.TransactionStruct = (0, keyring_utils_1.object)({
|
|
232
239
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
233
240
|
* details on the UI.
|
234
241
|
*/
|
235
|
-
type: (0, superstruct_1.enums)([
|
242
|
+
type: (0, superstruct_1.enums)([
|
243
|
+
`${TransactionType.Send}`,
|
244
|
+
`${TransactionType.Receive}`,
|
245
|
+
`${TransactionType.Swap}`,
|
246
|
+
]),
|
236
247
|
/**
|
237
248
|
* Transaction sender addresses and amounts.
|
238
249
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":";;;AACA,2DAA6D;AAE7D,uDAA+E;AAE/E,uCAAsC;AACtC,qCAA2C;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,iBAAiB,GAAG,IAAA,sBAAM,EAAC;IAC/B;;OAEG;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Q,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\n\nimport { AssetStruct } from './asset';\nimport { CaipChainIdStruct } from './caip';\nimport type { Paginated } from './pagination';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([`${TransactionType.Send}`, `${TransactionType.Receive}`]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
|
1
|
+
{"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":";;;AACA,2DAA6D;AAE7D,uDAA+E;AAE/E,uCAAsC;AACtC,qCAA2C;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,iBAAiB,GAAG,IAAA,sBAAM,EAAC;IAC/B;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,GAAE;IAEjB;;OAEG;IACH,KAAK,EAAE,IAAA,sBAAQ,EAAC,mBAAW,CAAC;CAC7B,CAAC,CAAC;AAEH;;GAEG;AACH,IAAY,OAiBX;AAjBD,WAAY,OAAO;IACjB;;;;;;OAMG;IACH,wBAAa,CAAA;IAEb;;;;;OAKG;IACH,gCAAqB,CAAA;AACvB,CAAC,EAjBW,OAAO,uBAAP,OAAO,QAiBlB;AAED;;GAEG;AACH,MAAM,SAAS,GAAG,IAAA,sBAAM,EAAC;IACvB;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEvD;;OAEG;IACH,KAAK,EAAE,mBAAW;CACnB,CAAC,CAAC;AAEH;;GAEG;AACH,IAAY,iBAsBX;AAtBD,WAAY,iBAAiB;IAC3B;;;OAGG;IACH,4CAAuB,CAAA;IAEvB;;;OAGG;IACH,gDAA2B,CAAA;IAE3B;;OAEG;IACH,4CAAuB,CAAA;IAEvB;;OAEG;IACH,sCAAiB,CAAA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e,CAAC,IAAI,EAAE;QACzB,GAAG,eAAe,CAAC,OAAO,EAAE;QAC5B,GAAG,eAAe,CAAC,IAAI,EAAE;KAC1B,CAAC;IAEF;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC,iBAAiB,CAAC;IAE9B;;OAEG;IACH,EAAE,EAAE,IAAA,mBAAK,EAAC,iBAAiB,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,MAAM,EAAE,IAAA,mBAAK,EAAC,8BAAsB,CAAC;CACtC,CAAC,CAAC;AASH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,sBAAsB,GAAG,IAAA,sBAAM,EAAC;IAC3C;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC,yBAAiB,CAAC;IAE9B;;;OAGG;IACH,IAAI,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\n\nimport { AssetStruct } from './asset';\nimport { CaipChainIdStruct } from './caip';\nimport type { Paginated } from './pagination';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n\n /**\n * The transaction is a swap. It decreases the balance of one asset and\n * increases the balance of another asset in a single transaction.\n *\n * A swap transaction must be originated by the account.\n */\n Swap = 'swap',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([\n `${TransactionType.Send}`,\n `${TransactionType.Receive}`,\n `${TransactionType.Swap}`,\n ]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
|
@@ -58,7 +58,14 @@ export declare enum TransactionType {
|
|
58
58
|
* The transaction was received by the account, but originated by
|
59
59
|
* another account.
|
60
60
|
*/
|
61
|
-
Receive = "receive"
|
61
|
+
Receive = "receive",
|
62
|
+
/**
|
63
|
+
* The transaction is a swap. It decreases the balance of one asset and
|
64
|
+
* increases the balance of another asset in a single transaction.
|
65
|
+
*
|
66
|
+
* A swap transaction must be originated by the account.
|
67
|
+
*/
|
68
|
+
Swap = "swap"
|
62
69
|
}
|
63
70
|
/**
|
64
71
|
* This struct represents a transaction event.
|
@@ -139,7 +146,7 @@ export declare const TransactionEventStruct: import("@metamask/superstruct").Str
|
|
139
146
|
* ```
|
140
147
|
*/
|
141
148
|
export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
142
|
-
type: "send" | "receive";
|
149
|
+
type: "send" | "receive" | "swap";
|
143
150
|
id: string;
|
144
151
|
from: {
|
145
152
|
address: string;
|
@@ -217,9 +224,10 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
|
217
224
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
218
225
|
* details on the UI.
|
219
226
|
*/
|
220
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
227
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
221
228
|
send: "send";
|
222
229
|
receive: "receive";
|
230
|
+
swap: "swap";
|
223
231
|
}>;
|
224
232
|
/**
|
225
233
|
* Transaction sender addresses and amounts.
|
@@ -416,7 +424,7 @@ export type Transaction = Infer<typeof TransactionStruct>;
|
|
416
424
|
*/
|
417
425
|
export declare const TransactionsPageStruct: import("@metamask/superstruct").Struct<{
|
418
426
|
data: {
|
419
|
-
type: "send" | "receive";
|
427
|
+
type: "send" | "receive" | "swap";
|
420
428
|
id: string;
|
421
429
|
from: {
|
422
430
|
address: string;
|
@@ -469,7 +477,7 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
469
477
|
* List of transactions.
|
470
478
|
*/
|
471
479
|
data: import("@metamask/superstruct").Struct<{
|
472
|
-
type: "send" | "receive";
|
480
|
+
type: "send" | "receive" | "swap";
|
473
481
|
id: string;
|
474
482
|
from: {
|
475
483
|
address: string;
|
@@ -516,7 +524,7 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
516
524
|
};
|
517
525
|
}[];
|
518
526
|
}[], import("@metamask/superstruct").Struct<{
|
519
|
-
type: "send" | "receive";
|
527
|
+
type: "send" | "receive" | "swap";
|
520
528
|
id: string;
|
521
529
|
from: {
|
522
530
|
address: string;
|
@@ -594,9 +602,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
594
602
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
595
603
|
* details on the UI.
|
596
604
|
*/
|
597
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
605
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
598
606
|
send: "send";
|
599
607
|
receive: "receive";
|
608
|
+
swap: "swap";
|
600
609
|
}>;
|
601
610
|
/**
|
602
611
|
* Transaction sender addresses and amounts.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction.d.cts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAAgC;AAE3D,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAqB;AAiD9C;;GAEG;AACH,oBAAY,OAAO;IACjB;;;;;;OAMG;IACH,IAAI,SAAS;IAEb;;;;;OAKG;IACH,QAAQ,aAAa;CACtB;AAiBD;;GAEG;AACH,oBAAY,iBAAiB;IAC3B;;;OAGG;IACH,SAAS,cAAc;IAEvB;;;OAGG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,SAAS,cAAc;IAEvB;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB;;;;OAIG;IACH,IAAI,SAAS;IAEb;;;OAGG;IACH,OAAO,YAAY;
|
1
|
+
{"version":3,"file":"transaction.d.cts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAAgC;AAE3D,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,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;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACjC;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAvGH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;;;;;;QAQH;;;;WAIG;;QAGH;;;WAGG;;;;;;QAOH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YA/NH;;eAEG;;YAGH;;eAEG;;;;;;;;;;;QA2NH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YApOH;;eAEG;;YAGH;;eAEG;;;;;;;;;;;QAgOH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YApMH;;eAEG;;;;;YAGH;;eAEG;;;;;;;;;;;QAgMH;;;;;WAKG;;;;;;;;YAxIH;;eAEG;;;;;;;YAQH;;eAEG;;;;IAwKH;;;OAGG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,OAAO,sBAAsB,EAC7B,SAAS,CAAC,WAAW,CAAC,CACvB,CAAC"}
|
@@ -58,7 +58,14 @@ export declare enum TransactionType {
|
|
58
58
|
* The transaction was received by the account, but originated by
|
59
59
|
* another account.
|
60
60
|
*/
|
61
|
-
Receive = "receive"
|
61
|
+
Receive = "receive",
|
62
|
+
/**
|
63
|
+
* The transaction is a swap. It decreases the balance of one asset and
|
64
|
+
* increases the balance of another asset in a single transaction.
|
65
|
+
*
|
66
|
+
* A swap transaction must be originated by the account.
|
67
|
+
*/
|
68
|
+
Swap = "swap"
|
62
69
|
}
|
63
70
|
/**
|
64
71
|
* This struct represents a transaction event.
|
@@ -139,7 +146,7 @@ export declare const TransactionEventStruct: import("@metamask/superstruct").Str
|
|
139
146
|
* ```
|
140
147
|
*/
|
141
148
|
export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
142
|
-
type: "send" | "receive";
|
149
|
+
type: "send" | "receive" | "swap";
|
143
150
|
id: string;
|
144
151
|
from: {
|
145
152
|
address: string;
|
@@ -217,9 +224,10 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
|
217
224
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
218
225
|
* details on the UI.
|
219
226
|
*/
|
220
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
227
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
221
228
|
send: "send";
|
222
229
|
receive: "receive";
|
230
|
+
swap: "swap";
|
223
231
|
}>;
|
224
232
|
/**
|
225
233
|
* Transaction sender addresses and amounts.
|
@@ -416,7 +424,7 @@ export type Transaction = Infer<typeof TransactionStruct>;
|
|
416
424
|
*/
|
417
425
|
export declare const TransactionsPageStruct: import("@metamask/superstruct").Struct<{
|
418
426
|
data: {
|
419
|
-
type: "send" | "receive";
|
427
|
+
type: "send" | "receive" | "swap";
|
420
428
|
id: string;
|
421
429
|
from: {
|
422
430
|
address: string;
|
@@ -469,7 +477,7 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
469
477
|
* List of transactions.
|
470
478
|
*/
|
471
479
|
data: import("@metamask/superstruct").Struct<{
|
472
|
-
type: "send" | "receive";
|
480
|
+
type: "send" | "receive" | "swap";
|
473
481
|
id: string;
|
474
482
|
from: {
|
475
483
|
address: string;
|
@@ -516,7 +524,7 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
516
524
|
};
|
517
525
|
}[];
|
518
526
|
}[], import("@metamask/superstruct").Struct<{
|
519
|
-
type: "send" | "receive";
|
527
|
+
type: "send" | "receive" | "swap";
|
520
528
|
id: string;
|
521
529
|
from: {
|
522
530
|
address: string;
|
@@ -594,9 +602,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
594
602
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
595
603
|
* details on the UI.
|
596
604
|
*/
|
597
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
605
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
598
606
|
send: "send";
|
599
607
|
receive: "receive";
|
608
|
+
swap: "swap";
|
600
609
|
}>;
|
601
610
|
/**
|
602
611
|
* Transaction sender addresses and amounts.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction.d.mts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAAgC;AAE3D,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAqB;AAiD9C;;GAEG;AACH,oBAAY,OAAO;IACjB;;;;;;OAMG;IACH,IAAI,SAAS;IAEb;;;;;OAKG;IACH,QAAQ,aAAa;CACtB;AAiBD;;GAEG;AACH,oBAAY,iBAAiB;IAC3B;;;OAGG;IACH,SAAS,cAAc;IAEvB;;;OAGG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,SAAS,cAAc;IAEvB;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB;;;;OAIG;IACH,IAAI,SAAS;IAEb;;;OAGG;IACH,OAAO,YAAY;
|
1
|
+
{"version":3,"file":"transaction.d.mts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAAgC;AAE3D,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAqB;AAiD9C;;GAEG;AACH,oBAAY,OAAO;IACjB;;;;;;OAMG;IACH,IAAI,SAAS;IAEb;;;;;OAKG;IACH,QAAQ,aAAa;CACtB;AAiBD;;GAEG;AACH,oBAAY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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAvGH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;;;;;;QAQH;;;;WAIG;;QAGH;;;WAGG;;;;;;QAOH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YA/NH;;eAEG;;YAGH;;eAEG;;;;;;;;;;;QA2NH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YApOH;;eAEG;;YAGH;;eAEG;;;;;;;;;;;QAgOH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YApMH;;eAEG;;;;;YAGH;;eAEG;;;;;;;;;;;QAgMH;;;;;WAKG;;;;;;;;YAxIH;;eAEG;;;;;;;YAQH;;eAEG;;;;IAwKH;;;OAGG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,OAAO,sBAAsB,EAC7B,SAAS,CAAC,WAAW,CAAC,CACvB,CAAC"}
|
package/dist/api/transaction.mjs
CHANGED
@@ -121,6 +121,13 @@ export var TransactionType;
|
|
121
121
|
* another account.
|
122
122
|
*/
|
123
123
|
TransactionType["Receive"] = "receive";
|
124
|
+
/**
|
125
|
+
* The transaction is a swap. It decreases the balance of one asset and
|
126
|
+
* increases the balance of another asset in a single transaction.
|
127
|
+
*
|
128
|
+
* A swap transaction must be originated by the account.
|
129
|
+
*/
|
130
|
+
TransactionType["Swap"] = "swap";
|
124
131
|
})(TransactionType || (TransactionType = {}));
|
125
132
|
/**
|
126
133
|
* This struct represents a transaction event.
|
@@ -229,7 +236,11 @@ export const TransactionStruct = object({
|
|
229
236
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
230
237
|
* details on the UI.
|
231
238
|
*/
|
232
|
-
type: enums([
|
239
|
+
type: enums([
|
240
|
+
`${TransactionType.Send}`,
|
241
|
+
`${TransactionType.Receive}`,
|
242
|
+
`${TransactionType.Swap}`,
|
243
|
+
]),
|
233
244
|
/**
|
234
245
|
* Transaction sender addresses and amounts.
|
235
246
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction.mjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE7D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAE/E,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAe;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE;IAEjB;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC;CAC7B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,OAiBX;AAjBD,WAAY,OAAO;IACjB;;;;;;OAMG;IACH,wBAAa,CAAA;IAEb;;;;;OAKG;IACH,gCAAqB,CAAA;AACvB,CAAC,EAjBW,OAAO,KAAP,OAAO,QAiBlB;AAED;;GAEG;AACH,MAAM,SAAS,GAAG,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEvD;;OAEG;IACH,KAAK,EAAE,WAAW;CACnB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,iBAsBX;AAtBD,WAAY,iBAAiB;IAC3B;;;OAGG;IACH,4CAAuB,CAAA;IAEvB;;;OAGG;IACH,gDAA2B,CAAA;IAE3B;;OAEG;IACH,4CAAuB,CAAA;IAEvB;;OAEG;IACH,sCAAiB,CAAA;AACnB,CAAC,EAtBW,iBAAiB,KAAj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C,iBAAiB,CAAC;IAE9B;;OAEG;IACH,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC;CACtC,CAAC,CAAC;AASH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\n\nimport { AssetStruct } from './asset';\nimport { CaipChainIdStruct } from './caip';\nimport type { Paginated } from './pagination';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([`${TransactionType.Send}`, `${TransactionType.Receive}`]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
|
1
|
+
{"version":3,"file":"transaction.mjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE7D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAE/E,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAe;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE;IAEjB;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC;CAC7B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,OAiBX;AAjBD,WAAY,OAAO;IACjB;;;;;;OAMG;IACH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AAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;IACtC;;OAEG;IACH,EAAE,EAAE,MAAM,EAAE;IAEZ;;OAEG;IACH,KAAK,EAAE,iBAAiB;IAExB;;OAEG;IACH,OAAO,EAAE,UAAU;IAEnB;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC;QACZ,GAAG,iBAAiB,CAAC,SAAS,EAAE;QAChC,GAAG,iBAAiB,CAAC,WAAW,EAAE;QAClC,GAAG,iBAAiB,CAAC,SAAS,EAAE;QAChC,GAAG,iBAAiB,CAAC,MAAM,EAAE;KAC9B,CAAC;IAEF;;;;OAIG;IACH,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAE7B;;;OAGG;IACH,IAAI,EAAE,KAAK,CAAC;QACV,GAAG,eAAe,CAAC,IAAI,EAAE;QACzB,GAAG,eAAe,CAAC,OAAO,EAAE;QAC5B,GAAG,eAAe,CAAC,IAAI,EAAE;KAC1B,CAAC;IAEF;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;OAEG;IACH,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC;CACtC,CAAC,CAAC;AASH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\n\nimport { AssetStruct } from './asset';\nimport { CaipChainIdStruct } from './caip';\nimport type { Paginated } from './pagination';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n\n /**\n * The transaction is a swap. It decreases the balance of one asset and\n * increases the balance of another asset in a single transaction.\n *\n * A swap transaction must be originated by the account.\n */\n Swap = 'swap',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([\n `${TransactionType.Send}`,\n `${TransactionType.Receive}`,\n `${TransactionType.Swap}`,\n ]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
|
package/dist/events.cjs
CHANGED
@@ -42,6 +42,15 @@ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
|
|
42
42
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
43
43
|
*/
|
44
44
|
displayConfirmation: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
|
45
|
+
/**
|
46
|
+
* Instructs MetaMask to display the name confirmation dialog in the UI.
|
47
|
+
* Otherwise, the account will be added with the suggested name, if it's not
|
48
|
+
* already in use; if it is, a suffix will be appended to the name to make it
|
49
|
+
* unique.
|
50
|
+
*
|
51
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
52
|
+
*/
|
53
|
+
displayAccountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
|
45
54
|
}),
|
46
55
|
});
|
47
56
|
exports.AccountUpdatedEventStruct = (0, keyring_utils_1.object)({
|
package/dist/events.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AAEjC,uDAAgF;AAChF,2CAIyB;AAEzB,yCAIe;AAEf;;GAEG;AACH,IAAY,YAcX;AAdD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;IAE1C,wBAAwB;IACxB,wEAAwD,CAAA;IACxD,0EAA0D,CAAA;IAC1D,gFAAgE,CAAA;AAClE,CAAC,EAdW,YAAY,4BAAZ,YAAY,QAcvB;AAEY,QAAA,yBAAyB,G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AEG;QACH,2BAAmB;QAEnB;;WAEG;QACH,+BAAyB,CAC1B,CACF;KACF,CAAC;CACH,CAAC,CAAC;AAeU,QAAA,qCAAqC,GAAG,IAAA,sBAAM,EAAC;IAC1D,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,0BAA0B,EAAE,CAAC;IAC7D,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,YAAY,EAAE,IAAA,oBAAM;QAClB;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,mBAAK,EAAC,uBAAiB,CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAgBU,QAAA,kCAAkC,GAAG,IAAA,sBAAM,EAAC;IACvD,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,MAAM,EAAE,IAAA,oBAAM;QACZ;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,sBAAM,EAAC;YACL;;eAEG;YACH,KAAK,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n} from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n\n // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n"]}
|
package/dist/events.d.cts
CHANGED
@@ -25,6 +25,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
25
25
|
};
|
26
26
|
accountNameSuggestion?: string;
|
27
27
|
displayConfirmation?: boolean;
|
28
|
+
displayAccountNameSuggestion?: boolean;
|
28
29
|
};
|
29
30
|
}, {
|
30
31
|
method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
|
@@ -39,6 +40,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
39
40
|
};
|
40
41
|
accountNameSuggestion?: string;
|
41
42
|
displayConfirmation?: boolean;
|
43
|
+
displayAccountNameSuggestion?: boolean;
|
42
44
|
}, {
|
43
45
|
/**
|
44
46
|
* New account object.
|
@@ -76,6 +78,15 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
76
78
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
77
79
|
*/
|
78
80
|
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
81
|
+
/**
|
82
|
+
* Instructs MetaMask to display the name confirmation dialog in the UI.
|
83
|
+
* Otherwise, the account will be added with the suggested name, if it's not
|
84
|
+
* already in use; if it is, a suffix will be appended to the name to make it
|
85
|
+
* unique.
|
86
|
+
*
|
87
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
88
|
+
*/
|
89
|
+
displayAccountNameSuggestion: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
79
90
|
}>;
|
80
91
|
}>;
|
81
92
|
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
@@ -219,7 +230,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
219
230
|
method: "notify:accountTransactionsUpdated";
|
220
231
|
params: {
|
221
232
|
transactions: Record<string, {
|
222
|
-
type: "send" | "receive";
|
233
|
+
type: "send" | "receive" | "swap";
|
223
234
|
id: string;
|
224
235
|
from: {
|
225
236
|
address: string;
|
@@ -271,7 +282,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
271
282
|
method: import("@metamask/superstruct").Struct<"notify:accountTransactionsUpdated", "notify:accountTransactionsUpdated">;
|
272
283
|
params: import("@metamask/superstruct").Struct<{
|
273
284
|
transactions: Record<string, {
|
274
|
-
type: "send" | "receive";
|
285
|
+
type: "send" | "receive" | "swap";
|
275
286
|
id: string;
|
276
287
|
from: {
|
277
288
|
address: string;
|
@@ -323,7 +334,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
323
334
|
* Transactions updates of accounts owned by the Snap.
|
324
335
|
*/
|
325
336
|
transactions: import("@metamask/superstruct").Struct<Record<string, {
|
326
|
-
type: "send" | "receive";
|
337
|
+
type: "send" | "receive" | "swap";
|
327
338
|
id: string;
|
328
339
|
from: {
|
329
340
|
address: string;
|
package/dist/events.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;IAG1C,sBAAsB,kCAAkC;IACxD,uBAAuB,mCAAmC;IAC1D,0BAA0B,sCAAsC;CACjE;AAED,eAAO,MAAM,yBAAyB
|
1
|
+
{"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAM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;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AACF,MAAM,MAAM,sCAAsC,GAChD,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAE5C,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;QAG3C;;WAEG;;;;;;EAuBL,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/events.d.mts
CHANGED
@@ -25,6 +25,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
25
25
|
};
|
26
26
|
accountNameSuggestion?: string;
|
27
27
|
displayConfirmation?: boolean;
|
28
|
+
displayAccountNameSuggestion?: boolean;
|
28
29
|
};
|
29
30
|
}, {
|
30
31
|
method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
|
@@ -39,6 +40,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
39
40
|
};
|
40
41
|
accountNameSuggestion?: string;
|
41
42
|
displayConfirmation?: boolean;
|
43
|
+
displayAccountNameSuggestion?: boolean;
|
42
44
|
}, {
|
43
45
|
/**
|
44
46
|
* New account object.
|
@@ -76,6 +78,15 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
76
78
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
77
79
|
*/
|
78
80
|
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
81
|
+
/**
|
82
|
+
* Instructs MetaMask to display the name confirmation dialog in the UI.
|
83
|
+
* Otherwise, the account will be added with the suggested name, if it's not
|
84
|
+
* already in use; if it is, a suffix will be appended to the name to make it
|
85
|
+
* unique.
|
86
|
+
*
|
87
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
88
|
+
*/
|
89
|
+
displayAccountNameSuggestion: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
79
90
|
}>;
|
80
91
|
}>;
|
81
92
|
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
@@ -219,7 +230,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
219
230
|
method: "notify:accountTransactionsUpdated";
|
220
231
|
params: {
|
221
232
|
transactions: Record<string, {
|
222
|
-
type: "send" | "receive";
|
233
|
+
type: "send" | "receive" | "swap";
|
223
234
|
id: string;
|
224
235
|
from: {
|
225
236
|
address: string;
|
@@ -271,7 +282,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
271
282
|
method: import("@metamask/superstruct").Struct<"notify:accountTransactionsUpdated", "notify:accountTransactionsUpdated">;
|
272
283
|
params: import("@metamask/superstruct").Struct<{
|
273
284
|
transactions: Record<string, {
|
274
|
-
type: "send" | "receive";
|
285
|
+
type: "send" | "receive" | "swap";
|
275
286
|
id: string;
|
276
287
|
from: {
|
277
288
|
address: string;
|
@@ -323,7 +334,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
323
334
|
* Transactions updates of accounts owned by the Snap.
|
324
335
|
*/
|
325
336
|
transactions: import("@metamask/superstruct").Struct<Record<string, {
|
326
|
-
type: "send" | "receive";
|
337
|
+
type: "send" | "receive" | "swap";
|
327
338
|
id: string;
|
328
339
|
from: {
|
329
340
|
address: string;
|
package/dist/events.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAG9C;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaL,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AACF,MAAM,MAAM,sCAAsC,GAChD,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAE5C,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;QAG3C;;WAEG;;;;;;EAuBL,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/events.mjs
CHANGED
@@ -39,6 +39,15 @@ export const AccountCreatedEventStruct = object({
|
|
39
39
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
40
40
|
*/
|
41
41
|
displayConfirmation: exactOptional(boolean()),
|
42
|
+
/**
|
43
|
+
* Instructs MetaMask to display the name confirmation dialog in the UI.
|
44
|
+
* Otherwise, the account will be added with the suggested name, if it's not
|
45
|
+
* already in use; if it is, a suffix will be appended to the name to make it
|
46
|
+
* unique.
|
47
|
+
*
|
48
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
49
|
+
*/
|
50
|
+
displayAccountNameSuggestion: exactOptional(boolean()),
|
42
51
|
}),
|
43
52
|
});
|
44
53
|
export const AccountUpdatedEventStruct = object({
|
package/dist/events.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,MAAM,EACN,UAAU,EACV,eAAe,EAChB,gCAAgC;AAEjC,OAAO,E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AAC;YACL;;eAEG;YACH,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,KAAK,CAAC,uBAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n} from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n\n // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n"]}
|
package/dist/rpc.d.cts
CHANGED
@@ -178,7 +178,7 @@ export declare const ListAccountTransactionsRequestStruct: import("@metamask/sup
|
|
178
178
|
export type ListAccountTransactionsRequest = Infer<typeof ListAccountTransactionsRequestStruct>;
|
179
179
|
export declare const ListAccountTransactionsResponseStruct: import("@metamask/superstruct").Struct<{
|
180
180
|
data: {
|
181
|
-
type: "send" | "receive";
|
181
|
+
type: "send" | "receive" | "swap";
|
182
182
|
id: string;
|
183
183
|
from: {
|
184
184
|
address: string;
|
@@ -228,7 +228,7 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
228
228
|
next: string | null;
|
229
229
|
}, {
|
230
230
|
data: import("@metamask/superstruct").Struct<{
|
231
|
-
type: "send" | "receive";
|
231
|
+
type: "send" | "receive" | "swap";
|
232
232
|
id: string;
|
233
233
|
from: {
|
234
234
|
address: string;
|
@@ -275,7 +275,7 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
275
275
|
};
|
276
276
|
}[];
|
277
277
|
}[], import("@metamask/superstruct").Struct<{
|
278
|
-
type: "send" | "receive";
|
278
|
+
type: "send" | "receive" | "swap";
|
279
279
|
id: string;
|
280
280
|
from: {
|
281
281
|
address: string;
|
@@ -332,9 +332,10 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
332
332
|
failed: "failed";
|
333
333
|
}>;
|
334
334
|
timestamp: import("@metamask/superstruct").Struct<number | null, null>;
|
335
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
335
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
336
336
|
send: "send";
|
337
337
|
receive: "receive";
|
338
|
+
swap: "swap";
|
338
339
|
}>;
|
339
340
|
from: import("@metamask/superstruct").Struct<{
|
340
341
|
address: string;
|
@@ -704,7 +705,7 @@ export declare const ListRequestsResponseStruct: import("@metamask/superstruct")
|
|
704
705
|
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
705
706
|
}, {
|
706
707
|
method: import("@metamask/superstruct").Struct<string, null>;
|
707
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/
|
708
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
708
709
|
}>;
|
709
710
|
}>>;
|
710
711
|
export type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;
|
@@ -743,7 +744,7 @@ export declare const GetRequestResponseStruct: import("@metamask/superstruct").S
|
|
743
744
|
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
744
745
|
}, {
|
745
746
|
method: import("@metamask/superstruct").Struct<string, null>;
|
746
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/
|
747
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
747
748
|
}>;
|
748
749
|
}>;
|
749
750
|
export type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;
|
@@ -779,7 +780,7 @@ export declare const SubmitRequestRequestStruct: import("@metamask/superstruct")
|
|
779
780
|
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
780
781
|
}, {
|
781
782
|
method: import("@metamask/superstruct").Struct<string, null>;
|
782
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/
|
783
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
783
784
|
}>;
|
784
785
|
}>;
|
785
786
|
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
package/dist/rpc.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rpc.d.cts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AA0BnD;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,iBAAiB,8BAA8B;IAC/C,uBAAuB,oCAAoC;IAC3D,kBAAkB,+BAA+B;IACjD,qBAAqB,kCAAkC;IACvD,mBAAmB,gCAAgC;IACnD,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,cAAc,2BAA2B;IACzC,aAAa,0BAA0B;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAYD,eAAO,MAAM,yBAAyB;;;;;;;;E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CAAC,OAAO,0BAA0B,CAAC,CAAC;AAK5E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;EAMlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEtE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;EAAuB,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAKxE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;QAAwB,CAAC;AAEjE,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAK9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;EAOtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAE9E,eAAO,MAAM,4BAA4B,oDAAgB,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAKhF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,oDAAgB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/dist/rpc.d.mts
CHANGED
@@ -178,7 +178,7 @@ export declare const ListAccountTransactionsRequestStruct: import("@metamask/sup
|
|
178
178
|
export type ListAccountTransactionsRequest = Infer<typeof ListAccountTransactionsRequestStruct>;
|
179
179
|
export declare const ListAccountTransactionsResponseStruct: import("@metamask/superstruct").Struct<{
|
180
180
|
data: {
|
181
|
-
type: "send" | "receive";
|
181
|
+
type: "send" | "receive" | "swap";
|
182
182
|
id: string;
|
183
183
|
from: {
|
184
184
|
address: string;
|
@@ -228,7 +228,7 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
228
228
|
next: string | null;
|
229
229
|
}, {
|
230
230
|
data: import("@metamask/superstruct").Struct<{
|
231
|
-
type: "send" | "receive";
|
231
|
+
type: "send" | "receive" | "swap";
|
232
232
|
id: string;
|
233
233
|
from: {
|
234
234
|
address: string;
|
@@ -275,7 +275,7 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
275
275
|
};
|
276
276
|
}[];
|
277
277
|
}[], import("@metamask/superstruct").Struct<{
|
278
|
-
type: "send" | "receive";
|
278
|
+
type: "send" | "receive" | "swap";
|
279
279
|
id: string;
|
280
280
|
from: {
|
281
281
|
address: string;
|
@@ -332,9 +332,10 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
332
332
|
failed: "failed";
|
333
333
|
}>;
|
334
334
|
timestamp: import("@metamask/superstruct").Struct<number | null, null>;
|
335
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
335
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
336
336
|
send: "send";
|
337
337
|
receive: "receive";
|
338
|
+
swap: "swap";
|
338
339
|
}>;
|
339
340
|
from: import("@metamask/superstruct").Struct<{
|
340
341
|
address: string;
|
@@ -704,7 +705,7 @@ export declare const ListRequestsResponseStruct: import("@metamask/superstruct")
|
|
704
705
|
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
705
706
|
}, {
|
706
707
|
method: import("@metamask/superstruct").Struct<string, null>;
|
707
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/
|
708
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
708
709
|
}>;
|
709
710
|
}>>;
|
710
711
|
export type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;
|
@@ -743,7 +744,7 @@ export declare const GetRequestResponseStruct: import("@metamask/superstruct").S
|
|
743
744
|
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
744
745
|
}, {
|
745
746
|
method: import("@metamask/superstruct").Struct<string, null>;
|
746
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/
|
747
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
747
748
|
}>;
|
748
749
|
}>;
|
749
750
|
export type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;
|
@@ -779,7 +780,7 @@ export declare const SubmitRequestRequestStruct: import("@metamask/superstruct")
|
|
779
780
|
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
780
781
|
}, {
|
781
782
|
method: import("@metamask/superstruct").Struct<string, null>;
|
782
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/
|
783
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
783
784
|
}>;
|
784
785
|
}>;
|
785
786
|
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
package/dist/rpc.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rpc.d.mts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AA0BnD;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,iBAAiB,8BAA8B;IAC/C,uBAAuB,oCAAoC;IAC3D,kBAAkB,+BAA+B;IACj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AoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,oDAAgB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@metamask/keyring-api",
|
3
|
-
"version": "17.1
|
3
|
+
"version": "17.2.1",
|
4
4
|
"description": "MetaMask Keyring API",
|
5
5
|
"keywords": [
|
6
6
|
"metamask",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"test:watch": "jest --watch"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
|
-
"@metamask/keyring-utils": "^2.
|
49
|
+
"@metamask/keyring-utils": "^2.3.1",
|
50
50
|
"@metamask/superstruct": "^3.1.0",
|
51
51
|
"@metamask/utils": "^11.1.0",
|
52
52
|
"bech32": "^2.0.0"
|
@@ -55,8 +55,8 @@
|
|
55
55
|
"@lavamoat/allow-scripts": "^3.2.1",
|
56
56
|
"@lavamoat/preinstall-always-fail": "^2.1.0",
|
57
57
|
"@metamask/auto-changelog": "^3.4.4",
|
58
|
-
"@metamask/keyring-utils": "^2.
|
59
|
-
"@ts-bridge/cli": "^0.6.
|
58
|
+
"@metamask/keyring-utils": "^2.3.1",
|
59
|
+
"@ts-bridge/cli": "^0.6.3",
|
60
60
|
"@types/jest": "^29.5.12",
|
61
61
|
"@types/node": "^20.12.12",
|
62
62
|
"@types/webextension-polyfill": "^0.12.1",
|