@metamask-previews/keyring-internal-api 0.0.1-72196d6 → 0.0.1-7befa45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./api.cjs"), exports);
18
17
  __exportStar(require("./types.cjs"), exports);
19
18
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,4CAAsB;AACtB,8CAAwB","sourcesContent":["export type * from './eth';\nexport * from './api';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,8CAAwB","sourcesContent":["export type * from './eth';\nexport * from './types';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
1
  export type * from "./eth/index.cjs";
2
- export * from "./api.cjs";
3
2
  export * from "./types.cjs";
4
3
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAA2B;AAC3B,0BAAsB;AACtB,4BAAwB"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAA2B;AAC3B,4BAAwB"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,3 @@
1
1
  export type * from "./eth/index.mjs";
2
- export * from "./api.mjs";
3
2
  export * from "./types.mjs";
4
3
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAA2B;AAC3B,0BAAsB;AACtB,4BAAwB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAA2B;AAC3B,4BAAwB"}
package/dist/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- export * from "./api.mjs";
2
1
  export * from "./types.mjs";
3
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,0BAAsB;AACtB,4BAAwB","sourcesContent":["export type * from './eth';\nexport * from './api';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,4BAAwB","sourcesContent":["export type * from './eth';\nexport * from './types';\n"]}
package/dist/types.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
3
3
  /* eslint-disable @typescript-eslint/no-duplicate-type-constituents */
4
- // Those rules seem to be triggering a false positive on the `InternalAccountStructs`
4
+ // FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`
5
5
  // and `InternalAccountTypes`.
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalSolDataAccountStruct = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,sEAAsE;AACtE,qFAAqF;AACrF,8BAA8B;;;AAE9B,uDAS+B;AAC/B,2DAAgE;AAEhE,uDAAgE;AAOnD,QAAA,6BAA6B,GAAG,IAAA,sBAAM,EAAC;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AAC,MAAM,EAAE,CAAC,EAAE,sCAA8B;IAC5D,CAAC,GAAG,4BAAc,CAAC,WAAW,EAAE,CAAC,EAAE,oCAA4B;CAChE,CAAC;AAQW,QAAA,qBAAqB,GAAG,IAAA,sBAAM,EAAC;IAC1C,GAAG,kCAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n// Those rules seem to be triggering a false positive on the `InternalAccountStructs`\n// and `InternalAccountTypes`.\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n BtcP2wpkhAccountStruct,\n EthEoaAccountStruct,\n EthErc4337AccountStruct,\n SolDataAccountStruct,\n} from '@metamask/keyring-api';\nimport { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4FAA4F;AAC5F,8BAA8B;;;AAE9B,uDAS+B;AAC/B,2DAAgE;AAEhE,uDAAgE;AAOnD,QAAA,6BAA6B,GAAG,IAAA,sBAAM,EAAC;IAClD,QAAQ,EAAE,IAAA,sBAAM,EAAC;QACf,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,iBAAiB,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAC1C,IAAI,EAAE,IAAA,6BAAa,EACjB,IAAA,sBAAM,EAAC;YACL,EAAE,EAAE,IAAA,o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,MAAM;CACxC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n// FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`\n// and `InternalAccountTypes`.\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n BtcP2wpkhAccountStruct,\n EthEoaAccountStruct,\n EthErc4337AccountStruct,\n SolDataAccountStruct,\n} from '@metamask/keyring-api';\nimport { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
package/dist/types.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2
2
  /* eslint-disable @typescript-eslint/no-duplicate-type-constituents */
3
- // Those rules seem to be triggering a false positive on the `InternalAccountStructs`
3
+ // FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`
4
4
  // and `InternalAccountTypes`.
5
5
  import { BtcAccountType, EthAccountType, KeyringAccountStruct, SolAccountType, BtcP2wpkhAccountStruct, EthEoaAccountStruct, EthErc4337AccountStruct, SolDataAccountStruct } from "@metamask/keyring-api";
6
6
  import { exactOptional, object } from "@metamask/keyring-utils";
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,qFAAqF;AACrF,8BAA8B;AAE9B,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACr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,EAAE,2BAA2B;IACtD,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,EAAE,+BAA+B;IAC9D,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,8BAA8B;IAC5D,CAAC,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC,EAAE,4BAA4B;CAChE,CAAC;AAQF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;IAC1C,GAAG,oBAAoB,CAAC,MAAM;IAC9B,GAAG,6BAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n// Those rules seem to be triggering a false positive on the `InternalAccountStructs`\n// and `InternalAccountTypes`.\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n BtcP2wpkhAccountStruct,\n EthEoaAccountStruct,\n EthErc4337AccountStruct,\n SolDataAccountStruct,\n} from '@metamask/keyring-api';\nimport { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4FAA4F;AAC5F,8BAA8B;AAE9B,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACrB,8BAA8B;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,gCAAgC;AAEhE,OAAO,EAAE,OAAO,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AC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,8BAA8B;IAC5D,CAAC,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC,EAAE,4BAA4B;CAChE,CAAC;AAQF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;IAC1C,GAAG,oBAAoB,CAAC,MAAM;IAC9B,GAAG,6BAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n// FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`\n// and `InternalAccountTypes`.\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n BtcP2wpkhAccountStruct,\n EthEoaAccountStruct,\n EthErc4337AccountStruct,\n SolDataAccountStruct,\n} from '@metamask/keyring-api';\nimport { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/keyring-internal-api",
3
- "version": "0.0.1-72196d6",
3
+ "version": "0.0.1-7befa45",
4
4
  "description": "MetaMask Keyring Internal API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -54,7 +54,7 @@
