@oobe-protocol-labs/synapse-sap-sdk 0.13.0 → 0.14.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 (654) hide show
  1. package/dist/cjs/accounts/index.js +286 -0
  2. package/dist/cjs/accounts/index.js.map +1 -0
  3. package/dist/cjs/client.js +108 -0
  4. package/dist/cjs/client.js.map +1 -0
  5. package/dist/cjs/constants.js +59 -0
  6. package/dist/cjs/constants.js.map +1 -0
  7. package/dist/cjs/errors.js +250 -0
  8. package/dist/cjs/errors.js.map +1 -0
  9. package/dist/cjs/events/index.js +38 -130
  10. package/dist/cjs/events/index.js.map +1 -1
  11. package/dist/cjs/idlTypes.js +4 -0
  12. package/dist/cjs/idlTypes.js.map +1 -0
  13. package/dist/cjs/index.js +75 -241
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/cjs/instructions/agent.js +89 -0
  16. package/dist/cjs/instructions/agent.js.map +1 -0
  17. package/dist/cjs/instructions/attestation.js +112 -0
  18. package/dist/cjs/instructions/attestation.js.map +1 -0
  19. package/dist/cjs/instructions/digest.js +28 -0
  20. package/dist/cjs/instructions/digest.js.map +1 -0
  21. package/dist/cjs/instructions/dispute.js +116 -0
  22. package/dist/cjs/instructions/dispute.js.map +1 -0
  23. package/dist/cjs/instructions/escrow.js +101 -0
  24. package/dist/cjs/instructions/escrow.js.map +1 -0
  25. package/dist/cjs/instructions/global.js +28 -0
  26. package/dist/cjs/instructions/global.js.map +1 -0
  27. package/dist/cjs/instructions/index.js +31 -0
  28. package/dist/cjs/instructions/index.js.map +1 -0
  29. package/dist/cjs/instructions/indexing.js +221 -0
  30. package/dist/cjs/instructions/indexing.js.map +1 -0
  31. package/dist/cjs/instructions/misc.js +73 -0
  32. package/dist/cjs/instructions/misc.js.map +1 -0
  33. package/dist/cjs/instructions/session.js +89 -0
  34. package/dist/cjs/instructions/session.js.map +1 -0
  35. package/dist/cjs/instructions/staking.js +132 -0
  36. package/dist/cjs/instructions/staking.js.map +1 -0
  37. package/dist/cjs/instructions/subscription.js +80 -0
  38. package/dist/cjs/instructions/subscription.js.map +1 -0
  39. package/dist/cjs/instructions/tools.js +109 -0
  40. package/dist/cjs/instructions/tools.js.map +1 -0
  41. package/dist/cjs/instructions/vault.js +106 -0
  42. package/dist/cjs/instructions/vault.js.map +1 -0
  43. package/dist/cjs/pdas/index.js +120 -0
  44. package/dist/cjs/pdas/index.js.map +1 -0
  45. package/dist/cjs/types.js +42 -0
  46. package/dist/cjs/types.js.map +1 -0
  47. package/dist/cjs/utils/index.js +29 -86
  48. package/dist/cjs/utils/index.js.map +1 -1
  49. package/dist/cjs/utils/validate.js +236 -0
  50. package/dist/cjs/utils/validate.js.map +1 -0
  51. package/dist/esm/accounts/index.d.ts +11 -0
  52. package/dist/esm/accounts/index.d.ts.map +1 -0
  53. package/dist/esm/accounts/index.js +273 -0
  54. package/dist/esm/accounts/index.js.map +1 -0
  55. package/dist/esm/client.d.ts +55 -0
  56. package/dist/esm/client.d.ts.map +1 -0
  57. package/dist/esm/client.js +70 -0
  58. package/dist/esm/client.js.map +1 -0
  59. package/dist/esm/constants.d.ts +52 -0
  60. package/dist/esm/constants.d.ts.map +1 -0
  61. package/dist/esm/constants.js +56 -0
  62. package/dist/esm/constants.js.map +1 -0
  63. package/dist/esm/errors.d.ts +111 -0
  64. package/dist/esm/errors.d.ts.map +1 -0
  65. package/dist/esm/errors.js +244 -0
  66. package/dist/esm/errors.js.map +1 -0
  67. package/dist/esm/events/index.d.ts +13 -0
  68. package/dist/esm/events/index.d.ts.map +1 -0
  69. package/dist/esm/events/index.js +36 -128
  70. package/dist/esm/events/index.js.map +1 -1
  71. package/dist/esm/idlTypes.d.ts +925 -0
  72. package/dist/esm/idlTypes.d.ts.map +1 -0
  73. package/dist/esm/idlTypes.js +3 -0
  74. package/dist/esm/idlTypes.js.map +1 -0
  75. package/dist/esm/index.d.ts +12 -0
  76. package/dist/esm/index.d.ts.map +1 -0
  77. package/dist/esm/index.js +15 -88
  78. package/dist/esm/index.js.map +1 -1
  79. package/dist/esm/instructions/agent.d.ts +71 -0
  80. package/dist/esm/instructions/agent.d.ts.map +1 -0
  81. package/dist/esm/instructions/agent.js +85 -0
  82. package/dist/esm/instructions/agent.js.map +1 -0
  83. package/dist/esm/instructions/attestation.d.ts +76 -0
  84. package/dist/esm/instructions/attestation.d.ts.map +1 -0
  85. package/dist/esm/instructions/attestation.js +108 -0
  86. package/dist/esm/instructions/attestation.js.map +1 -0
  87. package/dist/esm/instructions/digest.d.ts +20 -0
  88. package/dist/esm/instructions/digest.d.ts.map +1 -0
  89. package/dist/esm/instructions/digest.js +24 -0
  90. package/dist/esm/instructions/digest.js.map +1 -0
  91. package/dist/esm/instructions/dispute.d.ts +81 -0
  92. package/dist/esm/instructions/dispute.d.ts.map +1 -0
  93. package/dist/esm/instructions/dispute.js +112 -0
  94. package/dist/esm/instructions/dispute.js.map +1 -0
  95. package/dist/esm/instructions/escrow.d.ts +79 -0
  96. package/dist/esm/instructions/escrow.d.ts.map +1 -0
  97. package/dist/esm/instructions/escrow.js +97 -0
  98. package/dist/esm/instructions/escrow.js.map +1 -0
  99. package/dist/esm/instructions/global.d.ts +14 -0
  100. package/dist/esm/instructions/global.d.ts.map +1 -0
  101. package/dist/esm/instructions/global.js +24 -0
  102. package/dist/esm/instructions/global.js.map +1 -0
  103. package/dist/esm/instructions/index.d.ts +14 -0
  104. package/dist/esm/instructions/index.d.ts.map +1 -0
  105. package/dist/esm/instructions/index.js +15 -0
  106. package/dist/esm/instructions/index.js.map +1 -0
  107. package/dist/esm/instructions/indexing.d.ts +150 -0
  108. package/dist/esm/instructions/indexing.d.ts.map +1 -0
  109. package/dist/esm/instructions/indexing.js +217 -0
  110. package/dist/esm/instructions/indexing.js.map +1 -0
  111. package/dist/esm/instructions/memory.d.ts +8 -0
  112. package/dist/esm/instructions/memory.d.ts.map +1 -0
  113. package/dist/esm/instructions/memory.js +234 -0
  114. package/dist/esm/instructions/memory.js.map +1 -0
  115. package/dist/esm/instructions/misc.d.ts +50 -0
  116. package/dist/esm/instructions/misc.d.ts.map +1 -0
  117. package/dist/esm/instructions/misc.js +69 -0
  118. package/dist/esm/instructions/misc.js.map +1 -0
  119. package/dist/esm/instructions/session.d.ts +57 -0
  120. package/dist/esm/instructions/session.d.ts.map +1 -0
  121. package/dist/esm/instructions/session.js +85 -0
  122. package/dist/esm/instructions/session.js.map +1 -0
  123. package/dist/esm/instructions/staking.d.ts +85 -0
  124. package/dist/esm/instructions/staking.d.ts.map +1 -0
  125. package/dist/esm/instructions/staking.js +128 -0
  126. package/dist/esm/instructions/staking.js.map +1 -0
  127. package/dist/esm/instructions/subscription.d.ts +50 -0
  128. package/dist/esm/instructions/subscription.d.ts.map +1 -0
  129. package/dist/esm/instructions/subscription.js +76 -0
  130. package/dist/esm/instructions/subscription.js.map +1 -0
  131. package/dist/esm/instructions/tools.d.ts +88 -0
  132. package/dist/esm/instructions/tools.d.ts.map +1 -0
  133. package/dist/esm/instructions/tools.js +105 -0
  134. package/dist/esm/instructions/tools.js.map +1 -0
  135. package/dist/esm/instructions/vault.d.ts +84 -0
  136. package/dist/esm/instructions/vault.d.ts.map +1 -0
  137. package/dist/esm/instructions/vault.js +102 -0
  138. package/dist/esm/instructions/vault.js.map +1 -0
  139. package/dist/esm/pdas/index.d.ts +37 -0
  140. package/dist/esm/pdas/index.d.ts.map +1 -0
  141. package/dist/esm/pdas/index.js +101 -0
  142. package/dist/esm/pdas/index.js.map +1 -0
  143. package/dist/esm/types.d.ts +208 -0
  144. package/dist/esm/types.d.ts.map +1 -0
  145. package/dist/esm/types.js +39 -0
  146. package/dist/esm/types.js.map +1 -0
  147. package/dist/esm/utils/index.d.ts +4 -0
  148. package/dist/esm/utils/index.d.ts.map +1 -0
  149. package/dist/esm/utils/index.js +13 -33
  150. package/dist/esm/utils/index.js.map +1 -1
  151. package/dist/esm/utils/validate.d.ts +66 -0
  152. package/dist/esm/utils/validate.d.ts.map +1 -0
  153. package/dist/esm/utils/validate.js +221 -0
  154. package/dist/esm/utils/validate.js.map +1 -0
  155. package/package.json +59 -183
  156. package/LICENSE +0 -21
  157. package/README.md +0 -986
  158. package/dist/cjs/constants/addresses.js +0 -143
  159. package/dist/cjs/constants/addresses.js.map +0 -1
  160. package/dist/cjs/constants/index.js +0 -64
  161. package/dist/cjs/constants/index.js.map +0 -1
  162. package/dist/cjs/constants/limits.js +0 -161
  163. package/dist/cjs/constants/limits.js.map +0 -1
  164. package/dist/cjs/constants/network.js +0 -81
  165. package/dist/cjs/constants/network.js.map +0 -1
  166. package/dist/cjs/constants/payments.js +0 -137
  167. package/dist/cjs/constants/payments.js.map +0 -1
  168. package/dist/cjs/constants/programs.js +0 -78
  169. package/dist/cjs/constants/programs.js.map +0 -1
  170. package/dist/cjs/constants/seeds.js +0 -76
  171. package/dist/cjs/constants/seeds.js.map +0 -1
  172. package/dist/cjs/core/client.js +0 -546
  173. package/dist/cjs/core/client.js.map +0 -1
  174. package/dist/cjs/core/connection.js +0 -350
  175. package/dist/cjs/core/connection.js.map +0 -1
  176. package/dist/cjs/core/index.js +0 -25
  177. package/dist/cjs/core/index.js.map +0 -1
  178. package/dist/cjs/errors/index.js +0 -334
  179. package/dist/cjs/errors/index.js.map +0 -1
  180. package/dist/cjs/events/geyser.js +0 -295
  181. package/dist/cjs/events/geyser.js.map +0 -1
  182. package/dist/cjs/idl/index.js +0 -63
  183. package/dist/cjs/idl/index.js.map +0 -1
  184. package/dist/cjs/idl/synapse_agent_sap.json +0 -14595
  185. package/dist/cjs/modules/agent.js +0 -272
  186. package/dist/cjs/modules/agent.js.map +0 -1
  187. package/dist/cjs/modules/attestation.js +0 -147
  188. package/dist/cjs/modules/attestation.js.map +0 -1
  189. package/dist/cjs/modules/base.js +0 -189
  190. package/dist/cjs/modules/base.js.map +0 -1
  191. package/dist/cjs/modules/escrow-v2.js +0 -607
  192. package/dist/cjs/modules/escrow-v2.js.map +0 -1
  193. package/dist/cjs/modules/escrow.js +0 -336
  194. package/dist/cjs/modules/escrow.js.map +0 -1
  195. package/dist/cjs/modules/feedback.js +0 -166
  196. package/dist/cjs/modules/feedback.js.map +0 -1
  197. package/dist/cjs/modules/index.js +0 -43
  198. package/dist/cjs/modules/index.js.map +0 -1
  199. package/dist/cjs/modules/indexing.js +0 -375
  200. package/dist/cjs/modules/indexing.js.map +0 -1
  201. package/dist/cjs/modules/ledger.js +0 -234
  202. package/dist/cjs/modules/ledger.js.map +0 -1
  203. package/dist/cjs/modules/receipt.js +0 -148
  204. package/dist/cjs/modules/receipt.js.map +0 -1
  205. package/dist/cjs/modules/staking.js +0 -159
  206. package/dist/cjs/modules/staking.js.map +0 -1
  207. package/dist/cjs/modules/subscription.js +0 -96
  208. package/dist/cjs/modules/subscription.js.map +0 -1
  209. package/dist/cjs/modules/tools.js +0 -345
  210. package/dist/cjs/modules/tools.js.map +0 -1
  211. package/dist/cjs/modules/vault.js +0 -427
  212. package/dist/cjs/modules/vault.js.map +0 -1
  213. package/dist/cjs/parser/client.js +0 -146
  214. package/dist/cjs/parser/client.js.map +0 -1
  215. package/dist/cjs/parser/complete.js +0 -177
  216. package/dist/cjs/parser/complete.js.map +0 -1
  217. package/dist/cjs/parser/index.js +0 -57
  218. package/dist/cjs/parser/index.js.map +0 -1
  219. package/dist/cjs/parser/inner.js +0 -185
  220. package/dist/cjs/parser/inner.js.map +0 -1
  221. package/dist/cjs/parser/instructions.js +0 -114
  222. package/dist/cjs/parser/instructions.js.map +0 -1
  223. package/dist/cjs/parser/transaction.js +0 -153
  224. package/dist/cjs/parser/transaction.js.map +0 -1
  225. package/dist/cjs/parser/types.js +0 -14
  226. package/dist/cjs/parser/types.js.map +0 -1
  227. package/dist/cjs/pda/index.js +0 -672
  228. package/dist/cjs/pda/index.js.map +0 -1
  229. package/dist/cjs/plugin/index.js +0 -952
  230. package/dist/cjs/plugin/index.js.map +0 -1
  231. package/dist/cjs/plugin/protocols.js +0 -282
  232. package/dist/cjs/plugin/protocols.js.map +0 -1
  233. package/dist/cjs/plugin/schemas.js +0 -863
  234. package/dist/cjs/plugin/schemas.js.map +0 -1
  235. package/dist/cjs/postgres/adapter.js +0 -715
  236. package/dist/cjs/postgres/adapter.js.map +0 -1
  237. package/dist/cjs/postgres/index.js +0 -50
  238. package/dist/cjs/postgres/index.js.map +0 -1
  239. package/dist/cjs/postgres/serializers.js +0 -381
  240. package/dist/cjs/postgres/serializers.js.map +0 -1
  241. package/dist/cjs/postgres/sync.js +0 -289
  242. package/dist/cjs/postgres/sync.js.map +0 -1
  243. package/dist/cjs/postgres/types.js +0 -44
  244. package/dist/cjs/postgres/types.js.map +0 -1
  245. package/dist/cjs/registries/builder.js +0 -414
  246. package/dist/cjs/registries/builder.js.map +0 -1
  247. package/dist/cjs/registries/discovery.js +0 -362
  248. package/dist/cjs/registries/discovery.js.map +0 -1
  249. package/dist/cjs/registries/fairscale.js +0 -639
  250. package/dist/cjs/registries/fairscale.js.map +0 -1
  251. package/dist/cjs/registries/index.js +0 -58
  252. package/dist/cjs/registries/index.js.map +0 -1
  253. package/dist/cjs/registries/metaplex-bridge.js +0 -743
  254. package/dist/cjs/registries/metaplex-bridge.js.map +0 -1
  255. package/dist/cjs/registries/session.js +0 -433
  256. package/dist/cjs/registries/session.js.map +0 -1
  257. package/dist/cjs/registries/x402.js +0 -668
  258. package/dist/cjs/registries/x402.js.map +0 -1
  259. package/dist/cjs/types/accounts.js +0 -13
  260. package/dist/cjs/types/accounts.js.map +0 -1
  261. package/dist/cjs/types/common.js +0 -13
  262. package/dist/cjs/types/common.js.map +0 -1
  263. package/dist/cjs/types/endpoint.js +0 -15
  264. package/dist/cjs/types/endpoint.js.map +0 -1
  265. package/dist/cjs/types/enums.js +0 -269
  266. package/dist/cjs/types/enums.js.map +0 -1
  267. package/dist/cjs/types/index.js +0 -41
  268. package/dist/cjs/types/index.js.map +0 -1
  269. package/dist/cjs/types/instructions.js +0 -92
  270. package/dist/cjs/types/instructions.js.map +0 -1
  271. package/dist/cjs/utils/anchor-errors.js +0 -453
  272. package/dist/cjs/utils/anchor-errors.js.map +0 -1
  273. package/dist/cjs/utils/endpoint-validator.js +0 -232
  274. package/dist/cjs/utils/endpoint-validator.js.map +0 -1
  275. package/dist/cjs/utils/escrow-validation.js +0 -219
  276. package/dist/cjs/utils/escrow-validation.js.map +0 -1
  277. package/dist/cjs/utils/hash.js +0 -109
  278. package/dist/cjs/utils/hash.js.map +0 -1
  279. package/dist/cjs/utils/merchant-validator.js +0 -246
  280. package/dist/cjs/utils/merchant-validator.js.map +0 -1
  281. package/dist/cjs/utils/network-normalizer.js +0 -236
  282. package/dist/cjs/utils/network-normalizer.js.map +0 -1
  283. package/dist/cjs/utils/priority-fee.js +0 -215
  284. package/dist/cjs/utils/priority-fee.js.map +0 -1
  285. package/dist/cjs/utils/rpc-strategy.js +0 -239
  286. package/dist/cjs/utils/rpc-strategy.js.map +0 -1
  287. package/dist/cjs/utils/schemas.js +0 -331
  288. package/dist/cjs/utils/schemas.js.map +0 -1
  289. package/dist/cjs/utils/serialization.js +0 -105
  290. package/dist/cjs/utils/serialization.js.map +0 -1
  291. package/dist/cjs/utils/validation.js +0 -36
  292. package/dist/cjs/utils/validation.js.map +0 -1
  293. package/dist/cjs/utils/volume-curve.js +0 -117
  294. package/dist/cjs/utils/volume-curve.js.map +0 -1
  295. package/dist/cjs/utils/x402-direct.js +0 -231
  296. package/dist/cjs/utils/x402-direct.js.map +0 -1
  297. package/dist/esm/constants/addresses.js +0 -140
  298. package/dist/esm/constants/addresses.js.map +0 -1
  299. package/dist/esm/constants/index.js +0 -35
  300. package/dist/esm/constants/index.js.map +0 -1
  301. package/dist/esm/constants/limits.js +0 -158
  302. package/dist/esm/constants/limits.js.map +0 -1
  303. package/dist/esm/constants/network.js +0 -78
  304. package/dist/esm/constants/network.js.map +0 -1
  305. package/dist/esm/constants/payments.js +0 -131
  306. package/dist/esm/constants/payments.js.map +0 -1
  307. package/dist/esm/constants/programs.js +0 -75
  308. package/dist/esm/constants/programs.js.map +0 -1
  309. package/dist/esm/constants/seeds.js +0 -73
  310. package/dist/esm/constants/seeds.js.map +0 -1
  311. package/dist/esm/core/client.js +0 -539
  312. package/dist/esm/core/client.js.map +0 -1
  313. package/dist/esm/core/connection.js +0 -345
  314. package/dist/esm/core/connection.js.map +0 -1
  315. package/dist/esm/core/index.js +0 -19
  316. package/dist/esm/core/index.js.map +0 -1
  317. package/dist/esm/errors/index.js +0 -325
  318. package/dist/esm/errors/index.js.map +0 -1
  319. package/dist/esm/events/geyser.js +0 -258
  320. package/dist/esm/events/geyser.js.map +0 -1
  321. package/dist/esm/idl/index.js +0 -57
  322. package/dist/esm/idl/index.js.map +0 -1
  323. package/dist/esm/idl/synapse_agent_sap.json +0 -14595
  324. package/dist/esm/modules/agent.js +0 -268
  325. package/dist/esm/modules/agent.js.map +0 -1
  326. package/dist/esm/modules/attestation.js +0 -143
  327. package/dist/esm/modules/attestation.js.map +0 -1
  328. package/dist/esm/modules/base.js +0 -185
  329. package/dist/esm/modules/base.js.map +0 -1
  330. package/dist/esm/modules/escrow-v2.js +0 -603
  331. package/dist/esm/modules/escrow-v2.js.map +0 -1
  332. package/dist/esm/modules/escrow.js +0 -332
  333. package/dist/esm/modules/escrow.js.map +0 -1
  334. package/dist/esm/modules/feedback.js +0 -162
  335. package/dist/esm/modules/feedback.js.map +0 -1
  336. package/dist/esm/modules/index.js +0 -27
  337. package/dist/esm/modules/index.js.map +0 -1
  338. package/dist/esm/modules/indexing.js +0 -371
  339. package/dist/esm/modules/indexing.js.map +0 -1
  340. package/dist/esm/modules/ledger.js +0 -230
  341. package/dist/esm/modules/ledger.js.map +0 -1
  342. package/dist/esm/modules/receipt.js +0 -144
  343. package/dist/esm/modules/receipt.js.map +0 -1
  344. package/dist/esm/modules/staking.js +0 -155
  345. package/dist/esm/modules/staking.js.map +0 -1
  346. package/dist/esm/modules/subscription.js +0 -92
  347. package/dist/esm/modules/subscription.js.map +0 -1
  348. package/dist/esm/modules/tools.js +0 -341
  349. package/dist/esm/modules/tools.js.map +0 -1
  350. package/dist/esm/modules/vault.js +0 -423
  351. package/dist/esm/modules/vault.js.map +0 -1
  352. package/dist/esm/parser/client.js +0 -142
  353. package/dist/esm/parser/client.js.map +0 -1
  354. package/dist/esm/parser/complete.js +0 -173
  355. package/dist/esm/parser/complete.js.map +0 -1
  356. package/dist/esm/parser/index.js +0 -43
  357. package/dist/esm/parser/index.js.map +0 -1
  358. package/dist/esm/parser/inner.js +0 -180
  359. package/dist/esm/parser/inner.js.map +0 -1
  360. package/dist/esm/parser/instructions.js +0 -109
  361. package/dist/esm/parser/instructions.js.map +0 -1
  362. package/dist/esm/parser/transaction.js +0 -149
  363. package/dist/esm/parser/transaction.js.map +0 -1
  364. package/dist/esm/parser/types.js +0 -13
  365. package/dist/esm/parser/types.js.map +0 -1
  366. package/dist/esm/pda/index.js +0 -638
  367. package/dist/esm/pda/index.js.map +0 -1
  368. package/dist/esm/plugin/index.js +0 -945
  369. package/dist/esm/plugin/index.js.map +0 -1
  370. package/dist/esm/plugin/protocols.js +0 -279
  371. package/dist/esm/plugin/protocols.js.map +0 -1
  372. package/dist/esm/plugin/schemas.js +0 -860
  373. package/dist/esm/plugin/schemas.js.map +0 -1
  374. package/dist/esm/postgres/adapter.js +0 -678
  375. package/dist/esm/postgres/adapter.js.map +0 -1
  376. package/dist/esm/postgres/index.js +0 -27
  377. package/dist/esm/postgres/index.js.map +0 -1
  378. package/dist/esm/postgres/serializers.js +0 -362
  379. package/dist/esm/postgres/serializers.js.map +0 -1
  380. package/dist/esm/postgres/sync.js +0 -285
  381. package/dist/esm/postgres/sync.js.map +0 -1
  382. package/dist/esm/postgres/types.js +0 -41
  383. package/dist/esm/postgres/types.js.map +0 -1
  384. package/dist/esm/registries/builder.js +0 -410
  385. package/dist/esm/registries/builder.js.map +0 -1
  386. package/dist/esm/registries/discovery.js +0 -358
  387. package/dist/esm/registries/discovery.js.map +0 -1
  388. package/dist/esm/registries/fairscale.js +0 -633
  389. package/dist/esm/registries/fairscale.js.map +0 -1
  390. package/dist/esm/registries/index.js +0 -46
  391. package/dist/esm/registries/index.js.map +0 -1
  392. package/dist/esm/registries/metaplex-bridge.js +0 -706
  393. package/dist/esm/registries/metaplex-bridge.js.map +0 -1
  394. package/dist/esm/registries/session.js +0 -429
  395. package/dist/esm/registries/session.js.map +0 -1
  396. package/dist/esm/registries/x402.js +0 -664
  397. package/dist/esm/registries/x402.js.map +0 -1
  398. package/dist/esm/types/accounts.js +0 -12
  399. package/dist/esm/types/accounts.js.map +0 -1
  400. package/dist/esm/types/common.js +0 -12
  401. package/dist/esm/types/common.js.map +0 -1
  402. package/dist/esm/types/endpoint.js +0 -14
  403. package/dist/esm/types/endpoint.js.map +0 -1
  404. package/dist/esm/types/enums.js +0 -266
  405. package/dist/esm/types/enums.js.map +0 -1
  406. package/dist/esm/types/index.js +0 -25
  407. package/dist/esm/types/index.js.map +0 -1
  408. package/dist/esm/types/instructions.js +0 -89
  409. package/dist/esm/types/instructions.js.map +0 -1
  410. package/dist/esm/utils/anchor-errors.js +0 -447
  411. package/dist/esm/utils/anchor-errors.js.map +0 -1
  412. package/dist/esm/utils/endpoint-validator.js +0 -226
  413. package/dist/esm/utils/endpoint-validator.js.map +0 -1
  414. package/dist/esm/utils/escrow-validation.js +0 -212
  415. package/dist/esm/utils/escrow-validation.js.map +0 -1
  416. package/dist/esm/utils/hash.js +0 -103
  417. package/dist/esm/utils/hash.js.map +0 -1
  418. package/dist/esm/utils/merchant-validator.js +0 -241
  419. package/dist/esm/utils/merchant-validator.js.map +0 -1
  420. package/dist/esm/utils/network-normalizer.js +0 -229
  421. package/dist/esm/utils/network-normalizer.js.map +0 -1
  422. package/dist/esm/utils/priority-fee.js +0 -209
  423. package/dist/esm/utils/priority-fee.js.map +0 -1
  424. package/dist/esm/utils/rpc-strategy.js +0 -231
  425. package/dist/esm/utils/rpc-strategy.js.map +0 -1
  426. package/dist/esm/utils/schemas.js +0 -320
  427. package/dist/esm/utils/schemas.js.map +0 -1
  428. package/dist/esm/utils/serialization.js +0 -98
  429. package/dist/esm/utils/serialization.js.map +0 -1
  430. package/dist/esm/utils/validation.js +0 -33
  431. package/dist/esm/utils/validation.js.map +0 -1
  432. package/dist/esm/utils/volume-curve.js +0 -114
  433. package/dist/esm/utils/volume-curve.js.map +0 -1
  434. package/dist/esm/utils/x402-direct.js +0 -228
  435. package/dist/esm/utils/x402-direct.js.map +0 -1
  436. package/dist/types/constants/addresses.d.ts +0 -117
  437. package/dist/types/constants/addresses.d.ts.map +0 -1
  438. package/dist/types/constants/index.d.ts +0 -31
  439. package/dist/types/constants/index.d.ts.map +0 -1
  440. package/dist/types/constants/limits.d.ts +0 -149
  441. package/dist/types/constants/limits.d.ts.map +0 -1
  442. package/dist/types/constants/network.d.ts +0 -81
  443. package/dist/types/constants/network.d.ts.map +0 -1
  444. package/dist/types/constants/payments.d.ts +0 -121
  445. package/dist/types/constants/payments.d.ts.map +0 -1
  446. package/dist/types/constants/programs.d.ts +0 -69
  447. package/dist/types/constants/programs.d.ts.map +0 -1
  448. package/dist/types/constants/seeds.d.ts +0 -80
  449. package/dist/types/constants/seeds.d.ts.map +0 -1
  450. package/dist/types/core/client.d.ts +0 -452
  451. package/dist/types/core/client.d.ts.map +0 -1
  452. package/dist/types/core/connection.d.ts +0 -305
  453. package/dist/types/core/connection.d.ts.map +0 -1
  454. package/dist/types/core/index.d.ts +0 -20
  455. package/dist/types/core/index.d.ts.map +0 -1
  456. package/dist/types/errors/index.d.ts +0 -276
  457. package/dist/types/errors/index.d.ts.map +0 -1
  458. package/dist/types/events/geyser.d.ts +0 -150
  459. package/dist/types/events/geyser.d.ts.map +0 -1
  460. package/dist/types/events/index.d.ts +0 -248
  461. package/dist/types/events/index.d.ts.map +0 -1
  462. package/dist/types/idl/index.d.ts +0 -70
  463. package/dist/types/idl/index.d.ts.map +0 -1
  464. package/dist/types/index.d.ts +0 -85
  465. package/dist/types/index.d.ts.map +0 -1
  466. package/dist/types/modules/agent.d.ts +0 -166
  467. package/dist/types/modules/agent.d.ts.map +0 -1
  468. package/dist/types/modules/attestation.d.ts +0 -96
  469. package/dist/types/modules/attestation.d.ts.map +0 -1
  470. package/dist/types/modules/base.d.ts +0 -161
  471. package/dist/types/modules/base.d.ts.map +0 -1
  472. package/dist/types/modules/escrow-v2.d.ts +0 -169
  473. package/dist/types/modules/escrow-v2.d.ts.map +0 -1
  474. package/dist/types/modules/escrow.d.ts +0 -168
  475. package/dist/types/modules/escrow.d.ts.map +0 -1
  476. package/dist/types/modules/feedback.d.ts +0 -105
  477. package/dist/types/modules/feedback.d.ts.map +0 -1
  478. package/dist/types/modules/index.d.ts +0 -28
  479. package/dist/types/modules/index.d.ts.map +0 -1
  480. package/dist/types/modules/indexing.d.ts +0 -200
  481. package/dist/types/modules/indexing.d.ts.map +0 -1
  482. package/dist/types/modules/ledger.d.ts +0 -150
  483. package/dist/types/modules/ledger.d.ts.map +0 -1
  484. package/dist/types/modules/receipt.d.ts +0 -77
  485. package/dist/types/modules/receipt.d.ts.map +0 -1
  486. package/dist/types/modules/staking.d.ts +0 -51
  487. package/dist/types/modules/staking.d.ts.map +0 -1
  488. package/dist/types/modules/subscription.d.ts +0 -33
  489. package/dist/types/modules/subscription.d.ts.map +0 -1
  490. package/dist/types/modules/tools.d.ts +0 -182
  491. package/dist/types/modules/tools.d.ts.map +0 -1
  492. package/dist/types/modules/vault.d.ts +0 -240
  493. package/dist/types/modules/vault.d.ts.map +0 -1
  494. package/dist/types/parser/client.d.ts +0 -123
  495. package/dist/types/parser/client.d.ts.map +0 -1
  496. package/dist/types/parser/complete.d.ts +0 -90
  497. package/dist/types/parser/complete.d.ts.map +0 -1
  498. package/dist/types/parser/index.d.ts +0 -40
  499. package/dist/types/parser/index.d.ts.map +0 -1
  500. package/dist/types/parser/inner.d.ts +0 -114
  501. package/dist/types/parser/inner.d.ts.map +0 -1
  502. package/dist/types/parser/instructions.d.ts +0 -76
  503. package/dist/types/parser/instructions.d.ts.map +0 -1
  504. package/dist/types/parser/transaction.d.ts +0 -77
  505. package/dist/types/parser/transaction.d.ts.map +0 -1
  506. package/dist/types/parser/types.d.ts +0 -154
  507. package/dist/types/parser/types.d.ts.map +0 -1
  508. package/dist/types/pda/index.d.ts +0 -510
  509. package/dist/types/pda/index.d.ts.map +0 -1
  510. package/dist/types/plugin/index.d.ts +0 -171
  511. package/dist/types/plugin/index.d.ts.map +0 -1
  512. package/dist/types/plugin/protocols.d.ts +0 -152
  513. package/dist/types/plugin/protocols.d.ts.map +0 -1
  514. package/dist/types/plugin/schemas.d.ts +0 -829
  515. package/dist/types/plugin/schemas.d.ts.map +0 -1
  516. package/dist/types/postgres/adapter.d.ts +0 -355
  517. package/dist/types/postgres/adapter.d.ts.map +0 -1
  518. package/dist/types/postgres/index.d.ts +0 -24
  519. package/dist/types/postgres/index.d.ts.map +0 -1
  520. package/dist/types/postgres/serializers.d.ts +0 -30
  521. package/dist/types/postgres/serializers.d.ts.map +0 -1
  522. package/dist/types/postgres/sync.d.ts +0 -156
  523. package/dist/types/postgres/sync.d.ts.map +0 -1
  524. package/dist/types/postgres/types.d.ts +0 -167
  525. package/dist/types/postgres/types.d.ts.map +0 -1
  526. package/dist/types/registries/builder.d.ts +0 -340
  527. package/dist/types/registries/builder.d.ts.map +0 -1
  528. package/dist/types/registries/discovery.d.ts +0 -333
  529. package/dist/types/registries/discovery.d.ts.map +0 -1
  530. package/dist/types/registries/fairscale.d.ts +0 -680
  531. package/dist/types/registries/fairscale.d.ts.map +0 -1
  532. package/dist/types/registries/index.d.ts +0 -52
  533. package/dist/types/registries/index.d.ts.map +0 -1
  534. package/dist/types/registries/metaplex-bridge.d.ts +0 -488
  535. package/dist/types/registries/metaplex-bridge.d.ts.map +0 -1
  536. package/dist/types/registries/session.d.ts +0 -323
  537. package/dist/types/registries/session.d.ts.map +0 -1
  538. package/dist/types/registries/x402.d.ts +0 -530
  539. package/dist/types/registries/x402.d.ts.map +0 -1
  540. package/dist/types/types/accounts.d.ts +0 -765
  541. package/dist/types/types/accounts.d.ts.map +0 -1
  542. package/dist/types/types/common.d.ts +0 -166
  543. package/dist/types/types/common.d.ts.map +0 -1
  544. package/dist/types/types/endpoint.d.ts +0 -161
  545. package/dist/types/types/endpoint.d.ts.map +0 -1
  546. package/dist/types/types/enums.d.ts +0 -353
  547. package/dist/types/types/enums.d.ts.map +0 -1
  548. package/dist/types/types/index.d.ts +0 -29
  549. package/dist/types/types/index.d.ts.map +0 -1
  550. package/dist/types/types/instructions.d.ts +0 -400
  551. package/dist/types/types/instructions.d.ts.map +0 -1
  552. package/dist/types/utils/anchor-errors.d.ts +0 -61
  553. package/dist/types/utils/anchor-errors.d.ts.map +0 -1
  554. package/dist/types/utils/endpoint-validator.d.ts +0 -110
  555. package/dist/types/utils/endpoint-validator.d.ts.map +0 -1
  556. package/dist/types/utils/escrow-validation.d.ts +0 -145
  557. package/dist/types/utils/escrow-validation.d.ts.map +0 -1
  558. package/dist/types/utils/hash.d.ts +0 -75
  559. package/dist/types/utils/hash.d.ts.map +0 -1
  560. package/dist/types/utils/index.d.ts +0 -36
  561. package/dist/types/utils/index.d.ts.map +0 -1
  562. package/dist/types/utils/merchant-validator.d.ts +0 -176
  563. package/dist/types/utils/merchant-validator.d.ts.map +0 -1
  564. package/dist/types/utils/network-normalizer.d.ts +0 -120
  565. package/dist/types/utils/network-normalizer.d.ts.map +0 -1
  566. package/dist/types/utils/priority-fee.d.ts +0 -205
  567. package/dist/types/utils/priority-fee.d.ts.map +0 -1
  568. package/dist/types/utils/rpc-strategy.d.ts +0 -172
  569. package/dist/types/utils/rpc-strategy.d.ts.map +0 -1
  570. package/dist/types/utils/schemas.d.ts +0 -351
  571. package/dist/types/utils/schemas.d.ts.map +0 -1
  572. package/dist/types/utils/serialization.d.ts +0 -69
  573. package/dist/types/utils/serialization.d.ts.map +0 -1
  574. package/dist/types/utils/validation.d.ts +0 -29
  575. package/dist/types/utils/validation.d.ts.map +0 -1
  576. package/dist/types/utils/volume-curve.d.ts +0 -60
  577. package/dist/types/utils/volume-curve.d.ts.map +0 -1
  578. package/dist/types/utils/x402-direct.d.ts +0 -114
  579. package/dist/types/utils/x402-direct.d.ts.map +0 -1
  580. package/src/constants/addresses.ts +0 -162
  581. package/src/constants/index.ts +0 -69
  582. package/src/constants/limits.ts +0 -165
  583. package/src/constants/network.ts +0 -89
  584. package/src/constants/payments.ts +0 -145
  585. package/src/constants/programs.ts +0 -83
  586. package/src/constants/seeds.ts +0 -85
  587. package/src/core/client.ts +0 -583
  588. package/src/core/connection.ts +0 -461
  589. package/src/core/index.ts +0 -20
  590. package/src/errors/index.ts +0 -346
  591. package/src/events/geyser.ts +0 -384
  592. package/src/events/index.ts +0 -335
  593. package/src/events/yellowstone.d.ts +0 -7
  594. package/src/idl/index.ts +0 -76
  595. package/src/idl/synapse_agent_sap.json +0 -14595
  596. package/src/index.ts +0 -421
  597. package/src/modules/agent.ts +0 -319
  598. package/src/modules/attestation.ts +0 -168
  599. package/src/modules/base.ts +0 -247
  600. package/src/modules/escrow-v2.ts +0 -871
  601. package/src/modules/escrow.ts +0 -439
  602. package/src/modules/feedback.ts +0 -186
  603. package/src/modules/index.ts +0 -28
  604. package/src/modules/indexing.ts +0 -444
  605. package/src/modules/ledger.ts +0 -262
  606. package/src/modules/receipt.ts +0 -212
  607. package/src/modules/staking.ts +0 -223
  608. package/src/modules/subscription.ts +0 -147
  609. package/src/modules/tools.ts +0 -454
  610. package/src/modules/vault.ts +0 -558
  611. package/src/parser/client.ts +0 -211
  612. package/src/parser/complete.ts +0 -232
  613. package/src/parser/index.ts +0 -71
  614. package/src/parser/inner.ts +0 -255
  615. package/src/parser/instructions.ts +0 -135
  616. package/src/parser/transaction.ts +0 -200
  617. package/src/parser/types.ts +0 -182
  618. package/src/pda/index.ts +0 -919
  619. package/src/plugin/index.ts +0 -1224
  620. package/src/plugin/protocols.ts +0 -404
  621. package/src/plugin/schemas.ts +0 -941
  622. package/src/postgres/adapter.ts +0 -904
  623. package/src/postgres/index.ts +0 -59
  624. package/src/postgres/schema.sql +0 -683
  625. package/src/postgres/serializers.ts +0 -485
  626. package/src/postgres/sync.ts +0 -340
  627. package/src/postgres/types.ts +0 -245
  628. package/src/registries/builder.ts +0 -607
  629. package/src/registries/discovery.ts +0 -572
  630. package/src/registries/fairscale.ts +0 -1278
  631. package/src/registries/index.ts +0 -143
  632. package/src/registries/metaplex-bridge.ts +0 -1199
  633. package/src/registries/session.ts +0 -613
  634. package/src/registries/x402.ts +0 -1048
  635. package/src/types/accounts.ts +0 -858
  636. package/src/types/common.ts +0 -187
  637. package/src/types/endpoint.ts +0 -181
  638. package/src/types/enums.ts +0 -333
  639. package/src/types/index.ts +0 -121
  640. package/src/types/instructions.ts +0 -453
  641. package/src/utils/anchor-errors.ts +0 -461
  642. package/src/utils/endpoint-validator.ts +0 -300
  643. package/src/utils/escrow-validation.ts +0 -301
  644. package/src/utils/hash.ts +0 -113
  645. package/src/utils/index.ts +0 -118
  646. package/src/utils/merchant-validator.ts +0 -359
  647. package/src/utils/network-normalizer.ts +0 -240
  648. package/src/utils/priority-fee.ts +0 -325
  649. package/src/utils/rpc-strategy.ts +0 -322
  650. package/src/utils/schemas.ts +0 -359
  651. package/src/utils/serialization.ts +0 -98
  652. package/src/utils/validation.ts +0 -36
  653. package/src/utils/volume-curve.ts +0 -131
  654. package/src/utils/x402-direct.ts +0 -370
