@monerium/sdk 1.0.20 → 2.0.0-alpha

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +14 -79
  3. package/esm/_dnt.shims.js +76 -0
  4. package/esm/deps/deno.land/std@0.159.0/encoding/base64.js +123 -0
  5. package/esm/deps/deno.land/std@0.159.0/encoding/base64url.js +49 -0
  6. package/esm/mod.js +1 -0
  7. package/esm/package.json +3 -0
  8. package/esm/src/client.js +139 -0
  9. package/esm/src/config.js +13 -0
  10. package/esm/src/types.js +73 -0
  11. package/package.json +39 -46
  12. package/script/_dnt.shims.js +88 -0
  13. package/script/deps/deno.land/std@0.159.0/encoding/base64.js +151 -0
  14. package/script/deps/deno.land/std@0.159.0/encoding/base64url.js +77 -0
  15. package/script/mod.js +5 -0
  16. package/script/package.json +3 -0
  17. package/script/src/client.js +166 -0
  18. package/script/src/config.js +16 -0
  19. package/script/src/types.js +76 -0
  20. package/types/_dnt.shims.d.ts +18 -0
  21. package/types/deps/deno.land/std@0.159.0/encoding/base64.d.ts +11 -0
  22. package/types/deps/deno.land/std@0.159.0/encoding/base64url.d.ts +10 -0
  23. package/types/mod.d.ts +1 -0
  24. package/types/src/client.d.ts +19 -0
  25. package/types/src/config.d.ts +3 -0
  26. package/types/src/types.d.ts +266 -0
  27. package/.eslintignore +0 -13
  28. package/.eslintrc.cjs +0 -20
  29. package/.github/workflows/release-please.yml +0 -34
  30. package/.prettierignore +0 -13
  31. package/.prettierrc +0 -6
  32. package/CHANGELOG.md +0 -151
  33. package/src/app.d.ts +0 -11
  34. package/src/app.html +0 -12
  35. package/src/lib/client.ts +0 -341
  36. package/src/lib/config.ts +0 -59
  37. package/src/lib/index.ts +0 -1
  38. package/src/routes/index.svelte +0 -32
  39. package/src/routes/integration.svelte +0 -45
  40. package/static/favicon.png +0 -0
  41. package/svelte.config.js +0 -19
  42. package/test/index.test.ts +0 -20
  43. package/tsconfig.json +0 -19
  44. package/vite.config.js +0 -14
  45. package/vitest.config.ts +0 -7
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 monerium
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,93 +1,28 @@
1
1
  # @monerium/sdk
2
2
 
3
- Everything you need to interact with the Monerium API - An electronic money issuer.
3
+ Everything you need to interact with the Monerium API - an electronic money issuer.
4
4
 
5
- _This package is in development. Please make sure to check if any future updates contain commits that may change the behavior of your application before you upgrade._
5
+ _This package is in development. Please make sure to check if any future updates contain commits
6
+ that may change the behavior of your application before you upgrade._
6
7
 
7
- ## Authentication
8
+ ## Installing
8
9
 
