@bosonprotocol/core-sdk 1.6.0-alpha.4 → 1.6.0-alpha.6

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 (52) hide show
  1. package/dist/cjs/core-sdk.d.ts +4 -1
  2. package/dist/cjs/core-sdk.d.ts.map +1 -1
  3. package/dist/cjs/core-sdk.js +10 -0
  4. package/dist/cjs/core-sdk.js.map +1 -1
  5. package/dist/cjs/exchanges/index.d.ts +1 -0
  6. package/dist/cjs/exchanges/index.d.ts.map +1 -1
  7. package/dist/cjs/exchanges/index.js +2 -1
  8. package/dist/cjs/exchanges/index.js.map +1 -1
  9. package/dist/cjs/exchanges/subgraph.d.ts +6 -0
  10. package/dist/cjs/exchanges/subgraph.d.ts.map +1 -0
  11. package/dist/cjs/exchanges/subgraph.js +32 -0
  12. package/dist/cjs/exchanges/subgraph.js.map +1 -0
  13. package/dist/cjs/offers/subgraph.d.ts +3 -6
  14. package/dist/cjs/offers/subgraph.d.ts.map +1 -1
  15. package/dist/cjs/offers/subgraph.js +2 -6
  16. package/dist/cjs/offers/subgraph.js.map +1 -1
  17. package/dist/cjs/subgraph.d.ts +265 -37
  18. package/dist/cjs/subgraph.d.ts.map +1 -1
  19. package/dist/cjs/subgraph.js +83 -32
  20. package/dist/cjs/subgraph.js.map +1 -1
  21. package/dist/cjs/utils/graphql.d.ts +10 -0
  22. package/dist/cjs/utils/graphql.d.ts.map +1 -1
  23. package/dist/esm/core-sdk.d.ts +4 -1
  24. package/dist/esm/core-sdk.d.ts.map +1 -1
  25. package/dist/esm/core-sdk.js +6 -0
  26. package/dist/esm/core-sdk.js.map +1 -1
  27. package/dist/esm/exchanges/index.d.ts +1 -0
  28. package/dist/esm/exchanges/index.d.ts.map +1 -1
  29. package/dist/esm/exchanges/index.js +1 -0
  30. package/dist/esm/exchanges/index.js.map +1 -1
  31. package/dist/esm/exchanges/subgraph.d.ts +6 -0
  32. package/dist/esm/exchanges/subgraph.d.ts.map +1 -0
  33. package/dist/esm/exchanges/subgraph.js +17 -0
  34. package/dist/esm/exchanges/subgraph.js.map +1 -0
  35. package/dist/esm/offers/subgraph.d.ts +3 -6
  36. package/dist/esm/offers/subgraph.d.ts.map +1 -1
  37. package/dist/esm/offers/subgraph.js +2 -3
  38. package/dist/esm/offers/subgraph.js.map +1 -1
  39. package/dist/esm/subgraph.d.ts +265 -37
  40. package/dist/esm/subgraph.d.ts.map +1 -1
  41. package/dist/esm/subgraph.js +74 -20
  42. package/dist/esm/subgraph.js.map +1 -1
  43. package/dist/esm/utils/graphql.d.ts +10 -0
  44. package/dist/esm/utils/graphql.d.ts.map +1 -1
  45. package/package.json +3 -3
  46. package/src/core-sdk.ts +18 -1
  47. package/src/exchanges/index.ts +1 -0
  48. package/src/exchanges/queries.graphql +49 -0
  49. package/src/exchanges/subgraph.ts +34 -0
  50. package/src/offers/queries.graphql +0 -8
  51. package/src/offers/subgraph.ts +7 -12
  52. package/src/subgraph.ts +358 -48
package/src/subgraph.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GraphQLClient } from "graphql-request";
2
2
  import * as Dom from "graphql-request/dist/types.dom";
3
- import gql from "graphql-tag";
3
+ import { gql } from "graphql-request";
4
4
  export type Maybe<T> = T | null;
5
5
  export type InputMaybe<T> = Maybe<T>;
