@cardano-sdk/dapp-connector 0.6.0-nightly.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +5 -0
  3. package/README.md +9 -0
  4. package/dist/cjs/AuthenticatorApi/PersistentAuthenticator.d.ts +19 -0
  5. package/dist/cjs/AuthenticatorApi/PersistentAuthenticator.d.ts.map +1 -0
  6. package/dist/cjs/AuthenticatorApi/PersistentAuthenticator.js +85 -0
  7. package/dist/cjs/AuthenticatorApi/PersistentAuthenticator.js.map +1 -0
  8. package/dist/cjs/AuthenticatorApi/PersistentAuthenticatorStorage.d.ts +8 -0
  9. package/dist/cjs/AuthenticatorApi/PersistentAuthenticatorStorage.d.ts.map +1 -0
  10. package/dist/cjs/AuthenticatorApi/PersistentAuthenticatorStorage.js +16 -0
  11. package/dist/cjs/AuthenticatorApi/PersistentAuthenticatorStorage.js.map +1 -0
  12. package/dist/cjs/AuthenticatorApi/index.d.ts +4 -0
  13. package/dist/cjs/AuthenticatorApi/index.d.ts.map +1 -0
  14. package/dist/cjs/AuthenticatorApi/index.js +20 -0
  15. package/dist/cjs/AuthenticatorApi/index.js.map +1 -0
  16. package/dist/cjs/AuthenticatorApi/types.d.ts +20 -0
  17. package/dist/cjs/AuthenticatorApi/types.d.ts.map +1 -0
  18. package/dist/cjs/AuthenticatorApi/types.js +3 -0
  19. package/dist/cjs/AuthenticatorApi/types.js.map +1 -0
  20. package/dist/cjs/WalletApi/Cip30Wallet.d.ts +26 -0
  21. package/dist/cjs/WalletApi/Cip30Wallet.d.ts.map +1 -0
  22. package/dist/cjs/WalletApi/Cip30Wallet.js +58 -0
  23. package/dist/cjs/WalletApi/Cip30Wallet.js.map +1 -0
  24. package/dist/cjs/WalletApi/index.d.ts +3 -0
  25. package/dist/cjs/WalletApi/index.d.ts.map +1 -0
  26. package/dist/cjs/WalletApi/index.js +19 -0
  27. package/dist/cjs/WalletApi/index.js.map +1 -0
  28. package/dist/cjs/WalletApi/types.d.ts +42 -0
  29. package/dist/cjs/WalletApi/types.d.ts.map +1 -0
  30. package/dist/cjs/WalletApi/types.js +3 -0
  31. package/dist/cjs/WalletApi/types.js.map +1 -0
  32. package/dist/cjs/errors/ApiError.d.ts +12 -0
  33. package/dist/cjs/errors/ApiError.d.ts.map +1 -0
  34. package/dist/cjs/errors/ApiError.js +19 -0
  35. package/dist/cjs/errors/ApiError.js.map +1 -0
  36. package/dist/cjs/errors/DataSignError.d.ts +13 -0
  37. package/dist/cjs/errors/DataSignError.d.ts.map +1 -0
  38. package/dist/cjs/errors/DataSignError.js +20 -0
  39. package/dist/cjs/errors/DataSignError.js.map +1 -0
  40. package/dist/cjs/errors/PaginateError.d.ts +6 -0
  41. package/dist/cjs/errors/PaginateError.d.ts.map +1 -0
  42. package/dist/cjs/errors/PaginateError.js +13 -0
  43. package/dist/cjs/errors/PaginateError.js.map +1 -0
  44. package/dist/cjs/errors/TxSendError.d.ts +11 -0
  45. package/dist/cjs/errors/TxSendError.d.ts.map +1 -0
  46. package/dist/cjs/errors/TxSendError.js +18 -0
  47. package/dist/cjs/errors/TxSendError.js.map +1 -0
  48. package/dist/cjs/errors/TxSignError.d.ts +11 -0
  49. package/dist/cjs/errors/TxSignError.d.ts.map +1 -0
  50. package/dist/cjs/errors/TxSignError.js +18 -0
  51. package/dist/cjs/errors/TxSignError.js.map +1 -0
  52. package/dist/cjs/errors/index.d.ts +6 -0
  53. package/dist/cjs/errors/index.d.ts.map +1 -0
  54. package/dist/cjs/errors/index.js +22 -0
  55. package/dist/cjs/errors/index.js.map +1 -0
  56. package/dist/cjs/index.d.ts +5 -0
  57. package/dist/cjs/index.d.ts.map +1 -0
  58. package/dist/cjs/index.js +21 -0
  59. package/dist/cjs/index.js.map +1 -0
  60. package/dist/cjs/injectGlobal.d.ts +9 -0
  61. package/dist/cjs/injectGlobal.d.ts.map +1 -0
  62. package/dist/cjs/injectGlobal.js +26 -0
  63. package/dist/cjs/injectGlobal.js.map +1 -0
  64. package/dist/cjs/package.json +3 -0
  65. package/dist/cjs/tsconfig.tsbuildinfo +1 -0
  66. package/dist/esm/AuthenticatorApi/PersistentAuthenticator.d.ts +19 -0
  67. package/dist/esm/AuthenticatorApi/PersistentAuthenticator.d.ts.map +1 -0
  68. package/dist/esm/AuthenticatorApi/PersistentAuthenticator.js +81 -0
  69. package/dist/esm/AuthenticatorApi/PersistentAuthenticator.js.map +1 -0
  70. package/dist/esm/AuthenticatorApi/PersistentAuthenticatorStorage.d.ts +8 -0
  71. package/dist/esm/AuthenticatorApi/PersistentAuthenticatorStorage.d.ts.map +1 -0
  72. package/dist/esm/AuthenticatorApi/PersistentAuthenticatorStorage.js +12 -0
  73. package/dist/esm/AuthenticatorApi/PersistentAuthenticatorStorage.js.map +1 -0
  74. package/dist/esm/AuthenticatorApi/index.d.ts +4 -0
  75. package/dist/esm/AuthenticatorApi/index.d.ts.map +1 -0
  76. package/dist/esm/AuthenticatorApi/index.js +4 -0
  77. package/dist/esm/AuthenticatorApi/index.js.map +1 -0
  78. package/dist/esm/AuthenticatorApi/types.d.ts +20 -0
  79. package/dist/esm/AuthenticatorApi/types.d.ts.map +1 -0
  80. package/dist/esm/AuthenticatorApi/types.js +2 -0
  81. package/dist/esm/AuthenticatorApi/types.js.map +1 -0
  82. package/dist/esm/WalletApi/Cip30Wallet.d.ts +26 -0
  83. package/dist/esm/WalletApi/Cip30Wallet.d.ts.map +1 -0
  84. package/dist/esm/WalletApi/Cip30Wallet.js +54 -0
  85. package/dist/esm/WalletApi/Cip30Wallet.js.map +1 -0
  86. package/dist/esm/WalletApi/index.d.ts +3 -0
  87. package/dist/esm/WalletApi/index.d.ts.map +1 -0
  88. package/dist/esm/WalletApi/index.js +3 -0
  89. package/dist/esm/WalletApi/index.js.map +1 -0
  90. package/dist/esm/WalletApi/types.d.ts +42 -0
  91. package/dist/esm/WalletApi/types.d.ts.map +1 -0
  92. package/dist/esm/WalletApi/types.js +2 -0
  93. package/dist/esm/WalletApi/types.js.map +1 -0
  94. package/dist/esm/errors/ApiError.d.ts +12 -0
  95. package/dist/esm/errors/ApiError.d.ts.map +1 -0
  96. package/dist/esm/errors/ApiError.js +15 -0
  97. package/dist/esm/errors/ApiError.js.map +1 -0
  98. package/dist/esm/errors/DataSignError.d.ts +13 -0
  99. package/dist/esm/errors/DataSignError.d.ts.map +1 -0
  100. package/dist/esm/errors/DataSignError.js +16 -0
  101. package/dist/esm/errors/DataSignError.js.map +1 -0
  102. package/dist/esm/errors/PaginateError.d.ts +6 -0
  103. package/dist/esm/errors/PaginateError.d.ts.map +1 -0
  104. package/dist/esm/errors/PaginateError.js +9 -0
  105. package/dist/esm/errors/PaginateError.js.map +1 -0
  106. package/dist/esm/errors/TxSendError.d.ts +11 -0
  107. package/dist/esm/errors/TxSendError.d.ts.map +1 -0
  108. package/dist/esm/errors/TxSendError.js +14 -0
  109. package/dist/esm/errors/TxSendError.js.map +1 -0
  110. package/dist/esm/errors/TxSignError.d.ts +11 -0
  111. package/dist/esm/errors/TxSignError.d.ts.map +1 -0
  112. package/dist/esm/errors/TxSignError.js +14 -0
  113. package/dist/esm/errors/TxSignError.js.map +1 -0
  114. package/dist/esm/errors/index.d.ts +6 -0
  115. package/dist/esm/errors/index.d.ts.map +1 -0
  116. package/dist/esm/errors/index.js +6 -0
  117. package/dist/esm/errors/index.js.map +1 -0
  118. package/dist/esm/index.d.ts +5 -0
  119. package/dist/esm/index.d.ts.map +1 -0
  120. package/dist/esm/index.js +5 -0
  121. package/dist/esm/index.js.map +1 -0
  122. package/dist/esm/injectGlobal.d.ts +9 -0
  123. package/dist/esm/injectGlobal.d.ts.map +1 -0
  124. package/dist/esm/injectGlobal.js +22 -0
  125. package/dist/esm/injectGlobal.js.map +1 -0
  126. package/dist/esm/package.json +3 -0
  127. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  128. package/package.json +79 -0
