@bosonprotocol/core-sdk 1.44.0-alpha.0 → 1.44.0-alpha.1

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 (302) hide show
  1. package/dist/cjs/accounts/handler.d.ts +115 -1
  2. package/dist/cjs/accounts/handler.d.ts.map +1 -1
  3. package/dist/cjs/accounts/handler.js +126 -28
  4. package/dist/cjs/accounts/handler.js.map +1 -1
  5. package/dist/cjs/accounts/mixin.d.ts +105 -8
  6. package/dist/cjs/accounts/mixin.d.ts.map +1 -1
  7. package/dist/cjs/accounts/mixin.js +162 -122
  8. package/dist/cjs/accounts/mixin.js.map +1 -1
  9. package/dist/cjs/core-sdk.d.ts +6 -6
  10. package/dist/cjs/core-sdk.d.ts.map +1 -1
  11. package/dist/cjs/core-sdk.js.map +1 -1
  12. package/dist/cjs/disputes/handler.d.ts +77 -1
  13. package/dist/cjs/disputes/handler.d.ts.map +1 -1
  14. package/dist/cjs/disputes/handler.js +90 -20
  15. package/dist/cjs/disputes/handler.js.map +1 -1
  16. package/dist/cjs/disputes/mixin.d.ts +29 -11
  17. package/dist/cjs/disputes/mixin.d.ts.map +1 -1
  18. package/dist/cjs/disputes/mixin.js +97 -88
  19. package/dist/cjs/disputes/mixin.js.map +1 -1
  20. package/dist/cjs/erc1155/mixin.d.ts +2 -1
  21. package/dist/cjs/erc1155/mixin.d.ts.map +1 -1
  22. package/dist/cjs/erc1155/mixin.js.map +1 -1
  23. package/dist/cjs/erc165/mixin.d.ts +2 -1
  24. package/dist/cjs/erc165/mixin.d.ts.map +1 -1
  25. package/dist/cjs/erc165/mixin.js.map +1 -1
  26. package/dist/cjs/erc20/handler.d.ts +11 -2
  27. package/dist/cjs/erc20/handler.d.ts.map +1 -1
  28. package/dist/cjs/erc20/handler.js +8 -1
  29. package/dist/cjs/erc20/handler.js.map +1 -1
  30. package/dist/cjs/erc20/mixin.d.ts +20 -3
  31. package/dist/cjs/erc20/mixin.d.ts.map +1 -1
  32. package/dist/cjs/erc20/mixin.js +15 -10
  33. package/dist/cjs/erc20/mixin.js.map +1 -1
  34. package/dist/cjs/erc721/handler.d.ts +11 -2
  35. package/dist/cjs/erc721/handler.d.ts.map +1 -1
  36. package/dist/cjs/erc721/handler.js +8 -2
  37. package/dist/cjs/erc721/handler.js.map +1 -1
  38. package/dist/cjs/erc721/mixin.d.ts +2 -1
  39. package/dist/cjs/erc721/mixin.d.ts.map +1 -1
  40. package/dist/cjs/erc721/mixin.js.map +1 -1
  41. package/dist/cjs/errors/mixin.d.ts +2 -1
  42. package/dist/cjs/errors/mixin.d.ts.map +1 -1
  43. package/dist/cjs/errors/mixin.js.map +1 -1
  44. package/dist/cjs/event-logs/mixin.d.ts +2 -1
  45. package/dist/cjs/event-logs/mixin.d.ts.map +1 -1
  46. package/dist/cjs/event-logs/mixin.js.map +1 -1
  47. package/dist/cjs/exchanges/handler.d.ts +44 -1
  48. package/dist/cjs/exchanges/handler.d.ts.map +1 -1
  49. package/dist/cjs/exchanges/handler.js +76 -17
  50. package/dist/cjs/exchanges/handler.js.map +1 -1
  51. package/dist/cjs/exchanges/mixin.d.ts +24 -8
  52. package/dist/cjs/exchanges/mixin.d.ts.map +1 -1
  53. package/dist/cjs/exchanges/mixin.js +72 -72
  54. package/dist/cjs/exchanges/mixin.js.map +1 -1
  55. package/dist/cjs/funds/handler.d.ts +27 -1
  56. package/dist/cjs/funds/handler.d.ts.map +1 -1
  57. package/dist/cjs/funds/handler.js +28 -7
  58. package/dist/cjs/funds/handler.js.map +1 -1
  59. package/dist/cjs/funds/mixin.d.ts +50 -17
  60. package/dist/cjs/funds/mixin.d.ts.map +1 -1
  61. package/dist/cjs/funds/mixin.js +48 -46
  62. package/dist/cjs/funds/mixin.js.map +1 -1
  63. package/dist/cjs/groups/handler.d.ts +8 -1
  64. package/dist/cjs/groups/handler.d.ts.map +1 -1
  65. package/dist/cjs/groups/handler.js +9 -2
  66. package/dist/cjs/groups/handler.js.map +1 -1
  67. package/dist/cjs/groups/mixin.d.ts +12 -4
  68. package/dist/cjs/groups/mixin.d.ts.map +1 -1
  69. package/dist/cjs/groups/mixin.js +10 -8
  70. package/dist/cjs/groups/mixin.js.map +1 -1
  71. package/dist/cjs/marketplaces/mixin.d.ts +2 -1
  72. package/dist/cjs/marketplaces/mixin.d.ts.map +1 -1
  73. package/dist/cjs/marketplaces/mixin.js.map +1 -1
  74. package/dist/cjs/meta-tx/handler.d.ts.map +1 -1
  75. package/dist/cjs/meta-tx/handler.js +4 -2
  76. package/dist/cjs/meta-tx/handler.js.map +1 -1
  77. package/dist/cjs/meta-tx/mixin.d.ts +2 -2
  78. package/dist/cjs/meta-tx/mixin.d.ts.map +1 -1
  79. package/dist/cjs/meta-tx/mixin.js.map +1 -1
  80. package/dist/cjs/metadata/mixin.d.ts +2 -1
  81. package/dist/cjs/metadata/mixin.d.ts.map +1 -1
  82. package/dist/cjs/metadata/mixin.js.map +1 -1
  83. package/dist/cjs/mixins/base-core-sdk.d.ts +4 -4
  84. package/dist/cjs/mixins/base-core-sdk.d.ts.map +1 -1
  85. package/dist/cjs/mixins/base-core-sdk.js.map +1 -1
  86. package/dist/cjs/native-meta-tx/handler.d.ts.map +1 -1
  87. package/dist/cjs/native-meta-tx/handler.js +2 -1
  88. package/dist/cjs/native-meta-tx/handler.js.map +1 -1
  89. package/dist/cjs/native-meta-tx/mixin.d.ts +2 -2
  90. package/dist/cjs/native-meta-tx/mixin.d.ts.map +1 -1
  91. package/dist/cjs/native-meta-tx/mixin.js.map +1 -1
  92. package/dist/cjs/offers/handler.d.ts +79 -0
  93. package/dist/cjs/offers/handler.d.ts.map +1 -1
  94. package/dist/cjs/offers/handler.js +81 -17
  95. package/dist/cjs/offers/handler.js.map +1 -1
  96. package/dist/cjs/offers/mixin.d.ts +53 -2
  97. package/dist/cjs/offers/mixin.d.ts.map +1 -1
  98. package/dist/cjs/offers/mixin.js +101 -97
  99. package/dist/cjs/offers/mixin.js.map +1 -1
  100. package/dist/cjs/orchestration/handler.d.ts +86 -1
  101. package/dist/cjs/orchestration/handler.d.ts.map +1 -1
  102. package/dist/cjs/orchestration/handler.js +64 -16
  103. package/dist/cjs/orchestration/handler.js.map +1 -1
  104. package/dist/cjs/orchestration/mixin.d.ts +2 -2
  105. package/dist/cjs/orchestration/mixin.d.ts.map +1 -1
  106. package/dist/cjs/orchestration/mixin.js.map +1 -1
  107. package/dist/cjs/price-discovery/handler.d.ts +11 -1
  108. package/dist/cjs/price-discovery/handler.d.ts.map +1 -1
  109. package/dist/cjs/price-discovery/handler.js +9 -2
  110. package/dist/cjs/price-discovery/handler.js.map +1 -1
  111. package/dist/cjs/price-discovery/mixin.d.ts +16 -4
  112. package/dist/cjs/price-discovery/mixin.d.ts.map +1 -1
  113. package/dist/cjs/price-discovery/mixin.js +14 -12
  114. package/dist/cjs/price-discovery/mixin.js.map +1 -1
  115. package/dist/cjs/protocol-config/handler.d.ts +9 -0
  116. package/dist/cjs/protocol-config/handler.d.ts.map +1 -1
  117. package/dist/cjs/protocol-config/handler.js +10 -3
  118. package/dist/cjs/protocol-config/handler.js.map +1 -1
  119. package/dist/cjs/protocol-config/mixin.d.ts +2 -1
  120. package/dist/cjs/protocol-config/mixin.d.ts.map +1 -1
  121. package/dist/cjs/protocol-config/mixin.js.map +1 -1
  122. package/dist/cjs/subgraph/mixin.d.ts +2 -2
  123. package/dist/cjs/subgraph/mixin.d.ts.map +1 -1
  124. package/dist/cjs/subgraph/mixin.js.map +1 -1
  125. package/dist/cjs/voucher/handler.d.ts +56 -1
  126. package/dist/cjs/voucher/handler.d.ts.map +1 -1
  127. package/dist/cjs/voucher/handler.js +56 -14
  128. package/dist/cjs/voucher/handler.js.map +1 -1
  129. package/dist/cjs/voucher/mixin.d.ts +66 -22
  130. package/dist/cjs/voucher/mixin.d.ts.map +1 -1
  131. package/dist/cjs/voucher/mixin.js +75 -61
  132. package/dist/cjs/voucher/mixin.js.map +1 -1
  133. package/dist/esm/accounts/handler.d.ts +115 -1
  134. package/dist/esm/accounts/handler.d.ts.map +1 -1
  135. package/dist/esm/accounts/handler.js +126 -28
  136. package/dist/esm/accounts/handler.js.map +1 -1
  137. package/dist/esm/accounts/mixin.d.ts +105 -8
  138. package/dist/esm/accounts/mixin.d.ts.map +1 -1
  139. package/dist/esm/accounts/mixin.js +249 -116
  140. package/dist/esm/accounts/mixin.js.map +1 -1
  141. package/dist/esm/core-sdk.d.ts +6 -6
  142. package/dist/esm/core-sdk.d.ts.map +1 -1
  143. package/dist/esm/core-sdk.js.map +1 -1
  144. package/dist/esm/disputes/handler.d.ts +77 -1
  145. package/dist/esm/disputes/handler.d.ts.map +1 -1
  146. package/dist/esm/disputes/handler.js +90 -20
  147. package/dist/esm/disputes/handler.js.map +1 -1
  148. package/dist/esm/disputes/mixin.d.ts +29 -11
  149. package/dist/esm/disputes/mixin.d.ts.map +1 -1
  150. package/dist/esm/disputes/mixin.js +155 -90
  151. package/dist/esm/disputes/mixin.js.map +1 -1
  152. package/dist/esm/erc1155/mixin.d.ts +2 -1
  153. package/dist/esm/erc1155/mixin.d.ts.map +1 -1
  154. package/dist/esm/erc1155/mixin.js.map +1 -1
  155. package/dist/esm/erc165/mixin.d.ts +2 -1
  156. package/dist/esm/erc165/mixin.d.ts.map +1 -1
  157. package/dist/esm/erc165/mixin.js.map +1 -1
  158. package/dist/esm/erc20/handler.d.ts +11 -2
  159. package/dist/esm/erc20/handler.d.ts.map +1 -1
  160. package/dist/esm/erc20/handler.js +9 -2
  161. package/dist/esm/erc20/handler.js.map +1 -1
  162. package/dist/esm/erc20/mixin.d.ts +20 -3
  163. package/dist/esm/erc20/mixin.d.ts.map +1 -1
  164. package/dist/esm/erc20/mixin.js +24 -8
  165. package/dist/esm/erc20/mixin.js.map +1 -1
  166. package/dist/esm/erc721/handler.d.ts +11 -2
  167. package/dist/esm/erc721/handler.d.ts.map +1 -1
  168. package/dist/esm/erc721/handler.js +8 -2
  169. package/dist/esm/erc721/handler.js.map +1 -1
  170. package/dist/esm/erc721/mixin.d.ts +2 -1
  171. package/dist/esm/erc721/mixin.d.ts.map +1 -1
  172. package/dist/esm/erc721/mixin.js.map +1 -1
  173. package/dist/esm/errors/mixin.d.ts +2 -1
  174. package/dist/esm/errors/mixin.d.ts.map +1 -1
  175. package/dist/esm/errors/mixin.js.map +1 -1
  176. package/dist/esm/event-logs/mixin.d.ts +2 -1
  177. package/dist/esm/event-logs/mixin.d.ts.map +1 -1
  178. package/dist/esm/event-logs/mixin.js.map +1 -1
  179. package/dist/esm/exchanges/handler.d.ts +44 -1
  180. package/dist/esm/exchanges/handler.d.ts.map +1 -1
  181. package/dist/esm/exchanges/handler.js +80 -16
  182. package/dist/esm/exchanges/handler.js.map +1 -1
  183. package/dist/esm/exchanges/mixin.d.ts +24 -8
  184. package/dist/esm/exchanges/mixin.d.ts.map +1 -1
  185. package/dist/esm/exchanges/mixin.js +120 -72
  186. package/dist/esm/exchanges/mixin.js.map +1 -1
  187. package/dist/esm/funds/handler.d.ts +27 -1
  188. package/dist/esm/funds/handler.d.ts.map +1 -1
  189. package/dist/esm/funds/handler.js +28 -7
  190. package/dist/esm/funds/handler.js.map +1 -1
  191. package/dist/esm/funds/mixin.d.ts +50 -17
  192. package/dist/esm/funds/mixin.d.ts.map +1 -1
  193. package/dist/esm/funds/mixin.js +62 -42
  194. package/dist/esm/funds/mixin.js.map +1 -1
  195. package/dist/esm/groups/handler.d.ts +8 -1
  196. package/dist/esm/groups/handler.d.ts.map +1 -1
  197. package/dist/esm/groups/handler.js +9 -2
  198. package/dist/esm/groups/handler.js.map +1 -1
  199. package/dist/esm/groups/mixin.d.ts +12 -4
  200. package/dist/esm/groups/mixin.d.ts.map +1 -1
  201. package/dist/esm/groups/mixin.js +16 -8
  202. package/dist/esm/groups/mixin.js.map +1 -1
  203. package/dist/esm/marketplaces/mixin.d.ts +2 -1
  204. package/dist/esm/marketplaces/mixin.d.ts.map +1 -1
  205. package/dist/esm/marketplaces/mixin.js.map +1 -1
  206. package/dist/esm/meta-tx/handler.d.ts.map +1 -1
  207. package/dist/esm/meta-tx/handler.js +4 -2
  208. package/dist/esm/meta-tx/handler.js.map +1 -1
  209. package/dist/esm/meta-tx/mixin.d.ts +2 -2
  210. package/dist/esm/meta-tx/mixin.d.ts.map +1 -1
  211. package/dist/esm/meta-tx/mixin.js.map +1 -1
  212. package/dist/esm/metadata/mixin.d.ts +2 -1
  213. package/dist/esm/metadata/mixin.d.ts.map +1 -1
  214. package/dist/esm/metadata/mixin.js.map +1 -1
  215. package/dist/esm/mixins/base-core-sdk.d.ts +4 -4
  216. package/dist/esm/mixins/base-core-sdk.d.ts.map +1 -1
  217. package/dist/esm/mixins/base-core-sdk.js.map +1 -1
  218. package/dist/esm/native-meta-tx/handler.d.ts.map +1 -1
  219. package/dist/esm/native-meta-tx/handler.js +2 -1
  220. package/dist/esm/native-meta-tx/handler.js.map +1 -1
  221. package/dist/esm/native-meta-tx/mixin.d.ts +2 -2
  222. package/dist/esm/native-meta-tx/mixin.d.ts.map +1 -1
  223. package/dist/esm/native-meta-tx/mixin.js.map +1 -1
  224. package/dist/esm/offers/handler.d.ts +79 -0
  225. package/dist/esm/offers/handler.d.ts.map +1 -1
  226. package/dist/esm/offers/handler.js +82 -18
  227. package/dist/esm/offers/handler.js.map +1 -1
  228. package/dist/esm/offers/mixin.d.ts +53 -2
  229. package/dist/esm/offers/mixin.d.ts.map +1 -1
  230. package/dist/esm/offers/mixin.js +161 -97
  231. package/dist/esm/offers/mixin.js.map +1 -1
  232. package/dist/esm/orchestration/handler.d.ts +86 -1
  233. package/dist/esm/orchestration/handler.d.ts.map +1 -1
  234. package/dist/esm/orchestration/handler.js +64 -16
  235. package/dist/esm/orchestration/handler.js.map +1 -1
  236. package/dist/esm/orchestration/mixin.d.ts +2 -2
  237. package/dist/esm/orchestration/mixin.d.ts.map +1 -1
  238. package/dist/esm/orchestration/mixin.js.map +1 -1
  239. package/dist/esm/price-discovery/handler.d.ts +11 -1
  240. package/dist/esm/price-discovery/handler.d.ts.map +1 -1
  241. package/dist/esm/price-discovery/handler.js +9 -2
  242. package/dist/esm/price-discovery/handler.js.map +1 -1
  243. package/dist/esm/price-discovery/mixin.d.ts +16 -4
  244. package/dist/esm/price-discovery/mixin.d.ts.map +1 -1
  245. package/dist/esm/price-discovery/mixin.js +19 -11
  246. package/dist/esm/price-discovery/mixin.js.map +1 -1
  247. package/dist/esm/protocol-config/handler.d.ts +9 -0
  248. package/dist/esm/protocol-config/handler.d.ts.map +1 -1
  249. package/dist/esm/protocol-config/handler.js +10 -3
  250. package/dist/esm/protocol-config/handler.js.map +1 -1
  251. package/dist/esm/protocol-config/mixin.d.ts +2 -1
  252. package/dist/esm/protocol-config/mixin.d.ts.map +1 -1
  253. package/dist/esm/protocol-config/mixin.js.map +1 -1
  254. package/dist/esm/subgraph/mixin.d.ts +2 -2
  255. package/dist/esm/subgraph/mixin.d.ts.map +1 -1
  256. package/dist/esm/subgraph/mixin.js.map +1 -1
  257. package/dist/esm/voucher/handler.d.ts +56 -1
  258. package/dist/esm/voucher/handler.d.ts.map +1 -1
  259. package/dist/esm/voucher/handler.js +56 -14
  260. package/dist/esm/voucher/handler.js.map +1 -1
  261. package/dist/esm/voucher/mixin.d.ts +66 -22
  262. package/dist/esm/voucher/mixin.d.ts.map +1 -1
  263. package/dist/esm/voucher/mixin.js +93 -55
  264. package/dist/esm/voucher/mixin.js.map +1 -1
  265. package/package.json +3 -3
  266. package/src/accounts/handler.ts +369 -42
  267. package/src/accounts/mixin.ts +644 -57
  268. package/src/core-sdk.ts +26 -26
  269. package/src/disputes/handler.ts +257 -31
  270. package/src/disputes/mixin.ts +273 -42
  271. package/src/erc1155/mixin.ts +2 -1
  272. package/src/erc165/mixin.ts +2 -1
  273. package/src/erc20/handler.ts +36 -4
  274. package/src/erc20/mixin.ts +77 -10
  275. package/src/erc721/handler.ts +34 -4
  276. package/src/erc721/mixin.ts +2 -1
  277. package/src/errors/mixin.ts +2 -2
  278. package/src/event-logs/mixin.ts +2 -1
  279. package/src/exchanges/handler.ts +235 -25
  280. package/src/exchanges/mixin.ts +223 -32
  281. package/src/funds/handler.ts +99 -13
  282. package/src/funds/mixin.ts +177 -39
  283. package/src/groups/handler.ts +28 -3
  284. package/src/groups/mixin.ts +50 -7
  285. package/src/marketplaces/mixin.ts +2 -1
  286. package/src/meta-tx/handler.ts +4 -2
  287. package/src/meta-tx/mixin.ts +3 -2
  288. package/src/metadata/mixin.ts +2 -1
  289. package/src/mixins/base-core-sdk.ts +5 -5
  290. package/src/native-meta-tx/handler.ts +2 -1
  291. package/src/native-meta-tx/mixin.ts +8 -2
  292. package/src/offers/handler.ts +276 -27
  293. package/src/offers/mixin.ts +398 -35
  294. package/src/orchestration/handler.ts +259 -24
  295. package/src/orchestration/mixin.ts +8 -2
  296. package/src/price-discovery/handler.ts +35 -4
  297. package/src/price-discovery/mixin.ts +60 -9
  298. package/src/protocol-config/handler.ts +26 -4
  299. package/src/protocol-config/mixin.ts +4 -1
  300. package/src/subgraph/mixin.ts +6 -2
  301. package/src/voucher/handler.ts +192 -22
  302. package/src/voucher/mixin.ts +244 -66
