@scallop-io/sui-scallop-sdk 2.0.13-merge-split-ve-sca-alpha.5 → 2.1.0-alpha.1
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 +622 -697
- package/dist/index.d.ts +622 -697
- package/dist/index.js +32 -33
- package/dist/index.mjs +10 -10
- package/package.json +8 -18
- package/src/builders/borrowIncentiveBuilder.ts +9 -21
- package/src/builders/coreBuilder.ts +2 -2
- package/src/builders/index.ts +2 -2
- package/src/builders/oracles/index.ts +2 -3
- package/src/builders/oracles/pyth.ts +2 -2
- package/src/builders/spoolBuilder.ts +2 -2
- package/src/builders/vescaBuilder.ts +14 -132
- package/src/constants/queryKeys.ts +29 -54
- package/src/constants/testAddress.ts +6 -12
- package/src/index.ts +11 -1
- package/src/models/index.ts +11 -9
- package/src/models/interface.ts +36 -0
- package/src/models/scallop.ts +38 -133
- package/src/models/scallopAddress.ts +127 -142
- package/src/models/scallopAxios.ts +185 -0
- package/src/models/scallopBuilder.ts +45 -75
- package/src/models/scallopClient.ts +124 -154
- package/src/models/scallopConstants.ts +248 -323
- package/src/models/scallopIndexer.ts +54 -98
- package/src/models/scallopQuery.ts +145 -190
- package/src/models/scallopQueryClient.ts +29 -0
- package/src/models/scallopSuiKit.ts +432 -0
- package/src/models/scallopUtils.ts +260 -164
- package/src/queries/borrowIncentiveQuery.ts +28 -16
- package/src/queries/borrowLimitQuery.ts +1 -1
- package/src/queries/coreQuery.ts +148 -107
- package/src/queries/flashloanFeeQuery.ts +12 -6
- package/src/queries/index.ts +0 -1
- package/src/queries/isolatedAssetQuery.ts +3 -3
- package/src/queries/loyaltyProgramQuery.ts +10 -8
- package/src/queries/ownerQuery.ts +32 -0
- package/src/queries/portfolioQuery.ts +4 -5
- package/src/queries/priceQuery.ts +14 -8
- package/src/queries/referralQuery.ts +9 -3
- package/src/queries/sCoinQuery.ts +4 -4
- package/src/queries/spoolQuery.ts +11 -11
- package/src/queries/supplyLimitQuery.ts +1 -1
- package/src/queries/switchboardQuery.ts +1 -1
- package/src/queries/vescaQuery.ts +31 -27
- package/src/queries/xOracleQuery.ts +13 -8
- package/src/types/address.ts +0 -3
- package/src/types/builder/core.ts +1 -1
- package/src/types/builder/vesca.ts +10 -20
- package/src/types/constant/queryKeys.ts +48 -0
- package/src/types/index.ts +0 -1
- package/src/utils/builder.ts +1 -1
- package/src/utils/util.ts +1 -33
- package/src/models/scallopCache.ts +0 -428
- package/src/queries/objectsQuery.ts +0 -18
- package/src/types/model.ts +0 -117
package/src/models/index.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
1
|
+
export { default as Scallop } from './scallop';
|
|
2
|
+
export { default as ScallopClient } from './scallopClient';
|
|
3
|
+
export { default as ScallopBuilder } from './scallopBuilder';
|
|
4
|
+
export { default as ScallopAddress } from './scallopAddress';
|
|
5
|
+
export { default as ScallopAxios } from './scallopAxios';
|
|
6
|
+
export { default as ScallopConstants } from './scallopConstants';
|
|
7
|
+
export { default as ScallopIndexer } from './scallopIndexer';
|
|
8
|
+
export { default as ScallopQuery } from './scallopQuery';
|
|
9
|
+
export { default as ScallopQueryClient } from '../models/scallopQueryClient';
|
|
10
|
+
export { default as ScallopUtils } from './scallopUtils';
|
|
11
|
+
export { default as ScallopSuiKit } from './scallopSuiKit';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import ScallopAddress from './scallopAddress';
|
|
2
|
+
import ScallopBuilder from './scallopBuilder';
|
|
3
|
+
import ScallopConstants from './scallopConstants';
|
|
4
|
+
import ScallopQuery from './scallopQuery';
|
|
5
|
+
import ScallopSuiKit from './scallopSuiKit';
|
|
6
|
+
import ScallopUtils from './scallopUtils';
|
|
7
|
+
|
|
8
|
+
interface ScallopBaseInterface {
|
|
9
|
+
scallopSuiKit: ScallopSuiKit;
|
|
10
|
+
constants: ScallopConstants;
|
|
11
|
+
walletAddress: string;
|
|
12
|
+
init: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ScallopUtilsInterface extends ScallopBaseInterface {
|
|
16
|
+
address: ScallopAddress;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ScallopQueryInterface extends ScallopUtilsInterface {
|
|
20
|
+
utils: ScallopUtils;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface ScallopBuilderInterface extends ScallopQueryInterface {
|
|
24
|
+
query: ScallopQuery;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ScallopClientInterface extends ScallopBaseInterface {
|
|
28
|
+
builder: ScallopBuilder;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type {
|
|
32
|
+
ScallopUtilsInterface,
|
|
33
|
+
ScallopQueryInterface,
|
|
34
|
+
ScallopBuilderInterface,
|
|
35
|
+
ScallopClientInterface,
|
|
36
|
+
};
|
package/src/models/scallop.ts
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ScallopAddress } from './scallopAddress';
|
|
3
|
-
import { ScallopClient } from './scallopClient';
|
|
4
|
-
import { ScallopBuilder } from './scallopBuilder';
|
|
5
|
-
import { ScallopQuery } from './scallopQuery';
|
|
6
|
-
import { ScallopUtils } from './scallopUtils';
|
|
7
|
-
import type {
|
|
8
|
-
ScallopBuilderParams,
|
|
9
|
-
ScallopClientParams,
|
|
10
|
-
ScallopConstantsParams,
|
|
11
|
-
ScallopParams,
|
|
12
|
-
ScallopQueryParams,
|
|
13
|
-
ScallopUtilsParams,
|
|
14
|
-
} from 'src/types';
|
|
15
|
-
import { ScallopIndexer } from './scallopIndexer';
|
|
16
|
-
import { ScallopCache } from './scallopCache';
|
|
17
|
-
import { QueryClientConfig } from '@tanstack/query-core';
|
|
18
|
-
import { newSuiKit } from './suiKit';
|
|
19
|
-
import { ScallopConstants } from './scallopConstants';
|
|
20
|
-
import type { QueryClient } from '@tanstack/query-core';
|
|
1
|
+
import ScallopClient, { ScallopClientParams } from './scallopClient';
|
|
21
2
|
|
|
22
3
|
/**
|
|
23
4
|
* @argument params - The parameters for the Scallop instance.
|
|
@@ -36,65 +17,28 @@ import type { QueryClient } from '@tanstack/query-core';
|
|
|
36
17
|
* const scallopUtils= await sdk.createScallopUtils();
|
|
37
18
|
* ```
|
|
38
19
|
*/
|
|
39
|
-
export class Scallop {
|
|
40
|
-
public params: ScallopParams;
|
|
41
|
-
public suiKit: SuiKit;
|
|
42
|
-
public cache: ScallopCache;
|
|
43
20
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
) {
|
|
52
|
-
this.params = params;
|
|
53
|
-
this.suiKit = newSuiKit(params);
|
|
54
|
-
this.cache = new ScallopCache(
|
|
55
|
-
{
|
|
56
|
-
...this.params,
|
|
57
|
-
cacheOptions,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
suiKit: this.suiKit,
|
|
61
|
-
queryClient,
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
this.address = new ScallopAddress(params, {
|
|
66
|
-
cache: this.cache,
|
|
67
|
-
});
|
|
68
|
-
this.constants = new ScallopConstants(params, { address: this.address });
|
|
21
|
+
export type ScallopParams = {
|
|
22
|
+
client?: ScallopClient;
|
|
23
|
+
} & ScallopClientParams;
|
|
24
|
+
class Scallop {
|
|
25
|
+
public readonly client: ScallopClient;
|
|
26
|
+
public constructor(params: ScallopParams) {
|
|
27
|
+
this.client = params.client ?? new ScallopClient(params);
|
|
69
28
|
}
|
|
70
29
|
|
|
71
|
-
|
|
72
|
-
|
|
30
|
+
async init(force: boolean = false) {
|
|
31
|
+
await this.client.init(force);
|
|
73
32
|
}
|
|
74
33
|
|
|
75
34
|
/**
|
|
76
|
-
*
|
|
35
|
+
* Create a scallop client instance that already has initial data.
|
|
77
36
|
*
|
|
78
|
-
* @
|
|
79
|
-
* @return Scallop Address.
|
|
80
|
-
*/
|
|
81
|
-
public async getScallopAddress(id: string = this.params.addressId) {
|
|
82
|
-
await this.address.read(id);
|
|
83
|
-
|
|
84
|
-
return this.address;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Get a scallop constants instance that already has initial data.
|
|
89
|
-
* @returns Scallop Constants
|
|
37
|
+
* @return Scallop Client.
|
|
90
38
|
*/
|
|
91
|
-
|
|
92
|
-
await this.
|
|
93
|
-
|
|
94
|
-
...params,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
return this.constants;
|
|
39
|
+
async createScallopClient() {
|
|
40
|
+
await this.init();
|
|
41
|
+
return this.client;
|
|
98
42
|
}
|
|
99
43
|
|
|
100
44
|
/**
|
|
@@ -102,55 +46,29 @@ export class Scallop {
|
|
|
102
46
|
*
|
|
103
47
|
* @return Scallop Builder.
|
|
104
48
|
*/
|
|
105
|
-
|
|
106
|
-
await this.
|
|
107
|
-
|
|
108
|
-
...this.params,
|
|
109
|
-
...params,
|
|
110
|
-
};
|
|
111
|
-
const scallopBuilder = new ScallopBuilder(builderParams, {
|
|
112
|
-
query: await this.createScallopQuery(builderParams),
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
return scallopBuilder;
|
|
49
|
+
async createScallopBuilder() {
|
|
50
|
+
await this.init();
|
|
51
|
+
return this.client.builder;
|
|
116
52
|
}
|
|
117
53
|
|
|
118
54
|
/**
|
|
119
|
-
* Create a scallop
|
|
55
|
+
* Create a scallop query instance.
|
|
120
56
|
*
|
|
121
|
-
* @
|
|
122
|
-
* @return Scallop Client.
|
|
57
|
+
* @return Scallop Query.
|
|
123
58
|
*/
|
|
124
|
-
|
|
125
|
-
await this.
|
|
126
|
-
|
|
127
|
-
...this.params,
|
|
128
|
-
...params,
|
|
129
|
-
};
|
|
130
|
-
const scallopClient = new ScallopClient(clientParams, {
|
|
131
|
-
builder: await this.createScallopBuilder(clientParams),
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
return scallopClient;
|
|
59
|
+
async createScallopQuery() {
|
|
60
|
+
await this.init();
|
|
61
|
+
return this.client.query;
|
|
135
62
|
}
|
|
136
63
|
|
|
137
64
|
/**
|
|
138
|
-
* Create a scallop
|
|
65
|
+
* Create a scallop utils instance.
|
|
139
66
|
*
|
|
140
|
-
* @return Scallop
|
|
67
|
+
* @return Scallop Utils.
|
|
141
68
|
*/
|
|
142
|
-
|
|
143
|
-
await this.
|
|
144
|
-
|
|
145
|
-
...this.params,
|
|
146
|
-
...params,
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const scallopQuery = new ScallopQuery(queryParams, {
|
|
150
|
-
utils: await this.createScallopUtils(queryParams),
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
return scallopQuery;
|
|
69
|
+
async createScallopUtils() {
|
|
70
|
+
await this.init();
|
|
71
|
+
return this.client.utils;
|
|
154
72
|
}
|
|
155
73
|
|
|
156
74
|
/**
|
|
@@ -158,32 +76,19 @@ export class Scallop {
|
|
|
158
76
|
*
|
|
159
77
|
* @return Scallop Indexer.
|
|
160
78
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
return scallopIndexer;
|
|
79
|
+
async createScallopIndexer() {
|
|
80
|
+
await this.init();
|
|
81
|
+
return this.client.query.indexer;
|
|
167
82
|
}
|
|
168
83
|
|
|
169
84
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* @return Scallop Utils.
|
|
85
|
+
* Get a scallop constants instance that already has initial data.
|
|
86
|
+
* @returns Scallop Constants
|
|
173
87
|
*/
|
|
174
|
-
|
|
175
|
-
await this.
|
|
176
|
-
|
|
177
|
-
{
|
|
178
|
-
...this.params,
|
|
179
|
-
...params,
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
constants: this.constants,
|
|
183
|
-
suiKit: this.suiKit,
|
|
184
|
-
}
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
return scallopUtils;
|
|
88
|
+
async getScallopConstants() {
|
|
89
|
+
await this.init();
|
|
90
|
+
return this.client.constants;
|
|
188
91
|
}
|
|
189
92
|
}
|
|
93
|
+
|
|
94
|
+
export default Scallop;
|