@scallop-io/sui-scallop-sdk 1.3.0-alpha.6 → 1.3.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.
@@ -7,7 +7,6 @@ import type { Transaction } from '@mysten/sui/transactions';
7
7
  import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
8
8
  import type { ScallopBuilderParams, ScallopTxBlock, SupportMarketCoins, SupportAssetCoins, SupportSCoin, ScallopBuilderInstanceParams, SelectCoinReturnType } from '../types';
9
9
  import { ScallopCache } from './scallopCache';
10
- import { SuiClient as SuiClientV0 } from '@mysten/sui.js/client';
11
10
  /**
12
11
  * @description
13
12
  * It provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
@@ -28,7 +27,6 @@ export declare class ScallopBuilder {
28
27
  utils: ScallopUtils;
29
28
  walletAddress: string;
30
29
  cache: ScallopCache;
31
- oldSuiClient: SuiClientV0;
32
30
  constructor(params: ScallopBuilderParams, instance?: ScallopBuilderInstanceParams);
33
31
  /**
34
32
  * Request the scallop API to initialize data.
@@ -4,7 +4,7 @@ import { ScallopAddress } from './scallopAddress';
4
4
  import { ScallopUtils } from './scallopUtils';
5
5
  import { ScallopIndexer } from './scallopIndexer';
6
6
  import { ScallopCache } from './scallopCache';
7
- import { SuiObjectData } from '@mysten/sui/src/client';
7
+ import { SuiObjectData } from '@mysten/sui/client';
8
8
  /**
9
9
  * @description
10
10
  * It provides methods for getting on-chain data from the Scallop contract.
@@ -1,4 +1,4 @@
1
- import { SuiObjectData } from '@mysten/sui/src/client';
1
+ import { SuiObjectData } from '@mysten/sui/client';
2
2
  import { ScallopQuery } from 'src/models';
3
3
  import { LoyaltyProgramInfo } from 'src/types';
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import type { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
2
- import type { TransactionArgument, TransactionResult } from '@mysten/sui/transactions';
2
+ import type { Argument, TransactionResult } from '@mysten/sui/transactions';
3
3
  import type { ScallopBuilder } from '../../models';
4
4
  import type { SupportCollateralCoins, SupportPoolCoins, SupportAssetCoins } from '../constant';
5
5
  import { SuiTxBlockWithSpool } from '.';
@@ -10,8 +10,8 @@ export type CoreIds = {
10
10
  coinDecimalsRegistry: string;
11
11
  xOracle: string;
12
12
  };
13
- export type NestedResult = Extract<TransactionArgument, {
14
- kind: 'NestedResult';
13
+ export type NestedResult = Extract<Argument, {
14
+ $kind: 'NestedResult';
15
15
  }>;
16
16
  type Obligation = NestedResult;
17
17
  type ObligationKey = NestedResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.3.0-alpha.6",
3
+ "version": "1.3.0",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -41,11 +41,10 @@
41
41
  "@graphql-typed-document-node/core": "3.2.0",
42
42
  "@mysten/bcs": "^1.0.3",
43
43
  "@mysten/sui": "^1.3.0",
44
- "@mysten/sui.js": "0.54.1",
45
44
  "@noble/curves": "^1.2.0",
46
45
  "@noble/hashes": "^1.3.2",
47
46
  "@pythnetwork/price-service-client": "^1.8.2",
48
- "@pythnetwork/pyth-sui-js": "2.0.0",
47
+ "@pythnetwork/pyth-sui-js": "2.1.0",
49
48
  "@scallop-io/sui-kit": "1.3.1-alpha.1",
50
49
  "@scure/bip39": "^1.2.1",
51
50
  "@tanstack/query-core": "5.51.15",
@@ -9,7 +9,6 @@ import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
9
9
  import type { ScallopBuilder } from '../models';
10
10
  import type { SupportAssetCoins, SupportOracleType } from '../types';
11
11
  import { PYTH_ENDPOINTS } from 'src/constants/pyth';
12
- import { TransactionBlock } from '@mysten/sui.js/transactions';
13
12
 
14
13
  /**
15
14
  * Update the price of the oracle for multiple coin.
@@ -35,7 +34,7 @@ export const updateOracles = async (
35
34
  const rules: SupportOracleType[] = builder.isTestnet ? ['pyth'] : ['pyth'];
36
35
  if (usePythPullModel && rules.includes('pyth')) {
37
36
  const pythClient = new SuiPythClient(
38
- builder.oldSuiClient,
37
+ builder.suiKit.client(),
39
38
  builder.address.get('core.oracles.pyth.state'),
40
39
  builder.address.get('core.oracles.pyth.wormholeState')
41
40
  );
@@ -53,7 +52,7 @@ export const updateOracles = async (
53
52
  const priceUpdateData =
54
53
  await pythConnection.getPriceFeedsUpdateData(priceIds);
55
54
  await pythClient.updatePriceFeeds(
56
- TransactionBlock.from(txBlock.serialize()), // convert txBlock to TransactionBlock because pyth sdk not support new @mysten/sui yet
55
+ txBlock.txBlock, // convert txBlock to TransactionBlock because pyth sdk not support new @mysten/sui yet
57
56
  priceUpdateData,
58
57
  priceIds
59
58
  );
@@ -19,7 +19,6 @@ import type {
19
19
  } from '../types';
20
20
  import { ScallopCache } from './scallopCache';
21
21
  import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
22
- import { SuiClient as SuiClientV0 } from '@mysten/sui.js/client';
23
22
 
24
23
  /**
25
24
  * @description
@@ -43,9 +42,6 @@ export class ScallopBuilder {
43
42
  public walletAddress: string;
44
43
  public cache: ScallopCache;
45
44
 
46
- // For compatibility with pyth sdk
47
- public oldSuiClient: SuiClientV0;
48
-
49
45
  public constructor(
50
46
  params: ScallopBuilderParams,
51
47
  instance?: ScallopBuilderInstanceParams
@@ -93,11 +89,6 @@ export class ScallopBuilder {
93
89
  this.isTestnet = params.networkType
94
90
  ? params.networkType === 'testnet'
95
91
  : false;
96
-
97
- // intitialize old Sui Client version
98
- this.oldSuiClient = new SuiClientV0({
99
- url: this.suiKit.suiInteractor.currentFullNode,
100
- });
101
92
  }
102
93
 
103
94
  /**
@@ -53,7 +53,7 @@ import { ScallopUtils } from './scallopUtils';
53
53
  import { ScallopIndexer } from './scallopIndexer';
54
54
  import { ScallopCache } from './scallopCache';
55
55
  import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
56
- import { SuiObjectData } from '@mysten/sui/src/client';
56
+ import { SuiObjectData } from '@mysten/sui/client';
57
57
  import {
58
58
  getSCoinAmount,
59
59
  getSCoinAmounts,
@@ -1,4 +1,4 @@
1
- import { SuiObjectData } from '@mysten/sui/src/client';
1
+ import { SuiObjectData } from '@mysten/sui/client';
2
2
  import BigNumber from 'bignumber.js';
3
3
  import { ScallopQuery } from 'src/models';
4
4
  import { LoyaltyProgramInfo } from 'src/types';
@@ -2,10 +2,7 @@ import type {
2
2
  SuiTxBlock as SuiKitTxBlock,
3
3
  SuiObjectArg,
4
4
  } from '@scallop-io/sui-kit';
5
- import type {
6
- TransactionArgument,
7
- TransactionResult,
8
- } from '@mysten/sui/transactions';
5
+ import type { Argument, TransactionResult } from '@mysten/sui/transactions';
9
6
  import type { ScallopBuilder } from '../../models';
10
7
  import type {
11
8
  SupportCollateralCoins,
@@ -22,10 +19,7 @@ export type CoreIds = {
22
19
  xOracle: string;
23
20
  };
24
21
 
25
- export type NestedResult = Extract<
26
- TransactionArgument,
27
- { kind: 'NestedResult' }
28
- >;
22
+ export type NestedResult = Extract<Argument, { $kind: 'NestedResult' }>;
29
23
  type Obligation = NestedResult;
30
24
  type ObligationKey = NestedResult;
31
25
  type ObligationHotPotato = NestedResult;