@huggies/shit-1170-rex-engine-middleman 0.0.0-stage → 0.0.2

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 (171) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +43 -2
  3. package/bin/README.md +38 -0
  4. package/bin/fun/resolve_base_url.ts +45 -0
  5. package/bin/fun/split_argv.ts +67 -0
  6. package/bin/shit-1170/README.md +333 -0
  7. package/bin/shit-1170/api_shit_1170_api_key_me_get.ts +46 -0
  8. package/bin/shit-1170/api_shit_1170_api_key_rotate_post.ts +83 -0
  9. package/bin/shit-1170/api_shit_1170_api_keys_post.ts +68 -0
  10. package/bin/shit-1170/api_shit_1170_ping_get.ts +28 -0
  11. package/bin/shit-1170/api_shit_1170_swap_queue_accounts_delete.ts +81 -0
  12. package/bin/shit-1170/api_shit_1170_swap_queue_accounts_post.ts +80 -0
  13. package/bin/shit-1170/api_shit_1170_swap_queue_get.ts +91 -0
  14. package/bin/shit-1170/api_shit_1170_swap_queue_one_get.ts +62 -0
  15. package/bin/shit-1170/api_shit_1170_swap_queue_post.ts +118 -0
  16. package/bin/shit-1170/api_shit_1170_swap_queue_sent_post.ts +87 -0
  17. package/bin/shit-1170/api_shit_1170_tx_queue_accounts_delete.ts +68 -0
  18. package/bin/shit-1170/api_shit_1170_tx_queue_accounts_post.ts +65 -0
  19. package/bin/shit-1170/api_shit_1170_tx_queue_facets_get.ts +68 -0
  20. package/bin/shit-1170/api_shit_1170_tx_queue_get.ts +99 -0
  21. package/bin/shit-1170/api_shit_1170_tx_queue_one_get.ts +67 -0
  22. package/bin/shit-1170/api_shit_1170_tx_queue_post.ts +243 -0
  23. package/bin/shit-1170/api_shit_1170_tx_queue_sent_post.ts +172 -0
  24. package/bin/shit-1170/api_shit_1170_tx_queue_stats_contracts_get.ts +60 -0
  25. package/bin/shit-1170/api_shit_1170_tx_queue_stats_methods_get.ts +60 -0
  26. package/bin/shit-1170/api_trezu_treasuries_get.ts +62 -0
  27. package/dist/fun/api_shit_1170_api_key_me_get.d.ts +4 -0
  28. package/dist/fun/api_shit_1170_api_key_me_get.d.ts.map +1 -0
  29. package/dist/fun/api_shit_1170_api_key_me_get.js +38 -0
  30. package/dist/fun/api_shit_1170_api_key_me_get.js.map +1 -0
  31. package/dist/fun/api_shit_1170_api_key_rotate_post.d.ts +4 -0
  32. package/dist/fun/api_shit_1170_api_key_rotate_post.d.ts.map +1 -0
  33. package/dist/fun/api_shit_1170_api_key_rotate_post.js +46 -0
  34. package/dist/fun/api_shit_1170_api_key_rotate_post.js.map +1 -0
  35. package/dist/fun/api_shit_1170_api_keys_post.d.ts +3 -0
  36. package/dist/fun/api_shit_1170_api_keys_post.d.ts.map +1 -0
  37. package/dist/fun/api_shit_1170_api_keys_post.js +52 -0
  38. package/dist/fun/api_shit_1170_api_keys_post.js.map +1 -0
  39. package/dist/fun/api_shit_1170_ping_get.d.ts +3 -0
  40. package/dist/fun/api_shit_1170_ping_get.d.ts.map +1 -0
  41. package/dist/fun/api_shit_1170_ping_get.js +32 -0
  42. package/dist/fun/api_shit_1170_ping_get.js.map +1 -0
  43. package/dist/fun/api_shit_1170_swap_queue_accounts_delete.d.ts +4 -0
  44. package/dist/fun/api_shit_1170_swap_queue_accounts_delete.d.ts.map +1 -0
  45. package/dist/fun/api_shit_1170_swap_queue_accounts_delete.js +46 -0
  46. package/dist/fun/api_shit_1170_swap_queue_accounts_delete.js.map +1 -0
  47. package/dist/fun/api_shit_1170_swap_queue_accounts_post.d.ts +4 -0
  48. package/dist/fun/api_shit_1170_swap_queue_accounts_post.d.ts.map +1 -0
  49. package/dist/fun/api_shit_1170_swap_queue_accounts_post.js +42 -0
  50. package/dist/fun/api_shit_1170_swap_queue_accounts_post.js.map +1 -0
  51. package/dist/fun/api_shit_1170_swap_queue_get.d.ts +5 -0
  52. package/dist/fun/api_shit_1170_swap_queue_get.d.ts.map +1 -0
  53. package/dist/fun/api_shit_1170_swap_queue_get.js +77 -0
  54. package/dist/fun/api_shit_1170_swap_queue_get.js.map +1 -0
  55. package/dist/fun/api_shit_1170_swap_queue_one_get.d.ts +4 -0
  56. package/dist/fun/api_shit_1170_swap_queue_one_get.d.ts.map +1 -0
  57. package/dist/fun/api_shit_1170_swap_queue_one_get.js +38 -0
  58. package/dist/fun/api_shit_1170_swap_queue_one_get.js.map +1 -0
  59. package/dist/fun/api_shit_1170_swap_queue_post.d.ts +4 -0
  60. package/dist/fun/api_shit_1170_swap_queue_post.d.ts.map +1 -0
  61. package/dist/fun/api_shit_1170_swap_queue_post.js +62 -0
  62. package/dist/fun/api_shit_1170_swap_queue_post.js.map +1 -0
  63. package/dist/fun/api_shit_1170_swap_queue_sent_post.d.ts +4 -0
  64. package/dist/fun/api_shit_1170_swap_queue_sent_post.d.ts.map +1 -0
  65. package/dist/fun/api_shit_1170_swap_queue_sent_post.js +63 -0
  66. package/dist/fun/api_shit_1170_swap_queue_sent_post.js.map +1 -0
  67. package/dist/fun/api_shit_1170_tx_queue_accounts_delete.d.ts +4 -0
  68. package/dist/fun/api_shit_1170_tx_queue_accounts_delete.d.ts.map +1 -0
  69. package/dist/fun/api_shit_1170_tx_queue_accounts_delete.js +60 -0
  70. package/dist/fun/api_shit_1170_tx_queue_accounts_delete.js.map +1 -0
  71. package/dist/fun/api_shit_1170_tx_queue_accounts_post.d.ts +4 -0
  72. package/dist/fun/api_shit_1170_tx_queue_accounts_post.d.ts.map +1 -0
  73. package/dist/fun/api_shit_1170_tx_queue_accounts_post.js +54 -0
  74. package/dist/fun/api_shit_1170_tx_queue_accounts_post.js.map +1 -0
  75. package/dist/fun/api_shit_1170_tx_queue_facets_get.d.ts +5 -0
  76. package/dist/fun/api_shit_1170_tx_queue_facets_get.d.ts.map +1 -0
  77. package/dist/fun/api_shit_1170_tx_queue_facets_get.js +45 -0
  78. package/dist/fun/api_shit_1170_tx_queue_facets_get.js.map +1 -0
  79. package/dist/fun/api_shit_1170_tx_queue_get.d.ts +5 -0
  80. package/dist/fun/api_shit_1170_tx_queue_get.d.ts.map +1 -0
  81. package/dist/fun/api_shit_1170_tx_queue_get.js +70 -0
  82. package/dist/fun/api_shit_1170_tx_queue_get.js.map +1 -0
  83. package/dist/fun/api_shit_1170_tx_queue_one_get.d.ts +4 -0
  84. package/dist/fun/api_shit_1170_tx_queue_one_get.d.ts.map +1 -0
  85. package/dist/fun/api_shit_1170_tx_queue_one_get.js +46 -0
  86. package/dist/fun/api_shit_1170_tx_queue_one_get.js.map +1 -0
  87. package/dist/fun/api_shit_1170_tx_queue_post.d.ts +4 -0
  88. package/dist/fun/api_shit_1170_tx_queue_post.d.ts.map +1 -0
  89. package/dist/fun/api_shit_1170_tx_queue_post.js +57 -0
  90. package/dist/fun/api_shit_1170_tx_queue_post.js.map +1 -0
  91. package/dist/fun/api_shit_1170_tx_queue_sent_post.d.ts +4 -0
  92. package/dist/fun/api_shit_1170_tx_queue_sent_post.d.ts.map +1 -0
  93. package/dist/fun/api_shit_1170_tx_queue_sent_post.js +59 -0
  94. package/dist/fun/api_shit_1170_tx_queue_sent_post.js.map +1 -0
  95. package/dist/fun/api_shit_1170_tx_queue_stats_contracts_get.d.ts +5 -0
  96. package/dist/fun/api_shit_1170_tx_queue_stats_contracts_get.d.ts.map +1 -0
  97. package/dist/fun/api_shit_1170_tx_queue_stats_contracts_get.js +41 -0
  98. package/dist/fun/api_shit_1170_tx_queue_stats_contracts_get.js.map +1 -0
  99. package/dist/fun/api_shit_1170_tx_queue_stats_methods_get.d.ts +5 -0
  100. package/dist/fun/api_shit_1170_tx_queue_stats_methods_get.d.ts.map +1 -0
  101. package/dist/fun/api_shit_1170_tx_queue_stats_methods_get.js +41 -0
  102. package/dist/fun/api_shit_1170_tx_queue_stats_methods_get.js.map +1 -0
  103. package/dist/fun/api_trezu_treasuries_get.d.ts +4 -0
  104. package/dist/fun/api_trezu_treasuries_get.d.ts.map +1 -0
  105. package/dist/fun/api_trezu_treasuries_get.js +34 -0
  106. package/dist/fun/api_trezu_treasuries_get.js.map +1 -0
  107. package/dist/index.d.ts +40 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +42 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/stuff/api_call.d.ts +15 -0
  112. package/dist/stuff/api_call.d.ts.map +1 -0
  113. package/dist/stuff/api_call.js +86 -0
  114. package/dist/stuff/api_call.js.map +1 -0
  115. package/dist/stuff/endpoint_paths.d.ts +14 -0
  116. package/dist/stuff/endpoint_paths.d.ts.map +1 -0
  117. package/dist/stuff/endpoint_paths.js +30 -0
  118. package/dist/stuff/endpoint_paths.js.map +1 -0
  119. package/dist/stuff/parse_error.d.ts +12 -0
  120. package/dist/stuff/parse_error.d.ts.map +1 -0
  121. package/dist/stuff/parse_error.js +84 -0
  122. package/dist/stuff/parse_error.js.map +1 -0
  123. package/dist/stuff/request_options.d.ts +6 -0
  124. package/dist/stuff/request_options.d.ts.map +1 -0
  125. package/dist/stuff/request_options.js +43 -0
  126. package/dist/stuff/request_options.js.map +1 -0
  127. package/dist/types/common.d.ts +7 -0
  128. package/dist/types/common.d.ts.map +1 -0
  129. package/dist/types/common.js +6 -0
  130. package/dist/types/common.js.map +1 -0
  131. package/dist/types/shit_1170_api_keys.d.ts +25 -0
  132. package/dist/types/shit_1170_api_keys.d.ts.map +1 -0
  133. package/dist/types/shit_1170_api_keys.js +23 -0
  134. package/dist/types/shit_1170_api_keys.js.map +1 -0
  135. package/dist/types/shit_1170_ping.d.ts +5 -0
  136. package/dist/types/shit_1170_ping.d.ts.map +1 -0
  137. package/dist/types/shit_1170_ping.js +11 -0
  138. package/dist/types/shit_1170_ping.js.map +1 -0
  139. package/dist/types/shit_1170_swap_queue.d.ts +57 -0
  140. package/dist/types/shit_1170_swap_queue.d.ts.map +1 -0
  141. package/dist/types/shit_1170_swap_queue.js +37 -0
  142. package/dist/types/shit_1170_swap_queue.js.map +1 -0
  143. package/dist/types/shit_1170_tx_queue.d.ts +74 -0
  144. package/dist/types/shit_1170_tx_queue.d.ts.map +1 -0
  145. package/dist/types/shit_1170_tx_queue.js +34 -0
  146. package/dist/types/shit_1170_tx_queue.js.map +1 -0
  147. package/dist/types/shit_1170_tx_queue_facets.d.ts +13 -0
  148. package/dist/types/shit_1170_tx_queue_facets.d.ts.map +1 -0
  149. package/dist/types/shit_1170_tx_queue_facets.js +20 -0
  150. package/dist/types/shit_1170_tx_queue_facets.js.map +1 -0
  151. package/dist/types/shit_1170_tx_queue_query.d.ts +15 -0
  152. package/dist/types/shit_1170_tx_queue_query.d.ts.map +1 -0
  153. package/dist/types/shit_1170_tx_queue_query.js +30 -0
  154. package/dist/types/shit_1170_tx_queue_query.js.map +1 -0
  155. package/dist/types/trezu_treasuries_query.d.ts +5 -0
  156. package/dist/types/trezu_treasuries_query.d.ts.map +1 -0
  157. package/dist/types/trezu_treasuries_query.js +9 -0
  158. package/dist/types/trezu_treasuries_query.js.map +1 -0
  159. package/dist/types/trezu_treasury.d.ts +10 -0
  160. package/dist/types/trezu_treasury.d.ts.map +1 -0
  161. package/dist/types/trezu_treasury.js +15 -0
  162. package/dist/types/trezu_treasury.js.map +1 -0
  163. package/dist/types/trezu_treasury_config.d.ts +8 -0
  164. package/dist/types/trezu_treasury_config.d.ts.map +1 -0
  165. package/dist/types/trezu_treasury_config.js +14 -0
  166. package/dist/types/trezu_treasury_config.js.map +1 -0
  167. package/dist/types/trezu_treasury_metadata.d.ts +5 -0
  168. package/dist/types/trezu_treasury_metadata.d.ts.map +1 -0
  169. package/dist/types/trezu_treasury_metadata.js +13 -0
  170. package/dist/types/trezu_treasury_metadata.js.map +1 -0
  171. package/package.json +45 -4