9
- ```ts
10
- import { MoneriumClient } from 'monerium-js';
11
-
12
- const client = await MoneriumClient.create();
13
-
14
- // Depending on the authentication method you want to use,
15
- // make sure to pass the correct arguments to the `auth` method.
16
- // Optional arguments can be omitted.
17
-
18
- // --- BASIC Authentication --- //
19
-
20
- await client.auth({ email: '<required>', password: '<required>' });
21
-
22
- // --- BEARER PKCE Authentication --- //
23
-
24
- // 1. Redirect to Monerium PKCE Authentication flow.
25
- await client
26
- .auth({
27
- client_id: '<required>',
28
- state: '<recommended>',
29
- address: '<optional>',
30
- redirect_uri: '<optional>',
31
- scope: '<optional>'
32
- })
33
- .then(() => {
34
- // store the `code_verifier` from `client.codeVerifier` for later.
35
- sessionStorage.setItem('code_verifier', client.codeVerifier);
36
- });
37
-
38
- // User will be redirected to the redirect_url with
39
- // the code and the state in query parameters
40
- // Make sure to compare the state from the response and the one you passed.
41
-
42
- // 2. Redeem Code
43
- const bearerProfile = await client.auth({
44
- client_id: '<required>',
45
- code: '<required>',
46
- code_verifier: sessionStorage.getItem('code_verifier'),
47
- redirect_uri: '<can be omitted if not set in request>',
48
- scope: '<optional>'
49
- });
50
-
51
- // Note: In case steps 1 and 2 are executed in different environments,
52
- // e.g. 1 in the browser and 2 on the server, you can pass a bearer
53
- // profile in order to authenticate as shown below.
54
-
55
- client.auth(bearerProfile);
56
-
57
- // --- BEARER Client Authentication --- //
58
-
59
- await client.auth({ client_id: '<required>', client_secret: '<required>', scope: '<optional>' });
60
-
61
- // --- Client Attributes --- //
62
-
63
- client.authContext;
64
- client.bearerProfile;
65
- ```
66
-
67
- ## Demo
68
-
69
- To check out the demo site for this pacakge, run the following commands:
70
-
71
- ```bash
72
- yarn install
73
- yarn dev
10
+ ```sh
11
+ # Node
12
+ yarn add @monerium/sdk
74
13
  ```
75
14
 
76
15
  ## Developing
77
16
 
78
- If you want to make any code contributions, make sure to run the following commands before you pr them:
17
+ If you want to make any code contributions, make sure to run the following commands before you pr
18
+ them:
79
19
 
80
- ```bash
81
- yarn format
82
- yarn lint
83
- yarn test
20
+ ```sh
21
+ deno fmt
22
+ deno lint
23
+ deno test --allow-net=api.monerium.dev
84
24
  ```
85
25
 
86
26
  ## Publishing
87
27
 
