@reyaxyz/wallet-sdk 0.1.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 (48) hide show
  1. package/LICENSE.md +1 -0
  2. package/README.md +10 -0
  3. package/dist/clients/helpers/constants.js +37 -0
  4. package/dist/clients/helpers/constants.js.map +1 -0
  5. package/dist/clients/helpers/isWalletRisky.js +16 -0
  6. package/dist/clients/helpers/isWalletRisky.js.map +1 -0
  7. package/dist/clients/modules/risk/index.js +108 -0
  8. package/dist/clients/modules/risk/index.js.map +1 -0
  9. package/dist/clients/modules/risk/types.js +3 -0
  10. package/dist/clients/modules/risk/types.js.map +1 -0
  11. package/dist/clients/modules/tos/index.js +136 -0
  12. package/dist/clients/modules/tos/index.js.map +1 -0
  13. package/dist/clients/modules/tos/types.js +3 -0
  14. package/dist/clients/modules/tos/types.js.map +1 -0
  15. package/dist/clients/types.js +18 -0
  16. package/dist/clients/types.js.map +1 -0
  17. package/dist/clients/wallet-client.js +71 -0
  18. package/dist/clients/wallet-client.js.map +1 -0
  19. package/dist/index.js +21 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/types/clients/helpers/constants.d.ts +17 -0
  22. package/dist/types/clients/helpers/constants.d.ts.map +1 -0
  23. package/dist/types/clients/helpers/isWalletRisky.d.ts +8 -0
  24. package/dist/types/clients/helpers/isWalletRisky.d.ts.map +1 -0
  25. package/dist/types/clients/modules/risk/index.d.ts +7 -0
  26. package/dist/types/clients/modules/risk/index.d.ts.map +1 -0
  27. package/dist/types/clients/modules/risk/types.d.ts +33 -0
  28. package/dist/types/clients/modules/risk/types.d.ts.map +1 -0
  29. package/dist/types/clients/modules/tos/index.d.ts +8 -0
  30. package/dist/types/clients/modules/tos/index.d.ts.map +1 -0
  31. package/dist/types/clients/modules/tos/types.d.ts +5 -0
  32. package/dist/types/clients/modules/tos/types.d.ts.map +1 -0
  33. package/dist/types/clients/types.d.ts +2 -0
  34. package/dist/types/clients/types.d.ts.map +1 -0
  35. package/dist/types/clients/wallet-client.d.ts +34 -0
  36. package/dist/types/clients/wallet-client.d.ts.map +1 -0
  37. package/dist/types/index.d.ts +3 -0
  38. package/dist/types/index.d.ts.map +1 -0
  39. package/package.json +43 -0
  40. package/src/clients/helpers/constants.ts +50 -0
  41. package/src/clients/helpers/isWalletRisky.ts +14 -0
  42. package/src/clients/modules/risk/index.ts +42 -0
  43. package/src/clients/modules/risk/types.ts +36 -0
  44. package/src/clients/modules/tos/index.ts +74 -0
  45. package/src/clients/modules/tos/types.ts +5 -0
  46. package/src/clients/types.ts +1 -0
  47. package/src/clients/wallet-client.ts +64 -0
  48. package/src/index.ts +2 -0
package/LICENSE.md ADDED
@@ -0,0 +1 @@
1
+ MIT License
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # @reyaxyz/wallet-sdk
2
+
3
+ <p align="center"> Wallet sdk for the Reya Network </p>
4
+
5
+ <br />
6
+
7
+ | Statements | Branches | Functions | Lines |
8
+ | --------------------------- | ----------------------- | ------------------------- | ----------------- |
9
+ | ![Statements](https://img.shields.io/badge/statements-0%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-0%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-0%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-0%25-red.svg?style=flat) |
10
+
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getToSText = exports.API_CLIENT_CONFIGS = void 0;
4
+ var common_1 = require("@reyaxyz/common");
5
+ exports.API_CLIENT_CONFIGS = {
6
+ local: {
7
+ chain: common_1.ReyaChainId.reyaCronos,
8
+ apiEndpoint: 'http://localhost:3000',
9
+ trmApiEndpoint: 'https://api.trmlabs.com',
10
+ environment: 'local',
11
+ timeout: common_1.API_TIMEOUT,
12
+ },
13
+ production: {
14
+ chain: common_1.ReyaChainId.reyaNetwork,
15
+ apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',
16
+ trmApiEndpoint: 'https://api.trmlabs.com',
17
+ environment: 'production',
18
+ timeout: common_1.API_TIMEOUT,
19
+ },
20
+ test: {
21
+ chain: common_1.ReyaChainId.reyaCronos,
22
+ apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',
23
+ trmApiEndpoint: 'https://api.trmlabs.com',
24
+ environment: 'test',
25
+ timeout: common_1.API_TIMEOUT,
26
+ },
27
+ };
28
+ /**
29
+ * Returns the terms of service text that users have to agree to connect their wallet.
30
+ * Note - Any changes, including whitespace, will mean a new signature is required.
31
+ */
32
+ var getToSText = function () {
33
+ var text = "\nPlease sign this message to log in. This won't cost you any ETH.\n\nBy signing, you accept Voltz's Terms of Service (which may have been updated since you last signed). You can find these here:\n".concat(process.env.REACT_APP_TOS_URL || '', "\n\nIf you're connecting a hardware wallet, you'll need to sign the message on your device too.");
34
+ return text.trim();
35
+ };
36
+ exports.getToSText = getToSText;
37
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"/","sources":["clients/helpers/constants.ts"],"names":[],"mappings":";;;AAAA,0CAA2D;AAW9C,QAAA,kBAAkB,GAA8C;IAC3E,KAAK,EAAE;QACL,KAAK,EAAE,oBAAW,CAAC,UAAU;QAC7B,WAAW,EAAE,uBAAuB;QACpC,cAAc,EAAE,yBAAyB;QACzC,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,oBAAW;KACrB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,oBAAW,CAAC,WAAW;QAC9B,WAAW,EAAE,kDAAkD;QAC/D,cAAc,EAAE,yBAAyB;QACzC,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,oBAAW;KACrB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,oBAAW,CAAC,UAAU;QAC7B,WAAW,EAAE,kDAAkD;QAC/D,cAAc,EAAE,yBAAyB;QACzC,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,oBAAW;KACrB;CACF,CAAC;AAEF;;;GAGG;AACI,IAAM,UAAU,GAAG;IACxB,IAAM,IAAI,GAAG,+MAIb,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,oGAEuD,CAAC;IAE3F,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB","sourcesContent":["import { API_TIMEOUT, ReyaChainId } from '@reyaxyz/common';\n\ntype ServiceEnvironment = 'production' | 'test' | 'local';\nexport interface ServiceConfig {\n chain: ReyaChainId;\n apiEndpoint: string;\n trmApiEndpoint: string;\n environment: ServiceEnvironment; // Configuration for SDK, such as base URL for the REST API\n timeout: number; // Optional timeout for API requests\n}\n\nexport const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {\n local: {\n chain: ReyaChainId.reyaCronos,\n apiEndpoint: 'http://localhost:3000',\n trmApiEndpoint: 'https://api.trmlabs.com',\n environment: 'local',\n timeout: API_TIMEOUT,\n },\n production: {\n chain: ReyaChainId.reyaNetwork,\n apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',\n trmApiEndpoint: 'https://api.trmlabs.com',\n environment: 'production',\n timeout: API_TIMEOUT,\n },\n test: {\n chain: ReyaChainId.reyaCronos,\n apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',\n trmApiEndpoint: 'https://api.trmlabs.com',\n environment: 'test',\n timeout: API_TIMEOUT,\n },\n};\n\n/**\n * Returns the terms of service text that users have to agree to connect their wallet.\n * Note - Any changes, including whitespace, will mean a new signature is required.\n */\nexport const getToSText = () => {\n const text = `\nPlease sign this message to log in. This won't cost you any ETH.\n\nBy signing, you accept Voltz's Terms of Service (which may have been updated since you last signed). You can find these here:\n${process.env.REACT_APP_TOS_URL || ''}\n\nIf you're connecting a hardware wallet, you'll need to sign the message on your device too.`;\n\n return text.trim();\n};\n"]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWalletRisky = void 0;
4
+ /**
5
+ * It returns true if the risk assessment has a red flag
6
+ * @param {TRMRiskAssessment} [riskAssessment] - The risk assessment object returned from the API.
7
+ * @returns A boolean value.
8
+ */
9
+ var isWalletRisky = function (riskAssessment) {
10
+ var indicators = riskAssessment === null || riskAssessment === void 0 ? void 0 : riskAssessment.addressRiskIndicators;
11
+ var redFlag = Array.isArray(indicators) &&
12
+ indicators.find(function (i) { return i.categoryRiskScoreLevel >= 10; });
13
+ return Boolean(redFlag);
14
+ };
15
+ exports.isWalletRisky = isWalletRisky;
16
+ //# sourceMappingURL=isWalletRisky.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isWalletRisky.js","sourceRoot":"/","sources":["clients/helpers/isWalletRisky.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACI,IAAM,aAAa,GAAG,UAAC,cAAkC;IAC9D,IAAM,UAAU,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,qBAAqB,CAAC;IACzD,IAAM,OAAO,GACX,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QACzB,UAAU,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,sBAAsB,IAAI,EAAE,EAA9B,CAA8B,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC,CAAC;AANW,QAAA,aAAa,iBAMxB","sourcesContent":["import { TRMRiskAssessment } from '../types';\n\n/**\n * It returns true if the risk assessment has a red flag\n * @param {TRMRiskAssessment} [riskAssessment] - The risk assessment object returned from the API.\n * @returns A boolean value.\n */\nexport const isWalletRisky = (riskAssessment?: TRMRiskAssessment) => {\n const indicators = riskAssessment?.addressRiskIndicators;\n const redFlag =\n Array.isArray(indicators) &&\n indicators.find((i) => i.categoryRiskScoreLevel >= 10);\n return Boolean(redFlag);\n};\n"]}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ var common_1 = require("@reyaxyz/common");
55
+ var isWalletRisky_1 = require("../../helpers/isWalletRisky");
56
+ // todo @milanpajovic how shall we get the trm api key secret?
57
+ var TRM_API_KEY = process.env.TRM_API_KEY;
58
+ var RiskClient = /** @class */ (function (_super) {
59
+ __extends(RiskClient, _super);
60
+ function RiskClient() {
61
+ return _super !== null && _super.apply(this, arguments) || this;
62
+ }
63
+ RiskClient.prototype.getWalletRiskAssessment = function (params) {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ var uri, body, headers, result;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ uri = '/public/v2/screening/addresses';
70
+ body = JSON.stringify([
71
+ {
72
+ address: params.walletAddress,
73
+ chain: 'ethereum',
74
+ },
75
+ ]);
76
+ headers = {
77
+ Accept: 'application/json',
78
+ 'Content-type': 'application/json',
79
+ Authorization: "Basic ".concat(Buffer.from("".concat(TRM_API_KEY, ":").concat(TRM_API_KEY)).toString('base64')),
80
+ };
81
+ return [4 /*yield*/, this.post(uri, undefined, body, headers)];
82
+ case 1:
83
+ result = _a.sent();
84
+ return [2 /*return*/, result[0]];
85
+ }
86
+ });
87
+ });
88
+ };
89
+ RiskClient.prototype.checkForRiskWallet = function (params) {
90
+ return __awaiter(this, void 0, void 0, function () {
91
+ var riskAssessment;
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0: return [4 /*yield*/, this.getWalletRiskAssessment(params)];
95
+ case 1:
96
+ riskAssessment = _a.sent();
97
+ if ((0, isWalletRisky_1.isWalletRisky)(riskAssessment)) {
98
+ throw new Error('Risky Account Detected');
99
+ }
100
+ return [2 /*return*/];
101
+ }
102
+ });
103
+ });
104
+ };
105
+ return RiskClient;
106
+ }(common_1.RestClient));
107
+ exports.default = RiskClient;
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/risk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAG7C,6DAA4D;AAE5D,8DAA8D;AACtD,IAAA,WAAW,GAAK,OAAO,CAAC,GAAG,YAAhB,CAAiB;AAEpC;IAAwC,8BAAU;IAAlD;;IAiCA,CAAC;IAhCe,4CAAuB,GAArC,UACE,MAAiC;;;;;;wBAE3B,GAAG,GAAG,gCAAgC,CAAC;wBACvC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;4BAC1B;gCACE,OAAO,EAAE,MAAM,CAAC,aAAa;gCAC7B,KAAK,EAAE,UAAU;6BAClB;yBACF,CAAC,CAAC;wBACG,OAAO,GAAG;4BACd,MAAM,EAAE,kBAAkB;4BAC1B,cAAc,EAAE,kBAAkB;4BAClC,aAAa,EAAE,gBAAS,MAAM,CAAC,IAAI,CACjC,UAAG,WAAW,cAAI,WAAW,CAAE,CAChC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAE;yBACvB,CAAC;wBACkC,qBAAM,IAAI,CAAC,IAAI,CACjD,GAAG,EACH,SAAS,EACT,IAAI,EACJ,OAAO,CACR,EAAA;;wBALK,MAAM,GAAwB,SAKnC;wBACD,sBAAO,MAAM,CAAC,CAAC,CAAC,EAAC;;;;KAClB;IAEK,uCAAkB,GAAxB,UAAyB,MAAiC;;;;;4BACjC,qBAAM,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAA;;wBAA3D,cAAc,GAAG,SAA0C;wBACjE,IAAI,IAAA,6BAAa,EAAC,cAAc,CAAC,EAAE,CAAC;4BAClC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;wBAC5C,CAAC;;;;;KACF;IACH,iBAAC;AAAD,CAAC,AAjCD,CAAwC,mBAAU,GAiCjD","sourcesContent":["import { RestClient } from '@reyaxyz/common';\n\nimport { CheckForRiskyWalletParams, TRMRiskAssessment } from './types';\nimport { isWalletRisky } from '../../helpers/isWalletRisky';\n\n// todo @milanpajovic how shall we get the trm api key secret?\nconst { TRM_API_KEY } = process.env;\n\nexport default class RiskClient extends RestClient {\n private async getWalletRiskAssessment(\n params: CheckForRiskyWalletParams,\n ): Promise<TRMRiskAssessment> {\n const uri = '/public/v2/screening/addresses';\n const body = JSON.stringify([\n {\n address: params.walletAddress,\n chain: 'ethereum',\n },\n ]);\n const headers = {\n Accept: 'application/json',\n 'Content-type': 'application/json',\n Authorization: `Basic ${Buffer.from(\n `${TRM_API_KEY}:${TRM_API_KEY}`,\n ).toString('base64')}`,\n };\n const result: TRMRiskAssessment[] = await this.post(\n uri,\n undefined,\n body,\n headers,\n );\n return result[0];\n }\n\n async checkForRiskWallet(params: CheckForRiskyWalletParams) {\n const riskAssessment = await this.getWalletRiskAssessment(params);\n if (isWalletRisky(riskAssessment)) {\n throw new Error('Risky Account Detected');\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/risk/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Address } from '@reyaxyz/common';\n\nexport type CheckForRiskyWalletParams = {\n walletAddress: Address;\n};\n\nexport type TRMRiskAssessment = {\n accountExternalId: string;\n address: string;\n addressRiskIndicators: TMRRiskIndicator[];\n addressSubmitted: string;\n chain: string;\n entities: TRMEntity[];\n trmAppUrl: string;\n};\n\nexport type TMRRiskIndicator = {\n category: string;\n categoryId: string;\n categoryRiskScoreLevel: number;\n categoryRiskScoreLevelLabel: string;\n incomingVolumeUsd: string;\n outgoingVolumeUsd: string;\n riskType: string;\n totalVolumeUsd: string;\n};\n\nexport type TRMEntity = {\n category: string;\n categoryId: string;\n entity: string;\n riskScoreLevel: number;\n riskScoreLevelLabel: string;\n trmAppUrl: string;\n trmUrn: string;\n};\n"]}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ var common_1 = require("@reyaxyz/common");
55
+ var constants_1 = require("../../helpers/constants");
56
+ var ToSSignatureClient = /** @class */ (function (_super) {
57
+ __extends(ToSSignatureClient, _super);
58
+ function ToSSignatureClient() {
59
+ return _super !== null && _super.apply(this, arguments) || this;
60
+ }
61
+ ToSSignatureClient.prototype.getSignature = function (walletAddress) {
62
+ return __awaiter(this, void 0, void 0, function () {
63
+ var uri;
64
+ return __generator(this, function (_a) {
65
+ switch (_a.label) {
66
+ case 0:
67
+ uri = "/owner/".concat(walletAddress, "/tos/get-signature");
68
+ return [4 /*yield*/, this.get(uri)];
69
+ case 1:
70
+ // todo: make sure get api returns undefined if not found
71
+ return [2 /*return*/, _a.sent()];
72
+ }
73
+ });
74
+ });
75
+ };
76
+ ToSSignatureClient.prototype.saveSignatureWithToS = function (walletAddress, signature, termsOfService) {
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ var formData, uri;
79
+ return __generator(this, function (_a) {
80
+ formData = new FormData();
81
+ formData.append('signature', signature);
82
+ formData.append('walletAddress', walletAddress);
83
+ formData.append('message', termsOfService);
84
+ uri = '/owner/tos/add-signature';
85
+ return [2 /*return*/, this.post(uri, undefined, formData, undefined)];
86
+ });
87
+ });
88
+ };
89
+ ToSSignatureClient.prototype.checkForToSSignature = function (params) {
90
+ return __awaiter(this, void 0, void 0, function () {
91
+ var signerAddress, signatureData, latestToS, termsAccepted, signature, response, error_1;
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0: return [4 /*yield*/, params.signer.getAddress()];
95
+ case 1:
96
+ signerAddress = (_a.sent()).toLowerCase();
97
+ return [4 /*yield*/, this.getSignature(signerAddress)];
98
+ case 2:
99
+ signatureData = _a.sent();
100
+ latestToS = (0, constants_1.getToSText)();
101
+ termsAccepted = false;
102
+ if (signatureData &&
103
+ signatureData.walletAddress.toLowerCase() ===
104
+ signerAddress.toLowerCase() &&
105
+ signatureData.message === latestToS) {
106
+ // Wallet matches, and signed data also matches
107
+ // (signature was checked before being written to database)
108
+ termsAccepted = true;
109
+ } // todo: do we want eip1271?
110
+ if (!!termsAccepted) return [3 /*break*/, 7];
111
+ _a.label = 3;
112
+ case 3:
113
+ _a.trys.push([3, 6, , 7]);
114
+ return [4 /*yield*/, params.signer.signMessage(latestToS)];
115
+ case 4:
116
+ signature = _a.sent();
117
+ return [4 /*yield*/, this.saveSignatureWithToS(signerAddress, signature, latestToS)];
118
+ case 5:
119
+ response = _a.sent();
120
+ if (!response.signatureSavedSuccessfully) {
121
+ // todo: do we want eip1271?
122
+ throw new Error('Error saving signature');
123
+ }
124
+ return [3 /*break*/, 7];
125
+ case 6:
126
+ error_1 = _a.sent();
127
+ throw new Error('Error processing signature');
128
+ case 7: return [2 /*return*/];
129
+ }
130
+ });
131
+ });
132
+ };
133
+ return ToSSignatureClient;
134
+ }(common_1.RestClient));
135
+ exports.default = ToSSignatureClient;
136
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/tos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AAEzB,qDAAqD;AAErD;IAAgD,sCAAU;IAA1D;;IAgEA,CAAC;IA/De,yCAAY,GAA1B,UACE,aAAsB;;;;;;wBAEhB,GAAG,GAAG,iBAAU,aAAa,uBAAoB,CAAC;wBAEjD,qBAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAA;;oBAD1B,yDAAyD;oBACzD,sBAAO,SAAmB,EAAC;;;;KAC5B;IAEa,iDAAoB,GAAlC,UACE,aAAsB,EACtB,SAAiB,EACjB,cAAsB;;;;gBAGhB,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAChC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;gBACxC,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;gBAChD,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;gBAErC,GAAG,GAAG,0BAA0B,CAAC;gBACvC,sBAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAC;;;KACvD;IAEK,iDAAoB,GAA1B,UAA2B,MAAkC;;;;;4BAEzD,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;;wBAD5B,aAAa,GAAG,CACpB,SAAgC,CACjC,CAAC,WAAW,EAAa;wBAEJ,qBAAM,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAA;;wBAAtD,aAAa,GAAG,SAAsC;wBAEtD,SAAS,GAAG,IAAA,sBAAU,GAAE,CAAC;wBAC3B,aAAa,GAAG,KAAK,CAAC;wBAE1B,IACE,aAAa;4BACb,aAAa,CAAC,aAAa,CAAC,WAAW,EAAE;gCACvC,aAAa,CAAC,WAAW,EAAE;4BAC7B,aAAa,CAAC,OAAO,KAAK,SAAS,EACnC,CAAC;4BACD,+CAA+C;4BAC/C,2DAA2D;4BAC3D,aAAa,GAAG,IAAI,CAAC;wBACvB,CAAC,CAAC,4BAA4B;6BAE1B,CAAC,aAAa,EAAd,wBAAc;;;;wBAGI,qBAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,EAAA;;wBAAtD,SAAS,GAAG,SAA0C;wBAC3C,qBAAM,IAAI,CAAC,oBAAoB,CAC9C,aAAa,EACb,SAAS,EACT,SAAS,CACV,EAAA;;wBAJK,QAAQ,GAAG,SAIhB;wBAED,IAAI,CAAC,QAAQ,CAAC,0BAA0B,EAAE,CAAC;4BACzC,4BAA4B;4BAC5B,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;wBAC5C,CAAC;;;;wBAED,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;;;;;KAGnD;IACH,yBAAC;AAAD,CAAC,AAhED,CAAgD,mBAAU,GAgEzD","sourcesContent":["import {\n Address,\n RestClient,\n SignatureData,\n SaveSignatureResult,\n} from '@reyaxyz/common';\nimport { CheckForToSSignatureParams } from './types';\nimport { getToSText } from '../../helpers/constants';\n\nexport default class ToSSignatureClient extends RestClient {\n private async getSignature(\n walletAddress: Address,\n ): Promise<SignatureData | undefined> {\n const uri = `/owner/${walletAddress}/tos/get-signature`;\n // todo: make sure get api returns undefined if not found\n return await this.get(uri);\n }\n\n private async saveSignatureWithToS(\n walletAddress: Address,\n signature: string,\n termsOfService: string,\n ): Promise<SaveSignatureResult> {\n // Build formData object.\n const formData = new FormData();\n formData.append('signature', signature);\n formData.append('walletAddress', walletAddress);\n formData.append('message', termsOfService);\n\n const uri = '/owner/tos/add-signature';\n return this.post(uri, undefined, formData, undefined);\n }\n\n async checkForToSSignature(params: CheckForToSSignatureParams) {\n const signerAddress = (\n await params.signer.getAddress()\n ).toLowerCase() as Address;\n\n const signatureData = await this.getSignature(signerAddress);\n\n const latestToS = getToSText();\n let termsAccepted = false;\n\n if (\n signatureData &&\n signatureData.walletAddress.toLowerCase() ===\n signerAddress.toLowerCase() &&\n signatureData.message === latestToS\n ) {\n // Wallet matches, and signed data also matches\n // (signature was checked before being written to database)\n termsAccepted = true;\n } // todo: do we want eip1271?\n\n if (!termsAccepted) {\n try {\n // The latest terms of service have not been accepted. Get a signature now.\n const signature = await params.signer.signMessage(latestToS);\n const response = await this.saveSignatureWithToS(\n signerAddress,\n signature,\n latestToS,\n );\n\n if (!response.signatureSavedSuccessfully) {\n // todo: do we want eip1271?\n throw new Error('Error saving signature');\n }\n } catch (error) {\n throw new Error('Error processing signature');\n }\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/tos/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\n\nexport type CheckForToSSignatureParams = {\n signer: Signer | JsonRpcSigner;\n};\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./modules/risk/types"), exports);
18
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from './modules/risk/types';\n"]}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WalletClient = void 0;
7
+ var constants_1 = require("./helpers/constants");
8
+ var risk_1 = __importDefault(require("./modules/risk"));
9
+ var tos_1 = __importDefault(require("./modules/tos"));
10
+ /**
11
+ * @description Client for Wallet
12
+ */
13
+ var WalletClient = /** @class */ (function () {
14
+ function WalletClient() {
15
+ this._riskClient = new risk_1.default(WalletClient.config.trmApiEndpoint);
16
+ this._tosSignatureClient = new tos_1.default(WalletClient.config.apiEndpoint);
17
+ }
18
+ WalletClient.configure = function (environment) {
19
+ WalletClient.config =
20
+ constants_1.API_CLIENT_CONFIGS[environment] || constants_1.API_CLIENT_CONFIGS['test'];
21
+ WalletClient.instance = new WalletClient();
22
+ };
23
+ WalletClient.getInstance = function () {
24
+ if (!WalletClient.instance) {
25
+ throw new Error('WalletClient is not configured. Please configure it before using.');
26
+ }
27
+ return WalletClient.instance;
28
+ };
29
+ Object.defineProperty(WalletClient, "network", {
30
+ get: function () {
31
+ if (!WalletClient.config.chain) {
32
+ throw new Error('WalletClient is not configured');
33
+ }
34
+ return WalletClient.config.chain;
35
+ },
36
+ enumerable: false,
37
+ configurable: true
38
+ });
39
+ Object.defineProperty(WalletClient, "account", {
40
+ /**
41
+ * Provides access to the RiskClient instance.
42
+ * This getter allows for interacting with risk-related API functionalities.
43
+ *
44
+ * @returns {RiskClient} An instance of RiskClient for account-related operations.
45
+ * @memberof WalletClient
46
+ */
47
+ get: function () {
48
+ return WalletClient.getInstance()._riskClient;
49
+ },
50
+ enumerable: false,
51
+ configurable: true
52
+ });
53
+ Object.defineProperty(WalletClient, "tosSignature", {
54
+ /**
55
+ * Provides access to the ToSSignatureClient instance.
56
+ * This getter allows for interacting with tos signature related API functionalities.
57
+ *
58
+ * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
59
+ * @memberof WalletClient
60
+ */
61
+ get: function () {
62
+ return WalletClient.getInstance()._tosSignatureClient;
63
+ },
64
+ enumerable: false,
65
+ configurable: true
66
+ });
67
+ WalletClient.config = constants_1.API_CLIENT_CONFIGS['test'];
68
+ return WalletClient;
69
+ }());
70
+ exports.WalletClient = WalletClient;
71
+ //# sourceMappingURL=wallet-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-client.js","sourceRoot":"/","sources":["clients/wallet-client.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAwE;AAExE,wDAAwC;AACxC,sDAA+C;AAC/C;;GAEG;AACH;IAME;QACE,IAAI,CAAC,WAAW,GAAG,IAAI,cAAU,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACtE,IAAI,CAAC,mBAAmB,GAAG,IAAI,aAAkB,CAC/C,YAAY,CAAC,MAAM,CAAC,WAAW,CAChC,CAAC;IACJ,CAAC;IAEa,sBAAS,GAAvB,UAAwB,WAAyC;QAC/D,YAAY,CAAC,MAAM;YACjB,8BAAkB,CAAC,WAAW,CAAC,IAAI,8BAAkB,CAAC,MAAM,CAAC,CAAC;QAChE,YAAY,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;IAC7C,CAAC;IAEc,wBAAW,GAA1B;QACE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;QACJ,CAAC;QACD,OAAO,YAAY,CAAC,QAAQ,CAAC;IAC/B,CAAC;IAED,sBAAkB,uBAAO;aAAzB;YACE,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC;QACnC,CAAC;;;OAAA;IASD,sBAAkB,uBAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,YAAY,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC;QAChD,CAAC;;;OAAA;IASD,sBAAkB,4BAAY;QAP9B;;;;;;WAMG;aACH;YACE,OAAO,YAAY,CAAC,WAAW,EAAE,CAAC,mBAAmB,CAAC;QACxD,CAAC;;;OAAA;IArDc,mBAAM,GAAkB,8BAAkB,CAAC,MAAM,CAAC,CAAC;IAsDpE,mBAAC;CAAA,AAxDD,IAwDC;AAxDY,oCAAY","sourcesContent":["import { API_CLIENT_CONFIGS, ServiceConfig } from './helpers/constants';\nimport { ReyaChainId } from '@reyaxyz/common';\nimport RiskClient from './modules/risk';\nimport ToSSignatureClient from './modules/tos';\n/**\n * @description Client for Wallet\n */\nexport class WalletClient {\n private static instance: WalletClient;\n private static config: ServiceConfig = API_CLIENT_CONFIGS['test'];\n private readonly _riskClient: RiskClient;\n private readonly _tosSignatureClient: ToSSignatureClient;\n\n private constructor() {\n this._riskClient = new RiskClient(WalletClient.config.trmApiEndpoint);\n this._tosSignatureClient = new ToSSignatureClient(\n WalletClient.config.apiEndpoint,\n );\n }\n\n public static configure(environment: ServiceConfig['environment']): void {\n WalletClient.config =\n API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];\n WalletClient.instance = new WalletClient();\n }\n\n private static getInstance(): WalletClient {\n if (!WalletClient.instance) {\n throw new Error(\n 'WalletClient is not configured. Please configure it before using.',\n );\n }\n return WalletClient.instance;\n }\n\n public static get network(): ReyaChainId {\n if (!WalletClient.config.chain) {\n throw new Error('WalletClient is not configured');\n }\n return WalletClient.config.chain;\n }\n\n /**\n * Provides access to the RiskClient instance.\n * This getter allows for interacting with risk-related API functionalities.\n *\n * @returns {RiskClient} An instance of RiskClient for account-related operations.\n * @memberof WalletClient\n */\n public static get account(): RiskClient {\n return WalletClient.getInstance()._riskClient;\n }\n\n /**\n * Provides access to the ToSSignatureClient instance.\n * This getter allows for interacting with tos signature related API functionalities.\n *\n * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.\n * @memberof WalletClient\n */\n public static get tosSignature(): ToSSignatureClient {\n return WalletClient.getInstance()._tosSignatureClient;\n }\n}\n"]}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.WalletClient = void 0;
18
+ var wallet_client_1 = require("./clients/wallet-client");
19
+ Object.defineProperty(exports, "WalletClient", { enumerable: true, get: function () { return wallet_client_1.WalletClient; } });
20
+ __exportStar(require("./clients/types"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAuD;AAA9C,6GAAA,YAAY,OAAA;AACrB,kDAAgC","sourcesContent":["export { WalletClient } from './clients/wallet-client';\nexport * from './clients/types';\n"]}
@@ -0,0 +1,17 @@
1
+ import { ReyaChainId } from '@reyaxyz/common';
2
+ type ServiceEnvironment = 'production' | 'test' | 'local';
3
+ export interface ServiceConfig {
4
+ chain: ReyaChainId;
5
+ apiEndpoint: string;
6
+ trmApiEndpoint: string;
7
+ environment: ServiceEnvironment;
8
+ timeout: number;
9
+ }
10
+ export declare const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig>;
11
+ /**
12
+ * Returns the terms of service text that users have to agree to connect their wallet.
13
+ * Note - Any changes, including whitespace, will mean a new signature is required.
14
+ */
15
+ export declare const getToSText: () => string;
16
+ export {};
17
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"/","sources":["clients/helpers/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3D,KAAK,kBAAkB,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAC1D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,kBAAkB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAsBxE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,cAUtB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { TRMRiskAssessment } from '../types';
2
+ /**
3
+ * It returns true if the risk assessment has a red flag
4
+ * @param {TRMRiskAssessment} [riskAssessment] - The risk assessment object returned from the API.
5
+ * @returns A boolean value.
6
+ */
7
+ export declare const isWalletRisky: (riskAssessment?: TRMRiskAssessment) => boolean;
8
+ //# sourceMappingURL=isWalletRisky.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isWalletRisky.d.ts","sourceRoot":"/","sources":["clients/helpers/isWalletRisky.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,aAAa,oBAAqB,iBAAiB,YAM/D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { RestClient } from '@reyaxyz/common';
2
+ import { CheckForRiskyWalletParams } from './types';
3
+ export default class RiskClient extends RestClient {
4
+ private getWalletRiskAssessment;
5
+ checkForRiskWallet(params: CheckForRiskyWalletParams): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/risk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAqB,MAAM,SAAS,CAAC;AAMvE,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;YAClC,uBAAuB;IA0B/B,kBAAkB,CAAC,MAAM,EAAE,yBAAyB;CAM3D"}
@@ -0,0 +1,33 @@
1
+ import { Address } from '@reyaxyz/common';
2
+ export type CheckForRiskyWalletParams = {
3
+ walletAddress: Address;
4
+ };
5
+ export type TRMRiskAssessment = {
6
+ accountExternalId: string;
7
+ address: string;
8
+ addressRiskIndicators: TMRRiskIndicator[];
9
+ addressSubmitted: string;
10
+ chain: string;
11
+ entities: TRMEntity[];
12
+ trmAppUrl: string;
13
+ };
14
+ export type TMRRiskIndicator = {
15
+ category: string;
16
+ categoryId: string;
17
+ categoryRiskScoreLevel: number;
18
+ categoryRiskScoreLevelLabel: string;
19
+ incomingVolumeUsd: string;
20
+ outgoingVolumeUsd: string;
21
+ riskType: string;
22
+ totalVolumeUsd: string;
23
+ };
24
+ export type TRMEntity = {
25
+ category: string;
26
+ categoryId: string;
27
+ entity: string;
28
+ riskScoreLevel: number;
29
+ riskScoreLevelLabel: string;
30
+ trmAppUrl: string;
31
+ trmUrn: string;
32
+ };
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/risk/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB,EAAE,gBAAgB,EAAE,CAAC;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,2BAA2B,EAAE,MAAM,CAAC;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { RestClient } from '@reyaxyz/common';
2
+ import { CheckForToSSignatureParams } from './types';
3
+ export default class ToSSignatureClient extends RestClient {
4
+ private getSignature;
5
+ private saveSignatureWithToS;
6
+ checkForToSSignature(params: CheckForToSSignatureParams): Promise<void>;
7
+ }
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/tos/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAGrD,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;YAC1C,YAAY;YAQZ,oBAAoB;IAe5B,oBAAoB,CAAC,MAAM,EAAE,0BAA0B;CAwC9D"}
@@ -0,0 +1,5 @@
1
+ import { JsonRpcSigner, Signer } from 'ethers';
2
+ export type CheckForToSSignatureParams = {
3
+ signer: Signer | JsonRpcSigner;
4
+ };
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/tos/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './modules/risk/types';
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { ServiceConfig } from './helpers/constants';
2
+ import { ReyaChainId } from '@reyaxyz/common';
3
+ import RiskClient from './modules/risk';
4
+ import ToSSignatureClient from './modules/tos';
5
+ /**
6
+ * @description Client for Wallet
7
+ */
8
+ export declare class WalletClient {
9
+ private static instance;
10
+ private static config;
11
+ private readonly _riskClient;
12
+ private readonly _tosSignatureClient;
13
+ private constructor();
14
+ static configure(environment: ServiceConfig['environment']): void;
15
+ private static getInstance;
16
+ static get network(): ReyaChainId;
17
+ /**
18
+ * Provides access to the RiskClient instance.
19
+ * This getter allows for interacting with risk-related API functionalities.
20
+ *
21
+ * @returns {RiskClient} An instance of RiskClient for account-related operations.
22
+ * @memberof WalletClient
23
+ */
24
+ static get account(): RiskClient;
25
+ /**
26
+ * Provides access to the ToSSignatureClient instance.
27
+ * This getter allows for interacting with tos signature related API functionalities.
28
+ *
29
+ * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
30
+ * @memberof WalletClient
31
+ */
32
+ static get tosSignature(): ToSSignatureClient;
33
+ }
34
+ //# sourceMappingURL=wallet-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-client.d.ts","sourceRoot":"/","sources":["clients/wallet-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,UAAU,MAAM,gBAAgB,CAAC;AACxC,OAAO,kBAAkB,MAAM,eAAe,CAAC;AAC/C;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IACtC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA6C;IAClE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD,OAAO;WAOO,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,IAAI;IAMxE,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B,WAAkB,OAAO,IAAI,WAAW,CAKvC;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,UAAU,CAEtC;IAED;;;;;;OAMG;IACH,WAAkB,YAAY,IAAI,kBAAkB,CAEnD;CACF"}
@@ -0,0 +1,3 @@
1
+ export { WalletClient } from './clients/wallet-client';
2
+ export * from './clients/types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,cAAc,iBAAiB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@reyaxyz/wallet-sdk",
3
+ "version": "0.1.0",
4
+ "publishConfig": {
5
+ "access": "public",
6
+ "registry": "https://registry.npmjs.org"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Reya-Labs/reya-off-chain-monorepo.git"
11
+ },
12
+ "main": "dist/index.js",
13
+ "types": "dist/types",
14
+ "license": "MIT",
15
+ "files": [
16
+ "src/**/*.*",
17
+ "dist/**/*.*",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "prebuild": "rm -rf node_modules && rm -rf dist",
22
+ "build": "tsc -p tsconfig.build.json",
23
+ "ts:check-types": "npx tsc --noEmit",
24
+ "ts:circular-check": "dpdm --no-output --no-tree --no-warning --exit-code circular:1 -T src/index.ts",
25
+ "ts:check": "pnpm ts:check-types && pnpm ts:circular-check",
26
+ "lint:check": "eslint '{src,demo,tests}/**/*.{ts,tsx}'",
27
+ "prettier:check": "npx prettier --log-level silent --check './{src,demo,tests}/**/*.{ts,tsx}'",
28
+ "code-quality:check": "npx concurrently 'pnpm ts:check' 'pnpm prettier:check' 'pnpm lint:check --quiet'",
29
+ "lint:fix": "npx eslint --fix '{src,demo,tests}/**/*.{ts,tsx}'",
30
+ "prettier:fix": "npx prettier --log-level silent --write './{src,demo,tests}/**/*.{ts,tsx}'",
31
+ "test": "npx jest --silent",
32
+ "test:coverage": "npx jest test --coverage",
33
+ "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
+ },
35
+ "dependencies": {
36
+ "@reyaxyz/common": "0.26.0",
37
+ "axios": "^1.6.2",
38
+ "bignumber.js": "^9.1.2",
39
+ "ethers": "6.9.0"
40
+ },
41
+ "packageManager": "pnpm@8.10.4",
42
+ "gitHead": "a01cbabdcba8466a729e2cfe39db143157919670"
43
+ }
@@ -0,0 +1,50 @@
1
+ import { API_TIMEOUT, ReyaChainId } from '@reyaxyz/common';
2
+
3
+ type ServiceEnvironment = 'production' | 'test' | 'local';
4
+ export interface ServiceConfig {
5
+ chain: ReyaChainId;
6
+ apiEndpoint: string;
7
+ trmApiEndpoint: string;
8
+ environment: ServiceEnvironment; // Configuration for SDK, such as base URL for the REST API
9
+ timeout: number; // Optional timeout for API requests
10
+ }
11
+
12
+ export const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {
13
+ local: {
14
+ chain: ReyaChainId.reyaCronos,
15
+ apiEndpoint: 'http://localhost:3000',
16
+ trmApiEndpoint: 'https://api.trmlabs.com',
17
+ environment: 'local',
18
+ timeout: API_TIMEOUT,
19
+ },
20
+ production: {
21
+ chain: ReyaChainId.reyaNetwork,
22
+ apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',
23
+ trmApiEndpoint: 'https://api.trmlabs.com',
24
+ environment: 'production',
25
+ timeout: API_TIMEOUT,
26
+ },
27
+ test: {
28
+ chain: ReyaChainId.reyaCronos,
29
+ apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',
30
+ trmApiEndpoint: 'https://api.trmlabs.com',
31
+ environment: 'test',
32
+ timeout: API_TIMEOUT,
33
+ },
34
+ };
35
+
36
+ /**
37
+ * Returns the terms of service text that users have to agree to connect their wallet.
38
+ * Note - Any changes, including whitespace, will mean a new signature is required.
39
+ */
40
+ export const getToSText = () => {
41
+ const text = `
42
+ Please sign this message to log in. This won't cost you any ETH.
43
+
44
+ By signing, you accept Voltz's Terms of Service (which may have been updated since you last signed). You can find these here:
45
+ ${process.env.REACT_APP_TOS_URL || ''}
46
+
47
+ If you're connecting a hardware wallet, you'll need to sign the message on your device too.`;
48
+
49
+ return text.trim();
50
+ };
@@ -0,0 +1,14 @@
1
+ import { TRMRiskAssessment } from '../types';
2
+
3
+ /**
4
+ * It returns true if the risk assessment has a red flag
5
+ * @param {TRMRiskAssessment} [riskAssessment] - The risk assessment object returned from the API.
6
+ * @returns A boolean value.
7
+ */
8
+ export const isWalletRisky = (riskAssessment?: TRMRiskAssessment) => {
9
+ const indicators = riskAssessment?.addressRiskIndicators;
10
+ const redFlag =
11
+ Array.isArray(indicators) &&
12
+ indicators.find((i) => i.categoryRiskScoreLevel >= 10);
13
+ return Boolean(redFlag);
14
+ };
@@ -0,0 +1,42 @@
1
+ import { RestClient } from '@reyaxyz/common';
2
+
3
+ import { CheckForRiskyWalletParams, TRMRiskAssessment } from './types';
4
+ import { isWalletRisky } from '../../helpers/isWalletRisky';
5
+
6
+ // todo @milanpajovic how shall we get the trm api key secret?
7
+ const { TRM_API_KEY } = process.env;
8
+
9
+ export default class RiskClient extends RestClient {
10
+ private async getWalletRiskAssessment(
11
+ params: CheckForRiskyWalletParams,
12
+ ): Promise<TRMRiskAssessment> {
13
+ const uri = '/public/v2/screening/addresses';
14
+ const body = JSON.stringify([
15
+ {
16
+ address: params.walletAddress,
17
+ chain: 'ethereum',
18
+ },
19
+ ]);
20
+ const headers = {
21
+ Accept: 'application/json',
22
+ 'Content-type': 'application/json',
23
+ Authorization: `Basic ${Buffer.from(
24
+ `${TRM_API_KEY}:${TRM_API_KEY}`,
25
+ ).toString('base64')}`,
26
+ };
27
+ const result: TRMRiskAssessment[] = await this.post(
28
+ uri,
29
+ undefined,
30
+ body,
31
+ headers,
32
+ );
33
+ return result[0];
34
+ }
35
+
36
+ async checkForRiskWallet(params: CheckForRiskyWalletParams) {
37
+ const riskAssessment = await this.getWalletRiskAssessment(params);
38
+ if (isWalletRisky(riskAssessment)) {
39
+ throw new Error('Risky Account Detected');
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,36 @@
1
+ import { Address } from '@reyaxyz/common';
2
+
3
+ export type CheckForRiskyWalletParams = {
4
+ walletAddress: Address;
5
+ };
6
+
7
+ export type TRMRiskAssessment = {
8
+ accountExternalId: string;
9
+ address: string;
10
+ addressRiskIndicators: TMRRiskIndicator[];
11
+ addressSubmitted: string;
12
+ chain: string;
13
+ entities: TRMEntity[];
14
+ trmAppUrl: string;
15
+ };
16
+
17
+ export type TMRRiskIndicator = {
18
+ category: string;
19
+ categoryId: string;
20
+ categoryRiskScoreLevel: number;
21
+ categoryRiskScoreLevelLabel: string;
22
+ incomingVolumeUsd: string;
23
+ outgoingVolumeUsd: string;
24
+ riskType: string;
25
+ totalVolumeUsd: string;
26
+ };
27
+
28
+ export type TRMEntity = {
29
+ category: string;
30
+ categoryId: string;
31
+ entity: string;
32
+ riskScoreLevel: number;
33
+ riskScoreLevelLabel: string;
34
+ trmAppUrl: string;
35
+ trmUrn: string;
36
+ };
@@ -0,0 +1,74 @@
1
+ import {
2
+ Address,
3
+ RestClient,
4
+ SignatureData,
5
+ SaveSignatureResult,
6
+ } from '@reyaxyz/common';
7
+ import { CheckForToSSignatureParams } from './types';
8
+ import { getToSText } from '../../helpers/constants';
9
+
10
+ export default class ToSSignatureClient extends RestClient {
11
+ private async getSignature(
12
+ walletAddress: Address,
13
+ ): Promise<SignatureData | undefined> {
14
+ const uri = `/owner/${walletAddress}/tos/get-signature`;
15
+ // todo: make sure get api returns undefined if not found
16
+ return await this.get(uri);
17
+ }
18
+
19
+ private async saveSignatureWithToS(
20
+ walletAddress: Address,
21
+ signature: string,
22
+ termsOfService: string,
23
+ ): Promise<SaveSignatureResult> {
24
+ // Build formData object.
25
+ const formData = new FormData();
26
+ formData.append('signature', signature);
27
+ formData.append('walletAddress', walletAddress);
28
+ formData.append('message', termsOfService);
29
+
30
+ const uri = '/owner/tos/add-signature';
31
+ return this.post(uri, undefined, formData, undefined);
32
+ }
33
+
34
+ async checkForToSSignature(params: CheckForToSSignatureParams) {
35
+ const signerAddress = (
36
+ await params.signer.getAddress()
37
+ ).toLowerCase() as Address;
38
+
39
+ const signatureData = await this.getSignature(signerAddress);
40
+
41
+ const latestToS = getToSText();
42
+ let termsAccepted = false;
43
+
44
+ if (
45
+ signatureData &&
46
+ signatureData.walletAddress.toLowerCase() ===
47
+ signerAddress.toLowerCase() &&
48
+ signatureData.message === latestToS
49
+ ) {
50
+ // Wallet matches, and signed data also matches
51
+ // (signature was checked before being written to database)
52
+ termsAccepted = true;
53
+ } // todo: do we want eip1271?
54
+
55
+ if (!termsAccepted) {
56
+ try {
57
+ // The latest terms of service have not been accepted. Get a signature now.
58
+ const signature = await params.signer.signMessage(latestToS);
59
+ const response = await this.saveSignatureWithToS(
60
+ signerAddress,
61
+ signature,
62
+ latestToS,
63
+ );
64
+
65
+ if (!response.signatureSavedSuccessfully) {
66
+ // todo: do we want eip1271?
67
+ throw new Error('Error saving signature');
68
+ }
69
+ } catch (error) {
70
+ throw new Error('Error processing signature');
71
+ }
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,5 @@
1
+ import { JsonRpcSigner, Signer } from 'ethers';
2
+
3
+ export type CheckForToSSignatureParams = {
4
+ signer: Signer | JsonRpcSigner;
5
+ };
@@ -0,0 +1 @@
1
+ export * from './modules/risk/types';
@@ -0,0 +1,64 @@
1
+ import { API_CLIENT_CONFIGS, ServiceConfig } from './helpers/constants';
2
+ import { ReyaChainId } from '@reyaxyz/common';
3
+ import RiskClient from './modules/risk';
4
+ import ToSSignatureClient from './modules/tos';
5
+ /**
6
+ * @description Client for Wallet
7
+ */
8
+ export class WalletClient {
9
+ private static instance: WalletClient;
10
+ private static config: ServiceConfig = API_CLIENT_CONFIGS['test'];
11
+ private readonly _riskClient: RiskClient;
12
+ private readonly _tosSignatureClient: ToSSignatureClient;
13
+
14
+ private constructor() {
15
+ this._riskClient = new RiskClient(WalletClient.config.trmApiEndpoint);
16
+ this._tosSignatureClient = new ToSSignatureClient(
17
+ WalletClient.config.apiEndpoint,
18
+ );
19
+ }
20
+
21
+ public static configure(environment: ServiceConfig['environment']): void {
22
+ WalletClient.config =
23
+ API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];
24
+ WalletClient.instance = new WalletClient();
25
+ }
26
+
27
+ private static getInstance(): WalletClient {
28
+ if (!WalletClient.instance) {
29
+ throw new Error(
30
+ 'WalletClient is not configured. Please configure it before using.',
31
+ );
32
+ }
33
+ return WalletClient.instance;
34
+ }
35
+
36
+ public static get network(): ReyaChainId {
37
+ if (!WalletClient.config.chain) {
38
+ throw new Error('WalletClient is not configured');
39
+ }
40
+ return WalletClient.config.chain;
41
+ }
42
+
43
+ /**
44
+ * Provides access to the RiskClient instance.
45
+ * This getter allows for interacting with risk-related API functionalities.
46
+ *
47
+ * @returns {RiskClient} An instance of RiskClient for account-related operations.
48
+ * @memberof WalletClient
49
+ */
50
+ public static get account(): RiskClient {
51
+ return WalletClient.getInstance()._riskClient;
52
+ }
53
+
54
+ /**
55
+ * Provides access to the ToSSignatureClient instance.
56
+ * This getter allows for interacting with tos signature related API functionalities.
57
+ *
58
+ * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
59
+ * @memberof WalletClient
60
+ */
61
+ public static get tosSignature(): ToSSignatureClient {
62
+ return WalletClient.getInstance()._tosSignatureClient;
63
+ }
64
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { WalletClient } from './clients/wallet-client';
2
+ export * from './clients/types';