@metamask/keyring-api 17.2.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 +8 -1
- package/dist/api/request.d.cts +1 -1
- package/dist/api/request.d.mts +1 -1
- package/dist/api/transaction.cjs +5 -1
- package/dist/api/transaction.cjs.map +1 -1
- package/dist/api/transaction.d.cts +8 -6
- package/dist/api/transaction.d.cts.map +1 -1
- package/dist/api/transaction.d.mts +8 -6
- package/dist/api/transaction.d.mts.map +1 -1
- package/dist/api/transaction.mjs +5 -1
- package/dist/api/transaction.mjs.map +1 -1
- package/dist/events.d.cts +3 -3
- package/dist/events.d.mts +3 -3
- 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 +3 -3
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,12 @@ 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
|
+
|
10
16
|
## [17.2.0]
|
11
17
|
|
12
18
|
### Added
|
@@ -540,7 +546,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
540
546
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
541
547
|
- Helper functions to create keyring handler in the snap.
|
542
548
|
|
543
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.2.
|
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
|
544
551
|
[17.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.1.0...@metamask/keyring-api@17.2.0
|
545
552
|
[17.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.0.0...@metamask/keyring-api@17.1.0
|
546
553
|
[17.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@16.1.0...@metamask/keyring-api@17.0.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
@@ -239,7 +239,11 @@ exports.TransactionStruct = (0, keyring_utils_1.object)({
|
|
239
239
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
240
240
|
* details on the UI.
|
241
241
|
*/
|
242
|
-
type: (0, superstruct_1.enums)([
|
242
|
+
type: (0, superstruct_1.enums)([
|
243
|
+
`${TransactionType.Send}`,
|
244
|
+
`${TransactionType.Receive}`,
|
245
|
+
`${TransactionType.Swap}`,
|
246
|
+
]),
|
243
247
|
/**
|
244
248
|
* Transaction sender addresses and amounts.
|
245
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;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;AACnB,CAAC,EAtBW,iBAAiB,iCAAjB,iBAAiB,QAsB5B;AAED;;GAEG;AACH,IAAY,eAqBX;A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ACH,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([`${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,OA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port { 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"]}
|
@@ -146,7 +146,7 @@ export declare const TransactionEventStruct: import("@metamask/superstruct").Str
|
|
146
146
|
* ```
|
147
147
|
*/
|
148
148
|
export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
149
|
-
type: "send" | "receive";
|
149
|
+
type: "send" | "receive" | "swap";
|
150
150
|
id: string;
|
151
151
|
from: {
|
152
152
|
address: string;
|
@@ -224,9 +224,10 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
|
224
224
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
225
225
|
* details on the UI.
|
226
226
|
*/
|
227
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
227
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
228
228
|
send: "send";
|
229
229
|
receive: "receive";
|
230
|
+
swap: "swap";
|
230
231
|
}>;
|
231
232
|
/**
|
232
233
|
* Transaction sender addresses and amounts.
|
@@ -423,7 +424,7 @@ export type Transaction = Infer<typeof TransactionStruct>;
|
|
423
424
|
*/
|
424
425
|
export declare const TransactionsPageStruct: import("@metamask/superstruct").Struct<{
|
425
426
|
data: {
|
426
|
-
type: "send" | "receive";
|
427
|
+
type: "send" | "receive" | "swap";
|
427
428
|
id: string;
|
428
429
|
from: {
|
429
430
|
address: string;
|
@@ -476,7 +477,7 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
476
477
|
* List of transactions.
|
477
478
|
*/
|
478
479
|
data: import("@metamask/superstruct").Struct<{
|
479
|
-
type: "send" | "receive";
|
480
|
+
type: "send" | "receive" | "swap";
|
480
481
|
id: string;
|
481
482
|
from: {
|
482
483
|
address: string;
|
@@ -523,7 +524,7 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
523
524
|
};
|
524
525
|
}[];
|
525
526
|
}[], import("@metamask/superstruct").Struct<{
|
526
|
-
type: "send" | "receive";
|
527
|
+
type: "send" | "receive" | "swap";
|
527
528
|
id: string;
|
528
529
|
from: {
|
529
530
|
address: string;
|
@@ -601,9 +602,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
601
602
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
602
603
|
* details on the UI.
|
603
604
|
*/
|
604
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
605
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
605
606
|
send: "send";
|
606
607
|
receive: "receive";
|
608
|
+
swap: "swap";
|
607
609
|
}>;
|
608
610
|
/**
|
609
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;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QH;;eAEG;;;;IAwKH;;;OAGG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,OAAO,sBAAsB,EAC7B,SAAS,CAAC,WAAW,CAAC,CACvB,CAAC"}
|
@@ -146,7 +146,7 @@ export declare const TransactionEventStruct: import("@metamask/superstruct").Str
|
|
146
146
|
* ```
|
147
147
|
*/
|
148
148
|
export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
149
|
-
type: "send" | "receive";
|
149
|
+
type: "send" | "receive" | "swap";
|
150
150
|
id: string;
|
151
151
|
from: {
|
152
152
|
address: string;
|
@@ -224,9 +224,10 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
|
224
224
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
225
225
|
* details on the UI.
|
226
226
|
*/
|
227
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
227
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
228
228
|
send: "send";
|
229
229
|
receive: "receive";
|
230
|
+
swap: "swap";
|
230
231
|
}>;
|
231
232
|
/**
|
232
233
|
* Transaction sender addresses and amounts.
|
@@ -423,7 +424,7 @@ export type Transaction = Infer<typeof TransactionStruct>;
|
|
423
424
|
*/
|
424
425
|
export declare const TransactionsPageStruct: import("@metamask/superstruct").Struct<{
|
425
426
|
data: {
|
426
|
-
type: "send" | "receive";
|
427
|
+
type: "send" | "receive" | "swap";
|
427
428
|
id: string;
|
428
429
|
from: {
|
429
430
|
address: string;
|
@@ -476,7 +477,7 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
476
477
|
* List of transactions.
|
477
478
|
*/
|
478
479
|
data: import("@metamask/superstruct").Struct<{
|
479
|
-
type: "send" | "receive";
|
480
|
+
type: "send" | "receive" | "swap";
|
480
481
|
id: string;
|
481
482
|
from: {
|
482
483
|
address: string;
|
@@ -523,7 +524,7 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
523
524
|
};
|
524
525
|
}[];
|
525
526
|
}[], import("@metamask/superstruct").Struct<{
|
526
|
-
type: "send" | "receive";
|
527
|
+
type: "send" | "receive" | "swap";
|
527
528
|
id: string;
|
528
529
|
from: {
|
529
530
|
address: string;
|
@@ -601,9 +602,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
601
602
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
602
603
|
* details on the UI.
|
603
604
|
*/
|
604
|
-
type: import("@metamask/superstruct").Struct<"send" | "receive", {
|
605
|
+
type: import("@metamask/superstruct").Struct<"send" | "receive" | "swap", {
|
605
606
|
send: "send";
|
606
607
|
receive: "receive";
|
608
|
+
swap: "swap";
|
607
609
|
}>;
|
608
610
|
/**
|
609
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;IAEnB;;;;;OAKG;IACH,IAAI,SAAS;CACd;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;IACjC;;OAEG;;;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S,CAAC,WAAW,CAAC,CACvB,CAAC"}
|
package/dist/api/transaction.mjs
CHANGED
@@ -236,7 +236,11 @@ export const TransactionStruct = object({
|
|
236
236
|
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
237
237
|
* details on the UI.
|
238
238
|
*/
|
239
|
-
type: enums([
|
239
|
+
type: enums([
|
240
|
+
`${TransactionType.Send}`,
|
241
|
+
`${TransactionType.Receive}`,
|
242
|
+
`${TransactionType.Swap}`,
|
243
|
+
]),
|
240
244
|
/**
|
241
245
|
* Transaction sender addresses and amounts.
|
242
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,EA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B,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,CAAC,GAAG,eAAe,CAAC,IAAI,EAAE,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtE;;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([`${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,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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.d.cts
CHANGED
@@ -230,7 +230,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
230
230
|
method: "notify:accountTransactionsUpdated";
|
231
231
|
params: {
|
232
232
|
transactions: Record<string, {
|
233
|
-
type: "send" | "receive";
|
233
|
+
type: "send" | "receive" | "swap";
|
234
234
|
id: string;
|
235
235
|
from: {
|
236
236
|
address: string;
|
@@ -282,7 +282,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
282
282
|
method: import("@metamask/superstruct").Struct<"notify:accountTransactionsUpdated", "notify:accountTransactionsUpdated">;
|
283
283
|
params: import("@metamask/superstruct").Struct<{
|
284
284
|
transactions: Record<string, {
|
285
|
-
type: "send" | "receive";
|
285
|
+
type: "send" | "receive" | "swap";
|
286
286
|
id: string;
|
287
287
|
from: {
|
288
288
|
address: string;
|
@@ -334,7 +334,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
334
334
|
* Transactions updates of accounts owned by the Snap.
|
335
335
|
*/
|
336
336
|
transactions: import("@metamask/superstruct").Struct<Record<string, {
|
337
|
-
type: "send" | "receive";
|
337
|
+
type: "send" | "receive" | "swap";
|
338
338
|
id: string;
|
339
339
|
from: {
|
340
340
|
address: string;
|
package/dist/events.d.mts
CHANGED
@@ -230,7 +230,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
230
230
|
method: "notify:accountTransactionsUpdated";
|
231
231
|
params: {
|
232
232
|
transactions: Record<string, {
|
233
|
-
type: "send" | "receive";
|
233
|
+
type: "send" | "receive" | "swap";
|
234
234
|
id: string;
|
235
235
|
from: {
|
236
236
|
address: string;
|
@@ -282,7 +282,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
282
282
|
method: import("@metamask/superstruct").Struct<"notify:accountTransactionsUpdated", "notify:accountTransactionsUpdated">;
|
283
283
|
params: import("@metamask/superstruct").Struct<{
|
284
284
|
transactions: Record<string, {
|
285
|
-
type: "send" | "receive";
|
285
|
+
type: "send" | "receive" | "swap";
|
286
286
|
id: string;
|
287
287
|
from: {
|
288
288
|
address: string;
|
@@ -334,7 +334,7 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
334
334
|
* Transactions updates of accounts owned by the Snap.
|
335
335
|
*/
|
336
336
|
transactions: import("@metamask/superstruct").Struct<Record<string, {
|
337
|
-
type: "send" | "receive";
|
337
|
+
type: "send" | "receive" | "swap";
|
338
338
|
id: string;
|
339
339
|
from: {
|
340
340
|
address: string;
|
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;I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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":[],"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C,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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@metamask/keyring-api",
|
3
|
-
"version": "17.2.
|
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.3.
|
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,7 +55,7 @@
|
|
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.3.
|
58
|
+
"@metamask/keyring-utils": "^2.3.1",
|
59
59
|
"@ts-bridge/cli": "^0.6.3",
|
60
60
|
"@types/jest": "^29.5.12",
|
61
61
|
"@types/node": "^20.12.12",
|