54
54
  "@lavamoat/allow-scripts": "^3.2.1",
55
55
  "@lavamoat/preinstall-always-fail": "^2.1.0",
56
56
  "@metamask/auto-changelog": "^3.4.4",
57
- "@ts-bridge/cli": "^0.6.0",
57
+ "@ts-bridge/cli": "^0.6.1",
58
58
  "@types/jest": "^29.5.12",
59
59
  "@types/node": "^20.12.12",
60
60
  "deepmerge": "^4.2.2",
package/dist/api.cjs DELETED
@@ -1,148 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.ListAccountTransactionsResponseStruct = exports.ListAccountTransactionsRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = void 0;
4
- const keyring_api_1 = require("@metamask/keyring-api");
5
- const keyring_utils_1 = require("@metamask/keyring-utils");
6
- const superstruct_1 = require("@metamask/superstruct");
7
- const utils_1 = require("@metamask/utils");
8
- const CommonHeader = {
9
- jsonrpc: (0, superstruct_1.literal)('2.0'),
10
- id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
11
- };
12
- // ----------------------------------------------------------------------------
13
- // List accounts
14
- exports.ListAccountsRequestStruct = (0, keyring_utils_1.object)({
15
- ...CommonHeader,
16
- method: (0, superstruct_1.literal)('keyring_listAccounts'),
17
- });
18
- exports.ListAccountsResponseStruct = (0, superstruct_1.array)(keyring_api_1.KeyringAccountStruct);
19
- // ----------------------------------------------------------------------------
20
- // Get account
21
- exports.GetAccountRequestStruct = (0, keyring_utils_1.object)({
22
- ...CommonHeader,
23
- method: (0, superstruct_1.literal)('keyring_getAccount'),
24
- params: (0, keyring_utils_1.object)({
25
- id: keyring_utils_1.UuidStruct,
26
- }),
27
- });
28
- exports.GetAccountResponseStruct = keyring_api_1.KeyringAccountStruct;
29
- // ----------------------------------------------------------------------------
30
- // Create account
31
- exports.CreateAccountRequestStruct = (0, keyring_utils_1.object)({
32
- ...CommonHeader,
33
- method: (0, superstruct_1.literal)('keyring_createAccount'),
34
- params: (0, keyring_utils_1.object)({
35
- options: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
36
- }),
37
- });
38
- exports.CreateAccountResponseStruct = keyring_api_1.KeyringAccountStruct;
39
- // ----------------------------------------------------------------------------
40
- // List account transactions
41
- exports.ListAccountTransactionsRequestStruct = (0, keyring_utils_1.object)({
42
- ...CommonHeader,
43
- method: (0, superstruct_1.literal)('keyring_listAccountTransactions'),
44
- params: (0, keyring_utils_1.object)({
45
- id: keyring_utils_1.UuidStruct,
46
- pagination: keyring_api_1.PaginationStruct,
47
- }),
48
- });
49
- exports.ListAccountTransactionsResponseStruct = keyring_api_1.TransactionsPageStruct;
50
- // ----------------------------------------------------------------------------
51
- // Get account balances
52
- exports.GetAccountBalancesRequestStruct = (0, keyring_utils_1.object)({
53
- ...CommonHeader,
54
- method: (0, superstruct_1.literal)(`${keyring_api_1.KeyringRpcMethod.GetAccountBalances}`),
55
- params: (0, keyring_utils_1.object)({
56
- id: keyring_utils_1.UuidStruct,
57
- assets: (0, superstruct_1.array)(keyring_api_1.CaipAssetTypeStruct),
58
- }),
59
- });
60
- exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(keyring_api_1.CaipAssetTypeStruct, keyring_api_1.BalanceStruct);
61
- // ----------------------------------------------------------------------------
62
- // Filter account chains
63
- exports.FilterAccountChainsStruct = (0, keyring_utils_1.object)({
64
- ...CommonHeader,
65
- method: (0, superstruct_1.literal)('keyring_filterAccountChains'),
66
- params: (0, keyring_utils_1.object)({
67
- id: keyring_utils_1.UuidStruct,
68
- chains: (0, superstruct_1.array)((0, superstruct_1.string)()),
69
- }),
70
- });
71
- exports.FilterAccountChainsResponseStruct = (0, superstruct_1.array)((0, superstruct_1.string)());
72
- // ----------------------------------------------------------------------------
73
- // Update account
74
- exports.UpdateAccountRequestStruct = (0, keyring_utils_1.object)({
75
- ...CommonHeader,
76
- method: (0, superstruct_1.literal)('keyring_updateAccount'),
77
- params: (0, keyring_utils_1.object)({
78
- account: keyring_api_1.KeyringAccountStruct,
79
- }),
80
- });
81
- exports.UpdateAccountResponseStruct = (0, superstruct_1.literal)(null);
82
- // ----------------------------------------------------------------------------
83
- // Delete account
84
- exports.DeleteAccountRequestStruct = (0, keyring_utils_1.object)({
85
- ...CommonHeader,
86
- method: (0, superstruct_1.literal)('keyring_deleteAccount'),
87
- params: (0, keyring_utils_1.object)({
88
- id: keyring_utils_1.UuidStruct,
89
- }),
90
- });
91
- exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
92
- // ----------------------------------------------------------------------------
93
- // Export account
94
- exports.ExportAccountRequestStruct = (0, keyring_utils_1.object)({
95
- ...CommonHeader,
96
- method: (0, superstruct_1.literal)('keyring_exportAccount'),
97
- params: (0, keyring_utils_1.object)({
98
- id: keyring_utils_1.UuidStruct,
99
- }),
100
- });
101
- exports.ExportAccountResponseStruct = keyring_api_1.KeyringAccountDataStruct;
102
- // ----------------------------------------------------------------------------
103
- // List requests
104
- exports.ListRequestsRequestStruct = (0, keyring_utils_1.object)({
105
- ...CommonHeader,
106
- method: (0, superstruct_1.literal)('keyring_listRequests'),
107
- });
108
- exports.ListRequestsResponseStruct = (0, superstruct_1.array)(keyring_api_1.KeyringRequestStruct);
109
- // ----------------------------------------------------------------------------
110
- // Get request
111
- exports.GetRequestRequestStruct = (0, keyring_utils_1.object)({
112
- ...CommonHeader,
113
- method: (0, superstruct_1.literal)('keyring_getRequest'),
114
- params: (0, keyring_utils_1.object)({
115
- id: keyring_utils_1.UuidStruct,
116
- }),
117
- });
118
- exports.GetRequestResponseStruct = keyring_api_1.KeyringRequestStruct;
119
- // ----------------------------------------------------------------------------
120
- // Submit request
121
- exports.SubmitRequestRequestStruct = (0, keyring_utils_1.object)({
122
- ...CommonHeader,
123
- method: (0, superstruct_1.literal)('keyring_submitRequest'),
124
- params: keyring_api_1.KeyringRequestStruct,
125
- });
126
- exports.SubmitRequestResponseStruct = keyring_api_1.KeyringResponseStruct;
127
- // ----------------------------------------------------------------------------
128
- // Approve request
129
- exports.ApproveRequestRequestStruct = (0, keyring_utils_1.object)({
130
- ...CommonHeader,
131
- method: (0, superstruct_1.literal)('keyring_approveRequest'),
132
- params: (0, keyring_utils_1.object)({
133
- id: keyring_utils_1.UuidStruct,
134
- data: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
135
- }),
136
- });
137
- exports.ApproveRequestResponseStruct = (0, superstruct_1.literal)(null);
138
- // ----------------------------------------------------------------------------
139
- // Reject request
140
- exports.RejectRequestRequestStruct = (0, keyring_utils_1.object)({
141
- ...CommonHeader,
142
- method: (0, superstruct_1.literal)('keyring_rejectRequest'),
143
- params: (0, keyring_utils_1.object)({
144
- id: keyring_utils_1.UuidStruct,
145
- }),
146
- });
147
- exports.RejectRequestResponseStruct = (0, superstruct_1.literal)(null);
148
- //# sourceMappingURL=api.cjs.map
package/dist/api.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.cjs","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";;;AAAA,uDAU+B;AAC/B,2DAA6D;AAE7D,uDAO+B;AAC/B,2CAA6C;AAE7C,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,gBAAgB;AAEH,QA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AAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n KeyringRpcMethod,\n PaginationStruct,\n TransactionsPageStruct,\n} from '@metamask/keyring-api';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List account transactions\n\nexport const ListAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountTransactions'),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type ListAccountTransactionsRequest = Infer<\n typeof ListAccountTransactionsRequestStruct\n>;\n\nexport const ListAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type ListAccountTransactionsResponse = Infer<\n typeof ListAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_deleteAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}