@nadohq/mobile-client 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/README.md +15 -8
  2. package/dist/{MobileClient-CfDtaEeL.cjs → MobileClient-_i0ZV6Dq.cjs} +88 -48
  3. package/dist/MobileClient-_i0ZV6Dq.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +1 -1
  5. package/dist/MobileClient.d.cts +66 -37
  6. package/dist/MobileClient.d.cts.map +1 -1
  7. package/dist/MobileClient.d.ts +66 -37
  8. package/dist/MobileClient.d.ts.map +1 -1
  9. package/dist/MobileClient.js +88 -48
  10. package/dist/MobileClient.js.map +1 -1
  11. package/dist/{MobileServerFailureError-B11rr9O5.d.cts → MobileServerFailureError-BoyAfEZA.d.cts} +3 -3
  12. package/dist/{MobileServerFailureError-B11rr9O5.d.cts.map → MobileServerFailureError-BoyAfEZA.d.cts.map} +1 -1
  13. package/dist/{MobileServerFailureError-DoIvXqYV.d.ts → MobileServerFailureError-MgYVBh5p.d.ts} +3 -3
  14. package/dist/{MobileServerFailureError-DoIvXqYV.d.ts.map → MobileServerFailureError-MgYVBh5p.d.ts.map} +1 -1
  15. package/dist/{buildSignedMobileRequest-EEnDgZF8.d.cts → buildSignedMobileRequest-CBMt97aY.d.cts} +2 -2
  16. package/dist/{buildSignedMobileRequest-EEnDgZF8.d.cts.map → buildSignedMobileRequest-CBMt97aY.d.cts.map} +1 -1
  17. package/dist/{buildSignedMobileRequest-B4KJ6T1y.d.ts → buildSignedMobileRequest-qEC4gWaI.d.ts} +2 -2
  18. package/dist/{buildSignedMobileRequest-B4KJ6T1y.d.ts.map → buildSignedMobileRequest-qEC4gWaI.d.ts.map} +1 -1
  19. package/dist/{canonicalize-Cc7hdZLJ.d.ts → canonicalize-QNARV_Xc.d.cts} +4 -4
  20. package/dist/canonicalize-QNARV_Xc.d.cts.map +1 -0
  21. package/dist/{canonicalize-CDdYnhL3.d.cts → canonicalize-wVdGejB1.d.ts} +4 -4
  22. package/dist/canonicalize-wVdGejB1.d.ts.map +1 -0
  23. package/dist/{clientTypes-BsOps_pY.d.ts → clientTypes-6utzUU-b.d.ts} +40 -32
  24. package/dist/clientTypes-6utzUU-b.d.ts.map +1 -0
  25. package/dist/{clientTypes-UFInIAQd.d.cts → clientTypes-D9qgtNlE.d.cts} +40 -32
  26. package/dist/clientTypes-D9qgtNlE.d.cts.map +1 -0
  27. package/dist/dataMappers.cjs +2 -1
  28. package/dist/dataMappers.cjs.map +1 -1
  29. package/dist/dataMappers.d.cts +3 -3
  30. package/dist/dataMappers.d.cts.map +1 -1
  31. package/dist/dataMappers.d.ts +3 -3
  32. package/dist/dataMappers.d.ts.map +1 -1
  33. package/dist/dataMappers.js +2 -1
  34. package/dist/dataMappers.js.map +1 -1
  35. package/dist/{eip712MethodByType-DCU415zf.d.cts → eip712MethodByType-CroIPqsJ.d.cts} +2 -2
  36. package/dist/eip712MethodByType-CroIPqsJ.d.cts.map +1 -0
  37. package/dist/{eip712MethodByType-B67XiwTu.d.ts → eip712MethodByType-DBUy4AdI.d.ts} +2 -2
  38. package/dist/eip712MethodByType-DBUy4AdI.d.ts.map +1 -0
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.d.cts +15 -15
  41. package/dist/index.d.ts +15 -15
  42. package/dist/{mobileErrorCodes-Cj84nBnT.d.cts → mobileErrorCodes-CuQ5lyBV.d.ts} +2 -4
  43. package/dist/mobileErrorCodes-CuQ5lyBV.d.ts.map +1 -0
  44. package/dist/{mobileErrorCodes-Czmigq9x.d.ts → mobileErrorCodes-D_SyBm0k.d.cts} +2 -4
  45. package/dist/mobileErrorCodes-D_SyBm0k.d.cts.map +1 -0
  46. package/dist/{payloadHash-BSoGv3Lz.d.cts → payloadHash-B0tlFOK8.d.cts} +2 -2
  47. package/dist/payloadHash-B0tlFOK8.d.cts.map +1 -0
  48. package/dist/{payloadHash-BVP2v3p9.d.ts → payloadHash-D1yTQSF4.d.ts} +2 -2
  49. package/dist/payloadHash-D1yTQSF4.d.ts.map +1 -0
  50. package/dist/{serverBaseTypes-m3zEi0X9.d.ts → serverBaseTypes-CzRgwUvA.d.ts} +2 -2
  51. package/dist/{serverBaseTypes-m3zEi0X9.d.ts.map → serverBaseTypes-CzRgwUvA.d.ts.map} +1 -1
  52. package/dist/{serverBaseTypes-A16onlPN.d.cts → serverBaseTypes-DSRgU2Fb.d.cts} +2 -2
  53. package/dist/{serverBaseTypes-A16onlPN.d.cts.map → serverBaseTypes-DSRgU2Fb.d.cts.map} +1 -1
  54. package/dist/serverExecuteTypes-BCb6bUMP.d.cts +19 -0
  55. package/dist/serverExecuteTypes-BCb6bUMP.d.cts.map +1 -0
  56. package/dist/serverExecuteTypes-CI3NBW2Z.d.ts +19 -0
  57. package/dist/serverExecuteTypes-CI3NBW2Z.d.ts.map +1 -0
  58. package/dist/{serverModelTypes-CPZUvVil.d.cts → serverModelTypes-BYQcsRrx.d.cts} +14 -11
  59. package/dist/serverModelTypes-BYQcsRrx.d.cts.map +1 -0
  60. package/dist/{serverModelTypes-CqnqHY5F.d.ts → serverModelTypes-DvPs5qs3.d.ts} +14 -11
  61. package/dist/serverModelTypes-DvPs5qs3.d.ts.map +1 -0
  62. package/dist/{serverQueryTypes-CJLWWZBs.d.ts → serverQueryTypes-9H6P1vJ5.d.cts} +9 -8
  63. package/dist/serverQueryTypes-9H6P1vJ5.d.cts.map +1 -0
  64. package/dist/{serverQueryTypes-C_cCx0Ac.d.cts → serverQueryTypes-Cbjx0bIj.d.ts} +9 -8
  65. package/dist/serverQueryTypes-Cbjx0bIj.d.ts.map +1 -0
  66. package/dist/{serverRequestTypes-DQDy3K9O.d.ts → serverRequestTypes-CHDk6JwE.d.cts} +31 -8
  67. package/dist/serverRequestTypes-CHDk6JwE.d.cts.map +1 -0
  68. package/dist/{serverRequestTypes-DnU_FfMI.d.cts → serverRequestTypes-DYTLrCpz.d.ts} +31 -8
  69. package/dist/serverRequestTypes-DYTLrCpz.d.ts.map +1 -0
  70. package/dist/{serverResponseGuards-BlvfJjsa.d.cts → serverResponseGuards-DRMHmfXh.d.cts} +2 -2
  71. package/dist/{serverResponseGuards-BlvfJjsa.d.cts.map → serverResponseGuards-DRMHmfXh.d.cts.map} +1 -1
  72. package/dist/{serverResponseGuards-gpHH8SHk.d.ts → serverResponseGuards-DpbZvJfL.d.ts} +2 -2
  73. package/dist/{serverResponseGuards-gpHH8SHk.d.ts.map → serverResponseGuards-DpbZvJfL.d.ts.map} +1 -1
  74. package/dist/signing/buildSignedMobileRequest.cjs +1 -1
  75. package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
  76. package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
  77. package/dist/signing/canonicalize.cjs +4 -37
  78. package/dist/signing/canonicalize.cjs.map +1 -1
  79. package/dist/signing/canonicalize.d.cts +1 -1
  80. package/dist/signing/canonicalize.d.ts +1 -1
  81. package/dist/signing/canonicalize.js +4 -37
  82. package/dist/signing/canonicalize.js.map +1 -1
  83. package/dist/signing/eip712MethodByType.cjs +1 -5
  84. package/dist/signing/eip712MethodByType.cjs.map +1 -1
  85. package/dist/signing/eip712MethodByType.d.cts +1 -1
  86. package/dist/signing/eip712MethodByType.d.ts +1 -1
  87. package/dist/signing/eip712MethodByType.js +1 -5
  88. package/dist/signing/eip712MethodByType.js.map +1 -1
  89. package/dist/signing/index.d.cts +5 -5
  90. package/dist/signing/index.d.ts +5 -5
  91. package/dist/signing/payloadHash.cjs +1 -1
  92. package/dist/signing/payloadHash.d.cts +1 -1
  93. package/dist/signing/payloadHash.d.ts +1 -1
  94. package/dist/signing/types.d.cts +1 -1
  95. package/dist/signing/types.d.ts +1 -1
  96. package/dist/types/MobileServerFailureError.cjs +1 -1
  97. package/dist/types/MobileServerFailureError.d.cts +1 -1
  98. package/dist/types/MobileServerFailureError.d.ts +1 -1
  99. package/dist/types/clientTypes.d.cts +2 -2
  100. package/dist/types/clientTypes.d.ts +2 -2
  101. package/dist/types/index.d.cts +9 -9
  102. package/dist/types/index.d.ts +9 -9
  103. package/dist/types/mobileErrorCodes.cjs +2 -3
  104. package/dist/types/mobileErrorCodes.cjs.map +1 -1
  105. package/dist/types/mobileErrorCodes.d.cts +1 -1
  106. package/dist/types/mobileErrorCodes.d.ts +1 -1
  107. package/dist/types/mobileErrorCodes.js +1 -2
  108. package/dist/types/mobileErrorCodes.js.map +1 -1
  109. package/dist/types/serverBaseTypes.d.cts +1 -1
  110. package/dist/types/serverBaseTypes.d.ts +1 -1
  111. package/dist/types/serverExecuteTypes.d.cts +2 -2
  112. package/dist/types/serverExecuteTypes.d.ts +2 -2
  113. package/dist/types/serverModelTypes.cjs.map +1 -1
  114. package/dist/types/serverModelTypes.d.cts +1 -1
  115. package/dist/types/serverModelTypes.d.ts +1 -1
  116. package/dist/types/serverModelTypes.js.map +1 -1
  117. package/dist/types/serverQueryTypes.d.cts +1 -1
  118. package/dist/types/serverQueryTypes.d.ts +1 -1
  119. package/dist/types/serverRequestTypes.d.cts +2 -2
  120. package/dist/types/serverRequestTypes.d.ts +2 -2
  121. package/dist/{types-UHjZR-js.d.ts → types-CQE3HD2V.d.ts} +4 -15
  122. package/dist/types-CQE3HD2V.d.ts.map +1 -0
  123. package/dist/{types-CzOeSYnW.d.cts → types-bNB98pYk.d.cts} +4 -15
  124. package/dist/types-bNB98pYk.d.cts.map +1 -0
  125. package/dist/utils/index.d.cts +1 -1
  126. package/dist/utils/index.d.ts +1 -1
  127. package/dist/utils/serverResponseGuards.d.cts +1 -1
  128. package/dist/utils/serverResponseGuards.d.ts +1 -1
  129. package/package.json +3 -3
  130. package/src/MobileClient.ts +119 -90
  131. package/src/dataMappers.ts +1 -0
  132. package/src/signing/canonicalize.ts +4 -37
  133. package/src/signing/eip712MethodByType.ts +1 -5
  134. package/src/signing/signing.test.ts +17 -60
  135. package/src/signing/types.ts +2 -12
  136. package/src/types/clientTypes.ts +38 -30
  137. package/src/types/mobileErrorCodes.ts +1 -2
  138. package/src/types/serverExecuteTypes.ts +17 -0
  139. package/src/types/serverModelTypes.ts +13 -10
  140. package/src/types/serverQueryTypes.ts +5 -4
  141. package/src/types/serverRequestTypes.ts +27 -4
  142. package/dist/MobileClient-CfDtaEeL.cjs.map +0 -1
  143. package/dist/canonicalize-CDdYnhL3.d.cts.map +0 -1
  144. package/dist/canonicalize-Cc7hdZLJ.d.ts.map +0 -1
  145. package/dist/clientTypes-BsOps_pY.d.ts.map +0 -1
  146. package/dist/clientTypes-UFInIAQd.d.cts.map +0 -1
  147. package/dist/eip712MethodByType-B67XiwTu.d.ts.map +0 -1
  148. package/dist/eip712MethodByType-DCU415zf.d.cts.map +0 -1
  149. package/dist/mobileErrorCodes-Cj84nBnT.d.cts.map +0 -1
  150. package/dist/mobileErrorCodes-Czmigq9x.d.ts.map +0 -1
  151. package/dist/payloadHash-BSoGv3Lz.d.cts.map +0 -1
  152. package/dist/payloadHash-BVP2v3p9.d.ts.map +0 -1
  153. package/dist/serverExecuteTypes-C-bioiuQ.d.cts +0 -11
  154. package/dist/serverExecuteTypes-C-bioiuQ.d.cts.map +0 -1
  155. package/dist/serverExecuteTypes-DfzWOeIx.d.ts +0 -11
  156. package/dist/serverExecuteTypes-DfzWOeIx.d.ts.map +0 -1
  157. package/dist/serverModelTypes-CPZUvVil.d.cts.map +0 -1
  158. package/dist/serverModelTypes-CqnqHY5F.d.ts.map +0 -1
  159. package/dist/serverQueryTypes-CJLWWZBs.d.ts.map +0 -1
  160. package/dist/serverQueryTypes-C_cCx0Ac.d.cts.map +0 -1
  161. package/dist/serverRequestTypes-DQDy3K9O.d.ts.map +0 -1
  162. package/dist/serverRequestTypes-DnU_FfMI.d.cts.map +0 -1
  163. package/dist/types-CzOeSYnW.d.cts.map +0 -1
  164. package/dist/types-UHjZR-js.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- import { a as MobileServerPublicQueryResponseByType, c as MobileServerSelfIdentityResponse, d as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, l as MobileServerSignedQueryResponseByType, n as MobileServerNotificationPreferencesResponse, o as MobileServerPublicQuerySuccessResponse, r as MobileServerProfileResponse, s as MobileServerRegisteredDevicesResponse, t as MobileServerFeedResponse, u as MobileServerSignedQuerySuccessResponse } from "../serverQueryTypes-C_cCx0Ac.cjs";
