@reyaxyz/wallet-sdk 0.9.12 → 0.9.14

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.
@@ -0,0 +1,121 @@
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 ToSSignatureAppClient = /** @class */ (function (_super) {
56
+ __extends(ToSSignatureAppClient, _super);
57
+ function ToSSignatureAppClient() {
58
+ return _super !== null && _super.apply(this, arguments) || this;
59
+ }
60
+ ToSSignatureAppClient.prototype.getLatestToSVersion = function () {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ var uri;
63
+ return __generator(this, function (_a) {
64
+ switch (_a.label) {
65
+ case 0:
66
+ uri = "/api/tos/latest-version";
67
+ return [4 /*yield*/, this.get(uri)];
68
+ case 1: return [2 /*return*/, _a.sent()];
69
+ }
70
+ });
71
+ });
72
+ };
73
+ ToSSignatureAppClient.prototype.getLatestTacService = function (params) {
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ var tosDetails;
76
+ return __generator(this, function (_a) {
77
+ switch (_a.label) {
78
+ case 0: return [4 /*yield*/, this.getLatestToSVersion()];
79
+ case 1:
80
+ tosDetails = _a.sent();
81
+ return [2 /*return*/, {
82
+ version: tosDetails.version,
83
+ text: tosDetails.text,
84
+ product: params.product,
85
+ }];
86
+ }
87
+ });
88
+ });
89
+ };
90
+ ToSSignatureAppClient.prototype.getWalletLatestTacStatus = function (
91
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
92
+ params) {
93
+ return __awaiter(this, void 0, void 0, function () {
94
+ return __generator(this, function (_a) {
95
+ return [2 /*return*/, new Promise(function (resolve) {
96
+ return setTimeout(function () {
97
+ resolve({
98
+ signed: Math.random() * 100 > 50,
99
+ });
100
+ }, 1000);
101
+ })];
102
+ });
103
+ });
104
+ };
105
+ ToSSignatureAppClient.prototype.signTac = function (
106
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
107
+ params) {
108
+ return __awaiter(this, void 0, void 0, function () {
109
+ return __generator(this, function (_a) {
110
+ return [2 /*return*/, new Promise(function (resolve) {
111
+ return setTimeout(function () {
112
+ resolve();
113
+ }, 1000);
114
+ })];
115
+ });
116
+ });
117
+ };
118
+ return ToSSignatureAppClient;
119
+ }(common_1.RestClient));
120
+ exports.default = ToSSignatureAppClient;
121
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/tos-app/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAgE;AAShE;IAAmD,yCAAU;IAA7D;;IAwCA,CAAC;IAvCe,mDAAmB,GAAjC;;;;;;wBACQ,GAAG,GAAG,yBAAyB,CAAC;wBAC/B,qBAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAA;4BAA1B,sBAAO,SAAmB,EAAC;;;;KAC5B;IAEK,mDAAmB,GAAzB,UACE,MAA4B;;;;;4BAET,qBAAM,IAAI,CAAC,mBAAmB,EAAE,EAAA;;wBAA7C,UAAU,GAAG,SAAgC;wBACnD,sBAAO;gCACL,OAAO,EAAE,UAAU,CAAC,OAAO;gCAC3B,IAAI,EAAE,UAAU,CAAC,IAAI;gCACrB,OAAO,EAAE,MAAM,CAAC,OAAO;6BACxB,EAAC;;;;KACH;IAEK,wDAAwB,GAA9B;IACE,6DAA6D;IAC7D,MAAyC;;;gBAEzC,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO;wBACzB,OAAA,UAAU,CAAC;4BACT,OAAO,CAAC;gCACN,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE;6BACjC,CAAC,CAAC;wBACL,CAAC,EAAE,IAAI,CAAC;oBAJR,CAIQ,CACT,EAAC;;;KACH;IAEK,uCAAO,GAAb;IACE,6DAA6D;IAC7D,MAAwB;;;gBAExB,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO;wBACzB,OAAA,UAAU,CAAC;4BACT,OAAO,EAAE,CAAC;wBACZ,CAAC,EAAE,IAAI,CAAC;oBAFR,CAEQ,CACT,EAAC;;;KACH;IACH,4BAAC;AAAD,CAAC,AAxCD,CAAmD,mBAAU,GAwC5D","sourcesContent":["import { RestClient, ToSVersionDetails } from '@reyaxyz/common';\nimport {\n GetLatestAppTacResult,\n GetLatestAppTacParam,\n GetWalletLatestAppTacStatusParams,\n GetWalletLatestAppTacStatusResult,\n SignAppTacParams,\n} from './types';\n\nexport default class ToSSignatureAppClient extends RestClient {\n private async getLatestToSVersion(): Promise<ToSVersionDetails> {\n const uri = `/api/tos/latest-version`;\n return await this.get(uri);\n }\n\n async getLatestTacService(\n params: GetLatestAppTacParam,\n ): Promise<GetLatestAppTacResult> {\n const tosDetails = await this.getLatestToSVersion();\n return {\n version: tosDetails.version,\n text: tosDetails.text,\n product: params.product,\n };\n }\n\n async getWalletLatestTacStatus(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n params: GetWalletLatestAppTacStatusParams,\n ): Promise<GetWalletLatestAppTacStatusResult> {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve({\n signed: Math.random() * 100 > 50,\n });\n }, 1000),\n );\n }\n\n async signTac(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n params: SignAppTacParams,\n ): Promise<void> {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1000),\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-app/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\n\nexport type GetLatestAppTacResult = {\n version: string;\n text: string;\n product: string;\n};\n\nexport type GetLatestAppTacParam = {\n product: string;\n};\n\nexport type GetWalletLatestAppTacStatusResult = {\n signed: boolean;\n};\n\nexport type GetWalletLatestAppTacStatusParams = {\n address: string;\n product: string;\n};\n\nexport type SignAppTacParams = {\n signer: Signer | JsonRpcSigner;\n version: string;\n product: string;\n};\n"]}
@@ -7,6 +7,7 @@ exports.WalletClient = void 0;
7
7
  var constants_1 = require("./helpers/constants");