@@ -0,0 +1,86 @@
1
+ // ========================================
2
+ // API_CALL
3
+ // the single fetch+log+error helper every wrapper in middleman
4
+ // goes through. the goal: one place to change if we ever want to add
5
+ // retries, timeouts, tracing, or different log formatting.
6
+ //
7
+ // the url is base_url + ENDPOINT_PATHS[key], plus ?key=value&... when
8
+ // `query` is supplied. `body`, when supplied, is JSON.stringified and
9
+ // sent with content-type: application/json — omit for GET /
10
+ // DELETE-with-no-body. `options` carries the api key.
11
+ //
12
+ // --- WHY --- the base url is a parameter, not a constant. the frontend
13
+ // passes the origin of the page it is served from; a bin passes
14
+ // whatever backend it was told to talk to. a constant baked in would
15
+ // be "" outside a browser, so a bin could never reach the backend.
16
+ //
17
+ // --- WHY --- the query builder drops undefined/null/"" but keeps false
18
+ // and 0. our routes read those two as real values, so dropping them
19
+ // would silently change what the route does.
20
+ //
21
+ // --- WHY --- `path` OVERRIDES the endpoint map. some of our routes put
22
+ // a piece in the MIDDLE of the path — `/tx-queue/{queue_id}/accounts` —
23
+ // so the whole path cannot live in ENDPOINT_PATHS. the wrapper builds
24
+ // the path and hands it over, and the map stays the list of the routes
25
+ // whose path is fixed.
26
+ //
27
+ // the `url` + `method` are passed through to parse_error() on failure
28
+ // so the error log block can show exactly which request blew up.
29
+ // ========================================
30
+ import { ENDPOINT_PATHS } from "./endpoint_paths";
31
+ import { parse_error } from "./parse_error";
32
+ import { build_headers } from "./request_options";
33
+ export async function api_call({ base_url, key, path, query, method, body, options = {}, label, fallback, }) {
34
+ // ========================================
35
+ let url = `${base_url}${path ?? ENDPOINT_PATHS[key]}`;
36
+ if (query) {
37
+ const entries = Object.entries(query).filter((entry) => entry[1] !== undefined && entry[1] !== null && entry[1] !== "");
38
+ if (entries.length > 0) {
39
+ const qs = new URLSearchParams(Object.fromEntries(entries.map(([k, v]) => [k, encode_query_value_fun(v)]))).toString();
40
+ url = `${url}?${qs}`;
41
+ }
42
+ }
43
+ const init = {
44
+ method,
45
+ headers: build_headers(options, body !== undefined ? { "content-type": "application/json" } : {}),
46
+ };
47
+ if (body !== undefined) {
48
+ init.body = JSON.stringify(body);
49
+ }
50
+ const res = await fetch(url, init);
51
+ if (!res.ok) {
52
+ throw await parse_error(res, fallback, {
53
+ url,
54
+ method,
55
+ label,
56
+ // init.body is the post-JSON.stringify form, exactly
57
+ // what hit the wire. undefined for body-less calls
58
+ // (GET, DELETE), which parse_error then omits from
59
+ // the banner.
60
+ request_body: init.body,
61
+ });
62
+ }
63
+ const json = (await res.json());
64
+ // ========================================
65
+ console.log("=============================");
66
+ console.log(` ${label} via ${method} on:`, url);
67
+ console.log("RESPONSE STATUS:", `${res.status} - ${res.statusText}`);
68
+ console.log("RESPONSE:", json);
69
+ console.log("=============================");
70
+ // ========================================
71
+ return json;
72
+ }
73
+ // ========================================
74
+ // render one query value. booleans become "true"/"false", numbers
75
+ // keep their literal form, everything else is stringified.
76
+ function encode_query_value_fun(value) {
77
+ if (typeof value === "boolean")
78
+ return value ? "true" : "false";
79
+ if (typeof value === "number") {
80
+ return Number.isFinite(value) ? String(value) : "null";
81
+ }
82
+ return String(value);
83
+ }
84
+ // ========================================
85
+ // copyright 2026 by sleet.near
86
+ //# sourceMappingURL=api_call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api_call.js","sourceRoot":"","sources":["../../src/stuff/api_call.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,WAAW;AACX,+DAA+D;AAC/D,qEAAqE;AACrE,2DAA2D;AAC3D,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAC5D,sDAAsD;AACtD,EAAE;AACF,wEAAwE;AACxE,gEAAgE;AAChE,qEAAqE;AACrE,mEAAmE;AACnE,EAAE;AACF,wEAAwE;AACxE,oEAAoE;AACpE,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,sEAAsE;AACtE,uEAAuE;AACvE,uBAAuB;AACvB,EAAE;AACF,sEAAsE;AACtE,iEAAiE;AACjE,2CAA2C;AAE3C,OAAO,EAAE,cAAc,EAAoB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAwB,MAAM,mBAAmB,CAAC;AAmBxE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAc,EAC1C,QAAQ,EACR,GAAG,EAC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DPOINT_PATHS: {
2
+ readonly api_shit_1170_ping: "/api/shit-1170/ping";
3
+ readonly api_shit_1170_api_keys: "/api/shit-1170/api-keys";
4
+ readonly api_shit_1170_api_key_me: "/api/shit-1170/api-key/me";
5
+ readonly api_shit_1170_api_key_rotate: "/api/shit-1170/api-key/rotate";
6
+ readonly api_shit_1170_tx_queue: "/api/shit-1170/tx-queue";
7
+ readonly api_shit_1170_tx_queue_facets: "/api/shit-1170/tx-queue/facets";
8
+ readonly api_shit_1170_tx_queue_stats_contracts: "/api/shit-1170/tx-queue/stats/contracts";
9
+ readonly api_shit_1170_tx_queue_stats_methods: "/api/shit-1170/tx-queue/stats/methods";
10
+ readonly api_shit_1170_swap_queue: "/api/shit-1170/swap-queue";
11
+ readonly api_trezu_treasuries: "/api/trezu/user/treasuries";
12
+ };
13
+ export type EndpointKey = keyof typeof ENDPOINT_PATHS;
14
+ //# sourceMappingURL=endpoint_paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint_paths.d.ts","sourceRoot":"","sources":["../../src/stuff/endpoint_paths.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;aAEzB,kBAAkB,EAAE,qBAAqB;aACzC,sBAAsB,EAAE,yBAAyB;aACjD,wBAAwB,EAAE,2BAA2B;aACrD,4BAA4B,EAAE,+BAA+B;aAO7D,sBAAsB,EAAE,yBAAyB;aACjD,6BAA6B,EAAE,gCAAgC;aAC/D,sCAAsC,EACpC,yCAAyC;aAC3C,oCAAoC,EAAE,uCAAuC;aAO7E,wBAAwB,EAAE,2BAA2B;aAGrD,oBAAoB,EAAE,4BAA4B;CAC1C,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC"}
@@ -0,0 +1,30 @@
1
+ // ========================================
2
+ // ENDPOINT_PATHS
3
+ // ========================================
4
+ export const ENDPOINT_PATHS = {
5
+ // --- /api/shit-1170/* — our own routes ---
6
+ api_shit_1170_ping: "/api/shit-1170/ping",
7
+ api_shit_1170_api_keys: "/api/shit-1170/api-keys",
8
+ api_shit_1170_api_key_me: "/api/shit-1170/api-key/me",
9
+ api_shit_1170_api_key_rotate: "/api/shit-1170/api-key/rotate",
10
+ // --- the tx queue ---
11
+ // --- WHY --- the queue routes that carry a queue_id are NOT in this
12
+ // map: their path has a piece in the middle of it, so they are built
13
+ // by the wrapper and handed to api_call as a full path. see
14
+ // api_shit_1170_tx_queue_one_get.ts.
15
+ api_shit_1170_tx_queue: "/api/shit-1170/tx-queue",
16
+ api_shit_1170_tx_queue_facets: "/api/shit-1170/tx-queue/facets",
17
+ api_shit_1170_tx_queue_stats_contracts: "/api/shit-1170/tx-queue/stats/contracts",
18
+ api_shit_1170_tx_queue_stats_methods: "/api/shit-1170/tx-queue/stats/methods",
19
+ // --- the swap queue ---
20
+ // --- WHY --- the swap queue routes that carry a swap_id are NOT in
21
+ // this map: their path has a piece in the middle of it, so they are
22
+ // built by the wrapper and handed to api_call as a full path. see
23
+ // api_shit_1170_swap_queue_one_get.ts.
24
+ api_shit_1170_swap_queue: "/api/shit-1170/swap-queue",
25
+ // --- /api/trezu/* — our proxy for the trezu api ---
26
+ api_trezu_treasuries: "/api/trezu/user/treasuries",
27
+ };
28
+ // ========================================
29
+ // copyright 2026 by sleet.near
30
+ //# sourceMappingURL=endpoint_paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint_paths.js","sourceRoot":"","sources":["../../src/stuff/endpoint_paths.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,iBAAiB;AACjB,2CAA2C;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,4CAA4C;IAC5C,kBAAkB,EAAE,qBAAqB;IACzC,sBAAsB,EAAE,yBAAyB;IACjD,wBAAwB,EAAE,2BAA2B;IACrD,4BAA4B,EAAE,+BAA+B;IAE7D,uBAAuB;IACvB,qEAAqE;IACrE,qEAAqE;IACrE,4DAA4D;IAC5D,qCAAqC;IACrC,sBAAsB,EAAE,yBAAyB;IACjD,6BAA6B,EAAE,gCAAgC;IAC/D,sCAAsC,EACpC,yCAAyC;IAC3C,oCAAoC,EAAE,uCAAuC;IAE7E,yBAAyB;IACzB,oEAAoE;IACpE,oEAAoE;IACpE,kEAAkE;IAClE,uCAAuC;IACvC,wBAAwB,EAAE,2BAA2B;IAErD,qDAAqD;IACrD,oBAAoB,EAAE,4BAA4B;CAC1C,CAAC;AAGX,2CAA2C;AAC3C,+BAA+B"}
@@ -0,0 +1,12 @@
1
+ export interface SHIT_1170_API_ERROR extends Error {
2
+ status: number;
3
+ code: string;
4
+ }
5
+ export interface PARSE_ERROR_CONTEXT {
6
+ url?: string;
7
+ method?: string;
8
+ label?: string;
9
+ request_body?: BodyInit | null;
10
+ }
11
+ export declare function parse_error(res: Response, fallback: string, context?: PARSE_ERROR_CONTEXT): Promise<SHIT_1170_API_ERROR>;
12
+ //# sourceMappingURL=parse_error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse_error.d.ts","sourceRoot":"","sources":["../../src/stuff/parse_error.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,mBAAoB,SAAQ,KAAK;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,YAAY,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAChC;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,mBAAmB,CAAC,CA2D9B"}
@@ -0,0 +1,84 @@
1
+ // ========================================
2
+ // PARSE_ERROR
3
+ // turn a non-2xx backend response into a thrown Error.
4
+ //
5
+ // our backend answers failures with `{ "error": { "code", "message" } }`,
6
+ // so the code and the message are pulled out and put on the error itself.
7
+ // the framed banner is the mirror of api_call's success log.
8
+ //
9
+ // --- WHY --- the error carries the status and the code, not just a
10
+ // message: the code is what the backend decided (invalid_account_id,
11
+ // trezu_unreachable, ...), and a caller branching on it needs it as a
12
+ // field, not as text it has to parse.
13
+ // ========================================
14
+ export async function parse_error(res, fallback, context = {}) {
15
+ let detail = "";
16
+ let response_json;
17
+ let response_text = "";
18
+ try {
19
+ const text = await res.text();
20
+ response_text = text;
21
+ if (text) {
22
+ try {
23
+ const parsed = JSON.parse(text);
24
+ const envelope = parsed?.error;
25
+ if (envelope &&
26
+ typeof envelope.message === "string" &&
27
+ envelope.message.length > 0) {
28
+ detail = `: ${envelope.message}`;
29
+ }
30
+ else {
31
+ detail = `: ${text}`;
32
+ }
33
+ response_json = parsed;
34
+ }
35
+ catch {
36
+ detail = `: ${text}`;
37
+ }
38
+ }
39
+ }
40
+ catch {
41
+ // body read failed — leave detail empty.
42
+ }
43
+ // ========================================
44
+ // framed failure banner; mirrors api_call's success shape.
45
+ const label_str = context.label ?? fallback.toUpperCase();
46
+ const verb = context.method ?? "REQUEST";
47
+ console.log("=============================");
48
+ if (context.url) {
49
+ console.log(` ${label_str} VIA ${verb} failed: ${res.status} ${res.statusText} on:`, context.url);
50
+ }
51
+ else {
52
+ console.log(` ${label_str} VIA ${verb} failed: ${res.status} ${res.statusText}`);
53
+ }
54
+ if (context.request_body !== undefined && context.request_body !== null) {
55
+ console.log("REQUEST BODY:", context.request_body);
56
+ }
57
+ if (response_text) {
58
+ console.log("RESPONSE BODY:", response_json ?? response_text);
59
+ }
60
+ console.log("=============================");
61
+ // ========================================
62
+ const code = extract_code_fun(response_json, res.status);
63
+ const error = new Error(`${fallback} (${res.status} ${res.statusText})${detail}`);
64
+ error.name = "SHIT_1170_API_ERROR";
65
+ error.status = res.status;
66
+ error.code = code;
67
+ return error;
68
+ }
69
+ // ========================================
70
+ // pull the error code out of the envelope. falls back to a code derived
71
+ // from the status when the body carried no code, so the field is never
72
+ // empty.
73
+ function extract_code_fun(response_json, status) {
74
+ const envelope = response_json?.error;
75
+ if (envelope &&
76
+ typeof envelope.code === "string" &&
77
+ envelope.code.length > 0) {
78
+ return envelope.code;
79
+ }
80
+ return status === 404 ? "not_found" : "internal";
81
+ }
82
+ // ========================================
83
+ // copyright 2026 by sleet.near
84
+ //# sourceMappingURL=parse_error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse_error.js","sourceRoot":"","sources":["../../src/stuff/parse_error.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,cAAc;AACd,uDAAuD;AACvD,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,6DAA6D;AAC7D,EAAE;AACF,oEAAoE;AACpE,qEAAqE;AACrE,sEAAsE;AACtE,sCAAsC;AACtC,2CAA2C;AAkB3C,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAa,EACb,QAAgB,EAChB,OAAO,GAAwB,EAAE;IAEjC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,aAAsB,CAAC;IAC3B,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,aAAa,GAAG,IAAI,CAAC;QACrB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA6B,CAAC;gBAC5D,MAAM,QAAQ,GAAG,MAAM,EAAE,KAAK,CAAC;gBAC/B,IACE,QAAQ;oBACR,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;oBACpC,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAC3B,CAAC;oBACD,MAAM,GAAG,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACnC,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,KAAK,IAAI,EAAE,CAA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CACrB,GAAG,QAAQ,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,IAAI,MAAM,EAAE,CAClC,CAAC;IACzB,KAAK,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACnC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAC1B,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,2CAA2C;AAC3C,wEAAwE;AACxE,uEAAuE;AACvE,SAAS;AACT,SAAS,gBAAgB,CAAC,aAAsB,EAAE,MAAc;IAC9D,MAAM,QAAQ,GAAI,aAAiD,EAAE,KAAK,CAAC;IAC3E,IACE,QAAQ;QACR,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ;QACjC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EACxB,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AACnD,CAAC;AACD,2CAA2C;AAC3C,+BAA+B"}
@@ -0,0 +1,6 @@
1
+ export interface REQUEST_OPTIONS {
2
+ api_key?: string;
3
+ headers?: Record<string, string>;
4
+ }
5
+ export declare function build_headers(options?: REQUEST_OPTIONS, extra?: Record<string, string>): Record<string, string>;
6
+ //# sourceMappingURL=request_options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_options.d.ts","sourceRoot":"","sources":["../../src/stuff/request_options.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,eAAe;IAE9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,wBAAgB,aAAa,CAC3B,OAAO,GAAE,eAAoB,EAC7B,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB"}
@@ -0,0 +1,43 @@
1
+ // ========================================
2
+ // REQUEST_OPTIONS
3
+ // per-call bag for things that aren't part of the request payload
4
+ // itself: the api key and an optional header passthrough.
5
+ //
6
+ // `build_headers` turns an options bag + caller-supplied headers into
7
+ // the final header map. it knows one key:
8
+ //
9
+ // api_key -> x-api-key: <key>
10
+ // -> x-session-token: <key>
11
+ //
12
+ // any other header the caller supplies is passed through verbatim.
13
+ //
14
+ // --- WHY --- BOTH header names are sent. the backend reads
15
+ // `x-api-key` first and falls back to the legacy `x-session-token`
16
+ // during the beta, so a client built against either name works. the
17
+ // old name is not the new name's twin by accident: an agent built
18
+ // against `x-session-token` is out in the world already, and it would
19
+ // break the moment the backend stopped reading that header. sending
20
+ // both costs one extra header and keeps every old client alive.
21
+ //
22
+ // --- WHY --- the new name is sent too and not only the old one: the
23
+ // backend asks for `x-api-key`, and the new name is the one that will
24
+ // outlive the beta.
25
+ //
26
+ // --- WHY --- the two headers carry the SAME value: the middleware is
27
+ // the only reader of them, and it prefers the new name. sending two
28
+ // different values would be a way to lie about which key is in play.
29
+ // ========================================
30
+ export function build_headers(options = {}, extra = {}) {
31
+ const out = {};
32
+ if (options.api_key) {
33
+ out["x-api-key"] = options.api_key;
34
+ // the legacy name. the backend still reads it, so an old agent
35
+ // keeps working. it goes away when the beta is over.
36
+ out["x-session-token"] = options.api_key;
37
+ }
38
+ Object.assign(out, extra, options.headers ?? {});
39
+ return out;
40
+ }
41
+ // ========================================
42
+ // copyright 2026 by sleet.near
43
+ //# sourceMappingURL=request_options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_options.js","sourceRoot":"","sources":["../../src/stuff/request_options.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,kBAAkB;AAClB,kEAAkE;AAClE,0DAA0D;AAC1D,EAAE;AACF,sEAAsE;AACtE,0CAA0C;AAC1C,EAAE;AACF,gCAAgC;AAChC,sCAAsC;AACtC,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,4DAA4D;AAC5D,mEAAmE;AACnE,oEAAoE;AACpE,kEAAkE;AAClE,sEAAsE;AACtE,oEAAoE;AACpE,gEAAgE;AAChE,EAAE;AACF,qEAAqE;AACrE,sEAAsE;AACtE,oBAAoB;AACpB,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,qEAAqE;AACrE,2CAA2C;AAQ3C,MAAM,UAAU,aAAa,CAC3B,OAAO,GAAoB,EAAE,EAC7B,KAAK,GAA2B,EAAE;IAElC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,GAAG,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;QACnC,+DAA+D;QAC/D,qDAAqD;QACrD,GAAG,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAC3C,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IACjD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,2CAA2C;AAC3C,+BAA+B"}
@@ -0,0 +1,7 @@
1
+ export interface SHIT_1170_ERROR_RESPONSE {
2
+ error?: {
3
+ code?: string;
4
+ message?: string;
5
+ };
6
+ }
7
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH"}
@@ -0,0 +1,6 @@
1
+ // ========================================
2
+ // COMMON
3
+ // cross-cutting shapes used by every endpoint wrapper.
4
+ // ========================================
5
+ export {};
6
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,SAAS;AACT,uDAAuD;AACvD,2CAA2C"}
@@ -0,0 +1,25 @@
1
+ export interface SHIT_1170_SIGNED_ACCOUNT {
2
+ accountId: string;
3
+ publicKey: string;
4
+ signature: string;
5
+ message: string;
6
+ nonce: string;
7
+ recipient: string;
8
+ }
9
+ export interface SHIT_1170_API_KEYS_REQUEST {
10
+ accounts: SHIT_1170_SIGNED_ACCOUNT[];
11
+ }
12
+ export interface SHIT_1170_API_KEY {
13
+ accountId: string;
14
+ apiKey: string;
15
+ created: boolean;
16
+ }
17
+ export interface SHIT_1170_API_KEYS_RESPONSE {
18
+ keys: SHIT_1170_API_KEY[];
19
+ }
20
+ export interface SHIT_1170_API_KEY_ME {
21
+ accountId: string;
22
+ createdAt: number;
23
+ updatedAt: number;
24
+ }
25
+ //# sourceMappingURL=shit_1170_api_keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shit_1170_api_keys.d.ts","sourceRoot":"","sources":["../../src/types/shit_1170_api_keys.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,0BAA0B;IAEzC,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAGD,MAAM,WAAW,iBAAiB;IAEhC,SAAS,EAAE,MAAM,CAAC;IAKlB,MAAM,EAAE,MAAM,CAAC;IAGf,OAAO,EAAE,OAAO,CAAC;CAClB;AAGD,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,iBAAiB,EAAE,CAAC;CAC3B;AAID,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,23 @@
1
+ // ========================================
2
+ // SHIT_1170_API_KEYS
3
+ // the shapes of our own api key routes, under /api/shit-1170/api-keys
4
+ // and /api/shit-1170/api-key/*.
5
+ //
6
+ // the routes turn signed messages into api keys: the browser sends
7
+ // every account it holds a signature for, and the backend answers with
8
+ // ONE KEY PER ACCOUNT.
9
+ //
10
+ // --- WHY --- the fields are camelCase: they mirror the browser's own
11
+ // session object (`accountId`, `publicKey`), so the same names run all
12
+ // the way from the wallet to the db.
13
+ //
14
+ // --- WHY --- the key is called `apiKey` and not `sessionKey`: the
15
+ // credential in it is not a browser session. the user signs in once and
16
+ // hands the key to an agent, and the agent holds it as a bearer token
17
+ // for as long as it lives. a "session" describes the browser's short use
18
+ // of it; an "api key" describes what it actually is.
19
+ // ========================================
20
+ export {};
21
+ // ========================================
22
+ // copyright 2026 by sleet.near
23
+ //# sourceMappingURL=shit_1170_api_keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shit_1170_api_keys.js","sourceRoot":"","sources":["../../src/types/shit_1170_api_keys.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,qBAAqB;AACrB,sEAAsE;AACtE,gCAAgC;AAChC,EAAE;AACF,mEAAmE;AACnE,uEAAuE;AACvE,uBAAuB;AACvB,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,qCAAqC;AACrC,EAAE;AACF,mEAAmE;AACnE,wEAAwE;AACxE,sEAAsE;AACtE,yEAAyE;AACzE,qDAAqD;AACrD,2CAA2C;;AAiD3C,2CAA2C;AAC3C,+BAA+B"}
@@ -0,0 +1,5 @@
1
+ export interface SHIT_1170_PING {
2
+ ok: boolean;
3
+ app: string;
4
+ }
5
+ //# sourceMappingURL=shit_1170_ping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shit_1170_ping.d.ts","sourceRoot":"","sources":["../../src/types/shit_1170_ping.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,11 @@
1
+ // ========================================
2
+ // SHIT_1170_PING
3
+ // the answer of our own liveness route, GET /api/shit-1170/ping.
4
+ //
5
+ // `ok` is true when the backend answered, `app` names the app that
6
+ // answered so a health checker can tell the services apart.
7
+ // ========================================
8
+ export {};
9
+ // ========================================
10
+ // copyright 2026 by sleet.near
11
+ //# sourceMappingURL=shit_1170_ping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shit_1170_ping.js","sourceRoot":"","sources":["../../src/types/shit_1170_ping.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,iBAAiB;AACjB,iEAAiE;AACjE,EAAE;AACF,mEAAmE;AACnE,4DAA4D;AAC5D,2CAA2C;;AAM3C,2CAA2C;AAC3C,+BAA+B"}
@@ -0,0 +1,57 @@
1
+ export type SHIT_1170_SWAP_QUEUE_STATUS = "pending" | "sent" | "succeeded" | "failed";
2
+ export interface SHIT_1170_SWAP_QUEUE_ACCOUNT {
3
+ accountId: string;
4
+ status: SHIT_1170_SWAP_QUEUE_STATUS;
5
+ txHash: string | null;
6
+ amountOut: string | null;
7
+ }
8
+ export interface SHIT_1170_SWAP_QUEUE {
9
+ swapId: string;
10
+ what: string | null;
11
+ when: string | null;
12
+ why: string | null;
13
+ whenAt: number | null;
14
+ tokenIn: string;
15
+ amountIn: string;
16
+ tokenOut: string;
17
+ amountOut: string | null;
18
+ dexId: string | null;
19
+ accounts: SHIT_1170_SWAP_QUEUE_ACCOUNT[];
20
+ createdAt: number;
21
+ updatedAt: number;
22
+ }
23
+ export interface SHIT_1170_SWAP_QUEUE_LIST {
24
+ items: SHIT_1170_SWAP_QUEUE[];
25
+ total: number;
26
+ nextCursor: string | null;
27
+ }
28
+ export interface SHIT_1170_SWAP_QUEUE_REQUEST {
29
+ what?: string;
30
+ when?: string;
31
+ why?: string;
32
+ whenAt?: number;
33
+ tokenIn: string;
34
+ amountIn: string;
35
+ tokenOut: string;
36
+ amountOut?: string;
37
+ dexId?: string;
38
+ accounts?: string[];
39
+ }
40
+ export interface SHIT_1170_SWAP_QUEUE_ACCOUNT_REQUEST {
41
+ accountId: string;
42
+ }
43
+ export interface SHIT_1170_SWAP_QUEUE_SENT_REQUEST {
44
+ txHash: string;
45
+ status?: SHIT_1170_SWAP_QUEUE_STATUS;
46
+ amountOut?: string;
47
+ }
48
+ export interface SHIT_1170_SWAP_QUEUE_QUERY {
49
+ account_id?: string;
50
+ hide_sent?: boolean;
51
+ contract_id?: string;
52
+ token_in?: string;
53
+ token_out?: string;
54
+ limit?: number;
55
+ cursor?: string;
56
+ }
57
+ //# sourceMappingURL=shit_1170_swap_queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shit_1170_swap_queue.d.ts","sourceRoot":"","sources":["../../src/types/shit_1170_swap_queue.ts"],"names":[],"mappings":"AAwCA,MAAM,MAAM,2BAA2B,GACrC,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAG9C,MAAM,WAAW,4BAA4B;IAE3C,SAAS,EAAE,MAAM,CAAC;IAElB,MAAM,EAAE,2BAA2B,CAAC;IAGpC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAGD,MAAM,WAAW,oBAAoB;IAEnC,MAAM,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,OAAO,EAAE,MAAM,CAAC;IAEhB,QAAQ,EAAE,MAAM,CAAC;IAEjB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E,MAAM,CAAC;CACjB"}
@@ -0,0 +1,37 @@
1
+ // ========================================
2
+ // SHIT_1170_SWAP_QUEUE
3
+ // the shapes of our own swap queue routes, under /api/shit-1170/swap-queue.
4
+ //
5
+ // a queued SWAP is what an agent puts up for offer: the token in, the
6
+ // amount in and the token out. it is NOT a queued batch of transactions
7
+ // — the agent does not know the route, and the route is worked out at
8
+ // the moment somebody executes it.
9
+ //
10
+ // the model is two levels deep:
11
+ //
12
+ // a SWAP tokenIn / amountIn / tokenOut / amountOut / dexId
13
+ // └── an ACCOUNT ROW accountId / status / txHash / amountOut
14
+ //
15
+ // --- WHY --- the fields are camelCase: they mirror the browser's own
16
+ // session object (`accountId`), so nothing is renamed on the way.
17
+ //
18
+ // --- WHY --- `amountIn` is the RAW unit amount and not a human amount:
19
+ // the chain and the router trade the token's smallest unit, and a human
20
+ // amount is only meaningful next to the token it belongs to — "1.5 NEAR"
21
+ // and "1.5 USDC" are different trades. the raw number means the same
22
+ // thing whatever the token's decimals are.
23
+ //
24
+ // --- WHY --- `amountOut` is OPTIONAL: a swap may be queued without a
25
+ // quote, and the quote is worked out live on the feed page. the stored
26
+ // one is only the fallback.
27
+ //
28
+ // --- WHY --- there is no status on the swap and none on the queue: the
29
+ // truth is on the account row. a queued swap is never done — any
30
+ // account may still execute it — so there is nothing for a swap status
31
+ // to say, and two accounts executing the same queued swap produce two
32
+ // different on-chain transactions with two different outcomes.
33
+ // ========================================
34
+ export {};
35
+ // ========================================
36
+ // copyright 2026 by sleet.near
37
+ //# sourceMappingURL=shit_1170_swap_queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shit_1170_swap_queue.js","sourceRoot":"","sources":["../../src/types/shit_1170_swap_queue.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,uBAAuB;AACvB,4EAA4E;AAC5E,EAAE;AACF,sEAAsE;AACtE,wEAAwE;AACxE,sEAAsE;AACtE,mCAAmC;AACnC,EAAE;AACF,gCAAgC;AAChC,EAAE;AACF,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,sEAAsE;AACtE,kEAAkE;AAClE,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,qEAAqE;AACrE,2CAA2C;AAC3C,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,4BAA4B;AAC5B,EAAE;AACF,wEAAwE;AACxE,iEAAiE;AACjE,uEAAuE;AACvE,sEAAsE;AACtE,+DAA+D;AAC/D,2CAA2C;;AA+K3C,2CAA2C;AAC3C,+BAA+B"}
@@ -0,0 +1,74 @@
1
+ export type SHIT_1170_TX_QUEUE_STATUS = "pending" | "sent" | "succeeded" | "failed";
2
+ export interface SHIT_1170_TX_QUEUE_ACCOUNT {
3
+ accountId: string;
4
+ status: SHIT_1170_TX_QUEUE_STATUS;
5
+ txHash: string | null;
6
+ }
7
+ export interface SHIT_1170_TX_QUEUE_TRANSACTION {
8
+ txId: string;
9
+ position: number;
10
+ contractId: string;
11
+ method: string;
12
+ args: Record<string, unknown>;
13
+ gas: string | null;
14
+ deposit: string | null;
15
+ accounts: SHIT_1170_TX_QUEUE_ACCOUNT[];
16
+ }
17
+ export interface SHIT_1170_TX_QUEUE {
18
+ queueId: string;
19
+ what: string | null;
20
+ when: string | null;
21
+ why: string | null;
22
+ whenAt: number | null;
23
+ transactions: SHIT_1170_TX_QUEUE_TRANSACTION[];
24
+ accounts: SHIT_1170_TX_QUEUE_ACCOUNT[];
25
+ createdAt: number;
26
+ updatedAt: number;
27
+ }
28
+ export interface SHIT_1170_TX_QUEUE_LIST {
29
+ items: SHIT_1170_TX_QUEUE[];
30
+ total: number;
31
+ nextCursor: string | null;
32
+ }
33
+ export interface SHIT_1170_TX_QUEUE_TRANSACTION_REQUEST {
34
+ contractId: string;
35
+ method: string;
36
+ args?: Record<string, unknown>;
37
+ gas?: string;
38
+ deposit?: string;
39
+ }
40
+ export interface SHIT_1170_TX_QUEUE_REQUEST {
41
+ what?: string;
42
+ when?: string;
43
+ why?: string;
44
+ whenAt?: number;
45
+ transactions: SHIT_1170_TX_QUEUE_TRANSACTION_REQUEST[];
46
+ accounts?: string[];
47
+ }
48
+ export interface SHIT_1170_TX_QUEUE_ACCOUNT_REQUEST {
49
+ accountId: string;
50
+ }
51
+ export interface SHIT_1170_TX_QUEUE_HASH_REQUEST {
52
+ txId: string;
53
+ txHash: string;
54
+ status?: SHIT_1170_TX_QUEUE_STATUS;
55
+ }
56
+ export interface SHIT_1170_TX_QUEUE_SENT_REQUEST {
57
+ txHashes: SHIT_1170_TX_QUEUE_HASH_REQUEST[];
58
+ }
59
+ export interface SHIT_1170_TX_QUEUE_CONTRACT_STAT {
60
+ contractId: string;
61
+ count: number;
62
+ }
63
+ export interface SHIT_1170_TX_QUEUE_CONTRACT_STATS {
64
+ items: SHIT_1170_TX_QUEUE_CONTRACT_STAT[];
65
+ }
66
+ export interface SHIT_1170_TX_QUEUE_METHOD_STAT {
67
+ method: string;
68
+ contractId: string;
69
+ count: number;
70
+ }
71
+ export interface SHIT_1170_TX_QUEUE_METHOD_STATS {
72
+ items: SHIT_1170_TX_QUEUE_METHOD_STAT[];
73
+ }
74
+ //# sourceMappingURL=shit_1170_tx_queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shit_1170_tx_queue.d.ts","sourceRoot":"","sources":["../../src/types/shit_1170_tx_queue.ts"],"names":[],"mappings":"AAqCA,MAAM,MAAM,yBAAyB,GACnC,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAG9C,MAAM,WAAW,0BAA0B;IAEzC,SAAS,EAAE,MAAM,CAAC;IAElB,MAAM,EAAE,yBAAyB,CAAC;IAGlC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAGD,MAAM,WAAW,8BAA8B;IAE7C,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,MAAM,CAAC;IAEjB,UAAU,EAAE,MAAM,CAAC;IAEnB,MAAM,EAAE,MAAM,CA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