1
+ import { a as MobileServerPublicQueryResponseByType, c as MobileServerSelfIdentityResponse, d as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, l as MobileServerSignedQueryResponseByType, n as MobileServerNotificationPreferencesResponse, o as MobileServerPublicQuerySuccessResponse, r as MobileServerProfileResponse, s as MobileServerRegisteredDevicesResponse, t as MobileServerFeedResponse, u as MobileServerSignedQuerySuccessResponse } from "../serverQueryTypes-9H6P1vJ5.cjs";
2
2
  export { MobileServerFeedResponse, MobileServerNotificationPreferencesResponse, MobileServerProfileResponse, MobileServerPublicQueryRequest, MobileServerPublicQueryResponseByType, MobileServerPublicQuerySuccessResponse, MobileServerRegisteredDevicesResponse, MobileServerSelfIdentityResponse, MobileServerSignedQueryResponseByType, MobileServerSignedQuerySuccessResponse, MobileServerUsernameAvailabilityResponse };
@@ -1,2 +1,2 @@
1
- import { a as MobileServerPublicQueryResponseByType, c as MobileServerSelfIdentityResponse, d as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, l as MobileServerSignedQueryResponseByType, n as MobileServerNotificationPreferencesResponse, o as MobileServerPublicQuerySuccessResponse, r as MobileServerProfileResponse, s as MobileServerRegisteredDevicesResponse, t as MobileServerFeedResponse, u as MobileServerSignedQuerySuccessResponse } from "../serverQueryTypes-CJLWWZBs.js";
1
+ import { a as MobileServerPublicQueryResponseByType, c as MobileServerSelfIdentityResponse, d as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, l as MobileServerSignedQueryResponseByType, n as MobileServerNotificationPreferencesResponse, o as MobileServerPublicQuerySuccessResponse, r as MobileServerProfileResponse, s as MobileServerRegisteredDevicesResponse, t as MobileServerFeedResponse, u as MobileServerSignedQuerySuccessResponse } from "../serverQueryTypes-Cbjx0bIj.js";
2
2
  export { MobileServerFeedResponse, MobileServerNotificationPreferencesResponse, MobileServerProfileResponse, MobileServerPublicQueryRequest, MobileServerPublicQueryResponseByType, MobileServerPublicQuerySuccessResponse, MobileServerRegisteredDevicesResponse, MobileServerSelfIdentityResponse, MobileServerSignedQueryResponseByType, MobileServerSignedQuerySuccessResponse, MobileServerUsernameAvailabilityResponse };
