@credenza3/partner-sdk 0.0.2-alpha.9 → 1.0.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 (309) hide show
  1. package/dist/index.d.mts +307 -0
  2. package/dist/index.d.ts +307 -0
  3. package/dist/index.js +939 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +914 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +11 -125
  8. package/dist/cjs/accounts/accounts.js +0 -15
  9. package/dist/cjs/accounts/accounts.js.map +0 -7
  10. package/dist/cjs/accounts/client/client.js +0 -30
  11. package/dist/cjs/accounts/client/client.js.map +0 -7
  12. package/dist/cjs/accounts/client/index.js +0 -24
  13. package/dist/cjs/accounts/client/index.js.map +0 -7
  14. package/dist/cjs/accounts/client/jwt-auth/index.js +0 -24
  15. package/dist/cjs/accounts/client/jwt-auth/index.js.map +0 -7
  16. package/dist/cjs/accounts/client/jwt-auth/jwt-auth.js +0 -60
  17. package/dist/cjs/accounts/client/jwt-auth/jwt-auth.js.map +0 -7
  18. package/dist/cjs/accounts/client/jwt-auth/jwt-auth.spec.js +0 -43
  19. package/dist/cjs/accounts/client/jwt-auth/jwt-auth.spec.js.map +0 -7
  20. package/dist/cjs/accounts/client/jwt-auth/jwt-auth.types.js +0 -3
  21. package/dist/cjs/accounts/client/jwt-auth/jwt-auth.types.js.map +0 -7
  22. package/dist/cjs/accounts/index.js +0 -24
  23. package/dist/cjs/accounts/index.js.map +0 -7
  24. package/dist/cjs/accounts/oauth/index.js +0 -24
  25. package/dist/cjs/accounts/oauth/index.js.map +0 -7
  26. package/dist/cjs/accounts/oauth/oauth.js +0 -43
  27. package/dist/cjs/accounts/oauth/oauth.js.map +0 -7
  28. package/dist/cjs/accounts/oauth/oauth.spec.js +0 -73
  29. package/dist/cjs/accounts/oauth/oauth.spec.js.map +0 -7
  30. package/dist/cjs/accounts/oauth/oauth.types.js +0 -3
  31. package/dist/cjs/accounts/oauth/oauth.types.js.map +0 -7
  32. package/dist/cjs/accounts/user/index.js +0 -24
  33. package/dist/cjs/accounts/user/index.js.map +0 -7
  34. package/dist/cjs/accounts/user/user.js +0 -19
  35. package/dist/cjs/accounts/user/user.js.map +0 -7
  36. package/dist/cjs/accounts/user/user.types.js +0 -3
  37. package/dist/cjs/accounts/user/user.types.js.map +0 -7
  38. package/dist/cjs/api/api.js +0 -35
  39. package/dist/cjs/api/api.js.map +0 -7
  40. package/dist/cjs/api/index.js +0 -27
  41. package/dist/cjs/api/index.js.map +0 -7
  42. package/dist/cjs/api/nfc-id/index.js +0 -25
  43. package/dist/cjs/api/nfc-id/index.js.map +0 -7
  44. package/dist/cjs/api/nfc-id/nfc-id.js +0 -72
  45. package/dist/cjs/api/nfc-id/nfc-id.js.map +0 -7
  46. package/dist/cjs/api/nfc-id/nfc-id.types.js +0 -3
  47. package/dist/cjs/api/nfc-id/nfc-id.types.js.map +0 -7
  48. package/dist/cjs/api/passport-id/index.js +0 -24
  49. package/dist/cjs/api/passport-id/index.js.map +0 -7
  50. package/dist/cjs/api/passport-id/passport-id.js +0 -30
  51. package/dist/cjs/api/passport-id/passport-id.js.map +0 -7
  52. package/dist/cjs/api/promo/index.js +0 -25
  53. package/dist/cjs/api/promo/index.js.map +0 -7
  54. package/dist/cjs/api/promo/offers/index.js +0 -24
  55. package/dist/cjs/api/promo/offers/index.js.map +0 -7
  56. package/dist/cjs/api/promo/offers/offers.js +0 -91
  57. package/dist/cjs/api/promo/offers/offers.js.map +0 -7
  58. package/dist/cjs/api/promo/offers/offers.spec.js +0 -50
  59. package/dist/cjs/api/promo/offers/offers.spec.js.map +0 -7
  60. package/dist/cjs/api/promo/offers/offers.types.js +0 -3
  61. package/dist/cjs/api/promo/offers/offers.types.js.map +0 -7
  62. package/dist/cjs/api/promo/rules/index.js +0 -24
  63. package/dist/cjs/api/promo/rules/index.js.map +0 -7
  64. package/dist/cjs/api/promo/rules/rules.js +0 -60
  65. package/dist/cjs/api/promo/rules/rules.js.map +0 -7
  66. package/dist/cjs/api/promo/rules/rules.spec.js +0 -39
  67. package/dist/cjs/api/promo/rules/rules.spec.js.map +0 -7
  68. package/dist/cjs/api/promo/rules/rules.types.js +0 -3
  69. package/dist/cjs/api/promo/rules/rules.types.js.map +0 -7
  70. package/dist/cjs/credenza-partner-sdk.js +0 -18
  71. package/dist/cjs/credenza-partner-sdk.js.map +0 -7
  72. package/dist/cjs/evm/account/account.js +0 -18
  73. package/dist/cjs/evm/account/account.js.map +0 -7
  74. package/dist/cjs/evm/account/index.js +0 -24
  75. package/dist/cjs/evm/account/index.js.map +0 -7
  76. package/dist/cjs/evm/contract/contract.js +0 -98
  77. package/dist/cjs/evm/contract/contract.js.map +0 -7
  78. package/dist/cjs/evm/contract/index.js +0 -24
  79. package/dist/cjs/evm/contract/index.js.map +0 -7
  80. package/dist/cjs/evm/evm.js +0 -35
  81. package/dist/cjs/evm/evm.js.map +0 -7
  82. package/dist/cjs/evm/index.js +0 -26
  83. package/dist/cjs/evm/index.js.map +0 -7
  84. package/dist/cjs/index.js +0 -24
  85. package/dist/cjs/index.js.map +0 -7
  86. package/dist/cjs/lib/credentials/credentials.js +0 -25
  87. package/dist/cjs/lib/credentials/credentials.js.map +0 -7
  88. package/dist/cjs/lib/credentials/credentials.types.js +0 -3
  89. package/dist/cjs/lib/credentials/credentials.types.js.map +0 -7
  90. package/dist/cjs/lib/credentials/index.js +0 -25
  91. package/dist/cjs/lib/credentials/index.js.map +0 -7
  92. package/dist/cjs/lib/logging/index.js +0 -24
  93. package/dist/cjs/lib/logging/index.js.map +0 -7
  94. package/dist/cjs/lib/logging/logging.js +0 -14
  95. package/dist/cjs/lib/logging/logging.js.map +0 -7
  96. package/dist/cjs/lib/obj/index.js +0 -24
  97. package/dist/cjs/lib/obj/index.js.map +0 -7
  98. package/dist/cjs/lib/obj/obj.js +0 -29
  99. package/dist/cjs/lib/obj/obj.js.map +0 -7
  100. package/dist/cjs/lib/obj/obj.spec.js +0 -31
  101. package/dist/cjs/lib/obj/obj.spec.js.map +0 -7
  102. package/dist/cjs/lib/sdk-env/index.js +0 -26
  103. package/dist/cjs/lib/sdk-env/index.js.map +0 -7
  104. package/dist/cjs/lib/sdk-env/sdk-env.constants.js +0 -9
  105. package/dist/cjs/lib/sdk-env/sdk-env.constants.js.map +0 -7
  106. package/dist/cjs/lib/sdk-env/sdk-env.js +0 -13
  107. package/dist/cjs/lib/sdk-env/sdk-env.js.map +0 -7
  108. package/dist/cjs/lib/sdk-env/sdk-env.types.js +0 -3
  109. package/dist/cjs/lib/sdk-env/sdk-env.types.js.map +0 -7
  110. package/dist/cjs/lib/ws/index.js +0 -24
  111. package/dist/cjs/lib/ws/index.js.map +0 -7
  112. package/dist/cjs/lib/ws/ws.js +0 -21
  113. package/dist/cjs/lib/ws/ws.js.map +0 -7
  114. package/dist/cjs/package.json +0 -3
  115. package/dist/cjs/sui/account/account.js +0 -18
  116. package/dist/cjs/sui/account/account.js.map +0 -7
  117. package/dist/cjs/sui/account/index.js +0 -24
  118. package/dist/cjs/sui/account/index.js.map +0 -7
  119. package/dist/cjs/sui/index.js +0 -44
  120. package/dist/cjs/sui/index.js.map +0 -7
  121. package/dist/cjs/sui/sui.js +0 -15
  122. package/dist/cjs/sui/sui.js.map +0 -7
  123. package/dist/cjs/sui/zk/account/account.js +0 -18
  124. package/dist/cjs/sui/zk/account/account.js.map +0 -7
  125. package/dist/cjs/sui/zk/account/index.js +0 -24
  126. package/dist/cjs/sui/zk/account/index.js.map +0 -7
  127. package/dist/cjs/sui/zk/index.js +0 -24
  128. package/dist/cjs/sui/zk/index.js.map +0 -7
  129. package/dist/esm/accounts/accounts.d.ts +0 -1
  130. package/dist/esm/accounts/accounts.js +0 -15
  131. package/dist/esm/accounts/accounts.js.map +0 -1
  132. package/dist/esm/accounts/client/client.d.ts +0 -12
  133. package/dist/esm/accounts/client/client.js +0 -29
  134. package/dist/esm/accounts/client/client.js.map +0 -1
  135. package/dist/esm/accounts/client/index.d.ts +0 -1
  136. package/dist/esm/accounts/client/index.js +0 -18
  137. package/dist/esm/accounts/client/index.js.map +0 -1
  138. package/dist/esm/accounts/client/jwt-auth/index.d.ts +0 -1
  139. package/dist/esm/accounts/client/jwt-auth/index.js +0 -18
  140. package/dist/esm/accounts/client/jwt-auth/index.js.map +0 -1
  141. package/dist/esm/accounts/client/jwt-auth/jwt-auth.d.ts +0 -5
  142. package/dist/esm/accounts/client/jwt-auth/jwt-auth.js +0 -60
  143. package/dist/esm/accounts/client/jwt-auth/jwt-auth.js.map +0 -1
  144. package/dist/esm/accounts/client/jwt-auth/jwt-auth.spec.d.ts +0 -1
  145. package/dist/esm/accounts/client/jwt-auth/jwt-auth.spec.js +0 -43
  146. package/dist/esm/accounts/client/jwt-auth/jwt-auth.spec.js.map +0 -1
  147. package/dist/esm/accounts/client/jwt-auth/jwt-auth.types.d.ts +0 -25
  148. package/dist/esm/accounts/client/jwt-auth/jwt-auth.types.js +0 -3
  149. package/dist/esm/accounts/client/jwt-auth/jwt-auth.types.js.map +0 -1
  150. package/dist/esm/accounts/index.d.ts +0 -1
  151. package/dist/esm/accounts/index.js +0 -18
  152. package/dist/esm/accounts/index.js.map +0 -1
  153. package/dist/esm/accounts/oauth/index.d.ts +0 -1
  154. package/dist/esm/accounts/oauth/index.js +0 -18
  155. package/dist/esm/accounts/oauth/index.js.map +0 -1
  156. package/dist/esm/accounts/oauth/oauth.d.ts +0 -3
  157. package/dist/esm/accounts/oauth/oauth.js +0 -43
  158. package/dist/esm/accounts/oauth/oauth.js.map +0 -1
  159. package/dist/esm/accounts/oauth/oauth.spec.d.ts +0 -1
  160. package/dist/esm/accounts/oauth/oauth.spec.js +0 -78
  161. package/dist/esm/accounts/oauth/oauth.spec.js.map +0 -1
  162. package/dist/esm/accounts/oauth/oauth.types.d.ts +0 -10
  163. package/dist/esm/accounts/oauth/oauth.types.js +0 -3
  164. package/dist/esm/accounts/oauth/oauth.types.js.map +0 -1
  165. package/dist/esm/accounts/user/index.d.ts +0 -1
  166. package/dist/esm/accounts/user/index.js +0 -18
  167. package/dist/esm/accounts/user/index.js.map +0 -1
  168. package/dist/esm/accounts/user/user.d.ts +0 -2
  169. package/dist/esm/accounts/user/user.js +0 -19
  170. package/dist/esm/accounts/user/user.js.map +0 -1
  171. package/dist/esm/accounts/user/user.types.d.ts +0 -8
  172. package/dist/esm/accounts/user/user.types.js +0 -3
  173. package/dist/esm/accounts/user/user.types.js.map +0 -1
  174. package/dist/esm/api/api.d.ts +0 -4
  175. package/dist/esm/api/api.js +0 -35
  176. package/dist/esm/api/api.js.map +0 -1
  177. package/dist/esm/api/index.d.ts +0 -4
  178. package/dist/esm/api/index.js +0 -21
  179. package/dist/esm/api/index.js.map +0 -1
  180. package/dist/esm/api/nfc-id/index.d.ts +0 -2
  181. package/dist/esm/api/nfc-id/index.js +0 -19
  182. package/dist/esm/api/nfc-id/index.js.map +0 -1
  183. package/dist/esm/api/nfc-id/nfc-id.d.ts +0 -5
  184. package/dist/esm/api/nfc-id/nfc-id.js +0 -70
  185. package/dist/esm/api/nfc-id/nfc-id.js.map +0 -1
  186. package/dist/esm/api/nfc-id/nfc-id.types.d.ts +0 -9
  187. package/dist/esm/api/nfc-id/nfc-id.types.js +0 -3
  188. package/dist/esm/api/nfc-id/nfc-id.types.js.map +0 -1
  189. package/dist/esm/api/passport-id/index.d.ts +0 -1
  190. package/dist/esm/api/passport-id/index.js +0 -18
  191. package/dist/esm/api/passport-id/index.js.map +0 -1
  192. package/dist/esm/api/passport-id/passport-id.d.ts +0 -3
  193. package/dist/esm/api/passport-id/passport-id.js +0 -30
  194. package/dist/esm/api/passport-id/passport-id.js.map +0 -1
  195. package/dist/esm/api/promo/index.d.ts +0 -2
  196. package/dist/esm/api/promo/index.js +0 -19
  197. package/dist/esm/api/promo/index.js.map +0 -1
  198. package/dist/esm/api/promo/offers/index.d.ts +0 -1
  199. package/dist/esm/api/promo/offers/index.js +0 -18
  200. package/dist/esm/api/promo/offers/index.js.map +0 -1
  201. package/dist/esm/api/promo/offers/offers.d.ts +0 -10
  202. package/dist/esm/api/promo/offers/offers.js +0 -92
  203. package/dist/esm/api/promo/offers/offers.js.map +0 -1
  204. package/dist/esm/api/promo/offers/offers.spec.d.ts +0 -1
  205. package/dist/esm/api/promo/offers/offers.spec.js +0 -50
  206. package/dist/esm/api/promo/offers/offers.spec.js.map +0 -1
  207. package/dist/esm/api/promo/offers/offers.types.d.ts +0 -24
  208. package/dist/esm/api/promo/offers/offers.types.js +0 -3
  209. package/dist/esm/api/promo/offers/offers.types.js.map +0 -1
  210. package/dist/esm/api/promo/rules/index.d.ts +0 -1
  211. package/dist/esm/api/promo/rules/index.js +0 -18
  212. package/dist/esm/api/promo/rules/index.js.map +0 -1
  213. package/dist/esm/api/promo/rules/rules.d.ts +0 -5
  214. package/dist/esm/api/promo/rules/rules.js +0 -60
  215. package/dist/esm/api/promo/rules/rules.js.map +0 -1
  216. package/dist/esm/api/promo/rules/rules.spec.d.ts +0 -1
  217. package/dist/esm/api/promo/rules/rules.spec.js +0 -39
  218. package/dist/esm/api/promo/rules/rules.spec.js.map +0 -1
  219. package/dist/esm/api/promo/rules/rules.types.d.ts +0 -14
  220. package/dist/esm/api/promo/rules/rules.types.js +0 -3
  221. package/dist/esm/api/promo/rules/rules.types.js.map +0 -1
  222. package/dist/esm/credenza-partner-sdk.d.ts +0 -5
  223. package/dist/esm/credenza-partner-sdk.js +0 -18
  224. package/dist/esm/credenza-partner-sdk.js.map +0 -1
  225. package/dist/esm/evm/account/account.d.ts +0 -3
  226. package/dist/esm/evm/account/account.js +0 -18
  227. package/dist/esm/evm/account/account.js.map +0 -1
  228. package/dist/esm/evm/account/index.d.ts +0 -1
  229. package/dist/esm/evm/account/index.js +0 -18
  230. package/dist/esm/evm/account/index.js.map +0 -1
  231. package/dist/esm/evm/contract/contract.d.ts +0 -8
  232. package/dist/esm/evm/contract/contract.js +0 -98
  233. package/dist/esm/evm/contract/contract.js.map +0 -1
  234. package/dist/esm/evm/contract/index.d.ts +0 -1
  235. package/dist/esm/evm/contract/index.js +0 -18
  236. package/dist/esm/evm/contract/index.js.map +0 -1
  237. package/dist/esm/evm/evm.d.ts +0 -4
  238. package/dist/esm/evm/evm.js +0 -35
  239. package/dist/esm/evm/evm.js.map +0 -1
  240. package/dist/esm/evm/index.d.ts +0 -3
  241. package/dist/esm/evm/index.js +0 -20
  242. package/dist/esm/evm/index.js.map +0 -1
  243. package/dist/esm/index.d.ts +0 -1
  244. package/dist/esm/index.js +0 -18
  245. package/dist/esm/index.js.map +0 -1
  246. package/dist/esm/lib/credentials/credentials.d.ts +0 -4
  247. package/dist/esm/lib/credentials/credentials.js +0 -25
  248. package/dist/esm/lib/credentials/credentials.js.map +0 -1
  249. package/dist/esm/lib/credentials/credentials.types.d.ts +0 -4
  250. package/dist/esm/lib/credentials/credentials.types.js +0 -3
  251. package/dist/esm/lib/credentials/credentials.types.js.map +0 -1
  252. package/dist/esm/lib/credentials/index.d.ts +0 -2
  253. package/dist/esm/lib/credentials/index.js +0 -19
  254. package/dist/esm/lib/credentials/index.js.map +0 -1
  255. package/dist/esm/lib/logging/index.d.ts +0 -1
  256. package/dist/esm/lib/logging/index.js +0 -18
  257. package/dist/esm/lib/logging/index.js.map +0 -1
  258. package/dist/esm/lib/logging/logging.d.ts +0 -2
  259. package/dist/esm/lib/logging/logging.js +0 -14
  260. package/dist/esm/lib/logging/logging.js.map +0 -1
  261. package/dist/esm/lib/obj/index.d.ts +0 -1
  262. package/dist/esm/lib/obj/index.js +0 -18
  263. package/dist/esm/lib/obj/index.js.map +0 -1
  264. package/dist/esm/lib/obj/obj.d.ts +0 -2
  265. package/dist/esm/lib/obj/obj.js +0 -31
  266. package/dist/esm/lib/obj/obj.js.map +0 -1
  267. package/dist/esm/lib/obj/obj.spec.d.ts +0 -1
  268. package/dist/esm/lib/obj/obj.spec.js +0 -31
  269. package/dist/esm/lib/obj/obj.spec.js.map +0 -1
  270. package/dist/esm/lib/sdk-env/index.d.ts +0 -3
  271. package/dist/esm/lib/sdk-env/index.js +0 -20
  272. package/dist/esm/lib/sdk-env/index.js.map +0 -1
  273. package/dist/esm/lib/sdk-env/sdk-env.constants.d.ts +0 -5
  274. package/dist/esm/lib/sdk-env/sdk-env.constants.js +0 -9
  275. package/dist/esm/lib/sdk-env/sdk-env.constants.js.map +0 -1
  276. package/dist/esm/lib/sdk-env/sdk-env.d.ts +0 -3
  277. package/dist/esm/lib/sdk-env/sdk-env.js +0 -13
  278. package/dist/esm/lib/sdk-env/sdk-env.js.map +0 -1
  279. package/dist/esm/lib/sdk-env/sdk-env.types.d.ts +0 -2
  280. package/dist/esm/lib/sdk-env/sdk-env.types.js +0 -3
  281. package/dist/esm/lib/sdk-env/sdk-env.types.js.map +0 -1
  282. package/dist/esm/lib/ws/index.d.ts +0 -1
  283. package/dist/esm/lib/ws/index.js +0 -18
  284. package/dist/esm/lib/ws/index.js.map +0 -1
  285. package/dist/esm/lib/ws/ws.d.ts +0 -2
  286. package/dist/esm/lib/ws/ws.js +0 -21
  287. package/dist/esm/lib/ws/ws.js.map +0 -1
  288. package/dist/esm/package.json +0 -3
  289. package/dist/esm/sui/account/account.d.ts +0 -3
  290. package/dist/esm/sui/account/account.js +0 -18
  291. package/dist/esm/sui/account/account.js.map +0 -1
  292. package/dist/esm/sui/account/index.d.ts +0 -1
  293. package/dist/esm/sui/account/index.js +0 -18
  294. package/dist/esm/sui/account/index.js.map +0 -1
  295. package/dist/esm/sui/index.d.ts +0 -3
  296. package/dist/esm/sui/index.js +0 -33
  297. package/dist/esm/sui/index.js.map +0 -1
  298. package/dist/esm/sui/sui.d.ts +0 -1
  299. package/dist/esm/sui/sui.js +0 -15
  300. package/dist/esm/sui/sui.js.map +0 -1
  301. package/dist/esm/sui/zk/account/account.d.ts +0 -3
  302. package/dist/esm/sui/zk/account/account.js +0 -18
  303. package/dist/esm/sui/zk/account/account.js.map +0 -1
  304. package/dist/esm/sui/zk/account/index.d.ts +0 -1
  305. package/dist/esm/sui/zk/account/index.js +0 -18
  306. package/dist/esm/sui/zk/account/index.js.map +0 -1
  307. package/dist/esm/sui/zk/index.d.ts +0 -1
  308. package/dist/esm/sui/zk/index.js +0 -18
  309. package/dist/esm/sui/zk/index.js.map +0 -1