88
- If you want to modify and publish the package yourself, run the following commands:
89
-
90
- ```bash
91
- yarn package
92
- yarn publish
93
- ```
28
+ Tagging a release on GitHub will publish the package to NPM and Deno Land.
@@ -0,0 +1,76 @@
1
+ import { Deno } from "@deno/shim-deno";
2
+ export { Deno } from "@deno/shim-deno";
3
+ import { crypto } from "@deno/shim-crypto";
4
+ export { crypto } from "@deno/shim-crypto";
5
+ import { fetch, File, FormData, Headers, Request, Response } from "undici";
6
+ export { fetch, File, FormData, Headers, Request, Response } from "undici";
7
+ import { TextEncoder } from "util";
8
+ export { TextEncoder } from "util";
9
+ const dntGlobals = {
10
+ Deno,
11
+ crypto,
12
+ fetch,
13
+ File,
14
+ FormData,
15
+ Headers,
16
+ Request,
17
+ Response,
18
+ TextEncoder,
19
+ };
20
+ export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
21
+ // deno-lint-ignore ban-types
22
+ function createMergeProxy(baseObj, extObj) {
23
+ return new Proxy(baseObj, {
24
+ get(_target, prop, _receiver) {
25
+ if (prop in extObj) {
26
+ return extObj[prop];
27
+ }
28
+ else {
29
+ return baseObj[prop];
30
+ }
31
+ },
32
+ set(_target, prop, value) {
33
+ if (prop in extObj) {
34
+ delete extObj[prop];
35
+ }
36
+ baseObj[prop] = value;
37
+ return true;
38
+ },
39
+ deleteProperty(_target, prop) {
40
+ let success = false;
41
+ if (prop in extObj) {
42
+ delete extObj[prop];
43
+ success = true;
44
+ }
45
+ if (prop in baseObj) {
46
+ delete baseObj[prop];
47
+ success = true;
48
+ }
49
+ return success;
50
+ },
51
+ ownKeys(_target) {
52
+ const baseKeys = Reflect.ownKeys(baseObj);
53
+ const extKeys = Reflect.ownKeys(extObj);
54
+ const extKeysSet = new Set(extKeys);
55
+ return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
56
+ },
57
+ defineProperty(_target, prop, desc) {
58
+ if (prop in extObj) {
59
+ delete extObj[prop];
60
+ }
61
+ Reflect.defineProperty(baseObj, prop, desc);
62
+ return true;
63
+ },
64
+ getOwnPropertyDescriptor(_target, prop) {
65
+ if (prop in extObj) {
66
+ return Reflect.getOwnPropertyDescriptor(extObj, prop);
67
+ }
68
+ else {
69
+ return Reflect.getOwnPropertyDescriptor(baseObj, prop);
70
+ }
71
+ },
72
+ has(_target, prop) {
73
+ return prop in extObj || prop in baseObj;
74
+ },
75
+ });
76
+ }
@@ -0,0 +1,123 @@
1
+ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
2
+ /**
3
+ * {@linkcode encode} and {@linkcode decode} for
4
+ * [base64](https://en.wikipedia.org/wiki/Base64) encoding.
5
+ *
6
+ * This module is browser compatible.
7
+ *
8
+ * @module
9
+ */
10
+ import * as dntShim from "../../../../_dnt.shims.js";
11
+ const base64abc = [
12
+ "A",
13
+ "B",
14
+ "C",
15
+ "D",
16
+ "E",
17
+ "F",
18
+ "G",
19
+ "H",
20
+ "I",
21
+ "J",
22
+ "K",
23
+ "L",
24
+ "M",
25
+ "N",
26
+ "O",
27
+ "P",
28
+ "Q",
29
+ "R",
30
+ "S",
31
+ "T",
32
+ "U",
33
+ "V",
34
+ "W",
35
+ "X",
36
+ "Y",
37
+ "Z",
38
+ "a",
39
+ "b",
40
+ "c",
41
+ "d",
42
+ "e",
43
+ "f",
44
+ "g",
45
+ "h",
46
+ "i",
47
+ "j",
48
+ "k",
49
+ "l",
50
+ "m",
51
+ "n",
52
+ "o",
53
+ "p",
54
+ "q",
55
+ "r",
56
+ "s",
57
+ "t",
58
+ "u",
59
+ "v",
60
+ "w",
61
+ "x",
62
+ "y",
63
+ "z",
64
+ "0",
65
+ "1",
66
+ "2",
67
+ "3",
68
+ "4",
69
+ "5",
70
+ "6",
71
+ "7",
72
+ "8",
73
+ "9",
74
+ "+",
75
+ "/",
76
+ ];
77
+ /**
78
+ * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
79
+ * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
80
+ * @param data
81
+ */
82
+ export function encode(data) {
83
+ const uint8 = typeof data === "string"
84
+ ? new dntShim.TextEncoder().encode(data)
85
+ : data instanceof Uint8Array
86
+ ? data
87
+ : new Uint8Array(data);
88
+ let result = "", i;
89
+ const l = uint8.length;
90
+ for (i = 2; i < l; i += 3) {
91
+ result += base64abc[uint8[i - 2] >> 2];
92
+ result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)];
93
+ result += base64abc[((uint8[i - 1] & 0x0f) << 2) | (uint8[i] >> 6)];
94
+ result += base64abc[uint8[i] & 0x3f];
95
+ }
96
+ if (i === l + 1) {
97
+ // 1 octet yet to write
98
+ result += base64abc[uint8[i - 2] >> 2];
99
+ result += base64abc[(uint8[i - 2] & 0x03) << 4];
100
+ result += "==";
101
+ }
102
+ if (i === l) {
103
+ // 2 octets yet to write
104
+ result += base64abc[uint8[i - 2] >> 2];
105
+ result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)];
106
+ result += base64abc[(uint8[i - 1] & 0x0f) << 2];
107
+ result += "=";
108
+ }
109
+ return result;
110
+ }
111
+ /**
112
+ * Decodes a given RFC4648 base64 encoded string
113
+ * @param b64
114
+ */
115
+ export function decode(b64) {
116
+ const binString = atob(b64);
117
+ const size = binString.length;
118
+ const bytes = new Uint8Array(size);
119
+ for (let i = 0; i < size; i++) {
120
+ bytes[i] = binString.charCodeAt(i);
121
+ }
122
+ return bytes;
123
+ }
@@ -0,0 +1,49 @@
1
+ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
2
+ /**
3
+ * {@linkcode encode} and {@linkcode decode} for
4
+ * [base64 URL safe](https://en.wikipedia.org/wiki/Base64#URL_applications) encoding.
5
+ *
6
+ * This module is browser compatible.
7
+ *
8
+ * @module
9
+ */
10
+ import * as base64 from "./base64.js";
11
+ /*
12
+ * Some variants allow or require omitting the padding '=' signs:
13
+ * https://en.wikipedia.org/wiki/Base64#The_URL_applications
14
+ * @param base64url
15
+ */
16
+ function addPaddingToBase64url(base64url) {
17
+ if (base64url.length % 4 === 2)
18
+ return base64url + "==";
19
+ if (base64url.length % 4 === 3)
20
+ return base64url + "=";
21
+ if (base64url.length % 4 === 1) {
22
+ throw new TypeError("Illegal base64url string!");
23
+ }
24
+ return base64url;
25
+ }
26
+ function convertBase64urlToBase64(b64url) {
27
+ if (!/^[-_A-Z0-9]*?={0,2}$/i.test(b64url)) {
28
+ // Contains characters not part of base64url spec.
29
+ throw new TypeError("Failed to decode base64url: invalid character");
30
+ }
31
+ return addPaddingToBase64url(b64url).replace(/\-/g, "+").replace(/_/g, "/");
32
+ }
33
+ function convertBase64ToBase64url(b64) {
34
+ return b64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
35
+ }
36
+ /**
37
+ * Encodes a given ArrayBuffer or string into a base64url representation
38
+ * @param data
39
+ */
40
+ export function encode(data) {
41
+ return convertBase64ToBase64url(base64.encode(data));
42
+ }
43
+ /**
44
+ * Converts given base64url encoded data back to original
45
+ * @param b64url
46
+ */
47
+ export function decode(b64url) {
48
+ return base64.decode(convertBase64urlToBase64(b64url));
49
+ }
package/esm/mod.js ADDED
@@ -0,0 +1 @@
1
+ export { MoneriumClient } from "./src/client.js";
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,139 @@
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 _MoneriumClient_instances, _MoneriumClient_env, _MoneriumClient_authPayload, _MoneriumClient_api, _MoneriumClient_isAuthCode, _MoneriumClient_isRefreshToken, _MoneriumClient_isClientCredentials;
13
+ import * as dntShim from "../_dnt.shims.js";
14
+ import { encode as encodeBase64 } from "../deps/deno.land/std@0.159.0/encoding/base64.js";
15
+ import { encode as encodeBase64URL } from "../deps/deno.land/std@0.159.0/encoding/base64url.js";
16
+ import { MONERIUM_CONFIG } from "./config.js";
17
+ export class MoneriumClient {
18
+ constructor(env = "sandbox") {
19
+ _MoneriumClient_instances.add(this);
20
+ _MoneriumClient_env.set(this, void 0);
21
+ _MoneriumClient_authPayload.set(this, void 0);
22
+ Object.defineProperty(this, "codeVerifier", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: void 0
27
+ });
28
+ Object.defineProperty(this, "bearerProfile", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: void 0
33
+ });
34
+ __classPrivateFieldSet(this, _MoneriumClient_env, MONERIUM_CONFIG.environments[env], "f");
35
+ }
36
+ // -- Authentication
37
+ async auth(args) {
38
+ let params;
39
+ if (__classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_isAuthCode).call(this, args)) {
40
+ params = { ...args, grant_type: "authorization_code" };
41
+ }
42
+ else if (__classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_isRefreshToken).call(this, args)) {
43
+ params = { ...args, grant_type: "refresh_token" };
44
+ }
45
+ else if (__classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_isClientCredentials).call(this, args)) {
46
+ params = { ...args, grant_type: "client_credentials" };
47
+ }
48
+ else {
49
+ throw new Error("Authentication method could not be detected.");
50
+ }
51
+ this.bearerProfile = (await __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "post", `auth/token`, new URLSearchParams(params), true));
52
+ __classPrivateFieldSet(this, _MoneriumClient_authPayload, `Bearer ${this.bearerProfile.access_token}`, "f");
53
+ }
54
+ async pkceRequest(args) {
55
+ const buffer = dntShim.crypto.getRandomValues(new Uint8Array(128 / 2));
56
+ let randomString = "";
57
+ for (let i = 0; i < buffer.length; ++i) {
58
+ randomString += ("0" + buffer[i].toString(16)).slice(-2);
59
+ }
60
+ this.codeVerifier = randomString;
61
+ const data = new dntShim.TextEncoder().encode(this.codeVerifier);
62
+ const digest = await dntShim.crypto.subtle.digest("SHA-256", data);
63
+ const base64Digest = encodeBase64(digest);
64
+ const challenge = encodeBase64URL(base64Digest);
65
+ const params = {
66
+ ...args,
67
+ code_challenge: challenge,
68
+ code_challenge_method: "S256",
69
+ response_type: "code",
70
+ };
71
+ return `${__classPrivateFieldGet(this, _MoneriumClient_env, "f").api}/auth?${new URLSearchParams(params)}`;
72
+ }
73
+ // -- Read Methods
74
+ getAuthContext() {
75
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "get", `auth/context`);
76
+ }
77
+ getProfile(profileId) {
78
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "get", `profiles/${profileId}`);
79
+ }
80
+ getBalances(profileId) {
81
+ if (profileId) {
82
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "get", `profiles/${profileId}/balances`);
83
+ }
84
+ else {
85
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "get", `balances`);
86
+ }
87
+ }
88
+ getOrders(filter) {
89
+ const searchParams = new URLSearchParams(filter);
90
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "get", `orders?${searchParams}`);
91
+ }
92
+ getOrder(orderId) {
93
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "get", `orders/${orderId}`);
94
+ }
95
+ getTokens() {
96
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "get", "tokens");
97
+ }
98
+ // -- Write Methods
99
+ linkAddress(profileId, body) {
100
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "post", `profiles/${profileId}/addresses`, JSON.stringify(body));
101
+ }
102
+ placeOrder(order, profileId) {
103
+ if (profileId) {
104
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "post", `profiles/${profileId}/orders`, JSON.stringify(order));
105
+ }
106
+ else {
107
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "post", `orders`, JSON.stringify(order));
108
+ }
109
+ }
110
+ uploadSupportingDocument(document) {
111
+ const searchParams = new URLSearchParams(document);
112
+ return __classPrivateFieldGet(this, _MoneriumClient_instances, "m", _MoneriumClient_api).call(this, "post", "files/supporting-document", searchParams, true);
113
+ }
114
+ }
115
+ _MoneriumClient_env = new WeakMap(), _MoneriumClient_authPayload = new WeakMap(), _MoneriumClient_instances = new WeakSet(), _MoneriumClient_api =
116
+ // -- Helper Methods
117
+ async function _MoneriumClient_api(method, resource, body, isFormEncoded) {
118
+ const res = await dntShim.fetch(`${__classPrivateFieldGet(this, _MoneriumClient_env, "f").api}/${resource}`, {
119
+ method,
120
+ headers: {
121
+ "Content-Type": `application/${isFormEncoded ? "x-www-form-urlencoded" : "json"}`,
122
+ Authorization: __classPrivateFieldGet(this, _MoneriumClient_authPayload, "f") || "",
123
+ },
124
+ body,
125
+ });
126
+ const response = await res.json();
127
+ if (res.ok) {
128
+ return response;
129
+ }
130
+ else {
131
+ throw response;
132
+ }
133
+ }, _MoneriumClient_isAuthCode = function _MoneriumClient_isAuthCode(args) {
134
+ return args.code != undefined;
135
+ }, _MoneriumClient_isRefreshToken = function _MoneriumClient_isRefreshToken(args) {
136
+ return args.refresh_token != undefined;
137
+ }, _MoneriumClient_isClientCredentials = function _MoneriumClient_isClientCredentials(args) {
138
+ return args.client_secret != undefined;
139
+ };
@@ -0,0 +1,13 @@
1
+ const MONERIUM_CONFIG = {
2
+ environments: {
3
+ production: {
4
+ api: "https://api.monerium.app",
5
+ web: "https://monerium.app",
6
+ },
7
+ sandbox: {
8
+ api: "https://api.monerium.dev",
9
+ web: "https://sandbox.monerium.dev",
10
+ },
11
+ },
12
+ };
13
+ export { MONERIUM_CONFIG };
@@ -0,0 +1,73 @@
1
+ // --- Config --- //
2
+ // --- Client Methods --- //
3
+ export var Currency;
4
+ (function (Currency) {
5
+ Currency["eur"] = "eur";
6
+ Currency["usd"] = "usd";
7
+ Currency["gbp"] = "gbp";
8
+ Currency["isk"] = "isk";
9
+ })(Currency || (Currency = {}));
10
+ // -- authContext
11
+ var Method;
12
+ (function (Method) {
13
+ Method["password"] = "password";
14
+ Method["resource"] = "resource";
15
+ Method["jwt"] = "jwt";
16
+ Method["apiKey"] = "apiKey";
17
+ })(Method || (Method = {}));
18
+ var Type;
19
+ (function (Type) {
20
+ Type["corporate"] = "corporate";
21
+ Type["personal"] = "personal";
22
+ })(Type || (Type = {}));
23
+ var Permission;
24
+ (function (Permission) {
25
+ Permission["read"] = "read";
26
+ Permission["write"] = "write";
27
+ })(Permission || (Permission = {}));
28
+ // -- getProfile
29
+ var KYCState;
30
+ (function (KYCState) {
31
+ KYCState["absent"] = "absent";
32
+ KYCState["submitted"] = "submitted";
33
+ KYCState["pending"] = "pending";
34
+ KYCState["confirmed"] = "confirmed";
35
+ })(KYCState || (KYCState = {}));
36
+ var KYCOutcome;
37
+ (function (KYCOutcome) {
38
+ KYCOutcome["approved"] = "approved";
39
+ KYCOutcome["rejected"] = "rejected";
40
+ KYCOutcome["unknown"] = "unknown";
41
+ })(KYCOutcome || (KYCOutcome = {}));
42
+ export var PaymentStandard;
43
+ (function (PaymentStandard) {
44
+ PaymentStandard["iban"] = "iban";
45
+ PaymentStandard["scan"] = "scan";
46
+ })(PaymentStandard || (PaymentStandard = {}));
47
+ // -- getBalances
48
+ export var Chain;
49
+ (function (Chain) {
50
+ Chain["polygon"] = "polygon";
51
+ Chain["ethereum"] = "ethereum";
52
+ Chain["gnosis"] = "gnosis";
53
+ })(Chain || (Chain = {}));
54
+ export var Network;
55
+ (function (Network) {
56
+ Network["mainnet"] = "mainnet";
57
+ Network["chiado"] = "chiado";
58
+ Network["goerli"] = "goerli";
59
+ Network["mumbai"] = "mumbai";
60
+ })(Network || (Network = {}));
61
+ // --getOrders
62
+ export var OrderKind;
63
+ (function (OrderKind) {
64
+ OrderKind["redeem"] = "redeem";
65
+ OrderKind["issue"] = "issue";
66
+ })(OrderKind || (OrderKind = {}));
67
+ var OrderState;
68
+ (function (OrderState) {
69
+ OrderState["placed"] = "placed";
70
+ OrderState["pending"] = "pending";
71
+ OrderState["processed"] = "processed";
72
+ OrderState["rejected"] = "rejected";
73
+ })(OrderState || (OrderState = {}));