6
6
  export type Exact<T extends { [key: string]: unknown }> = {
@@ -401,7 +401,7 @@ export type Exchange = {
401
401
  id: Scalars["ID"];
402
402
  offer: Offer;
403
403
  redeemedDate?: Maybe<Scalars["BigInt"]>;
404
- seller?: Maybe<Seller>;
404
+ seller: Seller;
405
405
  state: ExchangeState;
406
406
  validUntilDate?: Maybe<Scalars["BigInt"]>;
407
407
  };
@@ -2364,6 +2364,265 @@ export type SellerFieldsFragment = {
2364
2364
  }>;
2365
2365
  };
2366
2366
 
2367
+ export type GetExchangeByIdQueryQueryVariables = Exact<{
2368
+ exchangeId: Scalars["ID"];
2369
+ }>;
2370
+
2371
+ export type GetExchangeByIdQueryQuery = {
2372
+ __typename?: "Query";
2373
+ exchange?: {
2374
+ __typename?: "Exchange";
2375
+ id: string;
2376
+ disputed: boolean;
2377
+ state: ExchangeState;
2378
+ committedDate: string;
2379
+ finalizedDate?: string | null;
2380
+ validUntilDate?: string | null;
2381
+ redeemedDate?: string | null;
2382
+ expired: boolean;
2383
+ buyer: {
2384
+ __typename?: "Buyer";
2385
+ id: string;
2386
+ wallet: string;
2387
+ active: boolean;
2388
+ };
2389
+ seller: {
2390
+ __typename?: "Seller";
2391
+ operator: string;
2392
+ admin: string;
2393
+ clerk: string;
2394
+ treasury: string;
2395
+ active: boolean;
2396
+ };
2397
+ offer: {
2398
+ __typename?: "Offer";
2399
+ id: string;
2400
+ createdAt: string;
2401
+ price: string;
2402
+ sellerDeposit: string;
2403
+ protocolFee: string;
2404
+ buyerCancelPenalty: string;
2405
+ quantityAvailable: string;
2406
+ quantityInitial: string;
2407
+ validFromDate: string;
2408
+ validUntilDate: string;
2409
+ voucherRedeemableFromDate: string;
2410
+ voucherRedeemableUntilDate: string;
2411
+ fulfillmentPeriodDuration: string;
2412
+ voucherValidDuration: string;
2413
+ resolutionPeriodDuration: string;
2414
+ metadataUri: string;
2415
+ offerChecksum: string;
2416
+ voidedAt?: string | null;
2417
+ disputeResolverId: string;
2418
+ seller: {
2419
+ __typename?: "Seller";
2420
+ id: string;
2421
+ operator: string;
2422
+ admin: string;
2423
+ clerk: string;
2424
+ treasury: string;
2425
+ active: boolean;
2426
+ };
2427
+ exchangeToken: {
2428
+ __typename?: "ExchangeToken";
2429
+ address: string;
2430
+ decimals: string;
2431
+ name: string;
2432
+ symbol: string;
2433
+ };
2434
+ metadata?:
2435
+ | {
2436
+ __typename?: "BaseMetadataEntity";
2437
+ name?: string | null;
2438
+ description?: string | null;
2439
+ externalUrl?: string | null;
2440
+ schemaUrl?: string | null;
2441
+ type: MetadataType;
2442
+ }
2443
+ | {
2444
+ __typename?: "ProductV1MetadataEntity";
2445
+ name?: string | null;
2446
+ description?: string | null;
2447
+ externalUrl?: string | null;
2448
+ schemaUrl?: string | null;
2449
+ type: MetadataType;
2450
+ }
2451
+ | null;
2452
+ };
2453
+ } | null;
2454
+ };
2455
+
2456
+ export type GetExchangesByOfferIdQueryVariables = Exact<{
2457
+ offerId: Scalars["String"];
2458
+ first?: InputMaybe<Scalars["Int"]>;
2459
+ skip?: InputMaybe<Scalars["Int"]>;
2460
+ orderBy?: InputMaybe<Exchange_OrderBy>;
2461
+ orderDirection?: InputMaybe<OrderDirection>;
2462
+ }>;
2463
+
2464
+ export type GetExchangesByOfferIdQuery = {
2465
+ __typename?: "Query";
2466
+ exchanges: Array<{
2467
+ __typename?: "Exchange";
2468
+ id: string;
2469
+ disputed: boolean;
2470
+ state: ExchangeState;
2471
+ committedDate: string;
2472
+ finalizedDate?: string | null;
2473
+ validUntilDate?: string | null;
2474
+ redeemedDate?: string | null;
2475
+ expired: boolean;
2476
+ buyer: {
2477
+ __typename?: "Buyer";
2478
+ id: string;
2479
+ wallet: string;
2480
+ active: boolean;
2481
+ };
2482
+ seller: {
2483
+ __typename?: "Seller";
2484
+ operator: string;
2485
+ admin: string;
2486
+ clerk: string;
2487
+ treasury: string;
2488
+ active: boolean;
2489
+ };
2490
+ offer: {
2491
+ __typename?: "Offer";
2492
+ id: string;
2493
+ createdAt: string;
2494
+ price: string;
2495
+ sellerDeposit: string;
2496
+ protocolFee: string;
2497
+ buyerCancelPenalty: string;
2498
+ quantityAvailable: string;
2499
+ quantityInitial: string;
2500
+ validFromDate: string;
2501
+ validUntilDate: string;
2502
+ voucherRedeemableFromDate: string;
2503
+ voucherRedeemableUntilDate: string;
2504
+ fulfillmentPeriodDuration: string;
2505
+ voucherValidDuration: string;
2506
+ resolutionPeriodDuration: string;
2507
+ metadataUri: string;
2508
+ offerChecksum: string;
2509
+ voidedAt?: string | null;
2510
+ disputeResolverId: string;
2511
+ seller: {
2512
+ __typename?: "Seller";
2513
+ id: string;
2514
+ operator: string;
2515
+ admin: string;
2516
+ clerk: string;
2517
+ treasury: string;
2518
+ active: boolean;
2519
+ };
2520
+ exchangeToken: {
2521
+ __typename?: "ExchangeToken";
2522
+ address: string;
2523
+ decimals: string;
2524
+ name: string;
2525
+ symbol: string;
2526
+ };
2527
+ metadata?:
2528
+ | {
2529
+ __typename?: "BaseMetadataEntity";
2530
+ name?: string | null;
2531
+ description?: string | null;
2532
+ externalUrl?: string | null;
2533
+ schemaUrl?: string | null;
2534
+ type: MetadataType;
2535
+ }
2536
+ | {
2537
+ __typename?: "ProductV1MetadataEntity";
2538
+ name?: string | null;
2539
+ description?: string | null;
2540
+ externalUrl?: string | null;
2541
+ schemaUrl?: string | null;
2542
+ type: MetadataType;
2543
+ }
2544
+ | null;
2545
+ };
2546
+ }>;
2547
+ };
2548
+
2549
+ export type ExchangeFieldsFragment = {
2550
+ __typename?: "Exchange";
2551
+ id: string;
2552
+ disputed: boolean;
2553
+ state: ExchangeState;
2554
+ committedDate: string;
2555
+ finalizedDate?: string | null;
2556
+ validUntilDate?: string | null;
2557
+ redeemedDate?: string | null;
2558
+ expired: boolean;
2559
+ buyer: { __typename?: "Buyer"; id: string; wallet: string; active: boolean };
2560
+ seller: {
2561
+ __typename?: "Seller";
2562
+ operator: string;
2563
+ admin: string;
2564
+ clerk: string;
2565
+ treasury: string;
2566
+ active: boolean;
2567
+ };
2568
+ offer: {
2569
+ __typename?: "Offer";
2570
+ id: string;
2571
+ createdAt: string;
2572
+ price: string;
2573
+ sellerDeposit: string;
2574
+ protocolFee: string;
2575
+ buyerCancelPenalty: string;
2576
+ quantityAvailable: string;
2577
+ quantityInitial: string;
2578
+ validFromDate: string;
2579
+ validUntilDate: string;
2580
+ voucherRedeemableFromDate: string;
2581
+ voucherRedeemableUntilDate: string;
2582
+ fulfillmentPeriodDuration: string;
2583
+ voucherValidDuration: string;
2584
+ resolutionPeriodDuration: string;
2585
+ metadataUri: string;
2586
+ offerChecksum: string;
2587
+ voidedAt?: string | null;
2588
+ disputeResolverId: string;
2589
+ seller: {
2590
+ __typename?: "Seller";
2591
+ id: string;
2592
+ operator: string;
2593
+ admin: string;
2594
+ clerk: string;
2595
+ treasury: string;
2596
+ active: boolean;
2597
+ };
2598
+ exchangeToken: {
2599
+ __typename?: "ExchangeToken";
2600
+ address: string;
2601
+ decimals: string;
2602
+ name: string;
2603
+ symbol: string;
2604
+ };
2605
+ metadata?:
2606
+ | {
2607
+ __typename?: "BaseMetadataEntity";
2608
+ name?: string | null;
2609
+ description?: string | null;
2610
+ externalUrl?: string | null;
2611
+ schemaUrl?: string | null;
2612
+ type: MetadataType;
2613
+ }
2614
+ | {
2615
+ __typename?: "ProductV1MetadataEntity";
2616
+ name?: string | null;
2617
+ description?: string | null;
2618
+ externalUrl?: string | null;
2619
+ schemaUrl?: string | null;
2620
+ type: MetadataType;
2621
+ }
2622
+ | null;
2623
+ };
2624
+ };
2625
+
2367
2626
  export type GetFundsByAccountIdQueryQueryVariables = Exact<{
2368
2627
  accountId: Scalars["BigInt"];
2369
2628
  }>;
@@ -2460,15 +2719,6 @@ export type GetOfferByIdQueryQuery = {
2460
2719
  type: MetadataType;
2461
2720
  }
2462
2721
  | null;
2463
- exchanges: Array<{
2464
- __typename?: "Exchange";
2465
- id: string;
2466
- committedDate: string;
2467
- redeemedDate?: string | null;
2468
- finalizedDate?: string | null;
2469
- expired: boolean;
2470
- disputed: boolean;
2471
- }>;
2472
2722
  } | null;
2473
2723
  };
2474
2724
 
@@ -2539,15 +2789,6 @@ export type GetAllOffersOfOperatorQueryQuery = {
2539
2789
  type: MetadataType;
2540
2790
  }
2541
2791
  | null;
2542
- exchanges: Array<{
2543
- __typename?: "Exchange";
2544
- id: string;
2545
- committedDate: string;
2546
- redeemedDate?: string | null;
2547
- finalizedDate?: string | null;
2548
- expired: boolean;
2549
- disputed: boolean;
2550
- }>;
2551
2792
  }>;
2552
2793
  }>;
2553
2794
  };
@@ -2607,15 +2848,6 @@ export type OfferFieldsFragment = {
2607
2848
  type: MetadataType;
2608
2849
  }
2609
2850
  | null;
2610
- exchanges: Array<{
2611
- __typename?: "Exchange";
2612
- id: string;
2613
- committedDate: string;
2614
- redeemedDate?: string | null;
2615
- finalizedDate?: string | null;
2616
- expired: boolean;
2617
- disputed: boolean;
2618
- }>;
2619
2851
  };
2620
2852
 
2621
2853
  export const SellerFieldsFragmentDoc = gql`
@@ -2637,19 +2869,6 @@ export const SellerFieldsFragmentDoc = gql`
2637
2869
  }
2638
2870
  }
2639
2871
  `;
2640
- export const FundsEntityFieldsFragmentDoc = gql`
2641
- fragment FundsEntityFields on FundsEntity {
2642
- id
2643
- availableAmount
2644
- token {
2645
- address
2646
- name
2647
- symbol
2648
- decimals
2649
- }
2650
- accountId
2651
- }
2652
- `;
2653
2872
  export const OfferFieldsFragmentDoc = gql`
2654
2873
  fragment OfferFields on Offer {
2655
2874
  id
@@ -2692,14 +2911,47 @@ export const OfferFieldsFragmentDoc = gql`
2692
2911
  schemaUrl
2693
2912
  type
2694
2913
  }
2695
- exchanges {
2914
+ }
2915
+ `;
2916
+ export const ExchangeFieldsFragmentDoc = gql`
2917
+ fragment ExchangeFields on Exchange {
2918
+ id
2919
+ buyer {
2696
2920
  id
2697
- committedDate
2698
- redeemedDate
2699
- finalizedDate
2700
- expired
2701
- disputed
2921
+ wallet
2922
+ active
2923
+ }
2924
+ seller {
2925
+ operator
2926
+ admin
2927
+ clerk
2928
+ treasury
2929
+ active
2930
+ }
2931
+ disputed
2932
+ state
2933
+ committedDate
2934
+ finalizedDate
2935
+ validUntilDate
2936
+ redeemedDate
2937
+ expired
2938
+ offer {
2939
+ ...OfferFields
2940
+ }
2941
+ }
2942
+ ${OfferFieldsFragmentDoc}
2943
+ `;
2944
+ export const FundsEntityFieldsFragmentDoc = gql`
2945
+ fragment FundsEntityFields on FundsEntity {
2946
+ id
2947
+ availableAmount
2948
+ token {
2949
+ address
2950
+ name
2951
+ symbol
2952
+ decimals
2702
2953
  }
2954
+ accountId
2703
2955
  }
2704
2956
  `;
2705
2957
  export const GetSellerByOperatorQueryDocument = gql`
@@ -2726,6 +2978,34 @@ export const GetSellerByClerkQueryDocument = gql`
2726
2978
  }
2727
2979
  ${SellerFieldsFragmentDoc}
2728
2980
  `;
2981
+ export const GetExchangeByIdQueryDocument = gql`
2982
+ query getExchangeByIdQuery($exchangeId: ID!) {
2983
+ exchange(id: $exchangeId) {
2984
+ ...ExchangeFields
2985
+ }
2986
+ }
2987
+ ${ExchangeFieldsFragmentDoc}
2988
+ `;
2989
+ export const GetExchangesByOfferIdDocument = gql`
2990
+ query getExchangesByOfferId(
2991
+ $offerId: String!
2992
+ $first: Int
2993
+ $skip: Int
2994
+ $orderBy: Exchange_orderBy
2995
+ $orderDirection: OrderDirection
2996
+ ) {
2997
+ exchanges(
2998
+ where: { offer: $offerId }
2999
+ first: $first
3000
+ skip: $skip
3001
+ orderBy: $orderBy
3002
+ orderDirection: $orderDirection
3003
+ ) {
3004
+ ...ExchangeFields
3005
+ }
3006
+ }
3007
+ ${ExchangeFieldsFragmentDoc}
3008
+ `;
2729
3009
  export const GetFundsByAccountIdQueryDocument = gql`
2730
3010
  query getFundsByAccountIdQuery($accountId: BigInt!) {
2731
3011
  fundsEntities(where: { accountId: $accountId }) {
@@ -2826,6 +3106,36 @@ export function getSdk(
2826
3106
  "query"
2827
3107
  );
2828
3108
  },
3109
+ getExchangeByIdQuery(
3110
+ variables: GetExchangeByIdQueryQueryVariables,
3111
+ requestHeaders?: Dom.RequestInit["headers"]
3112
+ ): Promise<GetExchangeByIdQueryQuery> {
3113
+ return withWrapper(
3114
+ (wrappedRequestHeaders) =>
3115
+ client.request<GetExchangeByIdQueryQuery>(
3116
+ GetExchangeByIdQueryDocument,
3117
+ variables,
3118
+ { ...requestHeaders, ...wrappedRequestHeaders }
3119
+ ),
3120
+ "getExchangeByIdQuery",
3121
+ "query"
3122
+ );
3123
+ },
3124
+ getExchangesByOfferId(
3125
+ variables: GetExchangesByOfferIdQueryVariables,
3126
+ requestHeaders?: Dom.RequestInit["headers"]
3127
+ ): Promise<GetExchangesByOfferIdQuery> {
3128
+ return withWrapper(
3129
+ (wrappedRequestHeaders) =>
3130
+ client.request<GetExchangesByOfferIdQuery>(
3131
+ GetExchangesByOfferIdDocument,
3132
+ variables,
3133
+ { ...requestHeaders, ...wrappedRequestHeaders }
3134
+ ),
3135
+ "getExchangesByOfferId",
3136
+ "query"
3137
+ );
3138
+ },
2829
3139
  getFundsByAccountIdQuery(
2830
3140
  variables: GetFundsByAccountIdQueryQueryVariables,
2831
3141
  requestHeaders?: Dom.RequestInit["headers"]