@@ -1,6 +1,10 @@
1
1
  import { BaseCoreSDK } from "./../mixins/base-core-sdk";
2
2
  import * as subgraph from "../subgraph";
3
- import { TransactionResponse } from "@bosonprotocol/common";
3
+ import {
4
+ TransactionResponse,
5
+ TransactionRequest,
6
+ Web3LibAdapter
7
+ } from "@bosonprotocol/common";
4
8
  import { BigNumberish } from "@ethersproject/bignumber";
5
9
  import { BytesLike } from "@ethersproject/bytes";
6
10
  import {
@@ -22,7 +26,7 @@ import {
22
26
  getDisputes
23
27
  } from "./subgraph";
24
28
 
25
- export class DisputesMixin extends BaseCoreSDK {
29
+ export class DisputesMixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
26
30
  /* -------------------------------------------------------------------------- */
27
31
  /* Dispute related methods */
28
32
  /* -------------------------------------------------------------------------- */
@@ -57,13 +61,34 @@ export class DisputesMixin extends BaseCoreSDK {
57
61
  * @returns Transaction response.
58
62
  */
59
63
  public async raiseDispute(
60
- exchangeId: BigNumberish
61
- ): Promise<TransactionResponse> {
62
- return raiseDispute({
64
+ exchangeId: BigNumberish,
65
+ returnTxInfo: true
66
+ ): Promise<TransactionRequest>;
67
+ public async raiseDispute(
68
+ exchangeId: BigNumberish,
69
+ returnTxInfo?: false | undefined
70
+ ): Promise<TransactionResponse>;
71
+ public async raiseDispute(
72
+ exchangeId: BigNumberish,
73
+ returnTxInfo?: boolean
74
+ ): Promise<TransactionResponse | TransactionRequest> {
75
+ const raiseArgs = {
63
76
  exchangeId,
64
77
  contractAddress: this._protocolDiamond,
65
78
  web3Lib: this._web3Lib
66
- });
79
+ } as const satisfies Parameters<typeof raiseDispute>[0];
80
+
81
+ if (returnTxInfo === true) {
82
+ return raiseDispute({
83
+ ...raiseArgs,
84
+ returnTxInfo: true
85
+ });
86
+ } else {
87
+ return raiseDispute({
88
+ ...raiseArgs,
89
+ returnTxInfo: false
90
+ });
91
+ }
67
92
  }
68
93
 
69
94
  /**
@@ -72,13 +97,34 @@ export class DisputesMixin extends BaseCoreSDK {
72
97
  * @returns Transaction response.
73
98
  */
74
99
  public async retractDispute(
75
- exchangeId: BigNumberish
76
- ): Promise<TransactionResponse> {
77
- return retractDispute({
100
+ exchangeId: BigNumberish,
101
+ returnTxInfo: true
102
+ ): Promise<TransactionRequest>;
103
+ public async retractDispute(
104
+ exchangeId: BigNumberish,
105
+ returnTxInfo?: false | undefined
106
+ ): Promise<TransactionResponse>;
107
+ public async retractDispute(
108
+ exchangeId: BigNumberish,
109
+ returnTxInfo?: boolean
110
+ ): Promise<TransactionResponse | TransactionRequest> {
111
+ const retractArgs = {
78
112
  exchangeId,
79
113
  contractAddress: this._protocolDiamond,
80
114
  web3Lib: this._web3Lib
81
- });
115
+ } as const satisfies Parameters<typeof retractDispute>[0];
116
+
117
+ if (returnTxInfo === true) {
118
+ return retractDispute({
119
+ ...retractArgs,
120
+ returnTxInfo: true
121
+ });
122
+ } else {
123
+ return retractDispute({
124
+ ...retractArgs,
125
+ returnTxInfo: false
126
+ });
127
+ }
82
128
  }
83
129
 
84
130
  /**
@@ -89,14 +135,37 @@ export class DisputesMixin extends BaseCoreSDK {
89
135
  */
90
136
  public async extendDisputeTimeout(
91
137
  exchangeId: BigNumberish,
92
- newDisputeTimeout: BigNumberish
93
- ): Promise<TransactionResponse> {
94
- return extendDisputeTimeout({
138
+ newDisputeTimeout: BigNumberish,
139
+ returnTxInfo: true
140
+ ): Promise<TransactionRequest>;
141
+ public async extendDisputeTimeout(
142
+ exchangeId: BigNumberish,
143
+ newDisputeTimeout: BigNumberish,
144
+ returnTxInfo?: false | undefined
145
+ ): Promise<TransactionResponse>;
146
+ public async extendDisputeTimeout(
147
+ exchangeId: BigNumberish,
148
+ newDisputeTimeout: BigNumberish,
149
+ returnTxInfo?: boolean
150
+ ): Promise<TransactionResponse | TransactionRequest> {
151
+ const extendArgs = {
95
152
  exchangeId,
96
153
  newDisputeTimeout,
97
154
  contractAddress: this._protocolDiamond,
98
155
  web3Lib: this._web3Lib
99
- });
156
+ } as const satisfies Parameters<typeof extendDisputeTimeout>[0];
157
+
158
+ if (returnTxInfo === true) {
159
+ return extendDisputeTimeout({
160
+ ...extendArgs,
161
+ returnTxInfo: true
162
+ });
163
+ } else {
164
+ return extendDisputeTimeout({
165
+ ...extendArgs,
166
+ returnTxInfo: false
167
+ });
168
+ }
100
169
  }
101
170
 
102
171
  /**
@@ -105,13 +174,34 @@ export class DisputesMixin extends BaseCoreSDK {
105
174
  * @returns Transaction response.
106
175
  */
107
176
  public async expireDispute(
108
- exchangeId: BigNumberish
109
- ): Promise<TransactionResponse> {
110
- return expireDispute({
177
+ exchangeId: BigNumberish,
178
+ returnTxInfo: true
179
+ ): Promise<TransactionRequest>;
180
+ public async expireDispute(
181
+ exchangeId: BigNumberish,
182
+ returnTxInfo?: false | undefined
183
+ ): Promise<TransactionResponse>;
184
+ public async expireDispute(
185
+ exchangeId: BigNumberish,
186
+ returnTxInfo?: boolean
187
+ ): Promise<TransactionResponse | TransactionRequest> {
188
+ const expireArgs = {
111
189
  exchangeId,
112
190
  contractAddress: this._protocolDiamond,
113
191
  web3Lib: this._web3Lib
114
- });
192
+ } as const satisfies Parameters<typeof expireDispute>[0];
193
+
194
+ if (returnTxInfo === true) {
195
+ return expireDispute({
196
+ ...expireArgs,
197
+ returnTxInfo: true
198
+ });
199
+ } else {
200
+ return expireDispute({
201
+ ...expireArgs,
202
+ returnTxInfo: false
203
+ });
204
+ }
115
205
  }
116
206
 
117
207
  /**
@@ -120,13 +210,34 @@ export class DisputesMixin extends BaseCoreSDK {
120
210
  * @returns Transaction response.
121
211
  */
122
212
  public async expireDisputeBatch(
123
- exchangeIds: BigNumberish[]
124
- ): Promise<TransactionResponse> {
125
- return expireDisputeBatch({
213
+ exchangeIds: BigNumberish[],
214
+ returnTxInfo: true
215
+ ): Promise<TransactionRequest>;
216
+ public async expireDisputeBatch(
217
+ exchangeIds: BigNumberish[],
218
+ returnTxInfo?: false | undefined
219
+ ): Promise<TransactionResponse>;
220
+ public async expireDisputeBatch(
221
+ exchangeIds: BigNumberish[],
222
+ returnTxInfo?: boolean
223
+ ): Promise<TransactionResponse | TransactionRequest> {
224
+ const batchArgs = {
126
225
  exchangeIds,
127
226
  contractAddress: this._protocolDiamond,
128
227
  web3Lib: this._web3Lib
129
- });
228
+ } as const satisfies Parameters<typeof expireDisputeBatch>[0];
229
+
230
+ if (returnTxInfo === true) {
231
+ return expireDisputeBatch({
232
+ ...batchArgs,
233
+ returnTxInfo: true
234
+ });
235
+ } else {
236
+ return expireDisputeBatch({
237
+ ...batchArgs,
238
+ returnTxInfo: false
239
+ });
240
+ }
130
241
  }
131
242
 
132
243
  /**
@@ -148,12 +259,46 @@ export class DisputesMixin extends BaseCoreSDK {
148
259
  sigR: BytesLike;
149
260
  sigS: BytesLike;
150
261
  sigV: BigNumberish;
151
- }): Promise<TransactionResponse> {
152
- return resolveDispute({
153
- ...args,
262
+ returnTxInfo: true;
263
+ }): Promise<TransactionRequest>;
264
+ public async resolveDispute(args: {
265
+ exchangeId: BigNumberish;
266
+ buyerPercentBasisPoints: BigNumberish;
267
+ sigR: BytesLike;
268
+ sigS: BytesLike;
269
+ sigV: BigNumberish;
270
+ returnTxInfo?: false | undefined;
271
+ }): Promise<TransactionResponse>;
272
+ public async resolveDispute(args: {
273
+ exchangeId: BigNumberish;
274
+ buyerPercentBasisPoints: BigNumberish;
275
+ sigR: BytesLike;
276
+ sigS: BytesLike;
277
+ sigV: BigNumberish;
278
+ returnTxInfo?: boolean;
279
+ }): Promise<TransactionResponse | TransactionRequest> {
280
+ const { returnTxInfo } = args;
281
+ const resolveArgs = {
282
+ exchangeId: args.exchangeId,
283
+ buyerPercentBasisPoints: args.buyerPercentBasisPoints,
284
+ sigR: args.sigR,
285
+ sigS: args.sigS,
286
+ sigV: args.sigV,
154
287
  contractAddress: this._protocolDiamond,
155
288
  web3Lib: this._web3Lib
156
- });
289
+ } as const satisfies Parameters<typeof resolveDispute>[0];
290
+
291
+ if (returnTxInfo === true) {
292
+ return resolveDispute({
293
+ ...resolveArgs,
294
+ returnTxInfo: true
295
+ });
296
+ } else {
297
+ return resolveDispute({
298
+ ...resolveArgs,
299
+ returnTxInfo: false
300
+ });
301
+ }
157
302
  }
158
303
 
159
304
  /**
@@ -162,13 +307,34 @@ export class DisputesMixin extends BaseCoreSDK {
162
307
  * @returns Transaction response.
163
308
  */
164
309
  public async escalateDispute(
165
- exchangeId: BigNumberish
166
- ): Promise<TransactionResponse> {
167
- return escalateDispute({
310
+ exchangeId: BigNumberish,
311
+ returnTxInfo: true
312
+ ): Promise<TransactionRequest>;
313
+ public async escalateDispute(
314
+ exchangeId: BigNumberish,
315
+ returnTxInfo?: false | undefined
316
+ ): Promise<TransactionResponse>;
317
+ public async escalateDispute(
318
+ exchangeId: BigNumberish,
319
+ returnTxInfo?: boolean
320
+ ): Promise<TransactionResponse | TransactionRequest> {
321
+ const escalateArgs = {
168
322
  exchangeId,
169
323
  contractAddress: this._protocolDiamond,
170
324
  web3Lib: this._web3Lib
171
- });
325
+ } as const satisfies Parameters<typeof escalateDispute>[0];
326
+
327
+ if (returnTxInfo === true) {
328
+ return escalateDispute({
329
+ ...escalateArgs,
330
+ returnTxInfo: true
331
+ });
332
+ } else {
333
+ return escalateDispute({
334
+ ...escalateArgs,
335
+ returnTxInfo: false
336
+ });
337
+ }
172
338
  }
173
339
 
174
340
  /**
@@ -179,14 +345,37 @@ export class DisputesMixin extends BaseCoreSDK {
179
345
  */
180
346
  public async decideDispute(
181
347
  exchangeId: BigNumberish,
182
- buyerPercent: BigNumberish
183
- ): Promise<TransactionResponse> {
184
- return decideDispute({
348
+ buyerPercent: BigNumberish,
349
+ returnTxInfo: true
350
+ ): Promise<TransactionRequest>;
351
+ public async decideDispute(
352
+ exchangeId: BigNumberish,
353
+ buyerPercent: BigNumberish,
354
+ returnTxInfo?: false | undefined
355
+ ): Promise<TransactionResponse>;
356
+ public async decideDispute(
357
+ exchangeId: BigNumberish,
358
+ buyerPercent: BigNumberish,
359
+ returnTxInfo?: boolean
360
+ ): Promise<TransactionResponse | TransactionRequest> {
361
+ const decideArgs = {
185
362
  exchangeId,
186
363
  buyerPercent,
187
364
  contractAddress: this._protocolDiamond,
188
365
  web3Lib: this._web3Lib
189
- });
366
+ } as const satisfies Parameters<typeof decideDispute>[0];
367
+
368
+ if (returnTxInfo === true) {
369
+ return decideDispute({
370
+ ...decideArgs,
371
+ returnTxInfo: true
372
+ });
373
+ } else {
374
+ return decideDispute({
375
+ ...decideArgs,
376
+ returnTxInfo: false
377
+ });
378
+ }
190
379
  }
191
380
 
192
381
  /**
@@ -195,13 +384,34 @@ export class DisputesMixin extends BaseCoreSDK {
195
384
  * @returns Transaction response.
196
385
  */
197
386
  public async refuseEscalatedDispute(
198
- exchangeId: BigNumberish
199
- ): Promise<TransactionResponse> {
200
- return refuseEscalatedDispute({
387
+ exchangeId: BigNumberish,
388
+ returnTxInfo: true
389
+ ): Promise<TransactionRequest>;
390
+ public async refuseEscalatedDispute(
391
+ exchangeId: BigNumberish,
392
+ returnTxInfo?: false | undefined
393
+ ): Promise<TransactionResponse>;
394
+ public async refuseEscalatedDispute(
395
+ exchangeId: BigNumberish,
396
+ returnTxInfo?: boolean
397
+ ): Promise<TransactionResponse | TransactionRequest> {
398
+ const refuseArgs = {
201
399
  exchangeId,
202
400
  contractAddress: this._protocolDiamond,
203
401
  web3Lib: this._web3Lib
204
- });
402
+ } as const satisfies Parameters<typeof refuseEscalatedDispute>[0];
403
+
404
+ if (returnTxInfo === true) {
405
+ return refuseEscalatedDispute({
406
+ ...refuseArgs,
407
+ returnTxInfo: true
408
+ });
409
+ } else {
410
+ return refuseEscalatedDispute({
411
+ ...refuseArgs,
412
+ returnTxInfo: false
413
+ });
414
+ }
205
415
  }
206
416
 
207
417
  /**
@@ -210,13 +420,34 @@ export class DisputesMixin extends BaseCoreSDK {
210
420
  * @returns Transaction response.
211
421
  */
212
422
  public async expireEscalatedDispute(
213
- exchangeId: BigNumberish
214
- ): Promise<TransactionResponse> {
215
- return expireEscalatedDispute({
423
+ exchangeId: BigNumberish,
424
+ returnTxInfo: true
425
+ ): Promise<TransactionRequest>;
426
+ public async expireEscalatedDispute(
427
+ exchangeId: BigNumberish,
428
+ returnTxInfo?: false | undefined
429
+ ): Promise<TransactionResponse>;
430
+ public async expireEscalatedDispute(
431
+ exchangeId: BigNumberish,
432
+ returnTxInfo?: boolean
433
+ ): Promise<TransactionResponse | TransactionRequest> {
434
+ const expireEscalatedArgs = {
216
435
  exchangeId,
217
436
  contractAddress: this._protocolDiamond,
218
437
  web3Lib: this._web3Lib
219
- });
438
+ } as const satisfies Parameters<typeof expireEscalatedDispute>[0];
439
+
440
+ if (returnTxInfo === true) {
441
+ return expireEscalatedDispute({
442
+ ...expireEscalatedArgs,
443
+ returnTxInfo: true
444
+ });
445
+ } else {
446
+ return expireEscalatedDispute({
447
+ ...expireEscalatedArgs,
448
+ returnTxInfo: false
449
+ });
450
+ }
220
451
  }
221
452
 
222
453
  /**
@@ -1,7 +1,8 @@
1
+ import { Web3LibAdapter } from "@bosonprotocol/common";
1
2
  import { BaseCoreSDK } from "./../mixins/base-core-sdk";
2
3
  import { balanceOf, name, symbol, uri } from "./handler";
3
4
 
4
- export class ERC1155Mixin extends BaseCoreSDK {
5
+ export class ERC1155Mixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
5
6
  /* -------------------------------------------------------------------------- */
6
7
  /* ERC1155 related methods */
7
8
  /* -------------------------------------------------------------------------- */
@@ -1,7 +1,8 @@
1
+ import { Web3LibAdapter } from "@bosonprotocol/common";
1
2
  import { BaseCoreSDK } from "./../mixins/base-core-sdk";
2
3
  import { supportsInterface } from "./handler";
3
4
 
4
- export class ERC165Mixin extends BaseCoreSDK {
5
+ export class ERC165Mixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
5
6
  /* -------------------------------------------------------------------------- */
6
7
  /* ERC20 related methods */
7
8
  /* -------------------------------------------------------------------------- */
@@ -1,19 +1,51 @@
1
- import { Web3LibAdapter, TransactionRequest } from "@bosonprotocol/common";
1
+ import {
2
+ Web3LibAdapter,
3
+ TransactionRequest,
4
+ TransactionResponse
5
+ } from "@bosonprotocol/common";
2
6
  import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
3
7
  import { erc20Iface } from "./interface";
4
8
 
9
+ // Overload: returnTxInfo is true -> returns TransactionRequest
5
10
  export async function approve(args: {
6
11
  contractAddress: string;
7
12
  spender: string;
8
13
  value: BigNumberish;
9
14
  web3Lib: Web3LibAdapter;
10
15
  txRequest?: TransactionRequest;
11
- }) {
12
- return args.web3Lib.sendTransaction({
16
+ returnTxInfo: true;
17
+ }): Promise<TransactionRequest>;
18
+
19
+ // Overload: returnTxInfo is false or undefined -> returns TransactionResponse
20
+ export async function approve(args: {
21
+ contractAddress: string;
22
+ spender: string;
23
+ value: BigNumberish;
24
+ web3Lib: Web3LibAdapter;
25
+ txRequest?: TransactionRequest;
26
+ returnTxInfo?: false | undefined;
27
+ }): Promise<TransactionResponse>;
28
+
29
+ // Implementation
30
+ export async function approve(args: {
31
+ contractAddress: string;
32
+ spender: string;
33
+ value: BigNumberish;
34
+ web3Lib: Web3LibAdapter;
35
+ txRequest?: TransactionRequest;
36
+ returnTxInfo?: boolean;
37
+ }): Promise<TransactionRequest | TransactionResponse> {
38
+ const transactionRequest: TransactionRequest = {
13
39
  ...args.txRequest,
14
40
  to: args.contractAddress,
15
41
  data: erc20Iface.encodeFunctionData("approve", [args.spender, args.value])
16
- });
42
+ };
43
+
44
+ if (args.returnTxInfo) {
45
+ return transactionRequest;
46
+ } else {
47
+ return args.web3Lib.sendTransaction(transactionRequest);
48
+ }
17
49
  }
18
50
 
19
51
  export async function getAllowance(args: {
@@ -1,3 +1,8 @@
1
+ import {
2
+ Web3LibAdapter,
3
+ TransactionResponse,
4
+ TransactionRequest
5
+ } from "@bosonprotocol/common";
1
6
  import { BaseCoreSDK } from "./../mixins/base-core-sdk";
2
7
  import {
3
8
  approve,
@@ -9,14 +14,82 @@ import {
9
14
  balanceOf
10
15
  } from "./handler";
11
16
 
12
- export class ERC20Mixin extends BaseCoreSDK {
17
+ export class ERC20Mixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
13
18
  /* -------------------------------------------------------------------------- */
14
19
  /* ERC20 related methods */
15
20
  /* -------------------------------------------------------------------------- */
21
+
22
+ /**
23
+ * Approves ERC20 token spending allowance.
24
+ * This transaction only succeeds if the token contract exists and caller has sufficient balance.
25
+ * @param args - Approval arguments.
26
+ * @param overrides - Optional overrides.
27
+ * @returns Transaction response.
28
+ */
29
+ // Overload: returnTxInfo is true → returns TransactionRequest
30
+ public async erc20Approve(
31
+ args: Omit<
32
+ Parameters<typeof approve>[0],
33
+ "web3Lib" | "theGraphStorage" | "metadataStorage"
34
+ >,
35
+ overrides: Partial<{
36
+ contractAddress: string;
37
+ txRequest: TransactionRequest;
38
+ returnTxInfo: true;
39
+ }>
40
+ ): Promise<TransactionRequest>;
41
+
42
+ // Overload: returnTxInfo is false or undefined → returns TransactionResponse
43
+ public async erc20Approve(
44
+ args: Omit<
45
+ Parameters<typeof approve>[0],
46
+ "web3Lib" | "theGraphStorage" | "metadataStorage"
47
+ >,
48
+ overrides?: Partial<{
49
+ contractAddress: string;
50
+ txRequest: TransactionRequest;
51
+ returnTxInfo?: false | undefined;
52
+ }>
53
+ ): Promise<TransactionResponse>;
54
+
55
+ // Implementation
16
56
  public async erc20Approve(
17
- args: Omit<Parameters<typeof approve>[0], "web3Lib">
18
- ): Promise<ReturnType<typeof approve>> {
19
- return approve({ web3Lib: this._web3Lib, ...args });
57
+ args: Omit<
58
+ Parameters<typeof approve>[0],
59
+ "web3Lib" | "theGraphStorage" | "metadataStorage"
60
+ >,
61
+ overrides: Partial<{
62
+ contractAddress: string;
63
+ txRequest: TransactionRequest;
64
+ returnTxInfo?: boolean;
65
+ }> = {}
66
+ ): Promise<TransactionResponse | TransactionRequest> {
67
+ const { returnTxInfo } = overrides;
68
+
69
+ const approveArgs = {
70
+ ...args,
71
+ web3Lib: this._web3Lib,
72
+ contractAddress: overrides.contractAddress,
73
+ txRequest: overrides.txRequest
74
+ } as const satisfies Parameters<typeof approve>[0];
75
+
76
+ if (returnTxInfo === true) {
77
+ return approve({
78
+ ...approveArgs,
79
+ returnTxInfo: true
80
+ });
81
+ } else {
82
+ return approve({
83
+ ...approveArgs,
84
+ returnTxInfo: false
85
+ });
86
+ }
87
+ }
88
+
89
+ public async erc20EnsureAllowance(
90
+ args: Omit<Parameters<typeof ensureAllowance>[0], "web3Lib">
91
+ ): Promise<ReturnType<typeof ensureAllowance>> {
92
+ return ensureAllowance({ web3Lib: this._web3Lib, ...args });
20
93
  }
21
94
 
22
95
  public async erc20GetAllowance(
@@ -43,12 +116,6 @@ export class ERC20Mixin extends BaseCoreSDK {
43
116
  return getName({ web3Lib: this._web3Lib, ...args });
44
117
  }
45
118
 
46
- public async erc20EnsureAllowance(
47
- args: Omit<Parameters<typeof ensureAllowance>[0], "web3Lib">
48
- ): Promise<ReturnType<typeof ensureAllowance>> {
49
- return ensureAllowance({ web3Lib: this._web3Lib, ...args });
50
- }
51
-
52
119
  public async erc20BalanceOf(
53
120
  args: Omit<Parameters<typeof balanceOf>[0], "web3Lib">
54
121
  ): Promise<ReturnType<typeof balanceOf>> {
@@ -1,4 +1,8 @@
1
- import { TransactionRequest, Web3LibAdapter } from "@bosonprotocol/common";
1
+ import {
2
+ TransactionRequest,
3
+ TransactionResponse,
4
+ Web3LibAdapter
5
+ } from "@bosonprotocol/common";
2
6
  import { BigNumberish } from "@ethersproject/bignumber";
3
7
  import { erc721Iface } from "./interface";
4
8
 
@@ -96,19 +100,45 @@ export async function tokenOfOwnerByIndex(args: {
96
100
  return String(tokenId);
97
101
  }
98
102
 
103
+ // setApprovalForAll overloads
99
104
  export async function setApprovalForAll(args: {
100
105
  contractAddress: string;
101
106
  operator: string;
102
107
  approved: boolean;
103
108
  web3Lib: Web3LibAdapter;
109
+ returnTxInfo: true;
104
110
  txRequest?: TransactionRequest;
105
- }) {
106
- return args.web3Lib.sendTransaction({
111
+ }): Promise<TransactionRequest>;
112
+
113
+ export async function setApprovalForAll(args: {
114
+ contractAddress: string;
115
+ operator: string;
116
+ approved: boolean;
117
+ web3Lib: Web3LibAdapter;
118
+ returnTxInfo?: false | undefined;
119
+ txRequest?: TransactionRequest;
120
+ }): Promise<TransactionResponse>;
121
+
122
+ export async function setApprovalForAll(args: {
123
+ contractAddress: string;
124
+ operator: string;
125
+ approved: boolean;
126
+ web3Lib: Web3LibAdapter;
127
+ returnTxInfo?: boolean;
128
+ txRequest?: TransactionRequest;
129
+ }): Promise<TransactionRequest | TransactionResponse> {
130
+ const transactionRequest = {
107
131
  ...args.txRequest,
108
132
  to: args.contractAddress,
109
133
  data: erc721Iface.encodeFunctionData("setApprovalForAll", [
110
134
  args.operator,
111
135
  args.approved
112
136
  ])
113
- });
137
+ } satisfies TransactionRequest;
138
+
139
+ if (args.returnTxInfo) {
140
+ return transactionRequest;
141
+ } else {
142
+ return args.web3Lib.sendTransaction(transactionRequest);
143
+ }
114
144
  }
@@ -1,3 +1,4 @@
1
+ import { Web3LibAdapter } from "@bosonprotocol/common";
1
2
  import { BaseCoreSDK } from "./../mixins/base-core-sdk";
2
3
  import {
3
4
  balanceOf,
@@ -8,7 +9,7 @@ import {
8
9
  tokenUri
9
10
  } from "./handler";
10
11
 
11
- export class ERC721Mixin extends BaseCoreSDK {
12
+ export class ERC721Mixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
12
13
  /* -------------------------------------------------------------------------- */
13
14
  /* ERC721 related methods */
14
15
  /* -------------------------------------------------------------------------- */
@@ -1,8 +1,8 @@
1
1
  import { Interface } from "@ethersproject/abi";
2
- import { abis, ErrorFragment } from "@bosonprotocol/common";
2
+ import { abis, ErrorFragment, Web3LibAdapter } from "@bosonprotocol/common";
3
3
  import { BaseCoreSDK } from "./../mixins/base-core-sdk";
4
4
 
5
- export class ErrorMixin extends BaseCoreSDK {
5
+ export class ErrorMixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
6
6
  public parseError(error: object): object {
7
7
  return { ...error, decoded: this.recurseParseError(error) };
8
8
  }