@scallop-io/sui-scallop-sdk 1.5.1 → 1.5.3
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.
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/constants/common.ts +1 -1
- package/src/constants/queryKeys.ts +2 -2
- package/src/models/scallop.ts +2 -2
- package/src/models/scallopAddress.ts +4 -4
- package/src/models/scallopBuilder.ts +2 -2
- package/src/models/scallopClient.ts +2 -2
- package/src/models/scallopQuery.ts +2 -2
- package/src/models/scallopUtils.ts +2 -2
- package/src/types/model.ts +1 -1
package/package.json
CHANGED
package/src/constants/common.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const SDK_API_BASE_URL = 'https://sdk.api.scallop.io' as const;
|
|
|
4
4
|
export const IS_VE_SCA_TEST: boolean = false;
|
|
5
5
|
export const USE_TEST_ADDRESS: boolean = false;
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const ADDRESS_ID =
|
|
8
8
|
IS_VE_SCA_TEST || USE_TEST_ADDRESS
|
|
9
9
|
? ('65fb07c39c845425d71d7b18' as const)
|
|
10
10
|
: ('67c44a103fe1b8c454eb9699' as const);
|
|
@@ -9,10 +9,10 @@ import type { SuiObjectArg, SuiTxArg } from '@scallop-io/sui-kit';
|
|
|
9
9
|
|
|
10
10
|
export const queryKeys = {
|
|
11
11
|
api: {
|
|
12
|
-
getAddresses: (
|
|
12
|
+
getAddresses: (addressId?: string) => [
|
|
13
13
|
'api',
|
|
14
14
|
'getAddresses',
|
|
15
|
-
{
|
|
15
|
+
{ addressId },
|
|
16
16
|
],
|
|
17
17
|
getMarket: () => ['api', 'getMarket'],
|
|
18
18
|
getSpools: () => ['api', 'getSpools'],
|
package/src/models/scallop.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ScallopClient } from './scallopClient';
|
|
|
4
4
|
import { ScallopBuilder } from './scallopBuilder';
|
|
5
5
|
import { ScallopQuery } from './scallopQuery';
|
|
6
6
|
import { ScallopUtils } from './scallopUtils';
|
|
7
|
-
import {
|
|
7
|
+
import { ADDRESS_ID } from '../constants';
|
|
8
8
|
import type {
|
|
9
9
|
ScallopBuilderParams,
|
|
10
10
|
ScallopClientParams,
|
|
@@ -61,7 +61,7 @@ export class Scallop {
|
|
|
61
61
|
);
|
|
62
62
|
this.address = new ScallopAddress(
|
|
63
63
|
{
|
|
64
|
-
id: params?.
|
|
64
|
+
id: params?.addressId ?? ADDRESS_ID,
|
|
65
65
|
network: params?.networkType,
|
|
66
66
|
forceInterface: params?.forceAddressesInterface,
|
|
67
67
|
},
|
|
@@ -642,12 +642,12 @@ export class ScallopAddress {
|
|
|
642
642
|
* @return All addresses.
|
|
643
643
|
*/
|
|
644
644
|
public async read(id?: string) {
|
|
645
|
-
const
|
|
646
|
-
if (
|
|
645
|
+
const addressId = id || this._id || undefined;
|
|
646
|
+
if (addressId !== undefined) {
|
|
647
647
|
const response = await this.cache.queryClient.fetchQuery({
|
|
648
|
-
queryKey: queryKeys.api.getAddresses(
|
|
648
|
+
queryKey: queryKeys.api.getAddresses(addressId),
|
|
649
649
|
queryFn: async () => {
|
|
650
|
-
return await this._requestClient.get(`/addresses/${
|
|
650
|
+
return await this._requestClient.get(`/addresses/${addressId}`, {
|
|
651
651
|
headers: {
|
|
652
652
|
'Content-Type': 'application/json',
|
|
653
653
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeSuiAddress } from '@mysten/sui/utils';
|
|
2
2
|
import { SuiKit } from '@scallop-io/sui-kit';
|
|
3
|
-
import {
|
|
3
|
+
import { ADDRESS_ID } from '../constants';
|
|
4
4
|
import { newScallopTxBlock } from '../builders';
|
|
5
5
|
import { ScallopAddress } from './scallopAddress';
|
|
6
6
|
import { ScallopQuery } from './scallopQuery';
|
|
@@ -70,7 +70,7 @@ export class ScallopBuilder {
|
|
|
70
70
|
});
|
|
71
71
|
this.address = new ScallopAddress(
|
|
72
72
|
{
|
|
73
|
-
id: params?.
|
|
73
|
+
id: params?.addressId ?? ADDRESS_ID,
|
|
74
74
|
network: params?.networkType,
|
|
75
75
|
forceInterface: params?.forceAddressesInterface,
|
|
76
76
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeSuiAddress } from '@mysten/sui/utils';
|
|
2
2
|
import { SuiKit } from '@scallop-io/sui-kit';
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
ADDRESS_ID,
|
|
5
5
|
SUPPORT_BORROW_INCENTIVE_POOLS,
|
|
6
6
|
SUPPORT_SCOIN,
|
|
7
7
|
SUPPORT_SPOOLS,
|
|
@@ -79,7 +79,7 @@ export class ScallopClient {
|
|
|
79
79
|
});
|
|
80
80
|
this.address = new ScallopAddress(
|
|
81
81
|
{
|
|
82
|
-
id: params?.
|
|
82
|
+
id: params?.addressId ?? ADDRESS_ID,
|
|
83
83
|
network: params?.networkType,
|
|
84
84
|
forceInterface: params?.forceAddressesInterface,
|
|
85
85
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuiKit, SuiObjectArg } from '@scallop-io/sui-kit';
|
|
2
|
-
import {
|
|
2
|
+
import { ADDRESS_ID, SUPPORT_POOLS, SUPPORT_SPOOLS } from '../constants';
|
|
3
3
|
import {
|
|
4
4
|
queryMarket,
|
|
5
5
|
getObligations,
|
|
@@ -117,7 +117,7 @@ export class ScallopQuery {
|
|
|
117
117
|
});
|
|
118
118
|
this.address = new ScallopAddress(
|
|
119
119
|
{
|
|
120
|
-
id: params?.
|
|
120
|
+
id: params?.addressId ?? ADDRESS_ID,
|
|
121
121
|
network: params?.networkType,
|
|
122
122
|
forceInterface: params?.forceAddressesInterface,
|
|
123
123
|
},
|
|
@@ -3,7 +3,7 @@ import { SuiKit } from '@scallop-io/sui-kit';
|
|
|
3
3
|
import { SuiPriceServiceConnection } from '@pythnetwork/pyth-sui-js';
|
|
4
4
|
import { ScallopAddress } from './scallopAddress';
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
ADDRESS_ID,
|
|
7
7
|
PROTOCOL_OBJECT_ID,
|
|
8
8
|
SUPPORT_POOLS,
|
|
9
9
|
SUPPORT_COLLATERALS,
|
|
@@ -96,7 +96,7 @@ export class ScallopUtils {
|
|
|
96
96
|
instance?.address ??
|
|
97
97
|
new ScallopAddress(
|
|
98
98
|
{
|
|
99
|
-
id: params?.
|
|
99
|
+
id: params?.addressId ?? ADDRESS_ID,
|
|
100
100
|
network: params?.networkType,
|
|
101
101
|
forceInterface: params?.forceAddressesInterface,
|
|
102
102
|
},
|
package/src/types/model.ts
CHANGED