@@ -1,2 +1,2 @@
1
- import { a as MobileServerSignedQueryRequestByType, i as MobileServerRequestType, n as MobileServerPublicQueryRequestByType, o as MobileServerSignedQueryRequestType, r as MobileServerPublicQueryRequestType, t as MobileServerExecuteRequestType } from "../serverRequestTypes-DnU_FfMI.cjs";
2
- export { MobileServerExecuteRequestType, MobileServerPublicQueryRequestByType, MobileServerPublicQueryRequestType, MobileServerRequestType, MobileServerSignedQueryRequestByType, MobileServerSignedQueryRequestType };
1
+ import { a as MobileServerPublicQueryRequestType, c as MobileServerSignedQueryRequestType, i as MobileServerPublicQueryRequestByType, n as MobileServerPublicExecuteRequestByType, o as MobileServerRequestType, r as MobileServerPublicExecuteRequestType, s as MobileServerSignedQueryRequestByType, t as MobileServerExecuteRequestType } from "../serverRequestTypes-CHDk6JwE.cjs";
2
+ export { MobileServerExecuteRequestType, MobileServerPublicExecuteRequestByType, MobileServerPublicExecuteRequestType, MobileServerPublicQueryRequestByType, MobileServerPublicQueryRequestType, MobileServerRequestType, MobileServerSignedQueryRequestByType, MobileServerSignedQueryRequestType };
@@ -1,2 +1,2 @@
1
- import { a as MobileServerSignedQueryRequestByType, i as MobileServerRequestType, n as MobileServerPublicQueryRequestByType, o as MobileServerSignedQueryRequestType, r as MobileServerPublicQueryRequestType, t as MobileServerExecuteRequestType } from "../serverRequestTypes-DQDy3K9O.js";
2
- export { MobileServerExecuteRequestType, MobileServerPublicQueryRequestByType, MobileServerPublicQueryRequestType, MobileServerRequestType, MobileServerSignedQueryRequestByType, MobileServerSignedQueryRequestType };
1
+ import { a as MobileServerPublicQueryRequestType, c as MobileServerSignedQueryRequestType, i as MobileServerPublicQueryRequestByType, n as MobileServerPublicExecuteRequestByType, o as MobileServerRequestType, r as MobileServerPublicExecuteRequestType, s as MobileServerSignedQueryRequestByType, t as MobileServerExecuteRequestType } from "../serverRequestTypes-DYTLrCpz.js";
2
+ export { MobileServerExecuteRequestType, MobileServerPublicExecuteRequestByType, MobileServerPublicExecuteRequestType, MobileServerPublicQueryRequestByType, MobileServerPublicQueryRequestType, MobileServerRequestType, MobileServerSignedQueryRequestByType, MobileServerSignedQueryRequestType };
@@ -1,5 +1,5 @@
1
- import { h as MobileServerNotificationPreferences, l as MobileNotificationPlatform } from "./serverModelTypes-CqnqHY5F.js";
2
- import { y as MobileSignedRequestParams } from "./clientTypes-BsOps_pY.js";
1
+ import { l as MobileNotificationPlatform } from "./serverModelTypes-DvPs5qs3.js";
2
+ import { y as MobileSignedRequestParams } from "./clientTypes-6utzUU-b.js";
3
3
  import { WalletClientWithAccount } from "@nadohq/shared";