@@ -0,0 +1,26 @@
1
+ import { Logger } from 'ts-log';
2
+ import { RemoteAuthenticator } from '../AuthenticatorApi';
3
+ import { WalletApi } from './types';
4
+ export declare type ApiVersion = string;
5
+ export declare type WalletName = string;
6
+ export declare type WalletIcon = string;
7
+ export declare type WalletProperties = {
8
+ icon: WalletIcon;
9
+ walletName: WalletName;
10
+ };
11
+ export declare type WalletDependencies = {
12
+ logger: Logger;
13
+ authenticator: RemoteAuthenticator;
14
+ api: WalletApi;
15
+ };
16
+ export declare class Cip30Wallet {
17
+ #private;
18
+ readonly apiVersion: ApiVersion;
19
+ readonly name: WalletName;
20
+ readonly icon: WalletIcon;
21
+ constructor(properties: WalletProperties, { api, authenticator, logger }: WalletDependencies);
22
+ isEnabled(): Promise<Boolean>;
23
+ enable(): Promise<WalletApi>;
24
+ }
25
+ export declare const WalletApiMethodNames: (keyof WalletApi)[];
26
+ //# sourceMappingURL=Cip30Wallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cip30Wallet.d.ts","sourceRoot":"","sources":["../../../src/WalletApi/Cip30Wallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKpC,oBAAY,UAAU,GAAG,MAAM,CAAC;AAKhC,oBAAY,UAAU,GAAG,MAAM,CAAC;AAOhC,oBAAY,UAAU,GAAG,MAAM,CAAC;AAEhC,oBAAY,gBAAgB,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AAE5E,oBAAY,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,mBAAmB,CAAC;IACnC,GAAG,EAAE,SAAS,CAAC;CAChB,CAAC;AAKF,qBAAa,WAAW;;IACtB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAW;IAC1C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;gBAMd,UAAU,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,kBAAkB;IAmB/E,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAmB7B,MAAM,IAAI,OAAO,CAAC,SAAS,CAAC;CAS1C;AAED,eAAO,MAAM,oBAAoB,EAAE,CAAC,MAAM,SAAS,CAAC,EAYnD,CAAC"}
@@ -0,0 +1,54 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _Cip30Wallet_logger, _Cip30Wallet_api, _Cip30Wallet_authenticator;
13
+ import { APIErrorCode, ApiError } from '../errors';
14
+ export class Cip30Wallet {
15
+ constructor(properties, { api, authenticator, logger }) {
16
+ this.apiVersion = '0.1.0';
17
+ _Cip30Wallet_logger.set(this, void 0);
18
+ _Cip30Wallet_api.set(this, void 0);
19
+ _Cip30Wallet_authenticator.set(this, void 0);
20
+ this.enable = this.enable.bind(this);
21
+ this.icon = properties.icon;
22
+ this.isEnabled = this.isEnabled.bind(this);
23
+ this.name = properties.walletName;
24
+ __classPrivateFieldSet(this, _Cip30Wallet_api, api, "f");
25
+ __classPrivateFieldSet(this, _Cip30Wallet_logger, logger, "f");
26
+ __classPrivateFieldSet(this, _Cip30Wallet_authenticator, authenticator, "f");
27
+ }
28
+ async isEnabled() {
29
+ return __classPrivateFieldGet(this, _Cip30Wallet_authenticator, "f").haveAccess();
30
+ }
31
+ async enable() {
32
+ if (await __classPrivateFieldGet(this, _Cip30Wallet_authenticator, "f").requestAccess()) {
33
+ __classPrivateFieldGet(this, _Cip30Wallet_logger, "f").debug(`${location.origin} has been granted access to wallet api`);
34
+ return __classPrivateFieldGet(this, _Cip30Wallet_api, "f");
35
+ }
36
+ __classPrivateFieldGet(this, _Cip30Wallet_logger, "f").debug(`${location.origin} not authorized to access wallet api`);
37
+ throw new ApiError(APIErrorCode.Refused, 'wallet not authorized.');
38
+ }
39
+ }
40
+ _Cip30Wallet_logger = new WeakMap(), _Cip30Wallet_api = new WeakMap(), _Cip30Wallet_authenticator = new WeakMap();
41
+ export const WalletApiMethodNames = [
42
+ 'getNetworkId',
43
+ 'getUtxos',
44
+ 'getCollateral',
45
+ 'getBalance',
46
+ 'getUsedAddresses',
47
+ 'getUnusedAddresses',
48
+ 'getChangeAddress',
49
+ 'getRewardAddresses',
50
+ 'signTx',
51
+ 'signData',
52
+ 'submitTx'
53
+ ];
54
+ //# sourceMappingURL=Cip30Wallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cip30Wallet.js","sourceRoot":"","sources":["../../../src/WalletApi/Cip30Wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAiCnD,MAAM,OAAO,WAAW;IAStB,YAAY,UAA4B,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAsB;QARnF,eAAU,GAAe,OAAO,CAAC;QAI1C,sCAAyB;QACzB,mCAAyB;QACzB,6CAA6C;QAG3C,IAAI,CAA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ourceRoot":"","sources":["../../../src/WalletApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './Cip30Wallet';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/WalletApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { Cardano } from '@cardano-sdk/core';
2
+ export declare type Bytes = string;
3
+ export declare type Cbor = string;
4
+ export declare type Paginate = {
5
+ page: number;
6
+ limit: number;
7
+ };
8
+ declare type CoseSign1CborHex = Cardano.util.HexBlob;
9
+ declare type CoseKeyCborHex = Cardano.util.HexBlob;
10
+ export interface Cip30DataSignature {
11
+ key: CoseKeyCborHex;
12
+ signature: CoseSign1CborHex;
13
+ }
14
+ export declare type GetNetworkId = () => Promise<Cardano.NetworkId>;
15
+ export declare type GetUtxos = (amount?: Cbor, paginate?: Paginate) => Promise<Cbor[] | undefined>;
16
+ export declare type GetCollateral = (params?: {
17
+ amount?: Cbor;
18
+ }) => Promise<Cbor[] | null>;
19
+ export declare type GetBalance = () => Promise<Cbor>;
20
+ export declare type GetUsedAddresses = (paginate?: Paginate) => Promise<Cbor[]>;
21
+ export declare type GetUnusedAddresses = () => Promise<Cbor[]>;
22
+ export declare type GetChangeAddress = () => Promise<Cbor>;
23
+ export declare type GetRewardAddresses = () => Promise<Cbor[]>;
24
+ export declare type SignTx = (tx: Cbor, partialSign?: Boolean) => Promise<Cbor>;
25
+ export declare type SignData = (addr: Cardano.Address, payload: Bytes) => Promise<Cip30DataSignature>;
26
+ export declare type SubmitTx = (tx: Cbor) => Promise<string>;
27
+ export interface WalletApi {
28
+ getNetworkId: GetNetworkId;
29
+ getUtxos: GetUtxos;
30
+ getBalance: GetBalance;
31
+ getCollateral: GetCollateral;
32
+ getUsedAddresses: GetUsedAddresses;
33
+ getUnusedAddresses: GetUnusedAddresses;
34
+ getChangeAddress: GetChangeAddress;
35
+ getRewardAddresses: GetRewardAddresses;
36
+ signTx: SignTx;
37
+ signData: SignData;
38
+ submitTx: SubmitTx;
39
+ }
40
+ export declare type WalletMethod = keyof WalletApi;
41
+ export {};
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/WalletApi/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C,oBAAY,KAAK,GAAG,MAAM,CAAC;AAO3B,oBAAY,IAAI,GAAG,MAAM,CAAC;AAO1B,oBAAY,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAMvD,aAAK,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;AAC7C,aAAK,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,cAAc,CAAC;IACpB,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAWD,oBAAY,YAAY,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAc5D,oBAAY,QAAQ,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC;AAS3F,oBAAY,aAAa,GAAG,CAAC,MAAM,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,IAAI,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAWnF,oBAAY,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAU7C,oBAAY,g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
1
+ import { CustomError } from 'ts-custom-error';
2
+ export declare enum APIErrorCode {
3
+ InvalidRequest = -1,
4
+ InternalError = -2,
5
+ Refused = -3
6
+ }
7
+ export declare class ApiError extends CustomError {
8
+ code: APIErrorCode;
9
+ info: string;
10
+ constructor(code: APIErrorCode, info: string);
11
+ }
12
+ //# sourceMappingURL=ApiError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiError.d.ts","sourceRoot":"","sources":["../../../src/errors/ApiError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,oBAAY,YAAY;IACtB,cAAc,KAAK;IACnB,aAAa,KAAK;IAClB,OAAO,KAAK;CACb;AACD,qBAAa,QAAS,SAAQ,WAAW;IACvC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;gBAEM,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM;CAKpD"}
@@ -0,0 +1,15 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export var APIErrorCode;
3
+ (function (APIErrorCode) {
4
+ APIErrorCode[APIErrorCode["InvalidRequest"] = -1] = "InvalidRequest";
5
+ APIErrorCode[APIErrorCode["InternalError"] = -2] = "InternalError";
6
+ APIErrorCode[APIErrorCode["Refused"] = -3] = "Refused";
7
+ })(APIErrorCode || (APIErrorCode = {}));
8
+ export class ApiError extends CustomError {
9
+ constructor(code, info) {
10
+ super();
11
+ this.code = code;
12
+ this.info = info;
13
+ }
14
+ }
15
+ //# sourceMappingURL=ApiError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiError.js","sourceRoot":"","sources":["../../../src/errors/ApiError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,oEAAmB,CAAA;IACnB,kEAAkB,CAAA;IAClB,sDAAY,CAAA;AACd,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AACD,MAAM,OAAO,QAAS,SAAQ,WAAW;IAIvC,YAAmB,IAAkB,EAAE,IAAY;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export declare enum DataSignErrorCode {
3
+ ProofGeneration = 1,
4
+ AddressNotPK = 2,
5
+ UserDeclined = 3,
6
+ InvalidFormat = 4
7
+ }
8
+ export declare class DataSignError extends CustomError {
9
+ code: DataSignErrorCode;
10
+ info: string;
11
+ constructor(code: DataSignErrorCode, info: string);
12
+ }
13
+ //# sourceMappingURL=DataSignError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSignError.d.ts","sourceRoot":"","sources":["../../../src/errors/DataSignError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C,oBAAY,iBAAiB;IAC3B,eAAe,IAAI;IACnB,YAAY,IAAI;IAChB,YAAY,IAAI;IAChB,aAAa,IAAI;CAClB;AACD,qBAAa,aAAc,SAAQ,WAAW;IAC5C,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;gBAEM,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM;CAKzD"}
@@ -0,0 +1,16 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export var DataSignErrorCode;
3
+ (function (DataSignErrorCode) {
4
+ DataSignErrorCode[DataSignErrorCode["ProofGeneration"] = 1] = "ProofGeneration";
5
+ DataSignErrorCode[DataSignErrorCode["AddressNotPK"] = 2] = "AddressNotPK";
6
+ DataSignErrorCode[DataSignErrorCode["UserDeclined"] = 3] = "UserDeclined";
7
+ DataSignErrorCode[DataSignErrorCode["InvalidFormat"] = 4] = "InvalidFormat";
8
+ })(DataSignErrorCode || (DataSignErrorCode = {}));
9
+ export class DataSignError extends CustomError {
10
+ constructor(code, info) {
11
+ super();
12
+ this.code = code;
13
+ this.info = info;
14
+ }
15
+ }
16
+ //# sourceMappingURL=DataSignError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSignError.js","sourceRoot":"","sources":["../../../src/errors/DataSignError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,+EAAmB,CAAA;IACnB,yEAAgB,CAAA;IAChB,yEAAgB,CAAA;IAChB,2EAAiB,CAAA;AACnB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AACD,MAAM,OAAO,aAAc,SAAQ,WAAW;IAI5C,YAAmB,IAAuB,EAAE,IAAY;QACtD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export declare class PaginateError extends CustomError {
3
+ maxSize: number;
4
+ constructor(maxSize: number, message: string);
5
+ }
6
+ //# sourceMappingURL=PaginateError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaginateError.d.ts","sourceRoot":"","sources":["../../../src/errors/PaginateError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM9C,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,EAAE,MAAM,CAAC;gBAEG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAKpD"}
@@ -0,0 +1,9 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export class PaginateError extends CustomError {
3
+ constructor(maxSize, message) {
4
+ super();
5
+ this.maxSize = maxSize;
6
+ this.message = message;
7
+ }
8
+ }
9
+ //# sourceMappingURL=PaginateError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaginateError.js","sourceRoot":"","sources":["../../../src/errors/PaginateError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM9C,MAAM,OAAO,aAAc,SAAQ,WAAW;IAG5C,YAAmB,OAAe,EAAE,OAAe;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export declare enum TxSendErrorCode {
3
+ Refused = 1,
4
+ Failure = 2
5
+ }
6
+ export declare class TxSendError extends CustomError {
7
+ code: TxSendErrorCode;
8
+ info: string;
9
+ constructor(code: TxSendErrorCode, info: string);
10
+ }
11
+ //# sourceMappingURL=TxSendError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TxSendError.d.ts","sourceRoot":"","sources":["../../../src/errors/TxSendError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM9C,oBAAY,eAAe;IACzB,OAAO,IAAI;IACX,OAAO,IAAI;CACZ;AACD,qBAAa,WAAY,SAAQ,WAAW;IAC1C,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;gBAEM,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM;CAKvD"}
@@ -0,0 +1,14 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export var TxSendErrorCode;
3
+ (function (TxSendErrorCode) {
4
+ TxSendErrorCode[TxSendErrorCode["Refused"] = 1] = "Refused";
5
+ TxSendErrorCode[TxSendErrorCode["Failure"] = 2] = "Failure";
6
+ })(TxSendErrorCode || (TxSendErrorCode = {}));
7
+ export class TxSendError extends CustomError {
8
+ constructor(code, info) {
9
+ super();
10
+ this.code = code;
11
+ this.info = info;
12
+ }
13
+ }
14
+ //# sourceMappingURL=TxSendError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TxSendError.js","sourceRoot":"","sources":["../../../src/errors/TxSendError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM9C,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,2DAAW,CAAA;IACX,2DAAW,CAAA;AACb,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,OAAO,WAAY,SAAQ,WAAW;IAI1C,YAAmB,IAAqB,EAAE,IAAY;QACpD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export declare enum TxSignErrorCode {
3
+ ProofGeneration = 1,
4
+ UserDeclined = 2
5
+ }
6
+ export declare class TxSignError extends CustomError {
7
+ code: TxSignErrorCode;
8
+ info: string;
9
+ constructor(code: TxSignErrorCode, info: string);
10
+ }
11
+ //# sourceMappingURL=TxSignError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TxSignError.d.ts","sourceRoot":"","sources":["../../../src/errors/TxSignError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,oBAAY,eAAe;IACzB,eAAe,IAAI;IACnB,YAAY,IAAI;CACjB;AACD,qBAAa,WAAY,SAAQ,WAAW;IAC1C,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;gBAEM,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM;CAKvD"}
@@ -0,0 +1,14 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export var TxSignErrorCode;
3
+ (function (TxSignErrorCode) {
4
+ TxSignErrorCode[TxSignErrorCode["ProofGeneration"] = 1] = "ProofGeneration";
5
+ TxSignErrorCode[TxSignErrorCode["UserDeclined"] = 2] = "UserDeclined";
6
+ })(TxSignErrorCode || (TxSignErrorCode = {}));
7
+ export class TxSignError extends CustomError {
8
+ constructor(code, info) {
9
+ super();
10
+ this.code = code;
11
+ this.info = info;
12
+ }
13
+ }
14
+ //# sourceMappingURL=TxSignError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TxSignError.js","sourceRoot":"","sources":["../../../src/errors/TxSignError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,2EAAmB,CAAA;IACnB,qEAAgB,CAAA;AAClB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,OAAO,WAAY,SAAQ,WAAW;IAI1C,YAAmB,IAAqB,EAAE,IAAY;QACpD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ export * from './ApiError';
2
+ export * from './DataSignError';
3
+ export * from './PaginateError';
4
+ export * from './TxSendError';
5
+ export * from './TxSignError';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './ApiError';
2
+ export * from './DataSignError';
3
+ export * from './PaginateError';
4
+ export * from './TxSendError';
5
+ export * from './TxSignError';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './errors';
2
+ export * from './WalletApi';
3
+ export * from './AuthenticatorApi';
4
+ export * from './injectGlobal';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './errors';
2
+ export * from './WalletApi';
3
+ export * from './AuthenticatorApi';
4
+ export * from './injectGlobal';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Cip30Wallet } from './WalletApi';
2
+ import { Logger } from 'ts-log';
3
+ export declare type WindowMaybeWithCardano = Window & {
4
+ cardano?: {
5
+ [k: string]: Cip30Wallet;
6
+ };
7
+ };
8
+ export declare const injectGlobal: (window: WindowMaybeWithCardano, wallet: Cip30Wallet, logger: Logger) => void;
9
+ //# sourceMappingURL=injectGlobal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectGlobal.d.ts","sourceRoot":"","sources":["../../src/injectGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,oBAAY,sBAAsB,GAAG,MAAM,GAAG;IAAE,OAAO,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAA;CAAE,CAAC;AAEzF,eAAO,MAAM,YAAY,WAAY,sBAAsB,UAAU,WAAW,UAAU,MAAM,KAAG,IA4BlG,CAAC"}
@@ -0,0 +1,22 @@
1
+ export const injectGlobal = (window, wallet, logger) => {
2
+ if (!window.cardano) {
3
+ logger.debug({
4
+ module: 'injectWindow',
5
+ wallet: { apiVersion: wallet.apiVersion, icon: wallet.icon, name: wallet.name }
6
+ }, 'Creating cardano global scope');
7
+ window.cardano = {};
8
+ }
9
+ else {
10
+ logger.debug({
11
+ module: 'injectWindow',
12
+ wallet: { apiVersion: wallet.apiVersion, icon: wallet.icon, name: wallet.name }
13
+ }, 'Cardano global scope exists');
14
+ }
15
+ window.cardano[wallet.name] = window.cardano[wallet.name] || wallet;
16
+ logger.debug({
17
+ module: 'injectWindow',
18
+ wallet: { apiVersion: wallet.apiVersion, icon: wallet.icon, name: wallet.name },
19
+ windowCardano: window.cardano
20
+ }, 'Injected');
21
+ };
22
+ //# sourceMappingURL=injectGlobal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectGlobal.js","sourceRoot":"","sources":["../../src/injectGlobal.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAA8B,EAAE,MAAmB,EAAE,MAAc,EAAQ,EAAE;IACxG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,MAAM,CAAC,KAAK,CACV;YACE,MAAM,EAAE,cAAc;YACtB,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;SAChF,EACD,+BAA+B,CAChC,CAAC;QACF,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;KACrB;SAAM;QACL,MAAM,CAAC,KAAK,CACV;YACE,MAAM,EAAE,cAAc;YACtB,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;SAChF,EACD,6BAA6B,CAC9B,CAAC;KACH;IACD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC;IACpE,MAAM,CAAC,KAAK,CACV;QACE,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;QAC/E,aAAa,EAAE,MAAM,CAAC,OAAO;KAC9B,EACD,UAAU,CACX,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }