@scallop-io/sui-scallop-sdk 0.47.0-alpha.1 → 0.47.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -101,10 +101,10 @@ export declare const getObligations: ({ address, }: {
101
101
  * Query obligation locked status.
102
102
  *
103
103
  * @param query - The Scallop query instance.
104
- * @param obligationId - The obligation id.
104
+ * @param obligation - The obligation id or the obligation object.
105
105
  * @return Obligation locked status.
106
106
  */
107
- export declare const getObligationLocked: (cache: ScallopCache, obligationId: string) => Promise<boolean>;
107
+ export declare const getObligationLocked: (cache: ScallopCache, obligation: string | SuiObjectData) => Promise<boolean>;
108
108
  /**
109
109
  * Query obligation data.
110
110
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.47.0-alpha.1",
3
+ "version": "0.47.0-alpha.2",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -817,7 +817,7 @@ export class ScallopClient {
817
817
  await this.utils.mergeSimilarCoins(
818
818
  txBlock,
819
819
  coin,
820
- this.utils.parseCoinType(this.utils.parseCoinName(stakeCoinName)),
820
+ this.utils.parseCoinType(stakeCoinName),
821
821
  requireSender(txBlock)
822
822
  );
823
823
 
@@ -72,7 +72,7 @@ export class ScallopIndexer {
72
72
  return await this._requestClient.get<{
73
73
  pools: MarketPool[];
74
74
  collaterals: MarketCollateral[];
75
- }>(`/api/market`);
75
+ }>(`/api/market/migrate`);
76
76
  },
77
77
  });
78
78
 
@@ -149,7 +149,7 @@ export class ScallopIndexer {
149
149
  queryFn: async () => {
150
150
  return await this._requestClient.get<{
151
151
  spools: Spool[];
152
- }>(`/api/spools`);
152
+ }>(`/api/spools/migrate`);
153
153
  },
154
154
  });
155
155
 
@@ -187,7 +187,7 @@ export class ScallopIndexer {
187
187
  queryFn: async () => {
188
188
  return await this._requestClient.get<{
189
189
  borrowIncentivePools: BorrowIncentivePool[];
190
- }>(`/api/borrowIncentivePools`);
190
+ }>(`/api/borrowIncentivePools/migrate`);
191
191
  },
192
192
  });
193
193
 
@@ -768,24 +768,29 @@ export const getObligations = async (
768
768
  * Query obligation locked status.
769
769
  *
770
770
  * @param query - The Scallop query instance.
771
- * @param obligationId - The obligation id.
771
+ * @param obligation - The obligation id or the obligation object.
772
772
  * @return Obligation locked status.
773
773
  */
774
774
  export const getObligationLocked = async (
775
775
  cache: ScallopCache,
776
- obligationId: string
776
+ obligation: string | SuiObjectData
777
777
  ) => {
778
- const obligationObjectResponse = await cache.queryGetObject(obligationId, {
779
- showContent: true,
780
- });
778
+ const obligationObjectResponse =
779
+ typeof obligation === 'string'
780
+ ? (
781
+ await cache.queryGetObject(obligation, {
782
+ showContent: true,
783
+ })
784
+ )?.data
785
+ : obligation;
781
786
  let obligationLocked = false;
782
787
  if (
783
- obligationObjectResponse?.data &&
784
- obligationObjectResponse?.data?.content?.dataType === 'moveObject' &&
785
- 'lock_key' in obligationObjectResponse.data.content.fields
788
+ obligationObjectResponse &&
789
+ obligationObjectResponse?.content?.dataType === 'moveObject' &&
790
+ 'lock_key' in obligationObjectResponse.content.fields
786
791
  ) {
787
792
  obligationLocked = Boolean(
788
- obligationObjectResponse.data.content.fields.lock_key
793
+ obligationObjectResponse.content.fields.lock_key
789
794
  );
790
795
  }
791
796