@@ -1,177 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module parser/complete
4
- * @description Full SAP transaction parser: instructions + args + accounts + events.
5
- *
6
- * This is "Case 2 Complete": given a raw transaction response, produce a
7
- * single {@link ParsedSapTransaction} containing every decoded instruction,
8
- * all inner (CPI) calls, and all SAP events extracted from the logs.
9
- *
10
- * Designed for indexer pipelines where the decode step must be pure,
11
- * deterministic, and fully testable without an RPC connection.
12
- *
13
- * @category Parser
14
- * @since v0.5.0
15
- *
16
- * @example
17
- * ```ts
18
- * import { parseSapTransactionComplete } from "@synapse-sap/sdk/parser";
19
- * import { SAP_PROGRAM_ID, SAP_IDL } from "@synapse-sap/sdk";
20
- * import { Program } from "\@coral-xyz/anchor";
21
- *
22
- * const program = new Program(SAP_IDL, provider);
23
- * const tx = await connection.getTransaction(sig, {
24
- * commitment: "confirmed",
25
- * maxSupportedTransactionVersion: 0,
26
- * });
27
- *
28
- * const parsed = parseSapTransactionComplete(tx, program, SAP_PROGRAM_ID);
29
- * console.log(parsed.instructions.map(i => i.name));
30
- * console.log(parsed.events.map(e => e.name));
31
- * ```
32
- */
33
- Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.parseSapTransactionComplete = parseSapTransactionComplete;
35
- exports.parseSapTransactionBatch = parseSapTransactionBatch;
36
- const events_1 = require("../events");
37
- const transaction_1 = require("./transaction");
38
- const inner_1 = require("./inner");
39
- // ================================================================
40
- // Public API
41
- // ================================================================
42
- /**
43
- * Parse a complete SAP transaction into a unified result.
44
- *
45
- * Combines three stages:
46
- * 1. **Instruction decode** - top-level SAP instructions with args and accounts
47
- * 2. **Inner instruction decode** - CPI calls with full account reconstruction
48
- * 3. **Event extraction** - SAP events decoded from the transaction logs
49
- *
50
- * All three stages are safe: malformed data produces `null` fields
51
- * rather than exceptions. This makes the function suitable for
52
- * batch-processing in indexer workers where a single bad transaction
53
- * must not halt the pipeline.
54
- *
55
- * @param tx - The raw transaction response from `connection.getTransaction`.
56
- * @param program - An Anchor `Program` instance built from the SAP IDL.
57
- * The coder and program ID are extracted automatically.
58
- * @param sapProgramId - The SAP program public key. Passed explicitly so
59
- * callers can target devnet/localnet deployments independently.
60
- * @param options - Optional filters for instructions, events, and inner calls.
61
- * @param addressLookupTables - Resolved lookup table accounts for v0 transactions.
62
- * @returns A fully parsed transaction, or `null` if the input is `null`/`undefined`.
63
- *
64
- * @category Parser
65
- * @since v0.5.0
66
- */
67
- function parseSapTransactionComplete(tx,
68
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
- program, sapProgramId, options, addressLookupTables) {
70
- if (!tx)
71
- return null;
72
- const opts = {
73
- includeInner: options?.includeInner ?? false,
74
- includeEvents: options?.includeEvents ?? true,
75
- instructionFilter: options?.instructionFilter ?? [],
76
- eventFilter: options?.eventFilter ?? [],
77
- };
78
- // Extract coder from the program
79
- const coder = program.coder.instruction;
80
- // 1. Top-level instructions
81
- let instructions = (0, transaction_1.parseSapInstructionsFromTransaction)(tx, coder, sapProgramId, addressLookupTables);
82
- if (opts.instructionFilter.length > 0) {
83
- const filterSet = new Set(opts.instructionFilter);
84
- instructions = instructions.filter((ix) => filterSet.has(ix.name));
85
- }
86
- // 2. Inner (CPI) instructions
87
- let innerInstructions = [];
88
- if (opts.includeInner && tx.meta?.innerInstructions) {
89
- const accountKeys = (0, inner_1.extractAccountKeys)(tx);
90
- innerInstructions = (0, inner_1.decodeInnerInstructions)(tx.meta.innerInstructions, accountKeys, coder, sapProgramId);
91
- }
92
- // 3. Events from logs
93
- let events = [];
94
- const logs = tx.meta?.logMessages ?? [];
95
- if (opts.includeEvents && logs.length > 0) {
96
- const eventParser = new events_1.EventParser(program);
97
- events = eventParser.parseLogs(logs);
98
- if (opts.eventFilter.length > 0) {
99
- const filterSet = new Set(opts.eventFilter);
100
- events = events.filter((e) => filterSet.has(e.name));
101
- }
102
- }
103
- // 4. Metadata
104
- const signature = extractSignature(tx);
105
- const slot = tx.slot ?? null;
106
- const blockTime = tx.blockTime ?? null;
107
- const success = tx.meta?.err === null || tx.meta?.err === undefined;
108
- return {
109
- signature,
110
- slot,
111
- blockTime,
112
- success,
113
- instructions,
114
- innerInstructions,
115
- events,
116
- logs,
117
- };
118
- }
119
- /**
120
- * Parse multiple transactions in batch.
121
- *
122
- * Convenience wrapper for indexer pipelines that process pages of
123
- * transactions. Skips `null` entries and failed decodes silently.
124
- *
125
- * @param txs - Array of transaction responses (may contain `null` entries).
126
- * @param program - The Anchor SAP program instance.
127
- * @param sapProgramId - The SAP program public key.
128
- * @param options - Optional parse filters applied to every transaction.
129
- * @param addressLookupTables - Lookup tables for v0 transactions.
130
- * @returns An array of non-null parsed transactions.
131
- *
132
- * @category Parser
133
- * @since v0.5.0
134
- *
135
- * @example
136
- * ```ts
137
- * const signatures = await connection.getSignaturesForAddress(agentPda);
138
- * const txs = await Promise.all(
139
- * signatures.map(s => connection.getTransaction(s.signature, { ... }))
140
- * );
141
- * const parsed = parseSapTransactionBatch(txs, program, SAP_PROGRAM_ID, {
142
- * includeEvents: true,
143
- * includeInner: true,
144
- * });
145
- * ```
146
- */
147
- function parseSapTransactionBatch(txs,
148
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
149
- program, sapProgramId, options, addressLookupTables) {
150
- const results = [];
151
- for (const tx of txs) {
152
- const parsed = parseSapTransactionComplete(tx, program, sapProgramId, options, addressLookupTables);
153
- if (parsed)
154
- results.push(parsed);
155
- }
156
- return results;
157
- }
158
- // ================================================================
159
- // Internal
160
- // ================================================================
161
- /**
162
- * Extract the transaction signature from the response.
163
- * Different RPC clients expose it in different locations.
164
- *
165
- * @internal
166
- */
167
- function extractSignature(tx) {
168
- // Some clients expose signatures on the transaction object
169
- const txObj = tx.transaction;
170
- if ("signatures" in txObj && Array.isArray(txObj.signatures) && txObj.signatures.length > 0) {
171
- const first = txObj.signatures[0];
172
- if (typeof first === "string")
173
- return first;
174
- }
175
- return null;
176
- }
177
- //# sourceMappingURL=complete.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"complete.js","sourceRoot":"","sources":["../../../src/parser/complete.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;AAsDH,kEA2EC;AA8BD,4DAoBC;AAlKD,sCAAwC;AACxC,+CAAoE;AACpE,mCAIiB;AAEjB,mEAAmE;AACnE,cAAc;AACd,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,2BAA2B,CACzC,EAAyE;AACzE,8DAA8D;AAC9D,OAAqB,EACrB,YAAuB,EACvB,OAA4B,EAC5B,mBAAiD;IAEjD,IAAI,CAAC,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pB,CAAC;QACF,IAAI,MAAM;YAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,mEAAmE;AACnE,YAAY;AACZ,mEAAmE;AAEnE;;;;;GAKG;AACH,SAAS,gBAAgB,CACvB,EAAsD;IAEtD,2DAA2D;IAC3D,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC;IAC7B,IAAI,YAAY,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5F,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAClC,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;IAC9C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module parser
4
- * @description Transaction parsing utilities for SAP v2.
5
- *
6
- * Provides modular, composable functions for decoding on-chain SAP
7
- * transactions into typed instruction data, argument objects, account
8
- * lists, and protocol events.
9
- *
10
- * Three levels of parsing are available depending on your use case:
11
- *
12
- * | Function | Input | Output |
13
- * |----------|-------|--------|
14
- * | `parseSapInstructionsFromTransaction` | `TransactionResponse` (RPC) | Decoded instructions |
15
- * | `parseSapInstructionsFromList` | `TransactionInstruction[]` | Decoded instructions |
16
- * | `parseSapTransactionComplete` | `TransactionResponse` (RPC) | Instructions + events + inner calls |
17
- *
18
- * All functions are pure and stateless: they accept the Anchor coder
19
- * (or full Program) as a parameter, making them safe for server-side
20
- * indexer workers, edge functions (Node.js runtime), and test suites.
21
- *
22
- * @category Parser
23
- * @since v0.5.0
24
- *
25
- * @example
26
- * ```ts
27
- * import {
28
- * parseSapTransactionComplete,
29
- * parseSapInstructionsFromList,
30
- * containsSapInstruction,
31
- * } from "@synapse-sap/sdk/parser";
32
- * ```
33
- */
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.TransactionParser = exports.extractAccountKeys = exports.filterSapInnerInstructions = exports.decodeInnerInstructions = exports.parseSapTransactionBatch = exports.parseSapTransactionComplete = exports.containsSapInstruction = exports.parseSapInstructionNamesFromList = exports.parseSapInstructionsFromList = exports.parseSapInstructionNamesFromTransaction = exports.parseSapInstructionsFromTransaction = void 0;
36
- // ── Case 2A: from TransactionResponse ────────────────
37
- var transaction_1 = require("./transaction");
38
- Object.defineProperty(exports, "parseSapInstructionsFromTransaction", { enumerable: true, get: function () { return transaction_1.parseSapInstructionsFromTransaction; } });
39
- Object.defineProperty(exports, "parseSapInstructionNamesFromTransaction", { enumerable: true, get: function () { return transaction_1.parseSapInstructionNamesFromTransaction; } });
40
- // ── Case 2B: from TransactionInstruction[] ───────────
41
- var instructions_1 = require("./instructions");
42
- Object.defineProperty(exports, "parseSapInstructionsFromList", { enumerable: true, get: function () { return instructions_1.parseSapInstructionsFromList; } });
43
- Object.defineProperty(exports, "parseSapInstructionNamesFromList", { enumerable: true, get: function () { return instructions_1.parseSapInstructionNamesFromList; } });
44
- Object.defineProperty(exports, "containsSapInstruction", { enumerable: true, get: function () { return instructions_1.containsSapInstruction; } });
45
- // ── Case 2 Complete: instructions + events + inner ───
46
- var complete_1 = require("./complete");
47
- Object.defineProperty(exports, "parseSapTransactionComplete", { enumerable: true, get: function () { return complete_1.parseSapTransactionComplete; } });
48
- Object.defineProperty(exports, "parseSapTransactionBatch", { enumerable: true, get: function () { return complete_1.parseSapTransactionBatch; } });
49
- // ── Inner instruction utilities ──────────────────────
50
- var inner_1 = require("./inner");
51
- Object.defineProperty(exports, "decodeInnerInstructions", { enumerable: true, get: function () { return inner_1.decodeInnerInstructions; } });
52
- Object.defineProperty(exports, "filterSapInnerInstructions", { enumerable: true, get: function () { return inner_1.filterSapInnerInstructions; } });
53
- Object.defineProperty(exports, "extractAccountKeys", { enumerable: true, get: function () { return inner_1.extractAccountKeys; } });
54
- // ── OOP wrapper (for SapClient integration) ──────────
55
- var client_1 = require("./client");
56
- Object.defineProperty(exports, "TransactionParser", { enumerable: true, get: function () { return client_1.TransactionParser; } });
57
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parser/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;;AAWH,wDAAwD;AACxD,6CAGuB;AAFrB,kIAAA,mCAAmC,OAAA;AACnC,sIAAA,uCAAuC,OAAA;AAGzC,wDAAwD;AACxD,+CAIwB;AAHtB,4HAAA,4BAA4B,OAAA;AAC5B,gIAAA,gCAAgC,OAAA;AAChC,sHAAA,sBAAsB,OAAA;AAGxB,wDAAwD;AACxD,uCAGoB;AAFlB,uHAAA,2BAA2B,OAAA;AAC3B,oHAAA,wBAAwB,OAAA;AAG1B,wDAAwD;AACxD,iCAIiB;AAHf,gHAAA,uBAAuB,OAAA;AACvB,mHAAA,0BAA0B,OAAA;AAC1B,2GAAA,kBAAkB,OAAA;AAIpB,wDAAwD;AACxD,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA"}
@@ -1,185 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module parser/inner
4
- * @description Decode inner (CPI) instructions from transaction metadata.
5
- *
6
- * When a SAP instruction triggers cross-program invocations, the
7
- * resulting inner instructions appear in `tx.meta.innerInstructions`.
8
- * These are stored in a "compiled" format that references account
9
- * indices rather than full public keys.
10
- *
11
- * This module reconstructs the full account keys from the transaction
12
- * message's account list and decodes any inner calls that target the
13
- * SAP program.
14
- *
15
- * @category Parser
16
- * @since v0.5.0
17
- *
18
- * @example
19
- * ```ts
20
- * import { decodeInnerInstructions } from "@synapse-sap/sdk/parser";
21
- *
22
- * const inner = decodeInnerInstructions(
23
- * tx.meta?.innerInstructions ?? [],
24
- * accountKeys,
25
- * program.coder.instruction,
26
- * SAP_PROGRAM_ID,
27
- * );
28
- * for (const cpi of inner) {
29
- * if (cpi.name) console.log("SAP CPI:", cpi.name);
30
- * }
31
- * ```
32
- */
33
- Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.decodeInnerInstructions = decodeInnerInstructions;
35
- exports.filterSapInnerInstructions = filterSapInnerInstructions;
36
- exports.extractAccountKeys = extractAccountKeys;
37
- const web3_js_1 = require("@solana/web3.js");
38
- const anchor_1 = require("@coral-xyz/anchor");
39
- // ================================================================
40
- // Public API
41
- // ================================================================
42
- /**
43
- * Decode inner (CPI) instructions from transaction metadata.
44
- *
45
- * Reconstructs full public keys from the compiled account indices
46
- * and attempts to decode each inner instruction that targets the
47
- * SAP program. Non-SAP inner instructions are included in the
48
- * result with `name: null` and `args: null`.
49
- *
50
- * @param innerInstructionGroups - The `tx.meta.innerInstructions` array.
51
- * @param accountKeys - Ordered list of all account public keys from the
52
- * transaction message (`staticAccountKeys` for versioned, or
53
- * `accountKeys` for legacy).
54
- * @param coder - An Anchor instruction coder built from the SAP IDL.
55
- * @param sapProgramId - The SAP program public key.
56
- * @returns An array of decoded inner instructions.
57
- *
58
- * @category Parser
59
- * @since v0.5.0
60
- */
61
- function decodeInnerInstructions(innerInstructionGroups, accountKeys, coder, sapProgramId) {
62
- const results = [];
63
- for (const group of innerInstructionGroups) {
64
- for (let innerIdx = 0; innerIdx < group.instructions.length; innerIdx++) {
65
- const compiled = group.instructions[innerIdx];
66
- if (!compiled)
67
- continue;
68
- const programId = resolveAccountKey(accountKeys, compiled.programIdIndex);
69
- const accounts = compiled.accounts.map((idx) => resolveAccountKey(accountKeys, idx));
70
- let name = null;
71
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
- let args = null;
73
- if (programId.equals(sapProgramId)) {
74
- const decoded = safeDecodeInstruction(coder, compiled.data);
75
- if (decoded) {
76
- name = decoded.name;
77
- args = decoded.data;
78
- }
79
- }
80
- results.push({
81
- outerIndex: group.index,
82
- innerIndex: innerIdx,
83
- name,
84
- args,
85
- accounts,
86
- programId,
87
- });
88
- }
89
- }
90
- return results;
91
- }
92
- /**
93
- * Filter decoded inner instructions to only those targeting the SAP program.
94
- *
95
- * @param inner - The full inner instruction list from {@link decodeInnerInstructions}.
96
- * @returns Only inner instructions where `name` is not `null`.
97
- *
98
- * @category Parser
99
- * @since v0.5.0
100
- */
101
- function filterSapInnerInstructions(inner) {
102
- return inner.filter((i) => i.name !== null);
103
- }
104
- // ================================================================
105
- // Helpers: extract account keys from various tx formats
106
- // ================================================================
107
- /**
108
- * Extract the full ordered list of account keys from a transaction
109
- * response, handling both legacy and versioned formats.
110
- *
111
- * For versioned transactions that include loaded addresses (from
112
- * address lookup tables), these are appended after the static keys
113
- * in the order: static, writable loaded, readonly loaded.
114
- *
115
- * @param tx - The raw transaction response from RPC.
116
- * @returns An ordered array of all account public keys.
117
- *
118
- * @category Parser
119
- * @since v0.5.0
120
- */
121
- function extractAccountKeys(tx) {
122
- const message = tx.transaction.message;
123
- // Versioned messages expose `staticAccountKeys`
124
- if ("staticAccountKeys" in message && Array.isArray(message.staticAccountKeys)) {
125
- const staticKeys = message.staticAccountKeys.map(toPubkey);
126
- const loaded = tx.meta?.loadedAddresses;
127
- if (loaded) {
128
- return [
129
- ...staticKeys,
130
- ...loaded.writable.map(toPubkey),
131
- ...loaded.readonly.map(toPubkey),
132
- ];
133
- }
134
- return staticKeys;
135
- }
136
- // Legacy messages expose `accountKeys`
137
- if ("accountKeys" in message && Array.isArray(message.accountKeys)) {
138
- return message.accountKeys.map(toPubkey);
139
- }
140
- return [];
141
- }
142
- // ================================================================
143
- // Internal
144
- // ================================================================
145
- /**
146
- * Safely resolve an account index to a public key, returning
147
- * `PublicKey.default` for out-of-bounds indices instead of throwing.
148
- *
149
- * @internal
150
- */
151
- function resolveAccountKey(keys, index) {
152
- const key = keys[index];
153
- return key ?? web3_js_1.PublicKey.default;
154
- }
155
- /**
156
- * Coerce a value to PublicKey. Handles both string base58 and
157
- * PublicKey instances returned by different RPC client versions.
158
- *
159
- * @internal
160
- */
161
- function toPubkey(value) {
162
- if (typeof value === "string")
163
- return new web3_js_1.PublicKey(value);
164
- return value;
165
- }
166
- /**
167
- * @internal
168
- */
169
- function safeDecodeInstruction(coder, data) {
170
- try {
171
- // Inner instruction data from RPC is base58-encoded
172
- const buffer = Buffer.from(anchor_1.utils.bytes.bs58.decode(data));
173
- return coder.decode(buffer);
174
- }
175
- catch {
176
- // Fallback: try base64 encoding (some RPC responses use base64)
177
- try {
178
- return coder.decode(Buffer.from(data, "base64"));
179
- }
180
- catch {
181
- return null;
182
- }
183
- }
184
- }
185
- //# sourceMappingURL=inner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inner.js","sourceRoot":"","sources":["../../../src/parser/inner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;AA4DH,0DA6CC;AAWD,gEAIC;AAoBD,gDAoCC;AA9KD,6CAA4C;AAC5C,8CAA0C;AAkC1C,mEAAmE;AACnE,cAAc;AACd,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,uBAAuB,CACrC,sBAA+C,EAC/C,WAAwB,EACxB,KAA0B,EAC1B,YAAuB;IAEvB,MAAM,OAAO,GAA8B,EAAE,CAAC;IAE9C,KAAK,MAAM,KAAK,IAAI,sBAAsB,EAAE,CAAC;QAC3C,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC;YACxE,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ;gBAAE,SAAS;YAExB,MAAM,SAAS,GAAG,iBAAiB,CACjC,WAAW,EACX,QAAQ,CAAC,cAAc,CACxB,CAAC;YACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG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AAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;QACnD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,114 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module parser/instructions
4
- * @description Decode SAP instruction names from a pre-built `TransactionInstruction[]`.
5
- *
6
- * This is "Case 2B": you already have the decompiled instruction list
7
- * (for example, from a UI that constructs instructions before sending)
8
- * and want to identify which ones target the SAP program.
9
- *
10
- * @category Parser
11
- * @since v0.5.0
12
- *
13
- * @example
14
- * ```ts
15
- * import { parseSapInstructionsFromList } from "@synapse-sap/sdk/parser";
16
- * import { SAP_PROGRAM_ID } from "@synapse-sap/sdk";
17
- *
18
- * const decoded = parseSapInstructionsFromList(
19
- * instructions,
20
- * program.coder.instruction,
21
- * SAP_PROGRAM_ID,
22
- * );
23
- * for (const ix of decoded) {
24
- * console.log(ix.name, ix.args);
25
- * }
26
- * ```
27
- */
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.parseSapInstructionsFromList = parseSapInstructionsFromList;
30
- exports.parseSapInstructionNamesFromList = parseSapInstructionNamesFromList;
31
- exports.containsSapInstruction = containsSapInstruction;
32
- // ================================================================
33
- // Public API
34
- // ================================================================
35
- /**
36
- * Decode an array of `TransactionInstruction` and return only the
37
- * SAP instructions with their decoded names and arguments.
38
- *
39
- * Non-SAP instructions (system, token, other programs) are silently
40
- * skipped. Instructions whose data cannot be decoded against the IDL
41
- * are still included with `name: "unknown"` and `args: null` so that
42
- * consumers can detect IDL mismatches or unsupported instruction
43
- * variants.
44
- *
45
- * @param instructions - The instruction array to inspect.
46
- * @param coder - An Anchor instruction coder built from the SAP IDL.
47
- * @param sapProgramId - The SAP program public key to filter by.
48
- * @returns An array of decoded SAP instructions.
49
- *
50
- * @category Parser
51
- * @since v0.5.0
52
- */
53
- function parseSapInstructionsFromList(instructions, coder, sapProgramId) {
54
- const results = [];
55
- for (const ix of instructions) {
56
- if (!ix.programId.equals(sapProgramId))
57
- continue;
58
- const decoded = safeDecodeInstruction(coder, ix.data);
59
- results.push({
60
- name: decoded?.name ?? "unknown",
61
- args: decoded?.data ?? null,
62
- accounts: ix.keys.map((k) => k.pubkey),
63
- raw: ix,
64
- });
65
- }
66
- return results;
67
- }
68
- /**
69
- * Return only the instruction names for SAP instructions in the list.
70
- *
71
- * Convenience wrapper over {@link parseSapInstructionsFromList} for
72
- * callers that only need the string names.
73
- *
74
- * @param instructions - The instruction array to inspect.
75
- * @param coder - An Anchor instruction coder for the SAP IDL.
76
- * @param sapProgramId - The SAP program public key.
77
- * @returns An array of instruction name strings.
78
- *
79
- * @category Parser
80
- * @since v0.5.0
81
- */
82
- function parseSapInstructionNamesFromList(instructions, coder, sapProgramId) {
83
- return parseSapInstructionsFromList(instructions, coder, sapProgramId).map((ix) => ix.name);
84
- }
85
- /**
86
- * Check whether any instruction in the list targets the SAP program.
87
- *
88
- * Useful as a fast pre-filter before committing to a full decode pass.
89
- *
90
- * @param instructions - The instruction array to inspect.
91
- * @param sapProgramId - The SAP program public key.
92
- * @returns `true` if at least one instruction targets the SAP program.
93
- *
94
- * @category Parser
95
- * @since v0.5.0
96
- */
97
- function containsSapInstruction(instructions, sapProgramId) {
98
- return instructions.some((ix) => ix.programId.equals(sapProgramId));
99
- }
100
- // ================================================================
101
- // Internal
102
- // ================================================================
103
- /**
104
- * @internal
105
- */
106
- function safeDecodeInstruction(coder, data) {
107
- try {
108
- return coder.decode(Buffer.from(data));
109
- }
110
- catch {
111
- return null;
112
- }
113
- }
114
- //# sourceMappingURL=instructions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/parser/instructions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;AA2BH,oEAoBC;AAgBD,4EAQC;AAcD,wDAKC;AArFD,mEAAm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