@nadohq/mobile-client 0.37.0 → 0.41.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/README.md +10 -10
- package/dist/{MobileClient-C9S_o_eC.cjs → MobileClient-Duy7MvxN.cjs} +39 -46
- package/dist/MobileClient-Duy7MvxN.cjs.map +1 -0
- package/dist/MobileClient.cjs +1 -1
- package/dist/MobileClient.d.cts +29 -31
- package/dist/MobileClient.d.cts.map +1 -1
- package/dist/MobileClient.d.ts +29 -31
- package/dist/MobileClient.d.ts.map +1 -1
- package/dist/MobileClient.js +39 -46
- package/dist/MobileClient.js.map +1 -1
- package/dist/{MobileServerFailureError-CVK3aLOi.d.cts → MobileServerFailureError-BvQYrxjx.d.cts} +3 -3
- package/dist/{MobileServerFailureError-CVK3aLOi.d.cts.map → MobileServerFailureError-BvQYrxjx.d.cts.map} +1 -1
- package/dist/{MobileServerFailureError-D-76n3pS.d.ts → MobileServerFailureError-CrNpL_L4.d.ts} +3 -3
- package/dist/{MobileServerFailureError-D-76n3pS.d.ts.map → MobileServerFailureError-CrNpL_L4.d.ts.map} +1 -1
- package/dist/{buildSignedMobileRequest-42meR4yV.d.ts → buildSignedMobileRequest-BqLRFLKV.d.ts} +2 -2
- package/dist/{buildSignedMobileRequest-42meR4yV.d.ts.map → buildSignedMobileRequest-BqLRFLKV.d.ts.map} +1 -1
- package/dist/{buildSignedMobileRequest-BDxji7Vy.d.cts → buildSignedMobileRequest-DkkwEqIu.d.cts} +2 -2
- package/dist/{buildSignedMobileRequest-BDxji7Vy.d.cts.map → buildSignedMobileRequest-DkkwEqIu.d.cts.map} +1 -1
- package/dist/{canonicalize-BebHhHcF.d.ts → canonicalize-BRhCpYm1.d.ts} +2 -2
- package/dist/canonicalize-BRhCpYm1.d.ts.map +1 -0
- package/dist/{canonicalize-CIDJLLgg.d.cts → canonicalize-DtpaaA2B.d.cts} +2 -2
- package/dist/canonicalize-DtpaaA2B.d.cts.map +1 -0
- package/dist/{clientTypes-2I3x4TTt.d.ts → clientTypes-CB_itU4Z.d.ts} +26 -21
- package/dist/clientTypes-CB_itU4Z.d.ts.map +1 -0
- package/dist/{clientTypes-tLld8E6J.d.cts → clientTypes-CceWsQzi.d.cts} +26 -21
- package/dist/clientTypes-CceWsQzi.d.cts.map +1 -0
- package/dist/dataMappers.cjs +16 -2
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +13 -7
- package/dist/dataMappers.d.cts.map +1 -1
- package/dist/dataMappers.d.ts +13 -7
- package/dist/dataMappers.d.ts.map +1 -1
- package/dist/dataMappers.js +15 -2
- package/dist/dataMappers.js.map +1 -1
- package/dist/{eip712MethodByType-2-vyN5SU.d.cts → eip712MethodByType-1xUkvTIp.d.cts} +2 -2
- package/dist/eip712MethodByType-1xUkvTIp.d.cts.map +1 -0
- package/dist/{eip712MethodByType-CAVpvZoS.d.ts → eip712MethodByType-CrqBJIrp.d.ts} +2 -2
- package/dist/eip712MethodByType-CrqBJIrp.d.ts.map +1 -0
- package/dist/endpoints.cjs +3 -3
- package/dist/endpoints.cjs.map +1 -1
- package/dist/endpoints.js +3 -3
- package/dist/endpoints.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/{payloadHash-BVPYKdk4.d.cts → payloadHash-CIo8Hkh6.d.cts} +2 -2
- package/dist/payloadHash-CIo8Hkh6.d.cts.map +1 -0
- package/dist/{payloadHash-DMqE5aMo.d.ts → payloadHash-Cv4WwZCZ.d.ts} +2 -2
- package/dist/payloadHash-Cv4WwZCZ.d.ts.map +1 -0
- package/dist/{serverBaseTypes-DPB1vEvv.d.ts → serverBaseTypes-C2JGib--.d.ts} +2 -2
- package/dist/{serverBaseTypes-DPB1vEvv.d.ts.map → serverBaseTypes-C2JGib--.d.ts.map} +1 -1
- package/dist/{serverBaseTypes-BybrVE6L.d.cts → serverBaseTypes-YkCmgmt1.d.cts} +2 -2
- package/dist/{serverBaseTypes-BybrVE6L.d.cts.map → serverBaseTypes-YkCmgmt1.d.cts.map} +1 -1
- package/dist/{serverExecuteTypes-ih4Xbr3J.d.ts → serverExecuteTypes-C2NoNEwu.d.ts} +3 -3
- package/dist/{serverExecuteTypes-ih4Xbr3J.d.ts.map → serverExecuteTypes-C2NoNEwu.d.ts.map} +1 -1
- package/dist/{serverExecuteTypes-DoR0InCd.d.cts → serverExecuteTypes-DPZbs9ym.d.cts} +3 -3
- package/dist/{serverExecuteTypes-DoR0InCd.d.cts.map → serverExecuteTypes-DPZbs9ym.d.cts.map} +1 -1
- package/dist/{serverModelTypes-KSm0CAcF.d.cts → serverModelTypes-CDcRlRtw.d.ts} +8 -5
- package/dist/serverModelTypes-CDcRlRtw.d.ts.map +1 -0
- package/dist/{serverModelTypes-DV-eARP8.d.ts → serverModelTypes-CUzqFA6x.d.cts} +8 -5
- package/dist/serverModelTypes-CUzqFA6x.d.cts.map +1 -0
- package/dist/{serverQueryTypes-LygPrZn7.d.ts → serverQueryTypes-B0xI1G39.d.ts} +16 -27
- package/dist/serverQueryTypes-B0xI1G39.d.ts.map +1 -0
- package/dist/{serverQueryTypes-B9OOpiJB.d.cts → serverQueryTypes-RdcIqRnM.d.cts} +16 -27
- package/dist/serverQueryTypes-RdcIqRnM.d.cts.map +1 -0
- package/dist/{serverRequestTypes-q4xTJHk0.d.cts → serverRequestTypes-Ddws3yXc.d.cts} +35 -20
- package/dist/serverRequestTypes-Ddws3yXc.d.cts.map +1 -0
- package/dist/{serverRequestTypes-BDXIPjtw.d.ts → serverRequestTypes-Dv9NR-hQ.d.ts} +35 -20
- package/dist/serverRequestTypes-Dv9NR-hQ.d.ts.map +1 -0
- package/dist/{serverResponseGuards-BcdkKV30.d.ts → serverResponseGuards-BjIzucYt.d.ts} +2 -2
- package/dist/{serverResponseGuards-BcdkKV30.d.ts.map → serverResponseGuards-BjIzucYt.d.ts.map} +1 -1
- package/dist/{serverResponseGuards-k6xK1bZ1.d.cts → serverResponseGuards-Dg9WbqBA.d.cts} +2 -2
- package/dist/{serverResponseGuards-k6xK1bZ1.d.cts.map → serverResponseGuards-Dg9WbqBA.d.cts.map} +1 -1
- package/dist/signing/buildSignedMobileRequest.cjs +1 -1
- package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
- package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
- package/dist/signing/canonicalize.cjs +0 -12
- package/dist/signing/canonicalize.cjs.map +1 -1
- package/dist/signing/canonicalize.d.cts +1 -1
- package/dist/signing/canonicalize.d.ts +1 -1
- package/dist/signing/canonicalize.js +0 -12
- package/dist/signing/canonicalize.js.map +1 -1
- package/dist/signing/eip712MethodByType.cjs +1 -3
- package/dist/signing/eip712MethodByType.cjs.map +1 -1
- package/dist/signing/eip712MethodByType.d.cts +1 -1
- package/dist/signing/eip712MethodByType.d.ts +1 -1
- package/dist/signing/eip712MethodByType.js +1 -3
- package/dist/signing/eip712MethodByType.js.map +1 -1
- package/dist/signing/index.d.cts +5 -5
- package/dist/signing/index.d.ts +5 -5
- package/dist/signing/payloadHash.cjs +1 -1
- package/dist/signing/payloadHash.d.cts +1 -1
- package/dist/signing/payloadHash.d.ts +1 -1
- package/dist/signing/types.d.cts +1 -1
- package/dist/signing/types.d.ts +1 -1
- package/dist/types/MobileServerFailureError.cjs +1 -1
- package/dist/types/MobileServerFailureError.d.cts +1 -1
- package/dist/types/MobileServerFailureError.d.ts +1 -1
- package/dist/types/clientTypes.d.cts +2 -2
- package/dist/types/clientTypes.d.ts +2 -2
- package/dist/types/index.d.cts +8 -8
- package/dist/types/index.d.ts +8 -8
- package/dist/types/mobileErrorCodes.cjs +1 -1
- package/dist/types/serverBaseTypes.d.cts +1 -1
- package/dist/types/serverBaseTypes.d.ts +1 -1
- package/dist/types/serverExecuteTypes.d.cts +1 -1
- package/dist/types/serverExecuteTypes.d.ts +1 -1
- package/dist/types/serverModelTypes.cjs.map +1 -1
- package/dist/types/serverModelTypes.d.cts +1 -1
- package/dist/types/serverModelTypes.d.ts +1 -1
- package/dist/types/serverModelTypes.js.map +1 -1
- package/dist/types/serverQueryTypes.d.cts +2 -2
- package/dist/types/serverQueryTypes.d.ts +2 -2
- package/dist/types/serverRequestTypes.d.cts +2 -2
- package/dist/types/serverRequestTypes.d.ts +2 -2
- package/dist/{types-B8lDIhBP.d.ts → types-BIIvIzG2.d.ts} +3 -13
- package/dist/types-BIIvIzG2.d.ts.map +1 -0
- package/dist/{types-CClB00EN.d.cts → types-UmYaeq1C.d.cts} +3 -13
- package/dist/types-UmYaeq1C.d.cts.map +1 -0
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/serverResponseGuards.d.cts +1 -1
- package/dist/utils/serverResponseGuards.d.ts +1 -1
- package/package.json +3 -3
- package/src/MobileClient.ts +49 -70
- package/src/dataMappers.ts +22 -2
- package/src/endpoints.ts +3 -3
- package/src/signing/canonicalize.ts +0 -14
- package/src/signing/eip712MethodByType.ts +0 -2
- package/src/signing/signing.test.ts +0 -26
- package/src/signing/types.ts +0 -16
- package/src/types/clientTypes.ts +23 -19
- package/src/types/serverModelTypes.ts +7 -4
- package/src/types/serverQueryTypes.ts +12 -29
- package/src/types/serverRequestTypes.ts +32 -21
- package/dist/MobileClient-C9S_o_eC.cjs.map +0 -1
- package/dist/canonicalize-BebHhHcF.d.ts.map +0 -1
- package/dist/canonicalize-CIDJLLgg.d.cts.map +0 -1
- package/dist/clientTypes-2I3x4TTt.d.ts.map +0 -1
- package/dist/clientTypes-tLld8E6J.d.cts.map +0 -1
- package/dist/eip712MethodByType-2-vyN5SU.d.cts.map +0 -1
- package/dist/eip712MethodByType-CAVpvZoS.d.ts.map +0 -1
- package/dist/payloadHash-BVPYKdk4.d.cts.map +0 -1
- package/dist/payloadHash-DMqE5aMo.d.ts.map +0 -1
- package/dist/serverModelTypes-DV-eARP8.d.ts.map +0 -1
- package/dist/serverModelTypes-KSm0CAcF.d.cts.map +0 -1
- package/dist/serverQueryTypes-B9OOpiJB.d.cts.map +0 -1
- package/dist/serverQueryTypes-LygPrZn7.d.ts.map +0 -1
- package/dist/serverRequestTypes-BDXIPjtw.d.ts.map +0 -1
- package/dist/serverRequestTypes-q4xTJHk0.d.cts.map +0 -1
- package/dist/types-B8lDIhBP.d.ts.map +0 -1
- package/dist/types-CClB00EN.d.cts.map +0 -1
package/README.md
CHANGED
|
@@ -46,25 +46,25 @@ await mobile.setUsername({
|
|
|
46
46
|
|
|
47
47
|
### Public Queries
|
|
48
48
|
|
|
49
|
-
`getUsernameAvailability`, `getProfiles`, `
|
|
49
|
+
`getUsernameAvailability`, `getProfiles`, `getFollowers`, `getFollowing`, `getFeed`,
|
|
50
|
+
`getNotificationPreferences`, `getRegisteredWallet`.
|
|
50
51
|
|
|
51
52
|
`getProfiles` is the only profile route: it batches up to 25 subaccounts, returns them in the requested order,
|
|
52
53
|
and carries follower totals (`include.followCounts`) and a follow summary (`include.followSummary.viewAs`) as
|
|
53
|
-
opt-in includes, so use it for a single subaccount too.
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
opt-in includes, so use it for a single subaccount too. The backend still serves the older singular `profile`
|
|
55
|
+
request for compatibility, but it returns base fields only and costs more weight than the batched equivalent,
|
|
56
|
+
so the SDK does not expose it.
|
|
57
|
+
|
|
58
|
+
`getFollowers` and `getFollowing` take an optional `viewAs`, which selects a viewer perspective rather than
|
|
59
|
+
proving one: with it the page is ordered familiar-first and every row carries an `isFollowing`, without it the
|
|
60
|
+
page is ordered by the listed relationship alone and `isFollowing` is absent rather than `false`. As with
|
|
61
|
+
`include.followSummary.viewAs`, an unsigned route means the claimed viewer is not verified.
|
|
56
62
|
|
|
57
63
|
### Public Executes
|
|
58
64
|
|
|
59
65
|
`unregisterExpoToken`, `updateNotificationPreferences`. These are authenticated by possession of an active Expo
|
|
60
66
|
push token rather than a wallet signature, so they still work at logout when a signature may be unobtainable.
|
|
61
67
|
|
|
62
|
-
### Signed Queries
|
|
63
|
-
|
|
64
|
-
`getFollowers`, `getFollowing`. Both follow list reads are signed because the rows carry an `isFollowing`
|
|
65
|
-
relative to the signing Viewer, which has to be proven rather than claimed — including on each paginated
|
|
66
|
-
request.
|
|
67
|
-
|
|
68
68
|
### Signed Executes
|
|
69
69
|
|
|
70
70
|
`setUsername`, `setPrivateMode`, `registerExpoToken`, `setFollow`.
|
|
@@ -70,8 +70,7 @@ var MobileClient = class {
|
|
|
70
70
|
* does not hide the profile itself, only the account's activity.
|
|
71
71
|
*
|
|
72
72
|
* This is the only profile route, so use it for a single subaccount too. It is unsigned, which means
|
|
73
|
-
* `include.followSummary.viewAs` is an unauthenticated claim
|
|
74
|
-
* because they prove the viewer.
|
|
73
|
+
* `include.followSummary.viewAs` is an unauthenticated claim.
|
|
75
74
|
*
|
|
76
75
|
* @throws {MobileServerFailureError} With error code `INVALID_PROFILES_REQUEST` if `subaccounts` is empty,
|
|
77
76
|
* holds duplicates, or exceeds `MOBILE_PROFILES_MAX_BATCH_SIZE` (25), or `PROFILE_NOT_FOUND` if any
|
|
@@ -87,6 +86,40 @@ var MobileClient = class {
|
|
|
87
86
|
return (await this.publicQuery(body)).profiles.map(require_dataMappers.mapMobilePublicProfile);
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
89
|
+
* Fetches a page of the accounts that follow the given Profile.
|
|
90
|
+
*
|
|
91
|
+
* Ordering depends on `viewAs`. With it, accounts the Viewer already follows come first, unfamiliar
|
|
92
|
+
* accounts second, and every row carries an `isFollowing`. Without it, the page is ordered by the listed
|
|
93
|
+
* relationship alone and no row carries an `isFollowing`. In both cases the newest listed relationship
|
|
94
|
+
* comes first within a group, with a bytes32 tie-break. The grouping is evaluated per request against the
|
|
95
|
+
* live graph, so following an account from inside the list moves it between groups on the next page —
|
|
96
|
+
* deduplicate by subaccount and do not re-sort locally.
|
|
97
|
+
*
|
|
98
|
+
* @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile or `viewAs`
|
|
99
|
+
* is isolated, `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different `viewAs`,
|
|
100
|
+
* Profile, or list direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if
|
|
101
|
+
* `limit` is outside 1–50.
|
|
102
|
+
*/
|
|
103
|
+
async getFollowers(params) {
|
|
104
|
+
const body = {
|
|
105
|
+
type: "followers",
|
|
106
|
+
...require_dataMappers.mapMobileFollowListParamsToServer(params)
|
|
107
|
+
};
|
|
108
|
+
return require_dataMappers.mapMobileFollowListPage(await this.publicQuery(body));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match
|
|
112
|
+
* {@link MobileClient.getFollowers}. When `viewAs` reads its own Following list every row is familiar, so
|
|
113
|
+
* every `isFollowing` is `true`.
|
|
114
|
+
*/
|
|
115
|
+
async getFollowing(params) {
|
|
116
|
+
const body = {
|
|
117
|
+
type: "following",
|
|
118
|
+
...require_dataMappers.mapMobileFollowListParamsToServer(params)
|
|
119
|
+
};
|
|
120
|
+
return require_dataMappers.mapMobileFollowListPage(await this.publicQuery(body));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
90
123
|
* Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a
|
|
91
124
|
* whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a
|
|
92
125
|
* username are included with `null` name fields; only private accounts are filtered out. The feed is
|
|
@@ -177,40 +210,6 @@ var MobileClient = class {
|
|
|
177
210
|
return this.publicExecute(body);
|
|
178
211
|
}
|
|
179
212
|
/**
|
|
180
|
-
* Fetches a page of the accounts that follow the given Profile.
|
|
181
|
-
*
|
|
182
|
-
* Familiar accounts (those the signing Viewer follows) come first, unfamiliar second, and within each group
|
|
183
|
-
* the newest listed relationship first with a bytes32 tie-break. The grouping is evaluated per request
|
|
184
|
-
* against the live graph, so following an account from inside the list moves it between groups on the next
|
|
185
|
-
* page — deduplicate by subaccount and do not re-sort locally.
|
|
186
|
-
*
|
|
187
|
-
* @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile is isolated,
|
|
188
|
-
* `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different Viewer, Profile, or list
|
|
189
|
-
* direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if `limit` is outside
|
|
190
|
-
* 1–50.
|
|
191
|
-
*/
|
|
192
|
-
async getFollowers(params) {
|
|
193
|
-
const signedRequest = await this.getSignedRequest("followers", params, {
|
|
194
|
-
subaccount: (0, _nadohq_shared.subaccountToHex)(params.target),
|
|
195
|
-
cursor: params.cursor ?? null,
|
|
196
|
-
limit: params.limit ?? null
|
|
197
|
-
});
|
|
198
|
-
return require_dataMappers.mapMobileFollowListPage(await this.signedQuery(signedRequest));
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match
|
|
202
|
-
* {@link MobileClient.getFollowers}. When the Viewer reads their own Following list every row is familiar,
|
|
203
|
-
* so every `isFollowing` is `true`.
|
|
204
|
-
*/
|
|
205
|
-
async getFollowing(params) {
|
|
206
|
-
const signedRequest = await this.getSignedRequest("following", params, {
|
|
207
|
-
subaccount: (0, _nadohq_shared.subaccountToHex)(params.target),
|
|
208
|
-
cursor: params.cursor ?? null,
|
|
209
|
-
limit: params.limit ?? null
|
|
210
|
-
});
|
|
211
|
-
return require_dataMappers.mapMobileFollowListPage(await this.signedQuery(signedRequest));
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
213
|
* Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
|
|
215
214
|
* username and renames an existing one, so callers never need to read the current identity first.
|
|
216
215
|
*
|
|
@@ -284,25 +283,19 @@ var MobileClient = class {
|
|
|
284
283
|
});
|
|
285
284
|
}
|
|
286
285
|
async publicQuery(body) {
|
|
287
|
-
const response = await this.axiosInstance.post(`${this.opts.url}/
|
|
286
|
+
const response = await this.axiosInstance.post(`${this.opts.url}/public_query`, body);
|
|
288
287
|
this.checkResponseStatus(response);
|
|
289
288
|
this.checkServerStatus(response);
|
|
290
289
|
return response.data;
|
|
291
290
|
}
|
|
292
291
|
async publicExecute(body) {
|
|
293
|
-
const response = await this.axiosInstance.post(`${this.opts.url}/
|
|
292
|
+
const response = await this.axiosInstance.post(`${this.opts.url}/public_execute`, body);
|
|
294
293
|
this.checkResponseStatus(response);
|
|
295
294
|
this.checkServerStatus(response);
|
|
296
295
|
return response.data;
|
|
297
296
|
}
|
|
298
297
|
async execute(body) {
|
|
299
|
-
const response = await this.axiosInstance.post(`${this.opts.url}/
|
|
300
|
-
this.checkResponseStatus(response);
|
|
301
|
-
this.checkServerStatus(response);
|
|
302
|
-
return response.data;
|
|
303
|
-
}
|
|
304
|
-
async signedQuery(body) {
|
|
305
|
-
const response = await this.axiosInstance.post(`${this.opts.url}/mobile/query`, body);
|
|
298
|
+
const response = await this.axiosInstance.post(`${this.opts.url}/execute`, body);
|
|
306
299
|
this.checkResponseStatus(response);
|
|
307
300
|
this.checkServerStatus(response);
|
|
308
301
|
return response.data;
|
|
@@ -337,4 +330,4 @@ Object.defineProperty(exports, "__toESM", {
|
|
|
337
330
|
}
|
|
338
331
|
});
|
|
339
332
|
|
|
340
|
-
//# sourceMappingURL=MobileClient-
|
|
333
|
+
//# sourceMappingURL=MobileClient-Duy7MvxN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MobileClient-Duy7MvxN.cjs","names":["subaccountToHex","mapMobileProfilesIncludeToServer","mapMobilePublicProfile","mapMobileFollowListParamsToServer","mapMobileFollowListPage","mapMobileFeedPage","mapMobileNotificationPreferences","mapMobileRegisteredWallet","mapMobileNotificationPreferencesToServer","mapMobileFollowMutationResult","WalletNotProvidedError","buildSignedMobileRequest","isMobileServerFailureResponse","MobileServerFailureError","isMobileServerSuccessResponse"],"sources":["../src/MobileClient.ts"],"sourcesContent":["import {\n getNadoClientTypeHeaders,\n subaccountToHex,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapMobileFeedPage,\n mapMobileFollowListPage,\n mapMobileFollowListParamsToServer,\n mapMobileFollowMutationResult,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobileProfilesIncludeToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredWallet,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerByType,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedParams,\n GetMobileFollowersParams,\n GetMobileFollowingParams,\n GetMobileNotificationPreferencesParams,\n GetMobileProfilesParams,\n GetMobileRegisteredWalletParams,\n GetMobileUsernameAvailabilityParams,\n MobileFeedPage,\n MobileFollowListPage,\n MobileFollowMutationResult,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredWallet,\n MobileRegisterExpoTokenParams,\n MobileSetFollowParams,\n MobileSetPrivateModeParams,\n MobileSetUsernameParams,\n MobileSignedRequestParams,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUsernameAvailability,\n} from './types/clientTypes';\nimport { MobileServerFailureError } from './types/MobileServerFailureError';\nimport { MobileServerSuccessResponse } from './types/serverBaseTypes';\nimport {\n MobileServerExecuteResult,\n MobileServerExecuteSuccessResponse,\n MobileServerPublicExecuteRequest,\n} from './types/serverExecuteTypes';\nimport {\n MobileServerPublicQueryRequest,\n MobileServerPublicQuerySuccessResponse,\n} from './types/serverQueryTypes';\nimport {\n MobileServerExecuteRequestType,\n MobileServerPublicQueryRequestByType,\n MobileServerPublicQueryRequestType,\n} from './types/serverRequestTypes';\nimport {\n isMobileServerFailureResponse,\n isMobileServerSuccessResponse,\n} from './utils/serverResponseGuards';\n\n/**\n * Options for constructing a {@link MobileClient}.\n */\nexport interface MobileClientOpts {\n /**\n * Base URL of the mobile service API, e.g. {@link MOBILE_CLIENT_ENDPOINTS}.\n */\n url: string;\n /**\n * Wallet client used to sign requests.\n */\n walletClient?: WalletClientWithAccount;\n /**\n * If provided, this signer is used instead of `walletClient` for all signed requests.\n */\n linkedSignerWalletClient?: WalletClientWithAccount;\n /**\n * If provided, identifies the calling client, sent as a header with every request.\n */\n clientType?: string;\n}\n\n/**\n * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, the\n * follower/following graph, privacy settings, and push notification device/preference management.\n */\nexport class MobileClient {\n readonly opts: MobileClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: MobileClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n headers: getNadoClientTypeHeaders(opts.clientType),\n });\n }\n\n /**\n * Sets the linked signer for requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n /*\n Public queries\n */\n\n /**\n * Checks whether a username derived from the given display name is available to claim.\n */\n async getUsernameAvailability(\n params: GetMobileUsernameAvailabilityParams,\n ): Promise<MobileUsernameAvailability> {\n const body: MobileServerPublicQueryRequest<'username_availability'> = {\n type: 'username_availability',\n display_name: params.displayName,\n };\n const data = await this.publicQuery(body);\n return { username: data.username, available: data.available };\n }\n\n /**\n * Looks up public profiles, optionally with follower totals and a follow summary. Returns one profile per\n * requested subaccount, in the requested order, so callers can correlate positionally. Every non-isolated\n * subaccount resolves, with `username` and `displayName` `null` until a username is claimed. Private Mode\n * does not hide the profile itself, only the account's activity.\n *\n * This is the only profile route, so use it for a single subaccount too. It is unsigned, which means\n * `include.followSummary.viewAs` is an unauthenticated claim.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PROFILES_REQUEST` if `subaccounts` is empty,\n * holds duplicates, or exceeds `MOBILE_PROFILES_MAX_BATCH_SIZE` (25), or `PROFILE_NOT_FOUND` if any\n * requested subaccount — or the follow summary's `viewAs` — is in the engine-created isolated namespace.\n * One isolated member fails the whole batch rather than being omitted.\n */\n async getProfiles(\n params: GetMobileProfilesParams,\n ): Promise<MobilePublicProfile[]> {\n const body: MobileServerPublicQueryRequest<'profiles'> = {\n type: 'profiles',\n subaccounts: params.subaccounts.map(subaccountToHex),\n include: params.include\n ? mapMobileProfilesIncludeToServer(params.include)\n : undefined,\n };\n const data = await this.publicQuery(body);\n return data.profiles.map(mapMobilePublicProfile);\n }\n\n /**\n * Fetches a page of the accounts that follow the given Profile.\n *\n * Ordering depends on `viewAs`. With it, accounts the Viewer already follows come first, unfamiliar\n * accounts second, and every row carries an `isFollowing`. Without it, the page is ordered by the listed\n * relationship alone and no row carries an `isFollowing`. In both cases the newest listed relationship\n * comes first within a group, with a bytes32 tie-break. The grouping is evaluated per request against the\n * live graph, so following an account from inside the list moves it between groups on the next page —\n * deduplicate by subaccount and do not re-sort locally.\n *\n * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile or `viewAs`\n * is isolated, `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different `viewAs`,\n * Profile, or list direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if\n * `limit` is outside 1–50.\n */\n async getFollowers(\n params: GetMobileFollowersParams,\n ): Promise<MobileFollowListPage> {\n const body: MobileServerPublicQueryRequest<'followers'> = {\n type: 'followers',\n ...mapMobileFollowListParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileFollowListPage(data);\n }\n\n /**\n * Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match\n * {@link MobileClient.getFollowers}. When `viewAs` reads its own Following list every row is familiar, so\n * every `isFollowing` is `true`.\n */\n async getFollowing(\n params: GetMobileFollowingParams,\n ): Promise<MobileFollowListPage> {\n const body: MobileServerPublicQueryRequest<'following'> = {\n type: 'following',\n ...mapMobileFollowListParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileFollowListPage(data);\n }\n\n /**\n * Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a\n * whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a\n * username are included with `null` name fields; only private accounts are filtered out. The feed is\n * best-effort rather than authoritative history, and pagination is live (not snapshot), so deduplicate pages\n * by {@link MobileFeedTrade.orderDigest}.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or\n * `limit` is outside its allowed domain (fix the request; do not retry unchanged), or\n * `INVALID_FEED_CURSOR` if the cursor is malformed or was issued for a different `minimumNotional`\n * (discard the cursor and restart from the first page).\n */\n async getFeed(params: GetMobileFeedParams = {}): Promise<MobileFeedPage> {\n const body: MobileServerPublicQueryRequest<'feed'> = {\n type: 'feed',\n minimum_notional: params.minimumNotional,\n limit: params.limit,\n cursor: params.cursor,\n };\n const data = await this.publicQuery(body);\n return mapMobileFeedPage(data);\n }\n\n /**\n * Fetches the push notification preferences of the wallet that owns the given Expo push token. Unsigned —\n * the token identifies the wallet on its own. Falls back to the backend's defaults if the wallet has never\n * updated its preferences.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet.\n */\n async getNotificationPreferences(\n params: GetMobileNotificationPreferencesParams,\n ): Promise<MobileNotificationPreferences> {\n const body: MobileServerPublicQueryRequest<'notification_preferences'> = {\n type: 'notification_preferences',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileNotificationPreferences(data.preferences);\n }\n\n /**\n * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata\n * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check\n * whether a locally held token is still active and which wallet currently owns it, since registering the\n * same token under another wallet transfers ownership.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet — including a token that was unregistered. The backend does not\n * distinguish those cases.\n */\n async getRegisteredWallet(\n params: GetMobileRegisteredWalletParams,\n ): Promise<MobileRegisteredWallet> {\n const body: MobileServerPublicQueryRequest<'registered_wallet'> = {\n type: 'registered_wallet',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileRegisteredWallet(data);\n }\n\n /*\n Public executes\n */\n\n /**\n * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout\n * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown\n * well-formed token succeeds.\n *\n * A registration that commits after this call re-activates the token, so stop or await any in-flight\n * {@link MobileClient.registerExpoToken} before unregistering.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed.\n */\n async unregisterExpoToken(\n params: MobileUnregisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'unregister_expo_token'> = {\n type: 'unregister_expo_token',\n expo_token: params.expoToken,\n };\n return this.publicExecute(body);\n }\n\n /**\n * Replaces the push notification preferences of the wallet that owns the given Expo push token. Possession\n * of an active token is the credential rather than a signature, so anyone holding the token can overwrite\n * that wallet's preferences. The backend requires `schemaVersion` of 1, exactly one entry per known\n * category, and empty `scopes` on every entry.\n *\n * Writes are last-write-wins on commit order rather than ordered by a client nonce, so callers must\n * serialize their own preference writes.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or\n * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.\n */\n async updateNotificationPreferences(\n params: MobileUpdateNotificationPreferencesParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'update_preferences'> = {\n type: 'update_preferences',\n expo_token: params.expoToken,\n preferences: mapMobileNotificationPreferencesToServer(params.preferences),\n };\n return this.publicExecute(body);\n }\n\n /*\n Signed executes\n */\n\n /**\n * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first\n * username and renames an existing one, so callers never need to read the current identity first.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_DISPLAY_NAME` if the display name violates\n * `MOBILE_DISPLAY_NAME_PATTERN`, `USERNAME_UNAVAILABLE` if the derived username is reserved or already\n * taken by another subaccount, `INVALID_IDENTITY_TARGET` if the sender is in the engine-created isolated\n * namespace, or `STALE_IDENTITY_UPDATE` if another identity write for this subaccount committed with a\n * later nonce (re-read the identity before retrying).\n */\n async setUsername(\n params: MobileSetUsernameParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_username', params, {\n display_name: params.displayName,\n });\n return this.execute(signedRequest);\n }\n\n /**\n * Sets whether a subaccount's profile is private.\n */\n async setPrivateMode(\n params: MobileSetPrivateModeParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'set_private_mode',\n params,\n { private_mode: params.privateMode },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Registers an Expo push token for the wallet, transferring active ownership of the token if another\n * wallet had registered it. Idempotent per `(wallet, token)`.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is not a valid Expo\n * push token, or `INVALID_DEVICE_METADATA` if `locale` (max 35 chars) or `appVersion` (max 64 chars) is\n * too long.\n */\n async registerExpoToken(\n params: MobileRegisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'register_expo_token',\n params,\n {\n expo_token: params.expoToken,\n platform: params.platform,\n locale: params.locale ?? null,\n app_version: params.appVersion ?? null,\n },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Sets whether the signing subaccount follows a Profile. Both directions are idempotent: following again\n * keeps the original relationship creation time, so it does not move the account in recency order, and\n * unfollowing a relationship that does not exist succeeds with `isFollowing: false`. Unfollowing deletes\n * the relationship rather than deactivating it, so a later follow gets a new creation time and moves the\n * account to the front of recency order.\n *\n * Only `isFollowing: true` is checked against the canonical Query DB subaccount index, so unfollowing still\n * works while that index lags.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_FOLLOW_TARGET` if the target is the sender or\n * either party is isolated, `FOLLOWER_NOT_ELIGIBLE` if the sender is not yet in the canonical Query DB\n * subaccount index, or `FOLLOWING_NOT_FOUND` if the target is not. Both index errors are transient for an\n * account that is being recorded, so they are retryable after catch-up — unlike `INVALID_FOLLOW_TARGET`.\n */\n async setFollow(\n params: MobileSetFollowParams,\n ): Promise<MobileFollowMutationResult> {\n const signedRequest = await this.getSignedRequest('set_follow', params, {\n subaccount: subaccountToHex(params.target),\n is_following: params.isFollowing,\n });\n const data = await this.execute(signedRequest);\n return mapMobileFollowMutationResult(data);\n }\n\n /*\n Base Fns\n */\n\n // Returns the request narrowed to `type` so `execute` can infer its response from the request it is given,\n // instead of being told the type a second time at the call site.\n protected async getSignedRequest<T extends MobileSignedInner['type']>(\n type: T,\n params: MobileSignedRequestParams,\n innerParams: MobileSignedInnerParams<T>,\n ): Promise<MobileSignedRequest<MobileSignedInnerByType<T>>> {\n // Use the linked signer if provided, otherwise use the default signer provided to the client\n const walletClient =\n this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n\n if (walletClient == null) {\n throw new WalletNotProvidedError();\n }\n\n const inner = {\n type,\n ...innerParams,\n } as unknown as MobileSignedInnerByType<T>;\n return buildSignedMobileRequest({ ...params, walletClient, inner });\n }\n\n // Spelled out as an intersection rather than `MobileServerPublicQueryRequest<T>`: the latter is an indexed\n // access on a mapped type, which is not an inference site, so `T` would always widen to the full union.\n protected async publicQuery<T extends MobileServerPublicQueryRequestType>(\n body: { type: T } & MobileServerPublicQueryRequestByType[T],\n ): Promise<MobileServerPublicQuerySuccessResponse<T>> {\n const response = await this.axiosInstance.post<unknown>(\n `${this.opts.url}/public_query`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n return response.data as MobileServerPublicQuerySuccessResponse<T>;\n }\n\n protected async publicExecute(\n body: MobileServerPublicExecuteRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/public_execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerSuccessResponse;\n }\n\n // `T` is inferred from the body's `type` rather than declared by the caller, for the same reason\n // `publicQuery` spells its body out as an intersection: an indexed access is not an inference site.\n protected async execute<T extends MobileServerExecuteRequestType>(\n body: MobileSignedRequest & { type: T },\n ): Promise<MobileServerExecuteSuccessResponse<T>> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerExecuteSuccessResponse<T>;\n }\n\n /**\n * Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns\n * failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a\n * failure envelope still throws the typed error; anything else is a transport-level error.\n */\n private checkResponseStatus(response: AxiosResponse<unknown>) {\n if (response.status >= 200 && response.status < 300) {\n return;\n }\n if (isMobileServerFailureResponse(response.data)) {\n throw new MobileServerFailureError(response.data, response.status);\n }\n throw new Error(\n `Unexpected response from mobile service: ${response.status} ${response.statusText}. Data: ${JSON.stringify(response.data)}`,\n );\n }\n\n private checkServerStatus(response: AxiosResponse<unknown>) {\n const { data } = response;\n\n if (isMobileServerFailureResponse(data)) {\n throw new MobileServerFailureError(data, response.status);\n }\n if (!isMobileServerSuccessResponse(data)) {\n throw new Error(\n `Unexpected response from mobile service: missing success envelope. Data: ${JSON.stringify(data)}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,IAAa,eA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AU,KAAK,UAAU,SAAS,IAAI,GAC3H;CACF;CAEA,kBAA0B,UAAkC;EAC1D,MAAM,EAAE,SAAS;EAEjB,IAAID,mCAAAA,8BAA8B,IAAI,GACpC,MAAM,IAAIC,uCAAAA,yBAAyB,MAAM,SAAS,MAAM;EAE1D,IAAI,CAACC,mCAAAA,8BAA8B,IAAI,GACrC,MAAM,IAAI,MACR,4EAA4E,KAAK,UAAU,IAAI,GACjG;CAEJ;AACF"}
|
package/dist/MobileClient.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_MobileClient = require("./MobileClient-
|
|
2
|
+
const require_MobileClient = require("./MobileClient-Duy7MvxN.cjs");
|
|
3
3
|
require("./signing/index.cjs");
|
|
4
4
|
exports.MobileClient = require_MobileClient.MobileClient;
|
package/dist/MobileClient.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as MobileSignedRequest, i as MobileSignedInnerParams, n as MobileSignedInner, r as MobileSignedInnerByType } from "./types-
|
|
3
|
-
import {
|
|
4
|
-
import { n as MobileServerSuccessResponse } from "./serverBaseTypes-
|
|
5
|
-
import { i as MobileServerExecuteSuccessResponse, o as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-
|
|
6
|
-
import { s as MobileServerPublicQuerySuccessResponse
|
|
1
|
+
import { A as MobileUsernameAvailability, C as MobileRegisteredWallet, D as MobileSignedRequestParams, E as MobileSetUsernameParams, O as MobileUnregisterExpoTokenParams, S as MobileRegisterExpoTokenParams, T as MobileSetPrivateModeParams, a as GetMobileNotificationPreferencesParams, c as GetMobileUsernameAvailabilityParams, i as GetMobileFollowingParams, k as MobileUpdateNotificationPreferencesParams, m as MobileFollowMutationResult, o as GetMobileProfilesParams, p as MobileFollowListPage, r as GetMobileFollowersParams, s as GetMobileRegisteredWalletParams, t as GetMobileFeedParams, u as MobileFeedPage, w as MobileSetFollowParams, x as MobilePublicProfile, y as MobileNotificationPreferences } from "./clientTypes-CceWsQzi.cjs";
|
|
2
|
+
import { a as MobileSignedRequest, i as MobileSignedInnerParams, n as MobileSignedInner, r as MobileSignedInnerByType } from "./types-UmYaeq1C.cjs";
|
|
3
|
+
import { o as MobileServerPublicQueryRequestByType, s as MobileServerPublicQueryRequestType, t as MobileServerExecuteRequestType } from "./serverRequestTypes-Ddws3yXc.cjs";
|
|
4
|
+
import { n as MobileServerSuccessResponse } from "./serverBaseTypes-YkCmgmt1.cjs";
|
|
5
|
+
import { i as MobileServerExecuteSuccessResponse, o as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-DPZbs9ym.cjs";
|
|
6
|
+
import { s as MobileServerPublicQuerySuccessResponse } from "./serverQueryTypes-RdcIqRnM.cjs";
|
|
7
7
|
import { WalletClientWithAccount } from "@nadohq/shared";
|
|
8
8
|
import { AxiosInstance } from "axios";
|
|
9
9
|
|
|
@@ -54,8 +54,7 @@ declare class MobileClient {
|
|
|
54
54
|
* does not hide the profile itself, only the account's activity.
|
|
55
55
|
*
|
|
56
56
|
* This is the only profile route, so use it for a single subaccount too. It is unsigned, which means
|
|
57
|
-
* `include.followSummary.viewAs` is an unauthenticated claim
|
|
58
|
-
* because they prove the viewer.
|
|
57
|
+
* `include.followSummary.viewAs` is an unauthenticated claim.
|
|
59
58
|
*
|
|
60
59
|
* @throws {MobileServerFailureError} With error code `INVALID_PROFILES_REQUEST` if `subaccounts` is empty,
|
|
61
60
|
* holds duplicates, or exceeds `MOBILE_PROFILES_MAX_BATCH_SIZE` (25), or `PROFILE_NOT_FOUND` if any
|
|
@@ -63,6 +62,28 @@ declare class MobileClient {
|
|
|
63
62
|
* One isolated member fails the whole batch rather than being omitted.
|
|
64
63
|
*/
|
|
65
64
|
getProfiles(params: GetMobileProfilesParams): Promise<MobilePublicProfile[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Fetches a page of the accounts that follow the given Profile.
|
|
67
|
+
*
|
|
68
|
+
* Ordering depends on `viewAs`. With it, accounts the Viewer already follows come first, unfamiliar
|
|
69
|
+
* accounts second, and every row carries an `isFollowing`. Without it, the page is ordered by the listed
|
|
70
|
+
* relationship alone and no row carries an `isFollowing`. In both cases the newest listed relationship
|
|
71
|
+
* comes first within a group, with a bytes32 tie-break. The grouping is evaluated per request against the
|
|
72
|
+
* live graph, so following an account from inside the list moves it between groups on the next page —
|
|
73
|
+
* deduplicate by subaccount and do not re-sort locally.
|
|
74
|
+
*
|
|
75
|
+
* @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile or `viewAs`
|
|
76
|
+
* is isolated, `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different `viewAs`,
|
|
77
|
+
* Profile, or list direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if
|
|
78
|
+
* `limit` is outside 1–50.
|
|
79
|
+
*/
|
|
80
|
+
getFollowers(params: GetMobileFollowersParams): Promise<MobileFollowListPage>;
|
|
81
|
+
/**
|
|
82
|
+
* Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match
|
|
83
|
+
* {@link MobileClient.getFollowers}. When `viewAs` reads its own Following list every row is familiar, so
|
|
84
|
+
* every `isFollowing` is `true`.
|
|
85
|
+
*/
|
|
86
|
+
getFollowing(params: GetMobileFollowingParams): Promise<MobileFollowListPage>;
|
|
66
87
|
/**
|
|
67
88
|
* Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a
|
|
68
89
|
* whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a
|
|
@@ -120,26 +141,6 @@ declare class MobileClient {
|
|
|
120
141
|
* `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.
|
|
121
142
|
*/
|
|
122
143
|
updateNotificationPreferences(params: MobileUpdateNotificationPreferencesParams): Promise<MobileServerSuccessResponse>;
|
|
123
|
-
/**
|
|
124
|
-
* Fetches a page of the accounts that follow the given Profile.
|
|
125
|
-
*
|
|
126
|
-
* Familiar accounts (those the signing Viewer follows) come first, unfamiliar second, and within each group
|
|
127
|
-
* the newest listed relationship first with a bytes32 tie-break. The grouping is evaluated per request
|
|
128
|
-
* against the live graph, so following an account from inside the list moves it between groups on the next
|
|
129
|
-
* page — deduplicate by subaccount and do not re-sort locally.
|
|
130
|
-
*
|
|
131
|
-
* @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile is isolated,
|
|
132
|
-
* `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different Viewer, Profile, or list
|
|
133
|
-
* direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if `limit` is outside
|
|
134
|
-
* 1–50.
|
|
135
|
-
*/
|
|
136
|
-
getFollowers(params: GetMobileFollowersParams): Promise<MobileFollowListPage>;
|
|
137
|
-
/**
|
|
138
|
-
* Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match
|
|
139
|
-
* {@link MobileClient.getFollowers}. When the Viewer reads their own Following list every row is familiar,
|
|
140
|
-
* so every `isFollowing` is `true`.
|
|
141
|
-
*/
|
|
142
|
-
getFollowing(params: GetMobileFollowingParams): Promise<MobileFollowListPage>;
|
|
143
144
|
/**
|
|
144
145
|
* Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
|
|
145
146
|
* username and renames an existing one, so callers never need to read the current identity first.
|
|
@@ -188,9 +189,6 @@ declare class MobileClient {
|
|
|
188
189
|
protected execute<T extends MobileServerExecuteRequestType>(body: MobileSignedRequest & {
|
|
189
190
|
type: T;
|
|
190
191
|
}): Promise<MobileServerExecuteSuccessResponse<T>>;
|
|
191
|
-
protected signedQuery<T extends MobileServerSignedQueryRequestType>(body: MobileSignedRequest & {
|
|
192
|
-
type: T;
|
|
193
|
-
}): Promise<MobileServerSignedQuerySuccessResponse<T>>;
|
|
194
192
|
/**
|
|
195
193
|
* Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns
|
|
196
194
|
* failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileClient.d.cts","names":[],"sources":["../src/src/MobileClient.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"MobileClient.d.cts","names":[],"sources":["../src/src/MobileClient.ts"],"mappings":";;;;;;;;;;;;;UAwEiB,gBAAA;EAAgB;;;EAI/B,GAAA;EAIA;;;EAAA,YAAA,GAAe,uBAAA;EAQf;;AAAU;EAJV,wBAAA,GAA2B,uBAAuB;EAW3B;;;EAPvB,UAAA;AAAA;;;;;cAOW,YAAA;EAAA,SACF,IAAA,EAAM,gBAAA;EAAA,SACN,aAAA,EAAe,aAAA;cAEZ,IAAA,EAAM,gBAAA;EAoFP;;;;;EArEJ,eAAA,CACL,wBAAA,EAA0B,uBAAA;EAyG6B;;;EA7FnD,uBAAA,CACJ,MAAA,EAAQ,mCAAA,GACP,OAAA,CAAQ,0BAAA;EAgHR;;;;;;;;;;;;;;EAzFG,WAAA,CACJ,MAAA,EAAQ,uBAAA,GACP,OAAA,CAAQ,mBAAA;EAgMR;;;;;;;;;;;;;;;EArKG,YAAA,CACJ,MAAA,EAAQ,wBAAA,GACP,OAAA,CAAQ,oBAAA;EA0P2B;;;;;EA5OhC,YAAA,CACJ,MAAA,EAAQ,wBAAA,GACP,OAAA,CAAQ,oBAAA;EA4OR;;;;;;;;;;;;EAvNG,OAAA,CAAQ,MAAA,GAAQ,mBAAA,GAA2B,OAAA,CAAQ,cAAA;EA5H1C;;;;;;;;EA+IT,0BAAA,CACJ,MAAA,EAAQ,sCAAA,GACP,OAAA,CAAQ,6BAAA;EAlHL;;;;;;;;;;EAqIA,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,sBAAA;EAhFD;;;;;;;;;;EAuGJ,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,2BAAA;EAnEG;;;;;;;;;;;;EAuFR,6BAAA,CACJ,MAAA,EAAQ,yCAAA,GACP,OAAA,CAAQ,2BAAA;EAxBL;;;;;;;;;;EA+CA,WAAA,CACJ,MAAA,EAAQ,uBAAA,GACP,OAAA,CAAQ,2BAAA;EADD;;;EAWJ,cAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAAQ,2BAAA;EAFL;;;;;;;;EAmBA,iBAAA,CACJ,MAAA,EAAQ,6BAAA,GACP,OAAA,CAAQ,2BAAA;EAAA;;;;;;;;;;;;;;;EA6BL,SAAA,CACJ,MAAA,EAAQ,qBAAA,GACP,OAAA,CAAQ,0BAAA;EAAA,UAeK,gBAAA,WAA2B,iBAAA,SAAA,CACzC,IAAA,EAAM,CAAA,EACN,MAAA,EAAQ,yBAAA,EACR,WAAA,EAAa,uBAAA,CAAwB,CAAA,IACpC,OAAA,CAAQ,mBAAA,CAAoB,uBAAA,CAAwB,CAAA;EAAA,UAkBvC,WAAA,WAAsB,kCAAA,CAAA,CACpC,IAAA;IAAQ,IAAA,EAAM,CAAA;EAAA,IAAM,oCAAA,CAAqC,CAAA,IACxD,OAAA,CAAQ,sCAAA,CAAuC,CAAA;EAAA,UAalC,aAAA,CACd,IAAA,EAAM,gCAAA,GACL,OAAA,CAAQ,2BAAA;EAAA,UAeK,OAAA,WAAkB,8BAAA,CAAA,CAChC,IAAA,EAAM,mBAAA;IAAwB,IAAA,EAAM,CAAA;EAAA,IACnC,OAAA,CAAQ,kCAAA,CAAmC,CAAA;EAjC9B;;;;;EAAA,QAmDR,mBAAA;EAAA,QAYA,iBAAA;AAAA"}
|
package/dist/MobileClient.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as MobileSignedRequest, i as MobileSignedInnerParams, n as MobileSignedInner, r as MobileSignedInnerByType } from "./types-
|
|
3
|
-
import {
|
|
4
|
-
import { n as MobileServerSuccessResponse } from "./serverBaseTypes-
|
|
5
|
-
import { i as MobileServerExecuteSuccessResponse, o as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-
|
|
6
|
-
import { s as MobileServerPublicQuerySuccessResponse
|
|
1
|
+
import { A as MobileUsernameAvailability, C as MobileRegisteredWallet, D as MobileSignedRequestParams, E as MobileSetUsernameParams, O as MobileUnregisterExpoTokenParams, S as MobileRegisterExpoTokenParams, T as MobileSetPrivateModeParams, a as GetMobileNotificationPreferencesParams, c as GetMobileUsernameAvailabilityParams, i as GetMobileFollowingParams, k as MobileUpdateNotificationPreferencesParams, m as MobileFollowMutationResult, o as GetMobileProfilesParams, p as MobileFollowListPage, r as GetMobileFollowersParams, s as GetMobileRegisteredWalletParams, t as GetMobileFeedParams, u as MobileFeedPage, w as MobileSetFollowParams, x as MobilePublicProfile, y as MobileNotificationPreferences } from "./clientTypes-CB_itU4Z.js";
|
|
2
|
+
import { a as MobileSignedRequest, i as MobileSignedInnerParams, n as MobileSignedInner, r as MobileSignedInnerByType } from "./types-BIIvIzG2.js";
|
|
3
|
+
import { o as MobileServerPublicQueryRequestByType, s as MobileServerPublicQueryRequestType, t as MobileServerExecuteRequestType } from "./serverRequestTypes-Dv9NR-hQ.js";
|
|
4
|
+
import { n as MobileServerSuccessResponse } from "./serverBaseTypes-C2JGib--.js";
|
|
5
|
+
import { i as MobileServerExecuteSuccessResponse, o as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-C2NoNEwu.js";
|
|
6
|
+
import { s as MobileServerPublicQuerySuccessResponse } from "./serverQueryTypes-B0xI1G39.js";
|
|
7
7
|
import { WalletClientWithAccount } from "@nadohq/shared";
|
|
8
8
|
import { AxiosInstance } from "axios";
|
|
9
9
|
|
|
@@ -54,8 +54,7 @@ declare class MobileClient {
|
|
|
54
54
|
* does not hide the profile itself, only the account's activity.
|
|
55
55
|
*
|
|
56
56
|
* This is the only profile route, so use it for a single subaccount too. It is unsigned, which means
|
|
57
|
-
* `include.followSummary.viewAs` is an unauthenticated claim
|
|
58
|
-
* because they prove the viewer.
|
|
57
|
+
* `include.followSummary.viewAs` is an unauthenticated claim.
|
|
59
58
|
*
|
|
60
59
|
* @throws {MobileServerFailureError} With error code `INVALID_PROFILES_REQUEST` if `subaccounts` is empty,
|
|
61
60
|
* holds duplicates, or exceeds `MOBILE_PROFILES_MAX_BATCH_SIZE` (25), or `PROFILE_NOT_FOUND` if any
|
|
@@ -63,6 +62,28 @@ declare class MobileClient {
|
|
|
63
62
|
* One isolated member fails the whole batch rather than being omitted.
|
|
64
63
|
*/
|
|
65
64
|
getProfiles(params: GetMobileProfilesParams): Promise<MobilePublicProfile[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Fetches a page of the accounts that follow the given Profile.
|
|
67
|
+
*
|
|
68
|
+
* Ordering depends on `viewAs`. With it, accounts the Viewer already follows come first, unfamiliar
|
|
69
|
+
* accounts second, and every row carries an `isFollowing`. Without it, the page is ordered by the listed
|
|
70
|
+
* relationship alone and no row carries an `isFollowing`. In both cases the newest listed relationship
|
|
71
|
+
* comes first within a group, with a bytes32 tie-break. The grouping is evaluated per request against the
|
|
72
|
+
* live graph, so following an account from inside the list moves it between groups on the next page —
|
|
73
|
+
* deduplicate by subaccount and do not re-sort locally.
|
|
74
|
+
*
|
|
75
|
+
* @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile or `viewAs`
|
|
76
|
+
* is isolated, `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different `viewAs`,
|
|
77
|
+
* Profile, or list direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if
|
|
78
|
+
* `limit` is outside 1–50.
|
|
79
|
+
*/
|
|
80
|
+
getFollowers(params: GetMobileFollowersParams): Promise<MobileFollowListPage>;
|
|
81
|
+
/**
|
|
82
|
+
* Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match
|
|
83
|
+
* {@link MobileClient.getFollowers}. When `viewAs` reads its own Following list every row is familiar, so
|
|
84
|
+
* every `isFollowing` is `true`.
|
|
85
|
+
*/
|
|
86
|
+
getFollowing(params: GetMobileFollowingParams): Promise<MobileFollowListPage>;
|
|
66
87
|
/**
|
|
67
88
|
* Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a
|
|
68
89
|
* whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a
|
|
@@ -120,26 +141,6 @@ declare class MobileClient {
|
|
|
120
141
|
* `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.
|
|
121
142
|
*/
|
|
122
143
|
updateNotificationPreferences(params: MobileUpdateNotificationPreferencesParams): Promise<MobileServerSuccessResponse>;
|
|
123
|
-
/**
|
|
124
|
-
* Fetches a page of the accounts that follow the given Profile.
|
|
125
|
-
*
|
|
126
|
-
* Familiar accounts (those the signing Viewer follows) come first, unfamiliar second, and within each group
|
|
127
|
-
* the newest listed relationship first with a bytes32 tie-break. The grouping is evaluated per request
|
|
128
|
-
* against the live graph, so following an account from inside the list moves it between groups on the next
|
|
129
|
-
* page — deduplicate by subaccount and do not re-sort locally.
|
|
130
|
-
*
|
|
131
|
-
* @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile is isolated,
|
|
132
|
-
* `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different Viewer, Profile, or list
|
|
133
|
-
* direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if `limit` is outside
|
|
134
|
-
* 1–50.
|
|
135
|
-
*/
|
|
136
|
-
getFollowers(params: GetMobileFollowersParams): Promise<MobileFollowListPage>;
|
|
137
|
-
/**
|
|
138
|
-
* Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match
|
|
139
|
-
* {@link MobileClient.getFollowers}. When the Viewer reads their own Following list every row is familiar,
|
|
140
|
-
* so every `isFollowing` is `true`.
|
|
141
|
-
*/
|
|
142
|
-
getFollowing(params: GetMobileFollowingParams): Promise<MobileFollowListPage>;
|
|
143
144
|
/**
|
|
144
145
|
* Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
|
|
145
146
|
* username and renames an existing one, so callers never need to read the current identity first.
|
|
@@ -188,9 +189,6 @@ declare class MobileClient {
|
|
|
188
189
|
protected execute<T extends MobileServerExecuteRequestType>(body: MobileSignedRequest & {
|
|
189
190
|
type: T;
|
|
190
191
|
}): Promise<MobileServerExecuteSuccessResponse<T>>;
|
|
191
|
-
protected signedQuery<T extends MobileServerSignedQueryRequestType>(body: MobileSignedRequest & {
|
|
192
|
-
type: T;
|
|
193
|
-
}): Promise<MobileServerSignedQuerySuccessResponse<T>>;
|
|
194
192
|
/**
|
|
195
193
|
* Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns
|
|
196
194
|
* failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileClient.d.ts","names":[],"sources":["../src/src/MobileClient.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"MobileClient.d.ts","names":[],"sources":["../src/src/MobileClient.ts"],"mappings":";;;;;;;;;;;;;UAwEiB,gBAAA;EAAgB;;;EAI/B,GAAA;EAIA;;;EAAA,YAAA,GAAe,uBAAA;EAQf;;AAAU;EAJV,wBAAA,GAA2B,uBAAuB;EAW3B;;;EAPvB,UAAA;AAAA;;;;;cAOW,YAAA;EAAA,SACF,IAAA,EAAM,gBAAA;EAAA,SACN,aAAA,EAAe,aAAA;cAEZ,IAAA,EAAM,gBAAA;EAoFP;;;;;EArEJ,eAAA,CACL,wBAAA,EAA0B,uBAAA;EAyG6B;;;EA7FnD,uBAAA,CACJ,MAAA,EAAQ,mCAAA,GACP,OAAA,CAAQ,0BAAA;EAgHR;;;;;;;;;;;;;;EAzFG,WAAA,CACJ,MAAA,EAAQ,uBAAA,GACP,OAAA,CAAQ,mBAAA;EAgMR;;;;;;;;;;;;;;;EArKG,YAAA,CACJ,MAAA,EAAQ,wBAAA,GACP,OAAA,CAAQ,oBAAA;EA0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AeK,OAAA,WAAkB,8BAAA,CAAA,CAChC,IAAA,EAAM,mBAAA;IAAwB,IAAA,EAAM,CAAA;EAAA,IACnC,OAAA,CAAQ,kCAAA,CAAmC,CAAA;EAjC9B;;;;;EAAA,QAmDR,mBAAA;EAAA,QAYA,iBAAA;AAAA"}
|
package/dist/MobileClient.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mapMobileFeedPage, mapMobileFollowListPage, mapMobileFollowMutationResult, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet } from "./dataMappers.js";
|
|
1
|
+
import { mapMobileFeedPage, mapMobileFollowListPage, mapMobileFollowListParamsToServer, mapMobileFollowMutationResult, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet } from "./dataMappers.js";
|
|
2
2
|
import { buildSignedMobileRequest } from "./signing/buildSignedMobileRequest.js";
|
|
3
3
|
import "./signing/index.js";
|
|
4
4
|
import { MobileServerFailureError } from "./types/MobileServerFailureError.js";
|
|
@@ -48,8 +48,7 @@ var MobileClient = class {
|
|
|
48
48
|
* does not hide the profile itself, only the account's activity.
|
|
49
49
|
*
|
|
50
50
|
* This is the only profile route, so use it for a single subaccount too. It is unsigned, which means
|
|
51
|
-
* `include.followSummary.viewAs` is an unauthenticated claim
|
|
52
|
-
* because they prove the viewer.
|
|
51
|
+
* `include.followSummary.viewAs` is an unauthenticated claim.
|
|
53
52
|
*
|
|
54
53
|
* @throws {MobileServerFailureError} With error code `INVALID_PROFILES_REQUEST` if `subaccounts` is empty,
|
|
55
54
|
* holds duplicates, or exceeds `MOBILE_PROFILES_MAX_BATCH_SIZE` (25), or `PROFILE_NOT_FOUND` if any
|
|
@@ -65,6 +64,40 @@ var MobileClient = class {
|
|
|
65
64
|
return (await this.publicQuery(body)).profiles.map(mapMobilePublicProfile);
|
|
66
65
|
}
|
|
67
66
|
/**
|
|
67
|
+
* Fetches a page of the accounts that follow the given Profile.
|
|
68
|
+
*
|
|
69
|
+
* Ordering depends on `viewAs`. With it, accounts the Viewer already follows come first, unfamiliar
|
|
70
|
+
* accounts second, and every row carries an `isFollowing`. Without it, the page is ordered by the listed
|
|
71
|
+
* relationship alone and no row carries an `isFollowing`. In both cases the newest listed relationship
|
|
72
|
+
* comes first within a group, with a bytes32 tie-break. The grouping is evaluated per request against the
|
|
73
|
+
* live graph, so following an account from inside the list moves it between groups on the next page —
|
|
74
|
+
* deduplicate by subaccount and do not re-sort locally.
|
|
75
|
+
*
|
|
76
|
+
* @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile or `viewAs`
|
|
77
|
+
* is isolated, `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different `viewAs`,
|
|
78
|
+
* Profile, or list direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if
|
|
79
|
+
* `limit` is outside 1–50.
|
|
80
|
+
*/
|
|
81
|
+
async getFollowers(params) {
|
|
82
|
+
const body = {
|
|
83
|
+
type: "followers",
|
|
84
|
+
...mapMobileFollowListParamsToServer(params)
|
|
85
|
+
};
|
|
86
|
+
return mapMobileFollowListPage(await this.publicQuery(body));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match
|
|
90
|
+
* {@link MobileClient.getFollowers}. When `viewAs` reads its own Following list every row is familiar, so
|
|
91
|
+
* every `isFollowing` is `true`.
|
|
92
|
+
*/
|
|
93
|
+
async getFollowing(params) {
|
|
94
|
+
const body = {
|
|
95
|
+
type: "following",
|
|
96
|
+
...mapMobileFollowListParamsToServer(params)
|
|
97
|
+
};
|
|
98
|
+
return mapMobileFollowListPage(await this.publicQuery(body));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
68
101
|
* Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a
|
|
69
102
|
* whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a
|
|
70
103
|
* username are included with `null` name fields; only private accounts are filtered out. The feed is
|
|
@@ -155,40 +188,6 @@ var MobileClient = class {
|
|
|
155
188
|
return this.publicExecute(body);
|
|
156
189
|
}
|
|
157
190
|
/**
|
|
158
|
-
* Fetches a page of the accounts that follow the given Profile.
|
|
159
|
-
*
|
|
160
|
-
* Familiar accounts (those the signing Viewer follows) come first, unfamiliar second, and within each group
|
|
161
|
-
* the newest listed relationship first with a bytes32 tie-break. The grouping is evaluated per request
|
|
162
|
-
* against the live graph, so following an account from inside the list moves it between groups on the next
|
|
163
|
-
* page — deduplicate by subaccount and do not re-sort locally.
|
|
164
|
-
*
|
|
165
|
-
* @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile is isolated,
|
|
166
|
-
* `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different Viewer, Profile, or list
|
|
167
|
-
* direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if `limit` is outside
|
|
168
|
-
* 1–50.
|
|
169
|
-
*/
|
|
170
|
-
async getFollowers(params) {
|
|
171
|
-
const signedRequest = await this.getSignedRequest("followers", params, {
|
|
172
|
-
subaccount: subaccountToHex(params.target),
|
|
173
|
-
cursor: params.cursor ?? null,
|
|
174
|
-
limit: params.limit ?? null
|
|
175
|
-
});
|
|
176
|
-
return mapMobileFollowListPage(await this.signedQuery(signedRequest));
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match
|
|
180
|
-
* {@link MobileClient.getFollowers}. When the Viewer reads their own Following list every row is familiar,
|
|
181
|
-
* so every `isFollowing` is `true`.
|
|
182
|
-
*/
|
|
183
|
-
async getFollowing(params) {
|
|
184
|
-
const signedRequest = await this.getSignedRequest("following", params, {
|
|
185
|
-
subaccount: subaccountToHex(params.target),
|
|
186
|
-
cursor: params.cursor ?? null,
|
|
187
|
-
limit: params.limit ?? null
|
|
188
|
-
});
|
|
189
|
-
return mapMobileFollowListPage(await this.signedQuery(signedRequest));
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
191
|
* Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
|
|
193
192
|
* username and renames an existing one, so callers never need to read the current identity first.
|
|
194
193
|
*
|
|
@@ -262,25 +261,19 @@ var MobileClient = class {
|
|
|
262
261
|
});
|
|
263
262
|
}
|
|
264
263
|
async publicQuery(body) {
|
|
265
|
-
const response = await this.axiosInstance.post(`${this.opts.url}/
|
|
264
|
+
const response = await this.axiosInstance.post(`${this.opts.url}/public_query`, body);
|
|
266
265
|
this.checkResponseStatus(response);
|
|
267
266
|
this.checkServerStatus(response);
|
|
268
267
|
return response.data;
|
|
269
268
|
}
|
|
270
269
|
async publicExecute(body) {
|
|
271
|
-
const response = await this.axiosInstance.post(`${this.opts.url}/
|
|
270
|
+
const response = await this.axiosInstance.post(`${this.opts.url}/public_execute`, body);
|
|
272
271
|
this.checkResponseStatus(response);
|
|
273
272
|
this.checkServerStatus(response);
|
|
274
273
|
return response.data;
|
|
275
274
|
}
|
|
276
275
|
async execute(body) {
|
|
277
|
-
const response = await this.axiosInstance.post(`${this.opts.url}/
|
|
278
|
-
this.checkResponseStatus(response);
|
|
279
|
-
this.checkServerStatus(response);
|
|
280
|
-
return response.data;
|
|
281
|
-
}
|
|
282
|
-
async signedQuery(body) {
|
|
283
|
-
const response = await this.axiosInstance.post(`${this.opts.url}/mobile/query`, body);
|
|
276
|
+
const response = await this.axiosInstance.post(`${this.opts.url}/execute`, body);
|
|
284
277
|
this.checkResponseStatus(response);
|
|
285
278
|
this.checkServerStatus(response);
|
|
286
279
|
return response.data;
|