4
4
  import { Hex } from "viem";
5
5
 
@@ -14,10 +14,7 @@ import { Hex } from "viem";
14
14
  * {@link canonicalizeMobileInner}, which is the source of truth. Keep the field order here in sync with it.
15
15
  */
16
16
  type MobileSignedInner = {
17
- type: 'claim_username';
18
- display_name: string;
19
- } | {
20
- type: 'update_username';
17
+ type: 'set_username';
21
18
  display_name: string;
22
19
  } | {
23
20
  type: 'set_private_mode';
@@ -30,14 +27,6 @@ type MobileSignedInner = {
30
27
  platform: MobileNotificationPlatform;
31
28
  locale: string | null;
32
29
  app_version: string | null;
33
- } | {
34
- type: 'unregister_expo_token';
35
- expo_token: string;
36
- } | {
37
- type: 'update_preferences';
38
- preferences: MobileServerNotificationPreferences;
39
- } | {
40
- type: 'notification_preferences';
41
30
  } | {
42
31
  type: 'registered_devices';
43
32
  };
@@ -70,4 +59,4 @@ interface BuildSignedMobileRequestParams extends MobileSignedRequestParams {
70
59
  }
71
60
  //#endregion
72
61
  export { MobileSignedRequest as i, MobileSignedInner as n, MobileSignedInnerParams as r, BuildSignedMobileRequestParams as t };
73
- //# sourceMappingURL=types-UHjZR-js.d.ts.map
62
+ //# sourceMappingURL=types-CQE3HD2V.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-CQE3HD2V.d.ts","names":[],"sources":["../src/signing/src/signing/types.ts"],"mappings":";;;;;;;;AAcA;;;;;;;KAAY,iBAAA;EACN,IAAA;EAAsB,YAAA;AAAA;EACtB,IAAA;EAA0B,YAAA;AAAA;EAC1B,IAAA;AAAA;EAEA,IAAA;EACA,UAAA;EACA,QAAA,EAAU,0BAA0B;EAGpC,MAAA;EACA,WAAA;AAAA;EAEA,IAAA;AAAA;;;;;KAMM,uBAAA,WAAkC,iBAAA,YAA6B,IAAA,CACzE,OAAA,CAAQ,iBAAA;EAAqB,IAAA,EAAM,CAAA;AAAA;;;;;KAQzB,mBAAA,WACA,iBAAA,GAAoB,iBAAA,IAC5B,CAAA;EACF,SAAA,EAAW,GAAA;EACX,MAAA,EAAQ,GAAA;EACR,KAAA;AAAA;;;;UAMe,8BAAA,SAAuC,yBAAA;EACtD,YAAA,EAAc,uBAAA;EACd,KAAA,EAAO,iBAAA;EATI;;;EAaX,KAAA;AAAA"}
@@ -1,5 +1,5 @@
1
- import { h as MobileServerNotificationPreferences, l as MobileNotificationPlatform } from "./serverModelTypes-CPZUvVil.cjs";
2
- import { y as MobileSignedRequestParams } from "./clientTypes-UFInIAQd.cjs";
1
+ import { l as MobileNotificationPlatform } from "./serverModelTypes-BYQcsRrx.cjs";
2
+ import { y as MobileSignedRequestParams } from "./clientTypes-D9qgtNlE.cjs";
3
3
  import { WalletClientWithAccount } from "@nadohq/shared";
4
4
  import { Hex } from "viem";
5
5
 
@@ -14,10 +14,7 @@ import { Hex } from "viem";
14
14
  * {@link canonicalizeMobileInner}, which is the source of truth. Keep the field order here in sync with it.
15
15
  */
16
16
  type MobileSignedInner = {
17
- type: 'claim_username';
18
- display_name: string;
19
- } | {
20
- type: 'update_username';
17
+ type: 'set_username';
21
18
  display_name: string;
22
19
  } | {
23
20
  type: 'set_private_mode';
@@ -30,14 +27,6 @@ type MobileSignedInner = {
30
27
  platform: MobileNotificationPlatform;
31
28
  locale: string | null;
32
29
  app_version: string | null;
33
- } | {
34
- type: 'unregister_expo_token';
35
- expo_token: string;
36
- } | {
37
- type: 'update_preferences';
38
- preferences: MobileServerNotificationPreferences;
39
- } | {
40
- type: 'notification_preferences';
41
30
  } | {
42
31
  type: 'registered_devices';
43
32
  };
@@ -70,4 +59,4 @@ interface BuildSignedMobileRequestParams extends MobileSignedRequestParams {
70
59
  }
71
60
  //#endregion
72
61
  export { MobileSignedRequest as i, MobileSignedInner as n, MobileSignedInnerParams as r, BuildSignedMobileRequestParams as t };
73
- //# sourceMappingURL=types-CzOeSYnW.d.cts.map
62
+ //# sourceMappingURL=types-bNB98pYk.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-bNB98pYk.d.cts","names":[],"sources":["../src/signing/src/signing/types.ts"],"mappings":";;;;;;;;AAcA;;;;;;;KAAY,iBAAA;EACN,IAAA;EAAsB,YAAA;AAAA;EACtB,IAAA;EAA0B,YAAA;AAAA;EAC1B,IAAA;AAAA;EAEA,IAAA;EACA,UAAA;EACA,QAAA,EAAU,0BAA0B;EAGpC,MAAA;EACA,WAAA;AAAA;EAEA,IAAA;AAAA;;;;;KAMM,uBAAA,WAAkC,iBAAA,YAA6B,IAAA,CACzE,OAAA,CAAQ,iBAAA;EAAqB,IAAA,EAAM,CAAA;AAAA;;;;;KAQzB,mBAAA,WACA,iBAAA,GAAoB,iBAAA,IAC5B,CAAA;EACF,SAAA,EAAW,GAAA;EACX,MAAA,EAAQ,GAAA;EACR,KAAA;AAAA;;;;UAMe,8BAAA,SAAuC,yBAAA;EACtD,YAAA,EAAc,uBAAA;EACd,KAAA,EAAO,iBAAA;EATI;;;EAaX,KAAA;AAAA"}
@@ -1,4 +1,4 @@
1
1
  import { n as MOBILE_FEED_MIN_NOTIONAL_FLOOR, t as MOBILE_FEED_MAX_PAGE_SIZE } from "../feed-CBIwOhTO.cjs";
2
2
  import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-Db6fgz8i.cjs";
3
- import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-BlvfJjsa.cjs";
3
+ import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-DRMHmfXh.cjs";
4
4
  export { MOBILE_DISPLAY_NAME_PATTERN, MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR, isMobileServerFailureResponse, isMobileServerSuccessResponse };
@@ -1,4 +1,4 @@
1
1
  import { n as MOBILE_FEED_MIN_NOTIONAL_FLOOR, t as MOBILE_FEED_MAX_PAGE_SIZE } from "../feed-BF5k6Ryu.js";
2
2
  import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-B5gi7OfV.js";
3
- import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-gpHH8SHk.js";
3
+ import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-DpbZvJfL.js";
4
4
  export { MOBILE_DISPLAY_NAME_PATTERN, MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR, isMobileServerFailureResponse, isMobileServerSuccessResponse };
@@ -1,2 +1,2 @@
1
- import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-BlvfJjsa.cjs";
1
+ import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-DRMHmfXh.cjs";
2
2
  export { isMobileServerFailureResponse, isMobileServerSuccessResponse };
@@ -1,2 +1,2 @@
1
- import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-gpHH8SHk.js";
1
+ import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-DpbZvJfL.js";
2
2
  export { isMobileServerFailureResponse, isMobileServerSuccessResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadohq/mobile-client",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "HTTP client for the Nado mobile service API — username claims, profiles, privacy settings, and push notification devices & preferences",
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/index.d.ts",
43
43
  "dependencies": {
44
44
  "@msgpack/msgpack": "3.1.3",
45
- "@nadohq/shared": "^0.30.0",
45
+ "@nadohq/shared": "^0.31.0",
46
46
  "axios": "1.16.1"
47
47
  },
48
48
  "peerDependencies": {
@@ -54,5 +54,5 @@
54
54
  "bignumber.js": "11.1.1",
55
55
  "viem": "2.52.0"
56
56
  },
57
- "gitHead": "792b9deb17d69d86a8ed6f9ec4e9b3f453bcb3e8"
57
+ "gitHead": "64989d50de00614c9e437cbac5a6b5785e514df5"
58
58
  }
@@ -1,4 +1,5 @@
1
1
  import {
2
+ subaccountToHex,
2
3
  WalletClientWithAccount,
3
4
  WalletNotProvidedError,
4
5
  } from '@nadohq/shared';
@@ -24,7 +25,6 @@ import {
24
25
  GetMobileRegisteredDevicesParams,
25
26
  GetMobileSelfIdentityParams,
26
27
  GetMobileUsernameAvailabilityParams,
27
- MobileClaimUsernameParams,
28
28
  MobileFeedPage,
29
29
  MobileIdentity,
30
30
  MobileNotificationPreferences,
@@ -32,15 +32,18 @@ import {
32
32
  MobileRegisteredDevice,
33
33
  MobileRegisterExpoTokenParams,
34
34
  MobileSetPrivateModeParams,
35
+ MobileSetUsernameParams,
35
36
  MobileSignedRequestParams,
36
37
  MobileUnregisterExpoTokenParams,
37
38
  MobileUpdateNotificationPreferencesParams,
38
- MobileUpdateUsernameParams,
39
39
  MobileUsernameAvailability,
40
40
  } from './types/clientTypes';
41
41
  import { MobileServerFailureError } from './types/MobileServerFailureError';
42
42
  import { MobileServerSuccessResponse } from './types/serverBaseTypes';
43
- import { MobileServerExecuteResult } from './types/serverExecuteTypes';
43
+ import {
44
+ MobileServerExecuteResult,
45
+ MobileServerPublicExecuteRequest,
46
+ } from './types/serverExecuteTypes';
44
47
  import {
45
48
  MobileServerPublicQueryRequest,
46
49
  MobileServerPublicQuerySuccessResponse,
@@ -75,8 +78,8 @@ export interface MobileClientOpts {
75
78
  }
76
79
 
77
80
  /**
78
- * Client for the Nado mobile service API: username claims, public profile lookups, privacy settings, and
79
- * push notification device/preference management.
81
+ * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, privacy
82
+ * settings, and push notification device/preference management.
80
83
  */
81
84
  export class MobileClient {
82
85
  readonly opts: MobileClientOpts;
@@ -121,27 +124,30 @@ export class MobileClient {
121
124
  }
122
125
 
123
126
  /**
124
- * Looks up a subaccount's public profile by username.
127
+ * Looks up a subaccount's public profile. Every non-isolated subaccount resolves, with `username` and
128
+ * `displayName` `null` until a username is claimed. Private Mode does not hide the profile itself, only the
129
+ * account's activity.
125
130
  *
126
- * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if no identity has claimed the
127
- * username or it is invalid. Private Mode does not hide the profile itself, only the account's activity.
131
+ * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the subaccount is in the
132
+ * engine-created isolated namespace, which cannot own a profile.
128
133
  */
129
134
  async getPublicProfile(
130
135
  params: GetMobilePublicProfileParams,
131
136
  ): Promise<MobilePublicProfile> {
132
137
  const body: MobileServerPublicQueryRequest<'profile'> = {
133
138
  type: 'profile',
134
- username: params.username,
139
+ subaccount: subaccountToHex(params),
135
140
  };
136
141
  const data = await this.publicQuery(body);
137
142
  return mapMobilePublicProfile(data.profile);
138
143
  }
139
144
 
140
145
  /**
141
- * Fetches a page of the global trade feed: public, named, perpetual trades, newest first, optionally
142
- * filtered by a whole-dollar minimum notional (omitted means unfiltered). The feed is best-effort rather
143
- * than authoritative history, and pagination is live (not snapshot), so deduplicate pages by
144
- * {@link MobileFeedTrade.orderDigest}.
146
+ * Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a
147
+ * whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a
148
+ * username are included with `null` name fields; only private accounts are filtered out. The feed is
149
+ * best-effort rather than authoritative history, and pagination is live (not snapshot), so deduplicate pages
150
+ * by {@link MobileFeedTrade.orderDigest}.
145
151
  *
146
152
  * @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or
147
153
  * `limit` is outside its allowed domain (fix the request; do not retry unchanged), or
@@ -159,13 +165,83 @@ export class MobileClient {
159
165
  return mapMobileFeedPage(data);
160
166
  }
161
167
 
168
+ /**
169
+ * Fetches the push notification preferences of the wallet that owns the given Expo push token. Unsigned —
170
+ * the token identifies the wallet on its own. Falls back to the backend's defaults if the wallet has never
171
+ * updated its preferences.
172
+ *
173
+ * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is
174
+ * not currently registered to a wallet.
175
+ */
176
+ async getNotificationPreferences(
177
+ params: GetMobileNotificationPreferencesParams,
178
+ ): Promise<MobileNotificationPreferences> {
179
+ const body: MobileServerPublicQueryRequest<'notification_preferences'> = {
180
+ type: 'notification_preferences',
181
+ expo_token: params.expoToken,
182
+ };
183
+ const data = await this.publicQuery(body);
184
+ return mapMobileNotificationPreferences(data.preferences);
185
+ }
186
+
187
+ /*
188
+ Public executes
189
+ */
190
+
191
+ /**
192
+ * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
193
+ * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
194
+ * well-formed token succeeds.
195
+ *
196
+ * A registration that commits after this call re-activates the token, so stop or await any in-flight
197
+ * {@link MobileClient.registerExpoToken} before unregistering.
198
+ *
199
+ * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed.
200
+ */
201
+ async unregisterExpoToken(
202
+ params: MobileUnregisterExpoTokenParams,
203
+ ): Promise<MobileServerSuccessResponse> {
204
+ const body: MobileServerPublicExecuteRequest<'unregister_expo_token'> = {
205
+ type: 'unregister_expo_token',
206
+ expo_token: params.expoToken,
207
+ };
208
+ return this.publicExecute(body);
209
+ }
210
+
211
+ /**
212
+ * Replaces the push notification preferences of the wallet that owns the given Expo push token. Possession
213
+ * of an active token is the credential rather than a signature, so anyone holding the token can overwrite
214
+ * that wallet's preferences. The backend requires `schemaVersion` of 1, exactly one entry per known
215
+ * category, and empty `scopes` on every entry.
216
+ *
217
+ * Writes are last-write-wins on commit order rather than ordered by a client nonce, so callers must
218
+ * serialize their own preference writes.
219
+ *
220
+ * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or
221
+ * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.
222
+ */
223
+ async updateNotificationPreferences(
224
+ params: MobileUpdateNotificationPreferencesParams,
225
+ ): Promise<MobileServerSuccessResponse> {
226
+ const body: MobileServerPublicExecuteRequest<'update_preferences'> = {
227
+ type: 'update_preferences',
228
+ expo_token: params.expoToken,
229
+ preferences: mapMobileNotificationPreferencesToServer(params.preferences),
230
+ };
231
+ return this.publicExecute(body);
232
+ }
233
+
162
234
  /*
163
235
  Signed queries
164
236
  */
165
237
 
166
238
  /**
167
- * Fetches the caller's own identity for a subaccount. Returns `null` if the subaccount has not claimed a
168
- * username yet — this is normal data, not an error.
239
+ * Fetches the caller's own identity for a subaccount. Every non-isolated subaccount has an implicit
240
+ * identity, so this resolves for any valid sender with `username` and `displayName` `null` until a username
241
+ * is claimed.
242
+ *
243
+ * @throws {MobileServerFailureError} With error code `INVALID_IDENTITY_TARGET` if the sender is in the
244
+ * engine-created isolated namespace, which cannot own an identity.
169
245
  */
170
246
  async getSelfIdentity(
171
247
  params: GetMobileSelfIdentityParams,
@@ -179,22 +255,6 @@ export class MobileClient {
179
255
  return data.identity ? mapMobileIdentity(data.identity) : null;
180
256
  }
181
257
 
182
- /**
183
- * Fetches a wallet's push notification preferences. Falls back to the backend's defaults if the wallet has
184
- * never updated its preferences.
185
- */
186
- async getNotificationPreferences(
187
- params: GetMobileNotificationPreferencesParams,
188
- ): Promise<MobileNotificationPreferences> {
189
- const signedRequest = await this.getSignedRequest(
190
- 'notification_preferences',
191
- params,
192
- {},
193
- );
194
- const data = await this.query<'notification_preferences'>(signedRequest);
195
- return mapMobileNotificationPreferences(data.preferences);
196
- }
197
-
198
258
  /**
199
259
  * Fetches the devices registered for push notifications for a wallet.
200
260
  */
@@ -215,32 +275,21 @@ export class MobileClient {
215
275
  */
216
276
 
217
277
  /**
218
- * Claims a username for a subaccount, derived from the given display name.
219
- */
220
- async claimUsername(
221
- params: MobileClaimUsernameParams,
222
- ): Promise<MobileServerSuccessResponse> {
223
- const signedRequest = await this.getSignedRequest(
224
- 'claim_username',
225
- params,
226
- {
227
- display_name: params.displayName,
228
- },
229
- );
230
- return this.execute(signedRequest);
231
- }
232
-
233
- /**
234
- * Updates the display name for a subaccount's already-claimed identity.
278
+ * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
279
+ * username and renames an existing one, so callers never need to read the current identity first.
280
+ *
281
+ * @throws {MobileServerFailureError} With error code `INVALID_DISPLAY_NAME` if the display name violates
282
+ * `MOBILE_DISPLAY_NAME_PATTERN`, `USERNAME_UNAVAILABLE` if the derived username is reserved or already
283
+ * taken by another subaccount, `INVALID_IDENTITY_TARGET` if the sender is in the engine-created isolated
284
+ * namespace, or `STALE_IDENTITY_UPDATE` if another identity write for this subaccount committed with a
285
+ * later nonce (re-read the identity before retrying).
235
286
  */
236
- async updateUsername(
237
- params: MobileUpdateUsernameParams,
287
+ async setUsername(
288
+ params: MobileSetUsernameParams,
238
289
  ): Promise<MobileServerSuccessResponse> {
239
- const signedRequest = await this.getSignedRequest(
240
- 'update_username',
241
- params,
242
- { display_name: params.displayName },
243
- );
290
+ const signedRequest = await this.getSignedRequest('set_username', params, {
291
+ display_name: params.displayName,
292
+ });
244
293
  return this.execute(signedRequest);
245
294
  }
246
295
 
@@ -282,41 +331,6 @@ export class MobileClient {
282
331
  return this.execute(signedRequest);
283
332
  }
284
333
 
285
- /**
286
- * Unregisters an Expo push token for the wallet. Idempotent — unregistering an unknown token succeeds.
287
- */
288
- async unregisterExpoToken(
289
- params: MobileUnregisterExpoTokenParams,
290
- ): Promise<MobileServerSuccessResponse> {
291
- const signedRequest = await this.getSignedRequest(
292
- 'unregister_expo_token',
293
- params,
294
- { expo_token: params.expoToken },
295
- );
296
- return this.execute(signedRequest);
297
- }
298
-
299
- /**
300
- * Replaces the wallet's push notification preferences. The backend requires `schemaVersion` of 1, exactly
301
- * one entry per known category, and empty `scopes` on every entry.
302
- *
303
- * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated.
304
- */
305
- async updateNotificationPreferences(
306
- params: MobileUpdateNotificationPreferencesParams,
307
- ): Promise<MobileServerSuccessResponse> {
308
- const signedRequest = await this.getSignedRequest(
309
- 'update_preferences',
310
- params,
311
- {
312
- preferences: mapMobileNotificationPreferencesToServer(
313
- params.preferences,
314
- ),
315
- },
316
- );
317
- return this.execute(signedRequest);
318
- }
319
-
320
334
  /*
321
335
  Base Fns
322
336
  */
@@ -355,6 +369,21 @@ export class MobileClient {
355
369
  return response.data as MobileServerPublicQuerySuccessResponse<T>;
356
370
  }
357
371
 
372
+ protected async publicExecute(
373
+ body: MobileServerPublicExecuteRequest,
374
+ ): Promise<MobileServerSuccessResponse> {
375
+ const response = await this.axiosInstance.post<MobileServerExecuteResult>(
376
+ `${this.opts.url}/mobile/public_execute`,
377
+ body,
378
+ );
379
+
380
+ this.checkResponseStatus(response);
381
+ this.checkServerStatus(response);
382
+
383
+ // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here
384
+ return response.data as MobileServerSuccessResponse;
385
+ }
386
+
358
387
  protected async query<T extends MobileServerSignedQueryRequestType>(
359
388
  body: MobileSignedRequest,
360
389
  ): Promise<MobileServerSignedQuerySuccessResponse<T>> {
@@ -41,6 +41,7 @@ export function mapMobilePublicProfile(
41
41
  subaccount: server.subaccount,
42
42
  username: server.username,
43
43
  displayName: server.display_name,
44
+ privateMode: server.private_mode,
44
45
  };
45
46
  }
46
47
 
@@ -1,21 +1,18 @@
1
- import { MobileServerNotificationPreferences } from '../types/serverModelTypes';
2
1
  import { MobileSignedInner } from './types';
3
2
 
4
3
  /**
5
4
  * Rebuilds an inner payload with its keys in the backend's struct declaration order (`type` first, then the
6
5
  * remaining fields in the exact order the backend serializes them). msgpack encodes object keys in insertion
7
6
  * order and the payload hash must be reproducible regardless of how the caller constructed the object, so
8
- * every inner payload — and each of its sub-types — is canonicalized here before hashing. This function (with
9
- * {@link canonicalizeNotificationPreferences} for nested preferences) is the source of truth for that order.
7
+ * every inner payload — and each of its sub-types — is canonicalized here before hashing. This function is
8
+ * the source of truth for that order.
10
9
  */
11
10
  export function canonicalizeMobileInner(
12
11
  inner: MobileSignedInner,
13
12
  ): MobileSignedInner {
14
13
  switch (inner.type) {
15
- case 'claim_username':
16
- return { type: 'claim_username', display_name: inner.display_name };
17
- case 'update_username':
18
- return { type: 'update_username', display_name: inner.display_name };
14
+ case 'set_username':
15
+ return { type: 'set_username', display_name: inner.display_name };
19
16
  case 'set_private_mode':
20
17
  return { type: 'set_private_mode', private_mode: inner.private_mode };
21
18
  case 'self_identity':
@@ -28,15 +25,6 @@ export function canonicalizeMobileInner(
28
25
  locale: inner.locale,
29
26
  app_version: inner.app_version,
30
27
  };
31
- case 'unregister_expo_token':
32
- return { type: 'unregister_expo_token', expo_token: inner.expo_token };
33
- case 'update_preferences':
34
- return {
35
- type: 'update_preferences',
36
- preferences: canonicalizeNotificationPreferences(inner.preferences),
37
- };
38
- case 'notification_preferences':
39
- return { type: 'notification_preferences' };
40
28
  case 'registered_devices':
41
29
  return { type: 'registered_devices' };
42
30
  default: {
@@ -46,24 +34,3 @@ export function canonicalizeMobileInner(
46
34
  }
47
35
  }
48
36
  }
49
-
50
- /**
51
- * Rebuilds notification preferences with keys in the backend's struct declaration order, so the msgpack
52
- * encoding matches the backend's `rmp_serde::to_vec_named` output field-for-field.
53
- */
54
- function canonicalizeNotificationPreferences(
55
- preferences: MobileServerNotificationPreferences,
56
- ): MobileServerNotificationPreferences {
57
- return {
58
- schema_version: preferences.schema_version,
59
- categories: preferences.categories.map((category) => ({
60
- category: category.category,
61
- enabled: category.enabled,
62
- scopes: category.scopes.map((scope) =>
63
- scope.type === 'subaccount'
64
- ? { type: 'subaccount', subaccount: scope.subaccount }
65
- : { type: 'product', product_id: scope.product_id },
66
- ),
67
- })),
68
- };
69
- }
@@ -7,13 +7,9 @@ export const MOBILE_EIP712_METHOD_BY_TYPE: Record<
7
7
  MobileSignedInner['type'],
8
8
  string
9
9
  > = {
10
- claim_username: 'mobile:execute_claim_username',
11
- update_username: 'mobile:execute_update_username',
10
+ set_username: 'mobile:execute_set_username',
12
11
  set_private_mode: 'mobile:execute_set_private_mode',
13
12
  self_identity: 'mobile:query_self_identity',
14
13
  register_expo_token: 'mobile:execute_register_expo_token',
15
- unregister_expo_token: 'mobile:execute_unregister_expo_token',
16
- update_preferences: 'mobile:execute_update_preferences',
17
- notification_preferences: 'mobile:query_notification_preferences',
18
14
  registered_devices: 'mobile:query_registered_devices',
19
15
  };