8
8
  var risk_1 = __importDefault(require("./modules/risk"));
9
9
  var tos_1 = __importDefault(require("./modules/tos"));
10
+ var tos_app_1 = __importDefault(require("./modules/tos-app"));
10
11
  /**
11
12
  * @description Client for Wallet
12
13
  */
@@ -14,6 +15,7 @@ var WalletClient = /** @class */ (function () {
14
15
  function WalletClient() {
15
16
  this._riskClient = new risk_1.default(WalletClient.config.apiEndpoint);
16
17
  this._tosSignatureClient = new tos_1.default(WalletClient.config.apiEndpoint);
18
+ this._tosSignatureAppClient = new tos_app_1.default(WalletClient.config.apiEndpoint);
17
19
  }
18
20
  WalletClient.configure = function (environment) {
19
21
  WalletClient.config =
@@ -52,7 +54,7 @@ var WalletClient = /** @class */ (function () {
52
54
  });
53
55
  Object.defineProperty(WalletClient, "tosSignature", {
54
56
  /**
55
- * Provides access to the ToSSignatureClient instance.
57
+ * Provides access to the ToSSignatureClient instance for LGE.
56
58
  * This getter allows for interacting with tos signature related API functionalities.
57
59
  *
58
60
  * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
@@ -64,6 +66,20 @@ var WalletClient = /** @class */ (function () {
64
66
  enumerable: false,
65
67
  configurable: true
66
68
  });
69
+ Object.defineProperty(WalletClient, "tosSignatureApp", {
70
+ /**
71
+ * Provides general access to the ToSSignatureAppClient instance.
72
+ * This getter allows for interacting with tos signature related API functionalities.
73
+ *
74
+ * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
75
+ * @memberof WalletClient
76
+ */
77
+ get: function () {
78
+ return WalletClient.getInstance()._tosSignatureAppClient;
79
+ },
80
+ enumerable: false,
81
+ configurable: true
82
+ });
67
83
  WalletClient.config = constants_1.API_CLIENT_CONFIGS['test'];
68
84
  return WalletClient;
69
85
  }());
@@ -1 +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,WAAW,CAAC,CAAC;QACnE,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,oBAAI;QAPtB;;;;;;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.apiEndpoint);\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 risk-related operations.\n * @memberof WalletClient\n */\n public static get risk(): 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"]}
1
+ {"version":3,"file":"wallet-client.js","sourceRoot":"/","sources":["clients/wallet-client.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAwE;AAExE,wDAAwC;AACxC,sDAA+C;AAC/C,8DAAsD;AACtD;;GAEG;AACH;IAOE;QACE,IAAI,CAAC,WAAW,GAAG,IAAI,cAAU,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACnE,IAAI,CAAC,mBAAmB,GAAG,IAAI,aAAkB,CAC/C,YAAY,CAAC,MAAM,CAAC,WAAW,CAChC,CAAC;QACF,IAAI,CAAC,sBAAsB,GAAG,IAAI,iBAAqB,CACrD,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,oBAAI;QAPtB;;;;;;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;IASD,sBAAkB,+BAAe;QAPjC;;;;;;WAMG;aACH;YACE,OAAO,YAAY,CAAC,WAAW,EAAE,CAAC,sBAAsB,CAAC;QAC3D,CAAC;;;OAAA;IApEc,mBAAM,GAAkB,8BAAkB,CAAC,MAAM,CAAC,CAAC;IAqEpE,mBAAC;CAAA,AAvED,IAuEC;AAvEY,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';\nimport ToSSignatureAppClient from './modules/tos-app';\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 private readonly _tosSignatureAppClient: ToSSignatureAppClient;\n\n private constructor() {\n this._riskClient = new RiskClient(WalletClient.config.apiEndpoint);\n this._tosSignatureClient = new ToSSignatureClient(\n WalletClient.config.apiEndpoint,\n );\n this._tosSignatureAppClient = new ToSSignatureAppClient(\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 risk-related operations.\n * @memberof WalletClient\n */\n public static get risk(): RiskClient {\n return WalletClient.getInstance()._riskClient;\n }\n\n /**\n * Provides access to the ToSSignatureClient instance for LGE.\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 /**\n * Provides general access to the ToSSignatureAppClient 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 tosSignatureApp(): ToSSignatureAppClient {\n return WalletClient.getInstance()._tosSignatureAppClient;\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { RestClient } from '@reyaxyz/common';
2
+ import { GetLatestAppTacResult, GetLatestAppTacParam, GetWalletLatestAppTacStatusParams, GetWalletLatestAppTacStatusResult, SignAppTacParams } from './types';
3
+ export default class ToSSignatureAppClient extends RestClient {
4
+ private getLatestToSVersion;
5
+ getLatestTacService(params: GetLatestAppTacParam): Promise<GetLatestAppTacResult>;
6
+ getWalletLatestTacStatus(params: GetWalletLatestAppTacStatusParams): Promise<GetWalletLatestAppTacStatusResult>;
7
+ signTac(params: SignAppTacParams): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/tos-app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqB,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,iCAAiC,EACjC,iCAAiC,EACjC,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU;YAC7C,mBAAmB;IAK3B,mBAAmB,CACvB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,qBAAqB,CAAC;IAS3B,wBAAwB,CAE5B,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,iCAAiC,CAAC;IAUvC,OAAO,CAEX,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,IAAI,CAAC;CAOjB"}
@@ -0,0 +1,22 @@
1
+ import { JsonRpcSigner, Signer } from 'ethers';
2
+ export type GetLatestAppTacResult = {
3
+ version: string;
4
+ text: string;
5
+ product: string;
6
+ };
7
+ export type GetLatestAppTacParam = {
8
+ product: string;
9
+ };
10
+ export type GetWalletLatestAppTacStatusResult = {
11
+ signed: boolean;
12
+ };
13
+ export type GetWalletLatestAppTacStatusParams = {
14
+ address: string;
15
+ product: string;
16
+ };
17
+ export type SignAppTacParams = {
18
+ signer: Signer | JsonRpcSigner;
19
+ version: string;
20
+ product: string;
21
+ };
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/tos-app/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -2,6 +2,7 @@ import { ServiceConfig } from './helpers/constants';
2
2
  import { ReyaChainId } from '@reyaxyz/common';
3
3
  import RiskClient from './modules/risk';
4
4
  import ToSSignatureClient from './modules/tos';
5
+ import ToSSignatureAppClient from './modules/tos-app';
5
6
  /**
6
7
  * @description Client for Wallet
7
8
  */
@@ -10,6 +11,7 @@ export declare class WalletClient {
10
11
  private static config;
11
12
  private readonly _riskClient;
12
13
  private readonly _tosSignatureClient;
14
+ private readonly _tosSignatureAppClient;
13
15
  private constructor();
14
16
  static configure(environment: ServiceConfig['environment']): void;
15
17
  private static getInstance;
@@ -23,12 +25,20 @@ export declare class WalletClient {
23
25
  */
24
26
  static get risk(): RiskClient;
25
27
  /**
26
- * Provides access to the ToSSignatureClient instance.
28
+ * Provides access to the ToSSignatureClient instance for LGE.
27
29
  * This getter allows for interacting with tos signature related API functionalities.
28
30
  *
29
31
  * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
30
32
  * @memberof WalletClient
31
33
  */
32
34
  static get tosSignature(): ToSSignatureClient;
35
+ /**
36
+ * Provides general access to the ToSSignatureAppClient instance.
37
+ * This getter allows for interacting with tos signature related API functionalities.
38
+ *
39
+ * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
40
+ * @memberof WalletClient
41
+ */
42
+ static get tosSignatureApp(): ToSSignatureAppClient;
33
43
  }
34
44
  //# sourceMappingURL=wallet-client.d.ts.map
@@ -1 +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,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,YAAY,IAAI,kBAAkB,CAEnD;CACF"}
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,OAAO,qBAAqB,MAAM,mBAAmB,CAAC;AACtD;;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;IACzD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAwB;IAE/D,OAAO;WAUO,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,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,YAAY,IAAI,kBAAkB,CAEnD;IAED;;;;;;OAMG;IACH,WAAkB,eAAe,IAAI,qBAAqB,CAEzD;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/wallet-sdk",
3
- "version": "0.9.12",
3
+ "version": "0.9.14",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -33,11 +33,11 @@
33
33
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
34
  },
35
35
  "dependencies": {
36
- "@reyaxyz/common": "0.73.0",
36
+ "@reyaxyz/common": "0.73.1",
37
37
  "axios": "^1.6.2",
38
38
  "bignumber.js": "^9.1.2",
39
39
  "ethers": "6.9.0"
40
40
  },
41
41
  "packageManager": "pnpm@8.10.4",
42
- "gitHead": "e515796e1445af959aa1083d01b884aaafc66055"
42
+ "gitHead": "f5f13f0307655a010fe3b805cba8122c0200056e"
43
43
  }
@@ -0,0 +1,50 @@
1
+ import { RestClient, ToSVersionDetails } from '@reyaxyz/common';
2
+ import {
3
+ GetLatestAppTacResult,
4
+ GetLatestAppTacParam,
5
+ GetWalletLatestAppTacStatusParams,
6
+ GetWalletLatestAppTacStatusResult,
7
+ SignAppTacParams,
8
+ } from './types';
9
+
10
+ export default class ToSSignatureAppClient extends RestClient {
11
+ private async getLatestToSVersion(): Promise<ToSVersionDetails> {
12
+ const uri = `/api/tos/latest-version`;
13
+ return await this.get(uri);
14
+ }
15
+
16
+ async getLatestTacService(
17
+ params: GetLatestAppTacParam,
18
+ ): Promise<GetLatestAppTacResult> {
19
+ const tosDetails = await this.getLatestToSVersion();
20
+ return {
21
+ version: tosDetails.version,
22
+ text: tosDetails.text,
23
+ product: params.product,
24
+ };
25
+ }
26
+
27
+ async getWalletLatestTacStatus(
28
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
+ params: GetWalletLatestAppTacStatusParams,
30
+ ): Promise<GetWalletLatestAppTacStatusResult> {
31
+ return new Promise((resolve) =>
32
+ setTimeout(() => {
33
+ resolve({
34
+ signed: Math.random() * 100 > 50,
35
+ });
36
+ }, 1000),
37
+ );
38
+ }
39
+
40
+ async signTac(
41
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
+ params: SignAppTacParams,
43
+ ): Promise<void> {
44
+ return new Promise((resolve) =>
45
+ setTimeout(() => {
46
+ resolve();
47
+ }, 1000),
48
+ );
49
+ }
50
+ }
@@ -0,0 +1,26 @@
1
+ import { JsonRpcSigner, Signer } from 'ethers';
2
+
3
+ export type GetLatestAppTacResult = {
4
+ version: string;
5
+ text: string;
6
+ product: string;
7
+ };
8
+
9
+ export type GetLatestAppTacParam = {
10
+ product: string;
11
+ };
12
+
13
+ export type GetWalletLatestAppTacStatusResult = {
14
+ signed: boolean;
15
+ };
16
+
17
+ export type GetWalletLatestAppTacStatusParams = {
18
+ address: string;
19
+ product: string;
20
+ };
21
+
22
+ export type SignAppTacParams = {
23
+ signer: Signer | JsonRpcSigner;
24
+ version: string;
25
+ product: string;
26
+ };
@@ -2,6 +2,7 @@ import { API_CLIENT_CONFIGS, ServiceConfig } from './helpers/constants';
2
2
  import { ReyaChainId } from '@reyaxyz/common';
3
3
  import RiskClient from './modules/risk';
4
4
  import ToSSignatureClient from './modules/tos';
5
+ import ToSSignatureAppClient from './modules/tos-app';
5
6
  /**
6
7
  * @description Client for Wallet
7
8
  */
@@ -10,12 +11,16 @@ export class WalletClient {
10
11
  private static config: ServiceConfig = API_CLIENT_CONFIGS['test'];
11
12
  private readonly _riskClient: RiskClient;
12
13
  private readonly _tosSignatureClient: ToSSignatureClient;
14
+ private readonly _tosSignatureAppClient: ToSSignatureAppClient;
13
15
 
14
16
  private constructor() {
15
17
  this._riskClient = new RiskClient(WalletClient.config.apiEndpoint);
16
18
  this._tosSignatureClient = new ToSSignatureClient(
17
19
  WalletClient.config.apiEndpoint,
18
20
  );
21
+ this._tosSignatureAppClient = new ToSSignatureAppClient(
22
+ WalletClient.config.apiEndpoint,
23
+ );
19
24
  }
20
25
 
21
26
  public static configure(environment: ServiceConfig['environment']): void {
@@ -52,7 +57,7 @@ export class WalletClient {
52
57
  }
53
58
 
54
59
  /**
55
- * Provides access to the ToSSignatureClient instance.
60
+ * Provides access to the ToSSignatureClient instance for LGE.
56
61
  * This getter allows for interacting with tos signature related API functionalities.
57
62
  *
58
63
  * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
@@ -61,4 +66,15 @@ export class WalletClient {
61
66
  public static get tosSignature(): ToSSignatureClient {
62
67
  return WalletClient.getInstance()._tosSignatureClient;
63
68
  }
69
+
70
+ /**
71
+ * Provides general access to the ToSSignatureAppClient instance.
72
+ * This getter allows for interacting with tos signature related API functionalities.
73
+ *
74
+ * @returns {ToSSignatureClient} An instance of ToSSignatureClient for account-related operations.
75
+ * @memberof WalletClient
76
+ */
77
+ public static get tosSignatureApp(): ToSSignatureAppClient {
78
+ return WalletClient.getInstance()._tosSignatureAppClient;
79
+ }
64
80
  }