package/dist/index.mjs ADDED
@@ -0,0 +1,914 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __export = (target, all) => {
18
+ for (var name in all)
19
+ __defProp(target, name, { get: all[name], enumerable: true });
20
+ };
21
+ var __async = (__this, __arguments, generator) => {
22
+ return new Promise((resolve, reject) => {
23
+ var fulfilled = (value) => {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ };
30
+ var rejected = (value) => {
31
+ try {
32
+ step(generator.throw(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
+ step((generator = generator.apply(__this, __arguments)).next());
39
+ });
40
+ };
41
+
42
+ // src/lib/credentials/credentials.ts
43
+ import { Buffer as Buffer2 } from "buffer";
44
+ var credentials = null;
45
+ function setCredentials(credentialsInput) {
46
+ if (!credentialsInput.clientId) throw new Error('"clientId" is required');
47
+ if (!credentialsInput.clientSecret) throw new Error('"clientSecret" is required');
48
+ credentials = credentialsInput;
49
+ }
50
+ function getCredentials() {
51
+ if (!(credentials == null ? void 0 : credentials.clientId) || !(credentials == null ? void 0 : credentials.clientSecret)) throw new Error("Credentials are not set");
52
+ return credentials;
53
+ }
54
+ function getBasicToken() {
55
+ const { clientId, clientSecret } = getCredentials();
56
+ const basicCredentials = `${clientId}:${clientSecret}`;
57
+ return `Basic ${Buffer2.from(basicCredentials).toString("base64")}`;
58
+ }
59
+
60
+ // src/lib/sdk-env/sdk-env.constants.ts
61
+ var SDK_ENV = {
62
+ PROD: "prod",
63
+ STAGING: "staging",
64
+ LOCAL: "local"
65
+ };
66
+
67
+ // src/lib/sdk-env/sdk-env.ts
68
+ var sdkEnv = SDK_ENV.PROD;
69
+ function getSdkEnv() {
70
+ return sdkEnv;
71
+ }
72
+ function setSdkEnv(sdkEnvironment) {
73
+ sdkEnv = sdkEnvironment;
74
+ }
75
+
76
+ // src/lib/logging/logging.ts
77
+ var debugEnabled = false;
78
+ function log(methodName, ...args) {
79
+ if (!debugEnabled) return;
80
+ console.log(`[CREDENZA_PARTNER_SDK#${methodName}]:`, ...args);
81
+ }
82
+ function enableSdkDebug(enableDebug) {
83
+ debugEnabled = enableDebug;
84
+ }
85
+
86
+ // src/accounts/index.ts
87
+ var accounts_exports = {};
88
+ __export(accounts_exports, {
89
+ client: () => client_exports,
90
+ getOAuthApiUrl: () => getOAuthApiUrl,
91
+ oauth: () => oauth_exports,
92
+ user: () => user_exports
93
+ });
94
+
95
+ // src/accounts/accounts.ts
96
+ function getOAuthApiUrl() {
97
+ switch (getSdkEnv()) {
98
+ case SDK_ENV.PROD:
99
+ return "https://accounts.credenza3.com";
100
+ case SDK_ENV.STAGING:
101
+ return "https://accounts.staging.credenza3.com";
102
+ case SDK_ENV.LOCAL:
103
+ return "http://localhost:8081";
104
+ }
105
+ }
106
+
107
+ // src/accounts/user/index.ts
108
+ var user_exports = {};
109
+ __export(user_exports, {
110
+ getAccountInfo: () => getAccountInfo
111
+ });
112
+
113
+ // src/lib/obj/obj.ts
114
+ function toCamelCase(obj) {
115
+ if (Array.isArray(obj)) {
116
+ return obj.map(toCamelCase);
117
+ } else if (obj !== null && typeof obj === "object") {
118
+ return Object.keys(obj).reduce((acc, key) => {
119
+ const camelKey = key.replace(/^_id$/, "id").replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
120
+ acc[camelKey] = toCamelCase(obj[key]);
121
+ return acc;
122
+ }, {});
123
+ }
124
+ return obj;
125
+ }
126
+ function toSnakeCase(obj) {
127
+ if (Array.isArray(obj)) {
128
+ return obj.map(toSnakeCase);
129
+ } else if (obj !== null && typeof obj === "object") {
130
+ return Object.keys(obj).reduce((acc, key) => {
131
+ const snakeKey = key.replace(/([A-Z])/g, (_, letter) => `_${letter.toLowerCase()}`);
132
+ acc[snakeKey] = toSnakeCase(obj[key]);
133
+ return acc;
134
+ }, {});
135
+ }
136
+ return obj;
137
+ }
138
+
139
+ // src/accounts/user/user.ts
140
+ function getAccountInfo(sub) {
141
+ return __async(this, null, function* () {
142
+ const response = yield fetch(`${getOAuthApiUrl()}/accounts/${sub}`, {
143
+ headers: {
144
+ Authorization: getBasicToken(),
145
+ "Content-Type": "application/json"
146
+ }
147
+ });
148
+ const json = yield response.json();
149
+ log(getAccountInfo.name, json);
150
+ return toCamelCase(json);
151
+ });
152
+ }
153
+
154
+ // src/accounts/client/index.ts
155
+ var client_exports = {};
156
+ __export(client_exports, {
157
+ getCurrentClientInfo: () => getCurrentClientInfo,
158
+ jwtAuth: () => jwt_auth_exports
159
+ });
160
+
161
+ // src/accounts/client/client.ts
162
+ function getCurrentClientInfo() {
163
+ return __async(this, null, function* () {
164
+ var _a;
165
+ const response = yield fetch(`${getOAuthApiUrl()}/clients/current`, {
166
+ headers: {
167
+ Authorization: getBasicToken(),
168
+ "Content-Type": "application/json"
169
+ }
170
+ });
171
+ const json = yield response.json();
172
+ log(getCurrentClientInfo.name, json);
173
+ return {
174
+ id: json._id,
175
+ name: json.name,
176
+ callbackUris: json.callback_uris,
177
+ confidential: json.confidential,
178
+ ownerId: json.owner_id,
179
+ accessTokenTTLMinutes: json.access_token_ttl_minutes,
180
+ availableLoginTypes: json.available_login_types,
181
+ admins: json.admins,
182
+ apiPermissions: json.api_permissions,
183
+ logoUri: (_a = json.logo_uri) != null ? _a : null
184
+ };
185
+ });
186
+ }
187
+
188
+ // src/accounts/client/jwt-auth/index.ts
189
+ var jwt_auth_exports = {};
190
+ __export(jwt_auth_exports, {
191
+ addJwtValidator: () => addJwtValidator,
192
+ getJwtValidators: () => getJwtValidators,
193
+ removeJwtValidator: () => removeJwtValidator,
194
+ updateJwtValidator: () => updateJwtValidator
195
+ });
196
+
197
+ // src/accounts/client/jwt-auth/jwt-auth.ts
198
+ function addJwtValidator(params) {
199
+ return __async(this, null, function* () {
200
+ const response = yield fetch(`${getOAuthApiUrl()}/clients/jwt-auth`, {
201
+ method: "POST",
202
+ headers: {
203
+ Authorization: getBasicToken(),
204
+ "Content-Type": "application/json"
205
+ },
206
+ body: JSON.stringify(toSnakeCase(params))
207
+ });
208
+ const json = yield response.json();
209
+ log(addJwtValidator.name, json);
210
+ return toCamelCase(json);
211
+ });
212
+ }
213
+ function updateJwtValidator(id, params) {
214
+ return __async(this, null, function* () {
215
+ const response = yield fetch(`${getOAuthApiUrl()}/clients/jwt-auth/${id}`, {
216
+ method: "PATCH",
217
+ headers: {
218
+ Authorization: getBasicToken(),
219
+ "Content-Type": "application/json"
220
+ },
221
+ body: JSON.stringify(toSnakeCase(params))
222
+ });
223
+ const json = yield response.json();
224
+ log(updateJwtValidator.name, json);
225
+ return toCamelCase(json);
226
+ });
227
+ }
228
+ function removeJwtValidator(id) {
229
+ return __async(this, null, function* () {
230
+ const response = yield fetch(`${getOAuthApiUrl()}/clients/jwt-auth/${id}`, {
231
+ method: "DELETE",
232
+ headers: {
233
+ Authorization: getBasicToken(),
234
+ "Content-Type": "application/json"
235
+ }
236
+ });
237
+ const json = yield response.json();
238
+ log(removeJwtValidator.name, json);
239
+ return json;
240
+ });
241
+ }
242
+ function getJwtValidators() {
243
+ return __async(this, null, function* () {
244
+ const response = yield fetch(`${getOAuthApiUrl()}/clients/jwt-auth`, {
245
+ headers: {
246
+ Authorization: getBasicToken(),
247
+ "Content-Type": "application/json"
248
+ }
249
+ });
250
+ const json = yield response.json();
251
+ log(getJwtValidators.name, json);
252
+ return toCamelCase(json);
253
+ });
254
+ }
255
+
256
+ // src/accounts/oauth/index.ts
257
+ var oauth_exports = {};
258
+ __export(oauth_exports, {
259
+ exchangeCodeForToken: () => exchangeCodeForToken,
260
+ refreshToken: () => refreshToken
261
+ });
262
+
263
+ // src/accounts/oauth/oauth.ts
264
+ function exchangeCodeForToken(params) {
265
+ return __async(this, null, function* () {
266
+ const response = yield fetch(`${getOAuthApiUrl()}/oauth2/token`, {
267
+ method: "POST",
268
+ headers: {
269
+ Authorization: getBasicToken(),
270
+ "Content-Type": "application/x-www-form-urlencoded"
271
+ },
272
+ body: new URLSearchParams({
273
+ grant_type: "authorization_code",
274
+ code: params.code,
275
+ code_verifier: params.codeVerifier,
276
+ redirect_uri: params.redirectUri || "none"
277
+ })
278
+ });
279
+ const json = yield response.json();
280
+ log(exchangeCodeForToken.name, json);
281
+ return toCamelCase(json);
282
+ });
283
+ }
284
+ function refreshToken(refreshTokenValue) {
285
+ return __async(this, null, function* () {
286
+ const response = yield fetch(`${getOAuthApiUrl()}/oauth2/token`, {
287
+ method: "POST",
288
+ headers: {
289
+ Authorization: getBasicToken(),
290
+ "Content-Type": "application/x-www-form-urlencoded"
291
+ },
292
+ body: new URLSearchParams({
293
+ grant_type: "refresh_token",
294
+ refresh_token: refreshTokenValue
295
+ })
296
+ });
297
+ const json = yield response.json();
298
+ log(refreshToken.name, json);
299
+ return toCamelCase(json);
300
+ });
301
+ }
302
+
303
+ // src/api/index.ts
304
+ var api_exports = {};
305
+ __export(api_exports, {
306
+ getGeneralApiUrl: () => getGeneralApiUrl,
307
+ getGeneralWsUrl: () => getGeneralWsUrl,
308
+ getWsConnection: () => getWsConnection,
309
+ nfcId: () => nfc_id_exports,
310
+ passportId: () => passport_id_exports,
311
+ promo: () => promo_exports
312
+ });
313
+
314
+ // src/lib/ws/ws.ts
315
+ import { io } from "socket.io-client";
316
+ function connectToWs(url) {
317
+ return __async(this, null, function* () {
318
+ const credentials2 = getCredentials();
319
+ const socket3 = io(url, {
320
+ auth: {
321
+ client_id: credentials2.clientId,
322
+ client_secret: credentials2.clientSecret
323
+ }
324
+ });
325
+ yield new Promise((resolve, reject) => {
326
+ socket3.once("connect_error", (err) => reject(err));
327
+ socket3.once("connect", () => resolve(socket3));
328
+ setTimeout(() => reject(new Error("Cannot connect to websocket server")), 5e3);
329
+ });
330
+ return socket3;
331
+ });
332
+ }
333
+
334
+ // src/api/api.ts
335
+ var socket;
336
+ function getGeneralApiUrl() {
337
+ switch (getSdkEnv()) {
338
+ case SDK_ENV.PROD:
339
+ return "https://api.credenza3.com";
340
+ case SDK_ENV.STAGING:
341
+ return "https://api.staging.credenza3.com";
342
+ case SDK_ENV.LOCAL:
343
+ return "http://localhost:8084";
344
+ }
345
+ }
346
+ function getGeneralWsUrl() {
347
+ switch (getSdkEnv()) {
348
+ case SDK_ENV.PROD:
349
+ return "wss://general-prod-prod.up.railway.app";
350
+ case SDK_ENV.STAGING:
351
+ return "wss://general-staging-staging.up.railway.app";
352
+ case SDK_ENV.LOCAL:
353
+ return "ws://localhost:8084";
354
+ }
355
+ }
356
+ function getWsConnection() {
357
+ return __async(this, null, function* () {
358
+ if (!(socket == null ? void 0 : socket.connected)) {
359
+ socket = yield connectToWs(getGeneralWsUrl());
360
+ }
361
+ return socket;
362
+ });
363
+ }
364
+
365
+ // src/api/nfc-id/index.ts
366
+ var nfc_id_exports = {};
367
+ __export(nfc_id_exports, {
368
+ addNfcId: () => addNfcId,
369
+ getNfcId: () => getNfcId,
370
+ removeNfcId: () => removeNfcId,
371
+ updateNfcId: () => updateNfcId
372
+ });
373
+
374
+ // src/api/nfc-id/nfc-id.ts
375
+ function addNfcId(params) {
376
+ return __async(this, null, function* () {
377
+ var _a;
378
+ const response = yield fetch(`${getGeneralApiUrl()}/nfc-id`, {
379
+ method: "POST",
380
+ headers: {
381
+ Authorization: getBasicToken(),
382
+ "Content-Type": "application/json"
383
+ },
384
+ body: JSON.stringify(__spreadValues({
385
+ serial_number: params.serialNumber,
386
+ sub: params.sub
387
+ }, params.text ? { text: params.text } : {}))
388
+ });
389
+ const json = yield response.json();
390
+ log(addNfcId.name, json);
391
+ return {
392
+ sub: json.sub,
393
+ serialNumber: json.serial_number,
394
+ text: (_a = json.text) != null ? _a : null
395
+ };
396
+ });
397
+ }
398
+ function updateNfcId(serialNumber, params) {
399
+ return __async(this, null, function* () {
400
+ const response = yield fetch(`${getGeneralApiUrl()}/nfc-id/${serialNumber}`, {
401
+ method: "PATCH",
402
+ headers: {
403
+ Authorization: getBasicToken(),
404
+ "Content-Type": "application/json"
405
+ },
406
+ body: JSON.stringify(__spreadValues(__spreadValues({}, params.text ? { text: params.text } : {}), params.sub ? { sub: params.sub } : {}))
407
+ });
408
+ const json = yield response.json();
409
+ log(updateNfcId.name, json);
410
+ return json;
411
+ });
412
+ }
413
+ function removeNfcId(serialNumber) {
414
+ return __async(this, null, function* () {
415
+ const response = yield fetch(`${getGeneralApiUrl()}/nfc-id/${serialNumber}`, {
416
+ method: "DELETE",
417
+ headers: {
418
+ Authorization: getBasicToken(),
419
+ "Content-Type": "application/json"
420
+ }
421
+ });
422
+ const json = yield response.json();
423
+ log(removeNfcId.name, json);
424
+ return json;
425
+ });
426
+ }
427
+ function getNfcId(serialNumber) {
428
+ return __async(this, null, function* () {
429
+ var _a;
430
+ const response = yield fetch(`${getGeneralApiUrl()}/nfc-id/${serialNumber}`, {
431
+ headers: {
432
+ Authorization: getBasicToken(),
433
+ "Content-Type": "application/json"
434
+ }
435
+ });
436
+ const json = yield response.json();
437
+ log(getNfcId.name, json);
438
+ return { sub: json.sub, text: (_a = json.text) != null ? _a : null };
439
+ });
440
+ }
441
+
442
+ // src/api/passport-id/index.ts
443
+ var passport_id_exports = {};
444
+ __export(passport_id_exports, {
445
+ requestPassportIdSignature: () => requestPassportIdSignature
446
+ });
447
+
448
+ // src/api/passport-id/passport-id.ts
449
+ function requestPassportIdSignature(sub, message) {
450
+ return __async(this, null, function* () {
451
+ if (!sub) throw new Error('"Sub is required"');
452
+ if (!message) throw new Error('"Message is required"');
453
+ const socket3 = yield getWsConnection();
454
+ return new Promise((resolve, reject) => {
455
+ socket3.once(`passport_id/signed/${sub}`, (data) => {
456
+ log(requestPassportIdSignature.name, "Received", data);
457
+ resolve(data.payload);
458
+ });
459
+ socket3.emit(
460
+ "passport_id/request_signature",
461
+ {
462
+ payload: { sub, message }
463
+ },
464
+ (data) => {
465
+ if (!data.payload.ok) {
466
+ reject(new Error("Failed to sign message"));
467
+ }
468
+ if (data.error) {
469
+ reject(new Error(data.error.message));
470
+ }
471
+ log(requestPassportIdSignature.name, "Requested", data);
472
+ }
473
+ );
474
+ });
475
+ });
476
+ }
477
+
478
+ // src/api/promo/index.ts
479
+ var promo_exports = {};
480
+ __export(promo_exports, {
481
+ offers: () => offers_exports,
482
+ rules: () => rules_exports
483
+ });
484
+
485
+ // src/api/promo/rules/index.ts
486
+ var rules_exports = {};
487
+ __export(rules_exports, {
488
+ addPromoRule: () => addPromoRule,
489
+ getPromoRules: () => getPromoRules,
490
+ removePromoRule: () => removePromoRule,
491
+ updatePromoRule: () => updatePromoRule
492
+ });
493
+
494
+ // src/api/promo/rules/rules.ts
495
+ function addPromoRule(params) {
496
+ return __async(this, null, function* () {
497
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/rules`, {
498
+ method: "POST",
499
+ headers: {
500
+ Authorization: getBasicToken(),
501
+ "Content-Type": "application/json"
502
+ },
503
+ body: JSON.stringify(toSnakeCase(params))
504
+ });
505
+ const json = yield response.json();
506
+ log(addPromoRule.name, json);
507
+ return toCamelCase(json);
508
+ });
509
+ }
510
+ function updatePromoRule(id, params) {
511
+ return __async(this, null, function* () {
512
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/rules/${id}`, {
513
+ method: "PATCH",
514
+ headers: {
515
+ Authorization: getBasicToken(),
516
+ "Content-Type": "application/json"
517
+ },
518
+ body: JSON.stringify(toSnakeCase(params))
519
+ });
520
+ const json = yield response.json();
521
+ log(updatePromoRule.name, json);
522
+ return toCamelCase(json);
523
+ });
524
+ }
525
+ function removePromoRule(id) {
526
+ return __async(this, null, function* () {
527
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/rules/${id}`, {
528
+ method: "DELETE",
529
+ headers: {
530
+ Authorization: getBasicToken(),
531
+ "Content-Type": "application/json"
532
+ }
533
+ });
534
+ const json = yield response.json();
535
+ log(removePromoRule.name, json);
536
+ return response.ok;
537
+ });
538
+ }
539
+ function getPromoRules() {
540
+ return __async(this, null, function* () {
541
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/rules`, {
542
+ headers: {
543
+ Authorization: getBasicToken(),
544
+ "Content-Type": "application/json"
545
+ }
546
+ });
547
+ const json = yield response.json();
548
+ log(getPromoRules.name, json);
549
+ return toCamelCase(json);
550
+ });
551
+ }
552
+
553
+ // src/api/promo/offers/index.ts
554
+ var offers_exports = {};
555
+ __export(offers_exports, {
556
+ addPromoOffer: () => addPromoOffer,
557
+ checkPromoOffer: () => checkPromoOffer,
558
+ getPromoOfferRss: () => getPromoOfferRss,
559
+ getPromoOffers: () => getPromoOffers,
560
+ removePromoOffer: () => removePromoOffer,
561
+ updatePromoOffer: () => updatePromoOffer
562
+ });
563
+
564
+ // src/api/promo/offers/offers.ts
565
+ function addPromoOffer(params) {
566
+ return __async(this, null, function* () {
567
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/offers`, {
568
+ method: "POST",
569
+ headers: {
570
+ Authorization: getBasicToken(),
571
+ "Content-Type": "application/json"
572
+ },
573
+ body: JSON.stringify(toSnakeCase(params))
574
+ });
575
+ const json = yield response.json();
576
+ log(addPromoOffer.name, json);
577
+ return toCamelCase(json);
578
+ });
579
+ }
580
+ function updatePromoOffer(id, params) {
581
+ return __async(this, null, function* () {
582
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/offers/${id}`, {
583
+ method: "PATCH",
584
+ headers: {
585
+ Authorization: getBasicToken(),
586
+ "Content-Type": "application/json"
587
+ },
588
+ body: JSON.stringify(toSnakeCase(params))
589
+ });
590
+ const json = yield response.json();
591
+ log(updatePromoOffer.name, json);
592
+ return toCamelCase(json);
593
+ });
594
+ }
595
+ function removePromoOffer(id) {
596
+ return __async(this, null, function* () {
597
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/offers/${id}`, {
598
+ method: "DELETE",
599
+ headers: {
600
+ Authorization: getBasicToken(),
601
+ "Content-Type": "application/json"
602
+ }
603
+ });
604
+ const json = yield response.json();
605
+ log(removePromoOffer.name, json);
606
+ return response.ok;
607
+ });
608
+ }
609
+ function getPromoOffers() {
610
+ return __async(this, null, function* () {
611
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/offers`, {
612
+ headers: {
613
+ Authorization: getBasicToken(),
614
+ "Content-Type": "application/json"
615
+ }
616
+ });
617
+ const json = yield response.json();
618
+ log(getPromoOffers.name, json);
619
+ return toCamelCase(json);
620
+ });
621
+ }
622
+ function checkPromoOffer(id, sub) {
623
+ return __async(this, null, function* () {
624
+ const response = yield fetch(`${getGeneralApiUrl()}/promo/offers/${id}/check?sub=${sub}`, {
625
+ headers: {
626
+ Authorization: getBasicToken(),
627
+ "Content-Type": "application/json"
628
+ }
629
+ });
630
+ const json = yield response.json();
631
+ log(checkPromoOffer.name, json);
632
+ return json;
633
+ });
634
+ }
635
+ function getPromoOfferRss(params) {
636
+ return __async(this, null, function* () {
637
+ const url = new URL(`${getGeneralApiUrl()}/promo/offers/rss`);
638
+ if (params == null ? void 0 : params.suiAddress) {
639
+ url.searchParams.append("sui_address", params.suiAddress);
640
+ } else if (params == null ? void 0 : params.evmAddress) {
641
+ url.searchParams.append("evm_address", params.evmAddress);
642
+ throw new Error("Currently not supported for EVM");
643
+ }
644
+ const response = yield fetch(url.toString(), {
645
+ headers: {
646
+ Authorization: getBasicToken(),
647
+ "Content-Type": "application/json"
648
+ }
649
+ });
650
+ const json = yield response.json();
651
+ log(getPromoOfferRss.name, json);
652
+ return toCamelCase(json);
653
+ });
654
+ }
655
+
656
+ // src/evm/index.ts
657
+ var evm_exports = {};
658
+ __export(evm_exports, {
659
+ account: () => account_exports,
660
+ contract: () => contract_exports,
661
+ getEvmApiUrl: () => getEvmApiUrl,
662
+ getEvmWsUrl: () => getEvmWsUrl,
663
+ getWsConnection: () => getWsConnection2
664
+ });
665
+
666
+ // src/evm/evm.ts
667
+ var socket2;
668
+ function getEvmApiUrl() {
669
+ switch (getSdkEnv()) {
670
+ case SDK_ENV.PROD:
671
+ return "https://evm.credenza3.com";
672
+ case SDK_ENV.STAGING:
673
+ return "https://evm.staging.credenza3.com";
674
+ case SDK_ENV.LOCAL:
675
+ return "http://localhost:8082";
676
+ }
677
+ }
678
+ function getEvmWsUrl() {
679
+ switch (getSdkEnv()) {
680
+ case SDK_ENV.PROD:
681
+ return "wss://evm-prod-prod.up.railway.app";
682
+ case SDK_ENV.STAGING:
683
+ return "wss://evm-staging-staging.up.railway.app";
684
+ case SDK_ENV.LOCAL:
685
+ return "ws://localhost:8082";
686
+ }
687
+ }
688
+ function getWsConnection2() {
689
+ return __async(this, null, function* () {
690
+ if (!(socket2 == null ? void 0 : socket2.connected)) {
691
+ socket2 = yield connectToWs(getEvmWsUrl());
692
+ }
693
+ return socket2;
694
+ });
695
+ }
696
+
697
+ // src/evm/account/index.ts
698
+ var account_exports = {};
699
+ __export(account_exports, {
700
+ getEvmAddress: () => getEvmAddress
701
+ });
702
+
703
+ // src/evm/account/account.ts
704
+ function getEvmAddress(sub) {
705
+ return __async(this, null, function* () {
706
+ const response = yield fetch(`${getEvmApiUrl()}/accounts/${sub}/address`, {
707
+ headers: {
708
+ Authorization: getBasicToken(),
709
+ "Content-Type": "application/json"
710
+ }
711
+ });
712
+ const json = yield response.json();
713
+ log(getEvmAddress.name, json);
714
+ return json;
715
+ });
716
+ }
717
+
718
+ // src/evm/contract/index.ts
719
+ var contract_exports = {};
720
+ __export(contract_exports, {
721
+ deployEvmContract: () => deployEvmContract,
722
+ findEvmContracts: () => findEvmContracts,
723
+ getAvailableEvmContracts: () => getAvailableEvmContracts,
724
+ sendEvmMetaTransaction: () => sendEvmMetaTransaction
725
+ });
726
+
727
+ // src/evm/contract/contract.ts
728
+ function getAvailableEvmContracts() {
729
+ return __async(this, null, function* () {
730
+ const response = yield fetch(`${getEvmApiUrl()}/contracts/available`, {
731
+ headers: {
732
+ Authorization: getBasicToken(),
733
+ "Content-Type": "application/json"
734
+ }
735
+ });
736
+ const json = yield response.json();
737
+ log(getAvailableEvmContracts.name, json);
738
+ if (!response.ok) throw new Error(json.message);
739
+ return json;
740
+ });
741
+ }
742
+ function findEvmContracts() {
743
+ return __async(this, arguments, function* (params = {}) {
744
+ const url = new URL(`${getEvmApiUrl()}/contracts`);
745
+ for (const [key, val] of Object.entries(params)) {
746
+ url.searchParams.append(key, String(val));
747
+ }
748
+ const response = yield fetch(url.toString(), {
749
+ headers: {
750
+ Authorization: getBasicToken(),
751
+ "Content-Type": "application/json"
752
+ }
753
+ });
754
+ const json = yield response.json();
755
+ log(findEvmContracts.name, json);
756
+ if (!response.ok) throw new Error(json.message);
757
+ return json.map((contract) => {
758
+ return {
759
+ id: contract._id,
760
+ type: contract.type,
761
+ name: contract.name,
762
+ chainId: contract.chain_id,
763
+ address: contract.address,
764
+ txHash: contract.tx_hash,
765
+ clientId: contract.client_id
766
+ };
767
+ });
768
+ });
769
+ }
770
+ function deployEvmContract(name, chainId, ownerAddresses) {
771
+ return __async(this, null, function* () {
772
+ if (!name) throw new Error('"name is required"');
773
+ if (!chainId) throw new Error('"chainId" is required');
774
+ if (!(ownerAddresses == null ? void 0 : ownerAddresses.length)) throw new Error('"ownerAddresses" can not be empty');
775
+ const socket3 = yield getWsConnection2();
776
+ return new Promise((resolve, reject) => {
777
+ socket3.emit(
778
+ "contracts/deploy",
779
+ {
780
+ payload: { name, chain_id: chainId, owner_addresses: ownerAddresses }
781
+ },
782
+ (data) => {
783
+ if (data.error) {
784
+ return reject(new Error(data.error.message));
785
+ }
786
+ log(deployEvmContract.name, `${name} contract deployed`, data);
787
+ resolve({
788
+ id: data.payload.contract._id,
789
+ type: data.payload.contract.type,
790
+ name: data.payload.contract.name,
791
+ chainId,
792
+ address: data.payload.contract.address,
793
+ tx: {
794
+ deployment: data.payload.tx.deployment,
795
+ trustedForwarder: data.payload.tx.trusted_forwarder,
796
+ addOwner: data.payload.tx.add_owner
797
+ }
798
+ });
799
+ }
800
+ );
801
+ });
802
+ });
803
+ }
804
+ function sendEvmMetaTransaction(unsignedSerializedMetaTx) {
805
+ return __async(this, null, function* () {
806
+ const socket3 = yield getWsConnection2();
807
+ return new Promise((resolve, reject) => {
808
+ socket3.emit(
809
+ "contracts/forward_transaction/client",
810
+ {
811
+ payload: {
812
+ unsigned_serialized_meta_tx: unsignedSerializedMetaTx
813
+ }
814
+ },
815
+ (data) => {
816
+ if (data.error) {
817
+ return reject(new Error(data.error.message));
818
+ }
819
+ log(sendEvmMetaTransaction.name, `meta tx sent`, data);
820
+ resolve(data.payload);
821
+ }
822
+ );
823
+ });
824
+ });
825
+ }
826
+
827
+ // src/sui/index.ts
828
+ var sui_exports = {};
829
+ __export(sui_exports, {
830
+ account: () => account_exports2,
831
+ getSuiApiUrl: () => getSuiApiUrl,
832
+ zk: () => zk_exports
833
+ });
834
+
835
+ // src/sui/sui.ts
836
+ function getSuiApiUrl() {
837
+ switch (getSdkEnv()) {
838
+ case SDK_ENV.PROD:
839
+ return "https://sui.credenza3.com";
840
+ case SDK_ENV.STAGING:
841
+ return "https://sui.staging.credenza3.com";
842
+ case SDK_ENV.LOCAL:
843
+ return "http://localhost:8083";
844
+ }
845
+ }
846
+
847
+ // src/sui/account/index.ts
848
+ var account_exports2 = {};
849
+ __export(account_exports2, {
850
+ getSuiAddress: () => getSuiAddress
851
+ });
852
+
853
+ // src/sui/account/account.ts
854
+ function getSuiAddress(sub) {
855
+ return __async(this, null, function* () {
856
+ const response = yield fetch(`${getSuiApiUrl()}/accounts/${sub}/address`, {
857
+ headers: {
858
+ Authorization: getBasicToken(),
859
+ "Content-Type": "application/json"
860
+ }
861
+ });
862
+ const json = yield response.json();
863
+ log(getSuiAddress.name, json);
864
+ return json;
865
+ });
866
+ }
867
+
868
+ // src/sui/zk/index.ts
869
+ var zk_exports = {};
870
+ __export(zk_exports, {
871
+ account: () => account_exports3
872
+ });
873
+
874
+ // src/sui/zk/account/index.ts
875
+ var account_exports3 = {};
876
+ __export(account_exports3, {
877
+ getSuiZkAddress: () => getSuiZkAddress
878
+ });
879
+
880
+ // src/sui/zk/account/account.ts
881
+ function getSuiZkAddress(sub) {
882
+ return __async(this, null, function* () {
883
+ const response = yield fetch(`${getSuiApiUrl()}/accounts/zk/${sub}/address`, {
884
+ headers: {
885
+ Authorization: getBasicToken(),
886
+ "Content-Type": "application/json"
887
+ }
888
+ });
889
+ const json = yield response.json();
890
+ log(getSuiZkAddress.name, json);
891
+ return json;
892
+ });
893
+ }
894
+
895
+ // src/credenza-partner-sdk.ts
896
+ function useAuth(credentials2) {
897
+ setCredentials(credentials2);
898
+ }
899
+ function useEnv(sdkEnv2) {
900
+ setSdkEnv(sdkEnv2);
901
+ }
902
+ function useDebug(enableDebug) {
903
+ enableSdkDebug(enableDebug);
904
+ }
905
+ export {
906
+ accounts_exports as accounts,
907
+ api_exports as api,
908
+ evm_exports as evm,
909
+ sui_exports as sui,
910
+ useAuth,
911
+ useDebug,
912
+ useEnv
913
+ };
914
+ //# sourceMappingURL=index.mjs.map