@bosonprotocol/core-sdk 1.1.1 → 1.2.0-alpha.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 (132) hide show
  1. package/dist/cjs/accounts/index.d.ts +17 -0
  2. package/dist/cjs/accounts/index.d.ts.map +1 -0
  3. package/dist/cjs/accounts/index.js +37 -0
  4. package/dist/cjs/accounts/index.js.map +1 -0
  5. package/dist/cjs/accounts/interface.d.ts +6 -0
  6. package/dist/cjs/accounts/interface.d.ts.map +1 -0
  7. package/dist/cjs/accounts/interface.js +11 -0
  8. package/dist/cjs/accounts/interface.js.map +1 -0
  9. package/dist/cjs/accounts/subgraph.d.ts +5 -0
  10. package/dist/cjs/accounts/subgraph.d.ts.map +1 -0
  11. package/dist/cjs/accounts/subgraph.js +39 -0
  12. package/dist/cjs/accounts/subgraph.js.map +1 -0
  13. package/dist/cjs/accounts/types.d.ts +10 -0
  14. package/dist/cjs/accounts/types.d.ts.map +1 -0
  15. package/dist/cjs/accounts/types.js +3 -0
  16. package/dist/cjs/accounts/types.js.map +1 -0
  17. package/dist/cjs/core-sdk.d.ts +8 -1
  18. package/dist/cjs/core-sdk.d.ts.map +1 -1
  19. package/dist/cjs/core-sdk.js +31 -3
  20. package/dist/cjs/core-sdk.js.map +1 -1
  21. package/dist/cjs/offers/handler.d.ts +0 -5
  22. package/dist/cjs/offers/handler.d.ts.map +1 -1
  23. package/dist/cjs/offers/handler.js +10 -23
  24. package/dist/cjs/offers/handler.js.map +1 -1
  25. package/dist/cjs/offers/index.d.ts +11 -12
  26. package/dist/cjs/offers/index.d.ts.map +1 -1
  27. package/dist/cjs/offers/index.js +2 -1
  28. package/dist/cjs/offers/index.js.map +1 -1
  29. package/dist/cjs/offers/interface.d.ts +1 -3
  30. package/dist/cjs/offers/interface.d.ts.map +1 -1
  31. package/dist/cjs/offers/interface.js +3 -16
  32. package/dist/cjs/offers/interface.js.map +1 -1
  33. package/dist/cjs/offers/storage.d.ts +13 -0
  34. package/dist/cjs/offers/storage.d.ts.map +1 -0
  35. package/dist/cjs/offers/storage.js +30 -0
  36. package/dist/cjs/offers/storage.js.map +1 -0
  37. package/dist/cjs/offers/subgraph.d.ts +3 -3
  38. package/dist/cjs/offers/subgraph.d.ts.map +1 -1
  39. package/dist/cjs/offers/subgraph.js +23 -16
  40. package/dist/cjs/offers/subgraph.js.map +1 -1
  41. package/dist/cjs/offers/types.d.ts +11 -6
  42. package/dist/cjs/offers/types.d.ts.map +1 -1
  43. package/dist/cjs/orchestration/handler.d.ts +12 -0
  44. package/dist/cjs/orchestration/handler.d.ts.map +1 -0
  45. package/dist/cjs/orchestration/handler.js +36 -0
  46. package/dist/cjs/orchestration/handler.js.map +1 -0
  47. package/dist/cjs/orchestration/index.d.ts +3 -0
  48. package/dist/cjs/orchestration/index.d.ts.map +1 -0
  49. package/dist/cjs/orchestration/index.js +29 -0
  50. package/dist/cjs/orchestration/index.js.map +1 -0
  51. package/dist/cjs/orchestration/interface.d.ts +6 -0
  52. package/dist/cjs/orchestration/interface.d.ts.map +1 -0
  53. package/dist/cjs/orchestration/interface.js +13 -0
  54. package/dist/cjs/orchestration/interface.js.map +1 -0
  55. package/dist/cjs/utils/logs.d.ts +4 -0
  56. package/dist/cjs/utils/logs.d.ts.map +1 -0
  57. package/dist/cjs/utils/logs.js +13 -0
  58. package/dist/cjs/utils/logs.js.map +1 -0
  59. package/dist/esm/accounts/index.d.ts +17 -0
  60. package/dist/esm/accounts/index.d.ts.map +1 -0
  61. package/dist/esm/accounts/index.js +8 -0
  62. package/dist/esm/accounts/index.js.map +1 -0
  63. package/dist/esm/accounts/interface.d.ts +6 -0
  64. package/dist/esm/accounts/interface.d.ts.map +1 -0
  65. package/dist/esm/accounts/interface.js +11 -0
  66. package/dist/esm/accounts/interface.js.map +1 -0
  67. package/dist/esm/accounts/subgraph.d.ts +5 -0
  68. package/dist/esm/accounts/subgraph.d.ts.map +1 -0
  69. package/dist/esm/accounts/subgraph.js +24 -0
  70. package/dist/esm/accounts/subgraph.js.map +1 -0
  71. package/dist/esm/accounts/types.d.ts +10 -0
  72. package/dist/esm/accounts/types.d.ts.map +1 -0
  73. package/dist/esm/accounts/types.js +2 -0
  74. package/dist/esm/accounts/types.js.map +1 -0
  75. package/dist/esm/core-sdk.d.ts +8 -1
  76. package/dist/esm/core-sdk.d.ts.map +1 -1
  77. package/dist/esm/core-sdk.js +27 -3
  78. package/dist/esm/core-sdk.js.map +1 -1
  79. package/dist/esm/offers/handler.d.ts +0 -5
  80. package/dist/esm/offers/handler.d.ts.map +1 -1
  81. package/dist/esm/offers/handler.js +9 -19
  82. package/dist/esm/offers/handler.js.map +1 -1
  83. package/dist/esm/offers/index.d.ts +11 -12
  84. package/dist/esm/offers/index.d.ts.map +1 -1
  85. package/dist/esm/offers/index.js +1 -0
  86. package/dist/esm/offers/index.js.map +1 -1
  87. package/dist/esm/offers/interface.d.ts +1 -3
  88. package/dist/esm/offers/interface.d.ts.map +1 -1
  89. package/dist/esm/offers/interface.js +3 -14
  90. package/dist/esm/offers/interface.js.map +1 -1
  91. package/dist/esm/offers/storage.d.ts +13 -0
  92. package/dist/esm/offers/storage.d.ts.map +1 -0
  93. package/dist/esm/offers/storage.js +15 -0
  94. package/dist/esm/offers/storage.js.map +1 -0
  95. package/dist/esm/offers/subgraph.d.ts +3 -3
  96. package/dist/esm/offers/subgraph.d.ts.map +1 -1
  97. package/dist/esm/offers/subgraph.js +22 -15
  98. package/dist/esm/offers/subgraph.js.map +1 -1
  99. package/dist/esm/offers/types.d.ts +11 -6
  100. package/dist/esm/offers/types.d.ts.map +1 -1
  101. package/dist/esm/orchestration/handler.d.ts +12 -0
  102. package/dist/esm/orchestration/handler.d.ts.map +1 -0
  103. package/dist/esm/orchestration/handler.js +21 -0
  104. package/dist/esm/orchestration/handler.js.map +1 -0
  105. package/dist/esm/orchestration/index.d.ts +3 -0
  106. package/dist/esm/orchestration/index.d.ts.map +1 -0
  107. package/dist/esm/orchestration/index.js +3 -0
  108. package/dist/esm/orchestration/index.js.map +1 -0
  109. package/dist/esm/orchestration/interface.d.ts +6 -0
  110. package/dist/esm/orchestration/interface.d.ts.map +1 -0
  111. package/dist/esm/orchestration/interface.js +9 -0
  112. package/dist/esm/orchestration/interface.js.map +1 -0
  113. package/dist/esm/utils/logs.d.ts +4 -0
  114. package/dist/esm/utils/logs.d.ts.map +1 -0
  115. package/dist/esm/utils/logs.js +9 -0
  116. package/dist/esm/utils/logs.js.map +1 -0
  117. package/package.json +3 -3
  118. package/src/accounts/index.ts +9 -0
  119. package/src/accounts/interface.ts +17 -0
  120. package/src/accounts/subgraph.ts +35 -0
  121. package/src/accounts/types.ts +10 -0
  122. package/src/core-sdk.ts +49 -7
  123. package/src/offers/handler.ts +9 -26
  124. package/src/offers/index.ts +1 -0
  125. package/src/offers/interface.ts +4 -23
  126. package/src/offers/storage.ts +23 -0
  127. package/src/offers/subgraph.ts +25 -18
  128. package/src/offers/types.ts +11 -6
  129. package/src/orchestration/handler.ts +39 -0
  130. package/src/orchestration/index.ts +2 -0
  131. package/src/orchestration/interface.ts +21 -0
  132. package/src/utils/logs.ts +16 -0
@@ -1 +1 @@
1
- {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/offers/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,EACN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAMjC;IACC,MAAM,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE;QACxE,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IAEH,oFAAoF;IACpF,qFAAqF;IACrF,0EAA0E;IAC1E,0EAA0E;IAC1E,IAAI,IAAI,CAAC,eAAe,I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AK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;KACnE;IAED,IAAI,KAAK,CAAC,QAAQ,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,OAAO,qBAAqB,CAAC,CAAC;KACtE;IAED,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAC5D,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,EAAE;QACvE,MAAM,IAAI,KAAK,CACb,wBAAwB,aAAa,0BAA0B,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,CACxF,CAAC;KACH;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;QAClC,EAAE,EAAE,IAAI,CAAC,eAAe;QACxB,IAAI,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC7E,CAAC,CAAC;AACL,CAAC"}
@@ -1,36 +1,35 @@
1
1
  export * as handler from "./handler";
2
2
  export * as subgraph from "./subgraph";
3
3
  export * as iface from "./interface";
4
+ export * as storage from "./storage";
4
5
  export * from "./types";
5
6
  export declare const validation: {
6
7
  createOfferArgsSchema: import("yup/lib/object").OptionalObjectSchema<{
7
8
  price: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
8
- deposit: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
9
- penalty: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
10
- quantity: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
9
+ sellerDeposit: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
10
+ buyerCancelPenalty: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
11
+ quantityAvailable: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
11
12
  validFromDateInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
12
13
  validUntilDateInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
13
- redeemableDateInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
14
+ redeemableFromDateInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
14
15
  fulfillmentPeriodDurationInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
15
16
  voucherValidDurationInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
16
- seller: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
17
17
  exchangeToken: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
18
18
  metadataUri: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
19
- metadataHash: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
19
+ offerChecksum: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
20
20
  }, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<{
21
21
  price: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
22
- deposit: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
23
- penalty: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
24
- quantity: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
22
+ sellerDeposit: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
23
+ buyerCancelPenalty: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
24
+ quantityAvailable: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
25
25
  validFromDateInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
26
26
  validUntilDateInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
27
- redeemableDateInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
27
+ redeemableFromDateInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
28
28
  fulfillmentPeriodDurationInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
29
29
  voucherValidDurationInMS: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
30
- seller: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
31
30
  exchangeToken: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
32
31
  metadataUri: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
33
- metadataHash: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
32
+ offerChecksum: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
34
33
  }>>;
35
34
  baseMetadataSchema: import("yup/lib/object").OptionalObjectSchema<{
36
35
  name: import("yup/lib/string").RequiredStringSchema<string, import("yup/lib/types").AnyObject>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/offers/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAItB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/offers/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAItB,CAAC"}
@@ -2,6 +2,7 @@ import { utils } from "@bosonprotocol/common";
2
2
  export * as handler from "./handler";
3
3
  export * as subgraph from "./subgraph";
4
4
  export * as iface from "./interface";
5
+ export * as storage from "./storage";
5
6
  export * from "./types";
6
7
  export const validation = {
7
8
  createOfferArgsSchema: utils.validation.createOfferArgsSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/offers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,cAAc,SAAS,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,qBAAqB,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB;IAC7D,kBAAkB,EAAE,KAAK,CAAC,UAAU,CAAC,kBAAkB;IACvD,uBAAuB,EAAE,KAAK,CAAC,UAAU,CAAC,uBAAuB;CAClE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/offers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,cAAc,SAAS,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,qBAAqB,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB;IAC7D,kBAAkB,EAAE,KAAK,CAAC,UAAU,CAAC,kBAAkB;IACvD,uBAAuB,EAAE,KAAK,CAAC,UAAU,CAAC,uBAAuB;CAClE,CAAC"}
@@ -1,9 +1,7 @@
1
- import { OfferStruct, Log } from "@bosonprotocol/common";
1
+ import { OfferStruct } from "@bosonprotocol/common";
2
2
  import { Interface } from "@ethersproject/abi";
3
3
  import { CreateOfferArgs } from "./types";
4
4
  export declare const bosonOfferHandlerIface: Interface;
5
- export declare function getCreatedOfferIdFromLogs(logs: Log[]): string;
6
- export declare function parseLog(data: string, topics: string[]): import("@ethersproject/abi").LogDescription;
7
5
  export declare function encodeCreateOffer(args: CreateOfferArgs): string;
8
6
  export declare function createOfferArgsToStruct(args: CreateOfferArgs): Partial<OfferStruct>;
9
7
  //# sourceMappingURL=interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/offers/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,sBAAsB,WAA4C,CAAC;AAEhF,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,UAYpD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,+CAEtD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,UAItD;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,WAAW,CAAC,CAyBtB"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/offers/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,sBAAsB,WAA4C,CAAC;AAEhF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,UAItD;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,WAAW,CAAC,CAwBtB"}
@@ -2,32 +2,21 @@ import { utils, abis } from "@bosonprotocol/common";
2
2
  import { Interface } from "@ethersproject/abi";
3
3
  import { getAddress } from "@ethersproject/address";
4
4
  export const bosonOfferHandlerIface = new Interface(abis.IBosonOfferHandlerABI);
5
- export function getCreatedOfferIdFromLogs(logs) {
6
- const parsedLogs = logs.map((log) => parseLog(log.data, log.topics));
7
- const [offerCreatedLog] = parsedLogs.filter((log) => log.name === "OfferCreated");
8
- if (!offerCreatedLog) {
9
- return null;
10
- }
11
- return String(offerCreatedLog.args.offerId);
12
- }
13
- export function parseLog(data, topics) {
14
- return bosonOfferHandlerIface.parseLog({ data, topics });
15
- }
16
5
  export function encodeCreateOffer(args) {
17
6
  return bosonOfferHandlerIface.encodeFunctionData("createOffer", [
18
7
  createOfferArgsToStruct(args)
19
8
  ]);
20
9
  }
21
10
  export function createOfferArgsToStruct(args) {
22
- const { exchangeToken, seller, validFromDateInMS, validUntilDateInMS, redeemableDateInMS, fulfillmentPeriodDurationInMS, voucherValidDurationInMS, ...restArgs } = args;
11
+ const { exchangeToken, validFromDateInMS, validUntilDateInMS, redeemableFromDateInMS, fulfillmentPeriodDurationInMS, voucherValidDurationInMS, ...restArgs } = args;
23
12
  return {
24
13
  id: "0",
14
+ sellerId: "0",
25
15
  ...restArgs,
26
16
  exchangeToken: getAddress(exchangeToken),
27
- seller: getAddress(seller),
28
17
  validFromDate: utils.timestamp.msToSec(validFromDateInMS),
29
18
  validUntilDate: utils.timestamp.msToSec(validUntilDateInMS),
30
- redeemableDate: utils.timestamp.msToSec(redeemableDateInMS),
19
+ redeemableFromDate: utils.timestamp.msToSec(redeemableFromDateInMS),
31
20
  fulfillmentPeriodDuration: utils.timestamp.msToSec(fulfillmentPeriodDurationInMS),
32
21
  voucherValidDuration: utils.timestamp.msToSec(voucherValidDurationInMS)
33
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/offers/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,EAAE,IAAI,EAAO,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAEhF,MAAM,UAAU,yBAAyB,CAAC,IAAW;IACnD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAErE,MAAM,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,MAAM,CACzC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,CACrC,CAAC;IAEF,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,MAAgB;IACrD,OAAO,sBAAsB,CAAC,QAAQ,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AAC,CAAC;AAEhF,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,OAAO,sBAAsB,CAAC,kBAAkB,CAAC,aAAa,EAAE;QAC9D,uBAAuB,CAAC,IAAI,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,IAAqB;IAErB,MAAM,EACJ,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,EACxB,GAAG,QAAQ,EACZ,GAAG,IAAI,CAAC;IAET,OAAO;QACL,EAAE,EAAE,GAAG;QACP,QAAQ,EAAE,GAAG;QACb,GAAG,QAAQ;QACX,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC;QACxC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC;QACzD,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC;QAC3D,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,sBAAsB,CAAC;QACnE,yBAAyB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAChD,6BAA6B,CAC9B;QACD,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,wBAAwB,CAAC;KACxE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { MetadataStorage } from "@bosonprotocol/common";
2
+ /**
3
+ * We use the feature `ipfsOnEthereum` in our subgraph to resolve metadata from IPFS
4
+ * and store them in the graph. In order for the graph node to reliably resolve them,
5
+ * we need to add the metadata additionally to the IPFS node of the graph.
6
+ * See https://thegraph.com/docs/en/developer/assemblyscript-api/#ipfs-api
7
+ */
8
+ export declare function storeMetadataOnTheGraph(args: {
9
+ metadataUriOrHash: string;
10
+ metadataStorage?: MetadataStorage;
11
+ theGraphStorage?: MetadataStorage;
12
+ }): Promise<string | null>;
13
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/offers/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUzB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * We use the feature `ipfsOnEthereum` in our subgraph to resolve metadata from IPFS
3
+ * and store them in the graph. In order for the graph node to reliably resolve them,
4
+ * we need to add the metadata additionally to the IPFS node of the graph.
5
+ * See https://thegraph.com/docs/en/developer/assemblyscript-api/#ipfs-api
6
+ */
7
+ export async function storeMetadataOnTheGraph(args) {
8
+ if (args.metadataStorage && args.theGraphStorage) {
9
+ const metadata = await args.metadataStorage.getMetadata(args.metadataUriOrHash);
10
+ const metadataUri = await args.theGraphStorage.storeMetadata(metadata);
11
+ return metadataUri;
12
+ }
13
+ return null;
14
+ }
15
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/offers/storage.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,IAI7C;IACC,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,EAAE;QAChD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CACrD,IAAI,CAAC,iBAAiB,CACvB,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACvE,OAAO,WAAW,CAAC;KACpB;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { BigNumberish } from "@ethersproject/bignumber";
2
2
  import { MultiQueryOpts } from "../utils/subgraph";
3
3
  import { RawOfferFromSubgraph } from "./types";
4
- export declare const offerFieldsFragment = "\nfragment offerFields on Offer {\n id\n createdAt\n price\n deposit\n penalty\n quantity\n validFromDate\n validUntilDate\n redeemableDate\n fulfillmentPeriodDuration\n voucherValidDuration\n metadataUri\n metadataHash\n voidedAt\n seller {\n address\n }\n exchangeToken {\n address\n decimals\n name\n symbol\n }\n metadata {\n name \n description\n externalUrl\n schemaUrl\n type\n }\n}\n";
4
+ export declare const offerFieldsFragment = "\nfragment offerFields on Offer {\n id\n createdAt\n price\n sellerDeposit\n buyerCancelPenalty\n quantityAvailable\n validFromDate\n validUntilDate\n redeemableFromDate\n fulfillmentPeriodDuration\n voucherValidDuration\n metadataUri\n offerChecksum\n voidedAt\n seller {\n id\n operator\n admin\n clerk\n treasury\n active\n }\n exchangeToken {\n address\n decimals\n name\n symbol\n }\n metadata {\n name \n description\n externalUrl\n schemaUrl\n type\n }\n}\n";
5
5
  export declare const getOfferByIdQuery: string;
6
6
  export declare function getOfferById(subgraphUrl: string, offerId: BigNumberish): Promise<RawOfferFromSubgraph>;
7
- export declare const getAllOffersOfSellerQuery: string;
8
- export declare function getAllOffersOfSeller(subgraphUrl: string, sellerAddress: string, opts?: MultiQueryOpts): Promise<RawOfferFromSubgraph[]>;
7
+ export declare const getAllOffersOfOperatorQuery: string;
8
+ export declare function getAllOffersOfOperator(subgraphUrl: string, operatorAddress: string, opts?: MultiQueryOpts): Promise<RawOfferFromSubgraph[]>;
9
9
  //# sourceMappingURL=subgraph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subgraph.d.ts","sourceRoot":"","sources":["../../../src/offers/subgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAiB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,mBAAmB,8bAiC/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAO7B,CAAC;AAEF,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,oBAAoB,CAAC,CAQ/B;AAED,eAAO,MAAM,yBAAyB,QAoBrC,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAiBjC"}
1
+ {"version":3,"file":"subgraph.d.ts","sourceRoot":"","sources":["../../../src/offers/subgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAiB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,mBAAmB,shBAsC/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAO7B,CAAC;AAEF,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,oBAAoB,CAAC,CAQ/B;AAED,eAAO,MAAM,2BAA2B,QAsBvC,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAiBjC"}
@@ -4,19 +4,24 @@ fragment offerFields on Offer {
4
4
  id
5
5
  createdAt
6
6
  price
7
- deposit
8
- penalty
9
- quantity
7
+ sellerDeposit
8
+ buyerCancelPenalty
9
+ quantityAvailable
10
10
  validFromDate
11
11
  validUntilDate
12
- redeemableDate
12
+ redeemableFromDate
13
13
  fulfillmentPeriodDuration
14
14
  voucherValidDuration
15
15
  metadataUri
16
- metadataHash
16
+ offerChecksum
17
17
  voidedAt
18
18
  seller {
19
- address
19
+ id
20
+ operator
21
+ admin
22
+ clerk
23
+ treasury
24
+ active
20
25
  }
21
26
  exchangeToken {
22
27
  address
@@ -45,15 +50,17 @@ export async function getOfferById(subgraphUrl, offerId) {
45
50
  const { offer } = await fetchSubgraph(subgraphUrl, getOfferByIdQuery, { offerId: offerId.toString() });
46
51
  return offer;
47
52
  }
48
- export const getAllOffersOfSellerQuery = `
49
- query GetAllOffersOfSellerQuery(
50
- $seller: ID!,
53
+ export const getAllOffersOfOperatorQuery = `
54
+ query GetAllOffersOfOperatorQuery(
55
+ $operator: String!,
51
56
  $first: Int,
52
57
  $skip: Int,
53
58
  $orderBy: String,
54
59
  $orderDirection: String
55
60
  ) {
56
- seller(id: $seller) {
61
+ sellers(where: {
62
+ operator: $operator
63
+ }) {
57
64
  offers(
58
65
  first: $first
59
66
  skip: $skip
@@ -66,18 +73,18 @@ query GetAllOffersOfSellerQuery(
66
73
  }
67
74
  ${offerFieldsFragment}
68
75
  `;
69
- export async function getAllOffersOfSeller(subgraphUrl, sellerAddress, opts = {}) {
70
- const { seller } = await fetchSubgraph(subgraphUrl, getAllOffersOfSellerQuery, {
71
- seller: sellerAddress.toLowerCase(),
76
+ export async function getAllOffersOfOperator(subgraphUrl, operatorAddress, opts = {}) {
77
+ const { sellers } = await fetchSubgraph(subgraphUrl, getAllOffersOfOperatorQuery, {
78
+ operator: operatorAddress.toLowerCase(),
72
79
  first: 100,
73
80
  skip: 0,
74
81
  orderBy: "createdAt",
75
82
  orderDirection: "desc",
76
83
  ...opts
77
84
  });
78
- if (!seller) {
85
+ if (!sellers) {
79
86
  return [];
80
87
  }
81
- return seller.offers;
88
+ return sellers[0].offers;
82
89
  }
83
90
  //# sourceMappingURL=subgraph.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subgraph.js","sourceRoot":"","sources":["../../../src/offers/subgraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAkB,MAAM,mBAAmB,CAAC;AAGlE,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiClC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;EAM/B,mBAAmB;CACpB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,WAAmB,EACnB,OAAqB;IAErB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,aAAa,CACnC,WAAW,EACX,iBAAiB,EACjB,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAChC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;EAmBvC,mBAAmB;CACpB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,WAAmB,EACnB,aAAqB,EACrB,OAAuB,EAAE;IAEzB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAEnC,WAAW,EAAE,yBAAyB,EAAE;QACzC,MAAM,EAAE,aAAa,CAAC,WAAW,EAAE;QACnC,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,WAAW;QACpB,cAAc,EAAE,MAAM;QACtB,GAAG,IAAI;KACR,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,CAAC;KACX;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC"}
1
+ {"version":3,"file":"subgraph.js","sourceRoot":"","sources":["../../../src/offers/subgraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAkB,MAAM,mBAAmB,CAAC;AAGlE,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsClC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;EAM/B,mBAAmB;CACpB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,WAAmB,EACnB,OAAqB;IAErB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,aAAa,CACnC,WAAW,EACX,iBAAiB,EACjB,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAChC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;EAqBzC,mBAAmB;CACpB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,WAAmB,EACnB,eAAuB,EACvB,OAAuB,EAAE;IAEzB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,aAAa,CAEpC,WAAW,EAAE,2BAA2B,EAAE;QAC3C,QAAQ,EAAE,eAAe,CAAC,WAAW,EAAE;QACvC,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,WAAW;QACpB,cAAc,EAAE,MAAM;QACtB,GAAG,IAAI;KACR,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,EAAE,CAAC;KACX;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC3B,CAAC"}
@@ -3,19 +3,24 @@ export declare type RawOfferFromSubgraph = {
3
3
  id: string;
4
4
  createdAt: string;
5
5
  price: string;
6
- deposit: string;
7
- penalty: string;
8
- quantity: string;
6
+ sellerDeposit: string;
7
+ buyerCancelPenalty: string;
8
+ quantityAvailable: string;
9
9
  validFromDate: string;
10
10
  validUntilDate: string;
11
- redeemableDate: string;
11
+ redeemableFromDate: string;
12
12
  fulfillmentPeriodDuration: string;
13
13
  voucherValidDuration: string;
14
14
  metadataUri: string;
15
- metadataHash: string;
15
+ offerChecksum: string;
16
16
  voidedAt: null | string;
17
17
  seller: {
18
- address: string;
18
+ id: string;
19
+ operator: string;
20
+ admin: string;
21
+ clerk: string;
22
+ treasury: string;
23
+ active: boolean;
19
24
  };
20
25
  exchangeToken: {
21
26
  address: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/offers/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,yBAAyB,EAAE,MAAM,CAAC;IAClC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,IAAI,GAAG,MAAM,CAAC;IACxB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,aAAa,EAAE;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,QAAQ,EAAE,IAAI,GAAG;QACf,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/offers/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yBAAyB,EAAE,MAAM,CAAC;IAClC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,IAAI,GAAG,MAAM,CAAC;IACxB,MAAM,EAAE;QACN,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,aAAa,EAAE;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,QAAQ,EAAE,IAAI,GAAG;QACf,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Web3LibAdapter, TransactionResponse, MetadataStorage } from "@bosonprotocol/common";
2
+ import { CreateOfferArgs } from "../offers/types";
3
+ import { CreateSellerArgs } from "../accounts/types";
4
+ export declare function createOfferAndSeller(args: {
5
+ offerToCreate: CreateOfferArgs;
6
+ sellerToCreate: CreateSellerArgs;
7
+ contractAddress: string;
8
+ web3Lib: Web3LibAdapter;
9
+ metadataStorage?: MetadataStorage;
10
+ theGraphStorage?: MetadataStorage;
11
+ }): Promise<TransactionResponse>;
12
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/orchestration/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,aAAa,EAAE,eAAe,CAAC;IAC/B,cAAc,EAAE,gBAAgB,CAAC;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmB/B"}
@@ -0,0 +1,21 @@
1
+ import { utils } from "@bosonprotocol/common";
2
+ import { encodeCreateSellerAndOffer } from "./interface";
3
+ import { storeMetadataOnTheGraph } from "../offers/storage";
4
+ export async function createOfferAndSeller(args) {
5
+ utils.validation.createOfferArgsSchema.validateSync(args.offerToCreate, {
6
+ abortEarly: false
7
+ });
8
+ utils.validation.createSellerArgsSchema.validateSync(args.sellerToCreate, {
9
+ abortEarly: false
10
+ });
11
+ await storeMetadataOnTheGraph({
12
+ metadataUriOrHash: args.offerToCreate.metadataUri,
13
+ metadataStorage: args.metadataStorage,
14
+ theGraphStorage: args.theGraphStorage
15
+ });
16
+ return args.web3Lib.sendTransaction({
17
+ to: args.contractAddress,
18
+ data: encodeCreateSellerAndOffer(args.sellerToCreate, args.offerToCreate)
19
+ });
20
+ }
21
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/orchestration/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,EACN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAK5D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAO1C;IACC,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE;QACtE,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IAEH,KAAK,CAAC,UAAU,CAAC,sBAAsB,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE;QACxE,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IAEH,MAAM,uBAAuB,CAAC;QAC5B,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,WAAW;QACjD,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,eAAe,EAAE,IAAI,CAAC,eAAe;KACtC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;QAClC,EAAE,EAAE,IAAI,CAAC,eAAe;QACxB,IAAI,EAAE,0BAA0B,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * as handler from "./handler";
2
+ export * as iface from "./interface";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * as handler from "./handler";
2
+ export * as iface from "./interface";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/orchestration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Interface } from "@ethersproject/abi";
2
+ import { CreateSellerArgs } from "../accounts/types";
3
+ import { CreateOfferArgs } from "../offers/types";
4
+ export declare const bosonOrchestrationHandlerIface: Interface;
5
+ export declare function encodeCreateSellerAndOffer(seller: CreateSellerArgs, offer: CreateOfferArgs): string;
6
+ //# sourceMappingURL=interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/orchestration/interface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAO,MAAM,8BAA8B,WAE1C,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,eAAe,UAMvB"}
@@ -0,0 +1,9 @@
1
+ import { abis } from "@bosonprotocol/common";
2
+ import { Interface } from "@ethersproject/abi";
3
+ import { createSellerArgsToStruct } from "../accounts/interface";
4
+ import { createOfferArgsToStruct } from "../offers/interface";
5
+ export const bosonOrchestrationHandlerIface = new Interface(abis.IBosonOrchestrationHandlerABI);
6
+ export function encodeCreateSellerAndOffer(seller, offer) {
7
+ return bosonOrchestrationHandlerIface.encodeFunctionData("createSellerAndOffer", [createSellerArgsToStruct(seller), createOfferArgsToStruct(offer)]);
8
+ }
9
+ //# sourceMappingURL=interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/orchestration/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAK9D,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,SAAS,CACzD,IAAI,CAAC,6BAA6B,CACnC,CAAC;AAEF,MAAM,UAAU,0BAA0B,CACxC,MAAwB,EACxB,KAAsB;IAEtB,OAAO,8BAA8B,CAAC,kBAAkB,CACtD,sBAAsB,EACtB,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC,KAAK,CAAC,CAAC,CACnE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Log } from "@bosonprotocol/common";
2
+ import { Interface } from "@ethersproject/abi";
3
+ export declare function getCreatedOfferIdFromLogs(iface: Interface, logs: Log[]): string;
4
+ //# sourceMappingURL=logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/utils/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,UAYtE"}
@@ -0,0 +1,9 @@
1
+ export function getCreatedOfferIdFromLogs(iface, logs) {
2
+ const parsedLogs = logs.map((log) => iface.parseLog(log));
3
+ const [offerCreatedLog] = parsedLogs.filter((log) => log.name === "OfferCreated");
4
+ if (!offerCreatedLog) {
5
+ return null;
6
+ }
7
+ return String(offerCreatedLog.args.offerId);
8
+ }
9
+ //# sourceMappingURL=logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/utils/logs.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,yBAAyB,CAAC,KAAgB,EAAE,IAAW;IACrE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAE1D,MAAM,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,MAAM,CACzC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,CACrC,CAAC;IAEF,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bosonprotocol/core-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.2.0-alpha.0",
4
4
  "description": "> TODO: description",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -30,7 +30,7 @@
30
30
  "access": "restricted"
31
31
  },
32
32
  "dependencies": {
33
- "@bosonprotocol/common": "1.1.1",
33
+ "@bosonprotocol/common": "1.2.0-alpha.0",
34
34
  "@ethersproject/abi": "^5.5.0",
35
35
  "@ethersproject/address": "^5.5.0",
36
36
  "@ethersproject/bignumber": "^5.5.0",
@@ -46,5 +46,5 @@
46
46
  "ts-jest": "^27.1.3",
47
47
  "typescript": "^4.5.5"
48
48
  },
49
- "gitHead": "b5574e65f060cebf436079c925bd8e6130d2fd2a"
49
+ "gitHead": "a96955d96b98699a6c169d0180902895b330cf5b"
50
50
  }
@@ -0,0 +1,9 @@
1
+ import { utils } from "@bosonprotocol/common";
2
+
3
+ export * as iface from "./interface";
4
+ export * as subgraph from "./subgraph";
5
+ export * from "./types";
6
+
7
+ export const validation = {
8
+ createSellerArgsSchema: utils.validation.createSellerArgsSchema
9
+ };
@@ -0,0 +1,17 @@
1
+ import { SellerStruct, abis } from "@bosonprotocol/common";
2
+ import { Interface } from "@ethersproject/abi";
3
+ import { CreateSellerArgs } from "./types";
4
+
5
+ export const bosonAccountHandlerIface = new Interface(
6
+ abis.IBosonAccountHandlerABI
7
+ );
8
+
9
+ export function createSellerArgsToStruct(
10
+ args: CreateSellerArgs
11
+ ): Partial<SellerStruct> {
12
+ return {
13
+ id: "0",
14
+ active: true,
15
+ ...args
16
+ };
17
+ }
@@ -0,0 +1,35 @@
1
+ import { fetchSubgraph } from "../utils/subgraph";
2
+ import { RawSellerFromSubgraph } from "./types";
3
+
4
+ export const sellerFieldsFragment = `
5
+ fragment sellerFields on Seller {
6
+ id
7
+ operator
8
+ admin
9
+ clerk
10
+ treasury
11
+ active
12
+ }
13
+ `;
14
+
15
+ export const getSellerByOperatorQuery = `
16
+ query GetSellersByOperator($operator: String!) {
17
+ sellers(operator: $operator) {
18
+ ...sellerFields
19
+ }
20
+ }
21
+ ${sellerFieldsFragment}
22
+ `;
23
+
24
+ export async function getSellerByOperator(
25
+ subgraphUrl: string,
26
+ operatorAddress: string
27
+ ): Promise<RawSellerFromSubgraph> {
28
+ const { sellers } = await fetchSubgraph<{ sellers: RawSellerFromSubgraph }>(
29
+ subgraphUrl,
30
+ getSellerByOperatorQuery,
31
+ { operator: operatorAddress }
32
+ );
33
+
34
+ return sellers[0];
35
+ }
@@ -0,0 +1,10 @@
1
+ export { CreateSellerArgs } from "@bosonprotocol/common";
2
+
3
+ export type RawSellerFromSubgraph = {
4
+ id: string;
5
+ operator: string;
6
+ admin: string;
7
+ clerk: string;
8
+ treasury: string;
9
+ active: boolean;
10
+ };