@reyaxyz/wallet-sdk 0.5.23 → 0.7.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.
- package/dist/clients/modules/risk/index.js +14 -12
- package/dist/clients/modules/risk/index.js.map +1 -1
- package/dist/clients/modules/risk/types.js.map +1 -1
- package/dist/clients/modules/tos/index.js +96 -0
- package/dist/clients/modules/tos/index.js.map +1 -1
- package/dist/clients/modules/tos/types.js.map +1 -1
- package/dist/clients/types.js +1 -0
- package/dist/clients/types.js.map +1 -1
- package/dist/clients/wallet-client.js +2 -2
- package/dist/clients/wallet-client.js.map +1 -1
- package/dist/types/clients/modules/risk/index.d.ts +2 -2
- package/dist/types/clients/modules/risk/index.d.ts.map +1 -1
- package/dist/types/clients/modules/risk/types.d.ts +3 -0
- package/dist/types/clients/modules/risk/types.d.ts.map +1 -1
- package/dist/types/clients/modules/tos/index.d.ts +4 -1
- package/dist/types/clients/modules/tos/index.d.ts.map +1 -1
- package/dist/types/clients/modules/tos/types.d.ts +14 -0
- package/dist/types/clients/modules/tos/types.d.ts.map +1 -1
- package/dist/types/clients/types.d.ts +1 -0
- package/dist/types/clients/types.d.ts.map +1 -1
- package/dist/types/clients/wallet-client.d.ts +2 -2
- package/dist/types/clients/wallet-client.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/clients/modules/risk/index.ts +21 -7
- package/src/clients/modules/risk/types.ts +4 -0
- package/src/clients/modules/tos/index.ts +97 -1
- package/src/clients/modules/tos/types.ts +18 -0
- package/src/clients/types.ts +1 -0
- package/src/clients/wallet-client.ts +2 -2
|
@@ -52,8 +52,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
var common_1 = require("@reyaxyz/common");
|
|
55
|
-
var isWalletRisky_1 = require("../../helpers/isWalletRisky");
|
|
56
55
|
// todo @milanpajovic how shall we get the trm api key secret?
|
|
56
|
+
// todo IR move this logic behind the api to hide this value
|
|
57
57
|
var TRM_API_KEY = process.env.TRM_API_KEY;
|
|
58
58
|
var RiskClient = /** @class */ (function (_super) {
|
|
59
59
|
__extends(RiskClient, _super);
|
|
@@ -86,19 +86,21 @@ var RiskClient = /** @class */ (function (_super) {
|
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
RiskClient.prototype.checkForRiskWallet = function (
|
|
89
|
+
RiskClient.prototype.checkForRiskWallet = function (
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
91
|
+
params) {
|
|
90
92
|
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
-
var riskAssessment;
|
|
92
93
|
return __generator(this, function (_a) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
// todo IR uncomment when trm key issue fixed
|
|
95
|
+
// const riskAssessment = await this.getWalletRiskAssessment(params);
|
|
96
|
+
// return { isSafe: !isWalletRisky(riskAssessment) };
|
|
97
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
98
|
+
return setTimeout(function () {
|
|
99
|
+
resolve({
|
|
100
|
+
isSafe: Math.random() * 100 > 50,
|
|
101
|
+
});
|
|
102
|
+
}, 1000);
|
|
103
|
+
})];
|
|
102
104
|
});
|
|
103
105
|
});
|
|
104
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/risk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/risk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAQ7C,8DAA8D;AAC9D,4DAA4D;AACpD,IAAA,WAAW,GAAK,OAAO,CAAC,GAAG,YAAhB,CAAiB;AAEpC;IAAwC,8BAAU;IAAlD;;IA2CA,CAAC;IA1Ce,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;IACE,6DAA6D;IAC7D,MAAiC;;;gBAEjC,6CAA6C;gBAC7C,qEAAqE;gBACrE,qDAAqD;gBAErD,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;IACH,iBAAC;AAAD,CAAC,AA3CD,CAAwC,mBAAU,GA2CjD","sourcesContent":["import { RestClient } from '@reyaxyz/common';\n\nimport {\n CheckForRiskWalletResult,\n CheckForRiskyWalletParams,\n TRMRiskAssessment,\n} from './types';\n\n// todo @milanpajovic how shall we get the trm api key secret?\n// todo IR move this logic behind the api to hide this value\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(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n params: CheckForRiskyWalletParams,\n ): Promise<CheckForRiskWalletResult> {\n // todo IR uncomment when trm key issue fixed\n // const riskAssessment = await this.getWalletRiskAssessment(params);\n // return { isSafe: !isWalletRisky(riskAssessment) };\n\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve({\n isSafe: Math.random() * 100 > 50,\n });\n }, 1000),\n );\n }\n}\n"]}
|
|
@@ -1 +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"]}
|
|
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\nexport type CheckForRiskWalletResult = {\n isSafe: boolean;\n};\n"]}
|
|
@@ -88,6 +88,102 @@ var ToSSignatureClient = /** @class */ (function (_super) {
|
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
+
ToSSignatureClient.prototype.getLatestTacService = function () {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
95
|
+
return setTimeout(function () {
|
|
96
|
+
resolve({
|
|
97
|
+
text: '# Hanc ille aequore cornua trux dilectos succedit\n' +
|
|
98
|
+
'\n' +
|
|
99
|
+
'## Pecudes idcirco illic cum mare deus novae\n' +
|
|
100
|
+
'\n' +
|
|
101
|
+
'Lorem markdownum nimium, quae Danais dabit lingua caedis insignis fatis: forte\n' +
|
|
102
|
+
'iter. De non, ut et portus et punior gemitu trementi fossas Coeo; una\n' +
|
|
103
|
+
'[volucrumque](https://temporis-vinoque.io/per.php): unum penetratque liber.\n' +
|
|
104
|
+
'Postquam et hanc, non, Saturnia duas poscimur triticeas intus. Tum **locis**?\n' +
|
|
105
|
+
'Num me in mali fingam area sed Pelion si prodet pastores.\n' +
|
|
106
|
+
'\n' +
|
|
107
|
+
'> Passus [tepentibus radiosque](http://undique-quid.org/) limina. Hoc superos\n' +
|
|
108
|
+
'> notam virga quicquid quisquam ineunt formidine utque; nostra potentia fulmine\n' +
|
|
109
|
+
'> nam pharetras unam, quique [circumspicit\n' +
|
|
110
|
+
'> mei](http://fuerat-arcanaque.io/cognoscit-dedit). Abdita timor suffuderat\n' +
|
|
111
|
+
'> rursusque credit, longis, videntur Aegides? Tuum proles indigenas increscere\n' +
|
|
112
|
+
'> Peloro denique.\n' +
|
|
113
|
+
'\n' +
|
|
114
|
+
'## Gratia possis undis deum nubere\n' +
|
|
115
|
+
'\n' +
|
|
116
|
+
'In spoliantis in quid. Pendebant pollue. Virgo *luctibus* Latio hoc artes multa\n' +
|
|
117
|
+
'dictis vereri primo frontem: caelestia magna legumque; est.\n' +
|
|
118
|
+
'\n' +
|
|
119
|
+
'> Timor de Cinyras sinistra agros Itys inque illud cum ait. Et inque alto,\n' +
|
|
120
|
+
'> harundinibus bellum aera aduncae: ponat clamor, tuum. [Ulli\n' +
|
|
121
|
+
'> greges](http://www.volucres.org/defensae) tinguat; Iuno potest questaque\n' +
|
|
122
|
+
'> traxere patulos, lacrimantia reserabo cava quo Lavini virtute ceciderunt sub\n' +
|
|
123
|
+
'> quod inanem.\n' +
|
|
124
|
+
'\n' +
|
|
125
|
+
'## Fama virtus\n' +
|
|
126
|
+
'\n' +
|
|
127
|
+
'Tanta nulla canis momentaque mihi plangentibus sunt, paene *amor novus est*, est\n' +
|
|
128
|
+
'sublimis nimia. Avi duxit feres capacibus, nec et? Sic mihi dolentem magni.\n' +
|
|
129
|
+
'\n' +
|
|
130
|
+
'## Boves ita esse in illa undarum illam\n' +
|
|
131
|
+
'\n' +
|
|
132
|
+
'Aurora femina timeto tibi animo sua templa, fama ad unus? Funesta illo, tibi\n' +
|
|
133
|
+
'diem consorte spernitque habet, nisi lina tergoque! Qua Venus aetas, quam ab\n' +
|
|
134
|
+
'pennas florumque letifer parentis ambae, et sacrilega altus passuque pectus.\n' +
|
|
135
|
+
'Meae tamen leto latratu Othryn visum huc?\n' +
|
|
136
|
+
'\n' +
|
|
137
|
+
'- Dixi malis huius ecce fratrem lux facundia\n' +
|
|
138
|
+
'- Neque vultus genis praeferri occidit quae sperata\n' +
|
|
139
|
+
'- Temptavit tactusque tamen somno antemnae amantior in\n' +
|
|
140
|
+
'- Dum Rhodopeius nobis coarguit odorato caelo\n' +
|
|
141
|
+
'- Amorem exercetque gremio\n' +
|
|
142
|
+
'\n' +
|
|
143
|
+
'## Tua non fumantia multaque egressus\n' +
|
|
144
|
+
'\n' +
|
|
145
|
+
'Plangitur dixi ultra, pectoraque sua caecus inquit *domo*, bis quod primis\n' +
|
|
146
|
+
'maturior rege veneris, Desine, vix. Et nostri genetrix simulavit *resolutis\n' +
|
|
147
|
+
'monitis quae*, sceptrum. Et **quoque**, extemplo humi.\n' +
|
|
148
|
+
'\n' +
|
|
149
|
+
'Undas quid vestris umeros, **his tabo**, tum orbem aures? Dexterior iusto. Quae\n' +
|
|
150
|
+
'Iove narrata carmina Phaethontis fatebor opacas. Est Cereris mutata paelex\n' +
|
|
151
|
+
'gigantas, alite?',
|
|
152
|
+
version: '0.0.1',
|
|
153
|
+
});
|
|
154
|
+
}, 1000);
|
|
155
|
+
})];
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
ToSSignatureClient.prototype.getWalletLatestTacStatus = function (
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
161
|
+
params) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
163
|
+
return __generator(this, function (_a) {
|
|
164
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
165
|
+
return setTimeout(function () {
|
|
166
|
+
resolve({
|
|
167
|
+
signed: Math.random() * 100 > 50,
|
|
168
|
+
});
|
|
169
|
+
}, 1000);
|
|
170
|
+
})];
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
ToSSignatureClient.prototype.signTac = function (
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
176
|
+
params) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
+
return __generator(this, function (_a) {
|
|
179
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
180
|
+
return setTimeout(function () {
|
|
181
|
+
resolve();
|
|
182
|
+
}, 1000);
|
|
183
|
+
})];
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
};
|
|
91
187
|
ToSSignatureClient.prototype.checkForToSSignature = function (params) {
|
|
92
188
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
189
|
var signerAddress, signatureData, latestToS, termsAccepted, signature, response, error_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/tos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AAEzB,qDAAqD;AAErD;IAAgD,sCAAU;IAGxD,4BAAY,MAAc,EAAE,IAAY,EAAE,UAA0B;QAClE,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QACxB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACvB,CAAC;IAEa,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;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BAA0B,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,AAvED,CAAgD,mBAAU,GAuEzD","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 readonly tosUrl: string;\n\n constructor(tosUrl: string, host: string, apiTimeout?: number | null) {\n super(host, apiTimeout);\n this.tosUrl = tosUrl;\n }\n\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(this.tosUrl);\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"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/tos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AAQzB,qDAAqD;AAErD;IAAgD,sCAAU;IAGxD,4BAAY,MAAc,EAAE,IAAY,EAAE,UAA0B;QAClE,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QACxB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACvB,CAAC;IAEa,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,gDAAmB,GAAzB;;;gBACE,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO;wBACzB,OAAA,UAAU,CAAC;4BACT,OAAO,CAAC;gCACN,IAAI,EACF,qDA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D;IACH,yBAAC;AAAD,CAAC,AAjKD,CAAgD,mBAAU,GAiKzD","sourcesContent":["import {\n Address,\n RestClient,\n SignatureData,\n SaveSignatureResult,\n} from '@reyaxyz/common';\nimport {\n CheckForToSSignatureParams,\n GetLatestTacResult,\n GetWalletLatestTacStatusParams,\n GetWalletLatestTacStatusResult,\n SignTacParams,\n} from './types';\nimport { getToSText } from '../../helpers/constants';\n\nexport default class ToSSignatureClient extends RestClient {\n readonly tosUrl: string;\n\n constructor(tosUrl: string, host: string, apiTimeout?: number | null) {\n super(host, apiTimeout);\n this.tosUrl = tosUrl;\n }\n\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 getLatestTacService(): Promise<GetLatestTacResult> {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve({\n text:\n '# Hanc ille aequore cornua trux dilectos succedit\\n' +\n '\\n' +\n '## Pecudes idcirco illic cum mare deus novae\\n' +\n '\\n' +\n 'Lorem markdownum nimium, quae Danais dabit lingua caedis insignis fatis: forte\\n' +\n 'iter. De non, ut et portus et punior gemitu trementi fossas Coeo; una\\n' +\n '[volucrumque](https://temporis-vinoque.io/per.php): unum penetratque liber.\\n' +\n 'Postquam et hanc, non, Saturnia duas poscimur triticeas intus. Tum **locis**?\\n' +\n 'Num me in mali fingam area sed Pelion si prodet pastores.\\n' +\n '\\n' +\n '> Passus [tepentibus radiosque](http://undique-quid.org/) limina. Hoc superos\\n' +\n '> notam virga quicquid quisquam ineunt formidine utque; nostra potentia fulmine\\n' +\n '> nam pharetras unam, quique [circumspicit\\n' +\n '> mei](http://fuerat-arcanaque.io/cognoscit-dedit). Abdita timor suffuderat\\n' +\n '> rursusque credit, longis, videntur Aegides? Tuum proles indigenas increscere\\n' +\n '> Peloro denique.\\n' +\n '\\n' +\n '## Gratia possis undis deum nubere\\n' +\n '\\n' +\n 'In spoliantis in quid. Pendebant pollue. Virgo *luctibus* Latio hoc artes multa\\n' +\n 'dictis vereri primo frontem: caelestia magna legumque; est.\\n' +\n '\\n' +\n '> Timor de Cinyras sinistra agros Itys inque illud cum ait. Et inque alto,\\n' +\n '> harundinibus bellum aera aduncae: ponat clamor, tuum. [Ulli\\n' +\n '> greges](http://www.volucres.org/defensae) tinguat; Iuno potest questaque\\n' +\n '> traxere patulos, lacrimantia reserabo cava quo Lavini virtute ceciderunt sub\\n' +\n '> quod inanem.\\n' +\n '\\n' +\n '## Fama virtus\\n' +\n '\\n' +\n 'Tanta nulla canis momentaque mihi plangentibus sunt, paene *amor novus est*, est\\n' +\n 'sublimis nimia. Avi duxit feres capacibus, nec et? Sic mihi dolentem magni.\\n' +\n '\\n' +\n '## Boves ita esse in illa undarum illam\\n' +\n '\\n' +\n 'Aurora femina timeto tibi animo sua templa, fama ad unus? Funesta illo, tibi\\n' +\n 'diem consorte spernitque habet, nisi lina tergoque! Qua Venus aetas, quam ab\\n' +\n 'pennas florumque letifer parentis ambae, et sacrilega altus passuque pectus.\\n' +\n 'Meae tamen leto latratu Othryn visum huc?\\n' +\n '\\n' +\n '- Dixi malis huius ecce fratrem lux facundia\\n' +\n '- Neque vultus genis praeferri occidit quae sperata\\n' +\n '- Temptavit tactusque tamen somno antemnae amantior in\\n' +\n '- Dum Rhodopeius nobis coarguit odorato caelo\\n' +\n '- Amorem exercetque gremio\\n' +\n '\\n' +\n '## Tua non fumantia multaque egressus\\n' +\n '\\n' +\n 'Plangitur dixi ultra, pectoraque sua caecus inquit *domo*, bis quod primis\\n' +\n 'maturior rege veneris, Desine, vix. Et nostri genetrix simulavit *resolutis\\n' +\n 'monitis quae*, sceptrum. Et **quoque**, extemplo humi.\\n' +\n '\\n' +\n 'Undas quid vestris umeros, **his tabo**, tum orbem aures? Dexterior iusto. Quae\\n' +\n 'Iove narrata carmina Phaethontis fatebor opacas. Est Cereris mutata paelex\\n' +\n 'gigantas, alite?',\n version: '0.0.1',\n });\n }, 1000),\n );\n }\n\n async getWalletLatestTacStatus(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n params: GetWalletLatestTacStatusParams,\n ): Promise<GetWalletLatestTacStatusResult> {\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: SignTacParams,\n ): Promise<void> {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1000),\n );\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(this.tosUrl);\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"]}
|
|
@@ -1 +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"]}
|
|
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\nexport type GetLatestTacResult = {\n version: string;\n text: string;\n};\n\nexport type GetWalletLatestTacStatusResult = {\n signed: boolean;\n};\n\nexport type GetWalletLatestTacStatusParams = {\n address: string;\n};\n\nexport type SignTacParams = {\n signer: Signer | JsonRpcSigner;\n version: string;\n};\n"]}
|
package/dist/clients/types.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./modules/risk/types"), exports);
|
|
18
|
+
__exportStar(require("./modules/tos/types"), exports);
|
|
18
19
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from './modules/risk/types';\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,sDAAoC","sourcesContent":["export * from './modules/risk/types';\nexport * from './modules/tos/types';\n"]}
|
|
@@ -36,12 +36,12 @@ var WalletClient = /** @class */ (function () {
|
|
|
36
36
|
enumerable: false,
|
|
37
37
|
configurable: true
|
|
38
38
|
});
|
|
39
|
-
Object.defineProperty(WalletClient, "
|
|
39
|
+
Object.defineProperty(WalletClient, "risk", {
|
|
40
40
|
/**
|
|
41
41
|
* Provides access to the RiskClient instance.
|
|
42
42
|
* This getter allows for interacting with risk-related API functionalities.
|
|
43
43
|
*
|
|
44
|
-
* @returns {RiskClient} An instance of RiskClient for
|
|
44
|
+
* @returns {RiskClient} An instance of RiskClient for risk-related operations.
|
|
45
45
|
* @memberof WalletClient
|
|
46
46
|
*/
|
|
47
47
|
get: function () {
|
|
@@ -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,cAAc,CAAC,CAAC;QACtE,IAAI,CAAC,mBAAmB,GAAG,IAAI,aAAkB,CAC/C,YAAY,CAAC,MAAM,CAAC,MAAM,EAC1B,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,
|
|
1
|
+
{"version":3,"file":"wallet-client.js","sourceRoot":"/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;IAuDpE,mBAAC;CAAA,AAzDD,IAyDC;AAzDY,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.tosUrl,\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,7 +1,7 @@
|
|
|
1
1
|
import { RestClient } from '@reyaxyz/common';
|
|
2
|
-
import { CheckForRiskyWalletParams } from './types';
|
|
2
|
+
import { CheckForRiskWalletResult, CheckForRiskyWalletParams } from './types';
|
|
3
3
|
export default class RiskClient extends RestClient {
|
|
4
4
|
private getWalletRiskAssessment;
|
|
5
|
-
checkForRiskWallet(params: CheckForRiskyWalletParams): Promise<
|
|
5
|
+
checkForRiskWallet(params: CheckForRiskyWalletParams): Promise<CheckForRiskWalletResult>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,
|
|
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,EACL,wBAAwB,EACxB,yBAAyB,EAE1B,MAAM,SAAS,CAAC;AAMjB,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;YAClC,uBAAuB;IA0B/B,kBAAkB,CAEtB,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,wBAAwB,CAAC;CAarC"}
|
|
@@ -1 +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,EA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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;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { RestClient } from '@reyaxyz/common';
|
|
2
|
-
import { CheckForToSSignatureParams } from './types';
|
|
2
|
+
import { CheckForToSSignatureParams, GetLatestTacResult, GetWalletLatestTacStatusParams, GetWalletLatestTacStatusResult, SignTacParams } from './types';
|
|
3
3
|
export default class ToSSignatureClient extends RestClient {
|
|
4
4
|
readonly tosUrl: string;
|
|
5
5
|
constructor(tosUrl: string, host: string, apiTimeout?: number | null);
|
|
6
6
|
private getSignature;
|
|
7
7
|
private saveSignatureWithToS;
|
|
8
|
+
getLatestTacService(): Promise<GetLatestTacResult>;
|
|
9
|
+
getWalletLatestTacStatus(params: GetWalletLatestTacStatusParams): Promise<GetWalletLatestTacStatusResult>;
|
|
10
|
+
signTac(params: SignTacParams): Promise<void>;
|
|
8
11
|
checkForToSSignature(params: CheckForToSSignatureParams): Promise<void>;
|
|
9
12
|
}
|
|
10
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,
|
|
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,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,8BAA8B,EAC9B,8BAA8B,EAC9B,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;YAKtD,YAAY;YAQZ,oBAAoB;IAe5B,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAkElD,wBAAwB,CAE5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC;IAUpC,OAAO,CAEX,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,IAAI,CAAC;IAQV,oBAAoB,CAAC,MAAM,EAAE,0BAA0B;CAwC9D"}
|
|
@@ -2,4 +2,18 @@ import { JsonRpcSigner, Signer } from 'ethers';
|
|
|
2
2
|
export type CheckForToSSignatureParams = {
|
|
3
3
|
signer: Signer | JsonRpcSigner;
|
|
4
4
|
};
|
|
5
|
+
export type GetLatestTacResult = {
|
|
6
|
+
version: string;
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
9
|
+
export type GetWalletLatestTacStatusResult = {
|
|
10
|
+
signed: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type GetWalletLatestTacStatusParams = {
|
|
13
|
+
address: string;
|
|
14
|
+
};
|
|
15
|
+
export type SignTacParams = {
|
|
16
|
+
signer: Signer | JsonRpcSigner;
|
|
17
|
+
version: string;
|
|
18
|
+
};
|
|
5
19
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +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"}
|
|
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;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
@@ -18,10 +18,10 @@ export declare class WalletClient {
|
|
|
18
18
|
* Provides access to the RiskClient instance.
|
|
19
19
|
* This getter allows for interacting with risk-related API functionalities.
|
|
20
20
|
*
|
|
21
|
-
* @returns {RiskClient} An instance of RiskClient for
|
|
21
|
+
* @returns {RiskClient} An instance of RiskClient for risk-related operations.
|
|
22
22
|
* @memberof WalletClient
|
|
23
23
|
*/
|
|
24
|
-
static get
|
|
24
|
+
static get risk(): RiskClient;
|
|
25
25
|
/**
|
|
26
26
|
* Provides access to the ToSSignatureClient instance.
|
|
27
27
|
* This getter allows for interacting with tos signature related API functionalities.
|
|
@@ -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;WAQO,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,
|
|
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;WAQO,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/wallet-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"ethers": "6.9.0"
|
|
40
40
|
},
|
|
41
41
|
"packageManager": "pnpm@8.10.4",
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "f13bff508a52da8150f84cd46226c16887139e68"
|
|
43
43
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { RestClient } from '@reyaxyz/common';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
CheckForRiskWalletResult,
|
|
5
|
+
CheckForRiskyWalletParams,
|
|
6
|
+
TRMRiskAssessment,
|
|
7
|
+
} from './types';
|
|
5
8
|
|
|
6
9
|
// todo @milanpajovic how shall we get the trm api key secret?
|
|
10
|
+
// todo IR move this logic behind the api to hide this value
|
|
7
11
|
const { TRM_API_KEY } = process.env;
|
|
8
12
|
|
|
9
13
|
export default class RiskClient extends RestClient {
|
|
@@ -33,10 +37,20 @@ export default class RiskClient extends RestClient {
|
|
|
33
37
|
return result[0];
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
async checkForRiskWallet(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
async checkForRiskWallet(
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
|
+
params: CheckForRiskyWalletParams,
|
|
43
|
+
): Promise<CheckForRiskWalletResult> {
|
|
44
|
+
// todo IR uncomment when trm key issue fixed
|
|
45
|
+
// const riskAssessment = await this.getWalletRiskAssessment(params);
|
|
46
|
+
// return { isSafe: !isWalletRisky(riskAssessment) };
|
|
47
|
+
|
|
48
|
+
return new Promise((resolve) =>
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
resolve({
|
|
51
|
+
isSafe: Math.random() * 100 > 50,
|
|
52
|
+
});
|
|
53
|
+
}, 1000),
|
|
54
|
+
);
|
|
41
55
|
}
|
|
42
56
|
}
|
|
@@ -4,7 +4,13 @@ import {
|
|
|
4
4
|
SignatureData,
|
|
5
5
|
SaveSignatureResult,
|
|
6
6
|
} from '@reyaxyz/common';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
CheckForToSSignatureParams,
|
|
9
|
+
GetLatestTacResult,
|
|
10
|
+
GetWalletLatestTacStatusParams,
|
|
11
|
+
GetWalletLatestTacStatusResult,
|
|
12
|
+
SignTacParams,
|
|
13
|
+
} from './types';
|
|
8
14
|
import { getToSText } from '../../helpers/constants';
|
|
9
15
|
|
|
10
16
|
export default class ToSSignatureClient extends RestClient {
|
|
@@ -38,6 +44,96 @@ export default class ToSSignatureClient extends RestClient {
|
|
|
38
44
|
return this.post(uri, undefined, formData, undefined);
|
|
39
45
|
}
|
|
40
46
|
|
|
47
|
+
async getLatestTacService(): Promise<GetLatestTacResult> {
|
|
48
|
+
return new Promise((resolve) =>
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
resolve({
|
|
51
|
+
text:
|
|
52
|
+
'# Hanc ille aequore cornua trux dilectos succedit\n' +
|
|
53
|
+
'\n' +
|
|
54
|
+
'## Pecudes idcirco illic cum mare deus novae\n' +
|
|
55
|
+
'\n' +
|
|
56
|
+
'Lorem markdownum nimium, quae Danais dabit lingua caedis insignis fatis: forte\n' +
|
|
57
|
+
'iter. De non, ut et portus et punior gemitu trementi fossas Coeo; una\n' +
|
|
58
|
+
'[volucrumque](https://temporis-vinoque.io/per.php): unum penetratque liber.\n' +
|
|
59
|
+
'Postquam et hanc, non, Saturnia duas poscimur triticeas intus. Tum **locis**?\n' +
|
|
60
|
+
'Num me in mali fingam area sed Pelion si prodet pastores.\n' +
|
|
61
|
+
'\n' +
|
|
62
|
+
'> Passus [tepentibus radiosque](http://undique-quid.org/) limina. Hoc superos\n' +
|
|
63
|
+
'> notam virga quicquid quisquam ineunt formidine utque; nostra potentia fulmine\n' +
|
|
64
|
+
'> nam pharetras unam, quique [circumspicit\n' +
|
|
65
|
+
'> mei](http://fuerat-arcanaque.io/cognoscit-dedit). Abdita timor suffuderat\n' +
|
|
66
|
+
'> rursusque credit, longis, videntur Aegides? Tuum proles indigenas increscere\n' +
|
|
67
|
+
'> Peloro denique.\n' +
|
|
68
|
+
'\n' +
|
|
69
|
+
'## Gratia possis undis deum nubere\n' +
|
|
70
|
+
'\n' +
|
|
71
|
+
'In spoliantis in quid. Pendebant pollue. Virgo *luctibus* Latio hoc artes multa\n' +
|
|
72
|
+
'dictis vereri primo frontem: caelestia magna legumque; est.\n' +
|
|
73
|
+
'\n' +
|
|
74
|
+
'> Timor de Cinyras sinistra agros Itys inque illud cum ait. Et inque alto,\n' +
|
|
75
|
+
'> harundinibus bellum aera aduncae: ponat clamor, tuum. [Ulli\n' +
|
|
76
|
+
'> greges](http://www.volucres.org/defensae) tinguat; Iuno potest questaque\n' +
|
|
77
|
+
'> traxere patulos, lacrimantia reserabo cava quo Lavini virtute ceciderunt sub\n' +
|
|
78
|
+
'> quod inanem.\n' +
|
|
79
|
+
'\n' +
|
|
80
|
+
'## Fama virtus\n' +
|
|
81
|
+
'\n' +
|
|
82
|
+
'Tanta nulla canis momentaque mihi plangentibus sunt, paene *amor novus est*, est\n' +
|
|
83
|
+
'sublimis nimia. Avi duxit feres capacibus, nec et? Sic mihi dolentem magni.\n' +
|
|
84
|
+
'\n' +
|
|
85
|
+
'## Boves ita esse in illa undarum illam\n' +
|
|
86
|
+
'\n' +
|
|
87
|
+
'Aurora femina timeto tibi animo sua templa, fama ad unus? Funesta illo, tibi\n' +
|
|
88
|
+
'diem consorte spernitque habet, nisi lina tergoque! Qua Venus aetas, quam ab\n' +
|
|
89
|
+
'pennas florumque letifer parentis ambae, et sacrilega altus passuque pectus.\n' +
|
|
90
|
+
'Meae tamen leto latratu Othryn visum huc?\n' +
|
|
91
|
+
'\n' +
|
|
92
|
+
'- Dixi malis huius ecce fratrem lux facundia\n' +
|
|
93
|
+
'- Neque vultus genis praeferri occidit quae sperata\n' +
|
|
94
|
+
'- Temptavit tactusque tamen somno antemnae amantior in\n' +
|
|
95
|
+
'- Dum Rhodopeius nobis coarguit odorato caelo\n' +
|
|
96
|
+
'- Amorem exercetque gremio\n' +
|
|
97
|
+
'\n' +
|
|
98
|
+
'## Tua non fumantia multaque egressus\n' +
|
|
99
|
+
'\n' +
|
|
100
|
+
'Plangitur dixi ultra, pectoraque sua caecus inquit *domo*, bis quod primis\n' +
|
|
101
|
+
'maturior rege veneris, Desine, vix. Et nostri genetrix simulavit *resolutis\n' +
|
|
102
|
+
'monitis quae*, sceptrum. Et **quoque**, extemplo humi.\n' +
|
|
103
|
+
'\n' +
|
|
104
|
+
'Undas quid vestris umeros, **his tabo**, tum orbem aures? Dexterior iusto. Quae\n' +
|
|
105
|
+
'Iove narrata carmina Phaethontis fatebor opacas. Est Cereris mutata paelex\n' +
|
|
106
|
+
'gigantas, alite?',
|
|
107
|
+
version: '0.0.1',
|
|
108
|
+
});
|
|
109
|
+
}, 1000),
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async getWalletLatestTacStatus(
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
115
|
+
params: GetWalletLatestTacStatusParams,
|
|
116
|
+
): Promise<GetWalletLatestTacStatusResult> {
|
|
117
|
+
return new Promise((resolve) =>
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
resolve({
|
|
120
|
+
signed: Math.random() * 100 > 50,
|
|
121
|
+
});
|
|
122
|
+
}, 1000),
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async signTac(
|
|
127
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
128
|
+
params: SignTacParams,
|
|
129
|
+
): Promise<void> {
|
|
130
|
+
return new Promise((resolve) =>
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
resolve();
|
|
133
|
+
}, 1000),
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
41
137
|
async checkForToSSignature(params: CheckForToSSignatureParams) {
|
|
42
138
|
const signerAddress = (
|
|
43
139
|
await params.signer.getAddress()
|
|
@@ -3,3 +3,21 @@ import { JsonRpcSigner, Signer } from 'ethers';
|
|
|
3
3
|
export type CheckForToSSignatureParams = {
|
|
4
4
|
signer: Signer | JsonRpcSigner;
|
|
5
5
|
};
|
|
6
|
+
|
|
7
|
+
export type GetLatestTacResult = {
|
|
8
|
+
version: string;
|
|
9
|
+
text: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type GetWalletLatestTacStatusResult = {
|
|
13
|
+
signed: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type GetWalletLatestTacStatusParams = {
|
|
17
|
+
address: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type SignTacParams = {
|
|
21
|
+
signer: Signer | JsonRpcSigner;
|
|
22
|
+
version: string;
|
|
23
|
+
};
|
package/src/clients/types.ts
CHANGED
|
@@ -45,10 +45,10 @@ export class WalletClient {
|
|
|
45
45
|
* Provides access to the RiskClient instance.
|
|
46
46
|
* This getter allows for interacting with risk-related API functionalities.
|
|
47
47
|
*
|
|
48
|
-
* @returns {RiskClient} An instance of RiskClient for
|
|
48
|
+
* @returns {RiskClient} An instance of RiskClient for risk-related operations.
|
|
49
49
|
* @memberof WalletClient
|
|
50
50
|
*/
|
|
51
|
-
public static get
|
|
51
|
+
public static get risk(): RiskClient {
|
|
52
52
|
return WalletClient.getInstance()._riskClient;
|
|
53
53
|
}
|
|
54
54
|
|