@zofai/zo-sdk 0.2.10 → 0.2.12
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/abstract/BaseAPI.cjs +29 -0
- package/dist/abstract/BaseAPI.cjs.map +1 -1
- package/dist/abstract/BaseAPI.d.cts +8 -3
- package/dist/abstract/BaseAPI.d.cts.map +1 -1
- package/dist/abstract/BaseAPI.d.mts +8 -3
- package/dist/abstract/BaseAPI.d.mts.map +1 -1
- package/dist/abstract/BaseAPI.mjs +29 -0
- package/dist/abstract/BaseAPI.mjs.map +1 -1
- package/dist/abstract/BaseDataAPI.d.cts +1 -1
- package/dist/abstract/BaseDataAPI.d.cts.map +1 -1
- package/dist/abstract/BaseDataAPI.d.mts +1 -1
- package/dist/abstract/BaseDataAPI.d.mts.map +1 -1
- package/dist/api.cjs +7 -7
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +7 -7
- package/dist/api.mjs.map +1 -1
- package/dist/bcs.d.cts +41 -71
- package/dist/bcs.d.cts.map +1 -1
- package/dist/bcs.d.mts +41 -71
- package/dist/bcs.d.mts.map +1 -1
- package/dist/coins.cjs +6 -0
- package/dist/coins.cjs.map +1 -1
- package/dist/coins.d.cts +3 -1
- package/dist/coins.d.cts.map +1 -1
- package/dist/coins.d.mts +3 -1
- package/dist/coins.d.mts.map +1 -1
- package/dist/coins.mjs +5 -0
- package/dist/coins.mjs.map +1 -1
- package/dist/data.d.cts +6 -6
- package/dist/data.d.cts.map +1 -1
- package/dist/data.d.mts +6 -6
- package/dist/data.d.mts.map +1 -1
- package/dist/factory/SDKFactory.d.cts +1 -1
- package/dist/factory/SDKFactory.d.cts.map +1 -1
- package/dist/factory/SDKFactory.d.mts +1 -1
- package/dist/factory/SDKFactory.d.mts.map +1 -1
- package/dist/implementations/SLPAPI.cjs +6 -8
- package/dist/implementations/SLPAPI.cjs.map +1 -1
- package/dist/implementations/SLPAPI.d.cts +1 -1
- package/dist/implementations/SLPAPI.d.cts.map +1 -1
- package/dist/implementations/SLPAPI.d.mts +1 -1
- package/dist/implementations/SLPAPI.d.mts.map +1 -1
- package/dist/implementations/SLPAPI.mjs +6 -8
- package/dist/implementations/SLPAPI.mjs.map +1 -1
- package/dist/implementations/SLPDataAPI.cjs.map +1 -1
- package/dist/implementations/SLPDataAPI.d.cts +5 -5
- package/dist/implementations/SLPDataAPI.d.cts.map +1 -1
- package/dist/implementations/SLPDataAPI.d.mts +5 -5
- package/dist/implementations/SLPDataAPI.d.mts.map +1 -1
- package/dist/implementations/SLPDataAPI.mjs.map +1 -1
- package/dist/implementations/USDZAPI.cjs +6 -8
- package/dist/implementations/USDZAPI.cjs.map +1 -1
- package/dist/implementations/USDZAPI.d.cts +1 -1
- package/dist/implementations/USDZAPI.d.cts.map +1 -1
- package/dist/implementations/USDZAPI.d.mts +1 -1
- package/dist/implementations/USDZAPI.d.mts.map +1 -1
- package/dist/implementations/USDZAPI.mjs +6 -8
- package/dist/implementations/USDZAPI.mjs.map +1 -1
- package/dist/implementations/USDZDataAPI.d.cts +5 -5
- package/dist/implementations/USDZDataAPI.d.cts.map +1 -1
- package/dist/implementations/USDZDataAPI.d.mts +5 -5
- package/dist/implementations/USDZDataAPI.d.mts.map +1 -1
- package/dist/implementations/ZBTCVCAPI.cjs.map +1 -1
- package/dist/implementations/ZBTCVCAPI.d.cts +1 -1
- package/dist/implementations/ZBTCVCAPI.d.cts.map +1 -1
- package/dist/implementations/ZBTCVCAPI.d.mts +1 -1
- package/dist/implementations/ZBTCVCAPI.d.mts.map +1 -1
- package/dist/implementations/ZBTCVCAPI.mjs.map +1 -1
- package/dist/implementations/ZBTCVCDataAPI.cjs.map +1 -1
- package/dist/implementations/ZBTCVCDataAPI.d.cts +5 -5
- package/dist/implementations/ZBTCVCDataAPI.d.cts.map +1 -1
- package/dist/implementations/ZBTCVCDataAPI.d.mts +5 -5
- package/dist/implementations/ZBTCVCDataAPI.d.mts.map +1 -1
- package/dist/implementations/ZBTCVCDataAPI.mjs.map +1 -1
- package/dist/implementations/ZLPAPI.cjs +6 -8
- package/dist/implementations/ZLPAPI.cjs.map +1 -1
- package/dist/implementations/ZLPAPI.d.cts +1 -1
- package/dist/implementations/ZLPAPI.d.cts.map +1 -1
- package/dist/implementations/ZLPAPI.d.mts +1 -1
- package/dist/implementations/ZLPAPI.d.mts.map +1 -1
- package/dist/implementations/ZLPAPI.mjs +6 -8
- package/dist/implementations/ZLPAPI.mjs.map +1 -1
- package/dist/implementations/ZLPDataAPI.cjs.map +1 -1
- package/dist/implementations/ZLPDataAPI.d.cts +5 -5
- package/dist/implementations/ZLPDataAPI.d.cts.map +1 -1
- package/dist/implementations/ZLPDataAPI.d.mts +5 -5
- package/dist/implementations/ZLPDataAPI.d.mts.map +1 -1
- package/dist/implementations/ZLPDataAPI.mjs.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/interfaces/base.d.cts +2 -2
- package/dist/interfaces/base.d.cts.map +1 -1
- package/dist/interfaces/base.d.mts +2 -2
- package/dist/interfaces/base.d.mts.map +1 -1
- package/dist/oracle.cjs.map +1 -1
- package/dist/oracle.d.cts +1 -1
- package/dist/oracle.d.cts.map +1 -1
- package/dist/oracle.d.mts +1 -1
- package/dist/oracle.d.mts.map +1 -1
- package/dist/oracle.mjs.map +1 -1
- package/dist/suiClient.cjs +8 -0
- package/dist/suiClient.cjs.map +1 -0
- package/dist/suiClient.d.cts +8 -0
- package/dist/suiClient.d.cts.map +1 -0
- package/dist/suiClient.d.mts +8 -0
- package/dist/suiClient.d.mts.map +1 -0
- package/dist/suiClient.mjs +2 -0
- package/dist/suiClient.mjs.map +1 -0
- package/dist/utils.cjs +7 -3
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts +2 -2
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +7 -3
- package/dist/utils.mjs.map +1 -1
- package/package.json +4 -4
- package/src/abstract/BaseAPI.ts +52 -1
- package/src/abstract/BaseDataAPI.ts +1 -1
- package/src/api.ts +8 -12
- package/src/coins.ts +13 -1
- package/src/data.ts +1 -1
- package/src/factory/SDKFactory.ts +1 -1
- package/src/implementations/SLPAPI.ts +13 -13
- package/src/implementations/SLPDataAPI.ts +1 -1
- package/src/implementations/USDZAPI.ts +13 -13
- package/src/implementations/USDZDataAPI.ts +1 -1
- package/src/implementations/ZBTCVCAPI.ts +1 -1
- package/src/implementations/ZBTCVCDataAPI.ts +1 -1
- package/src/implementations/ZLPAPI.ts +13 -13
- package/src/implementations/ZLPDataAPI.ts +1 -1
- package/src/index.ts +2 -1
- package/src/interfaces/base.ts +2 -1
- package/src/oracle.ts +6 -2
- package/src/suiClient.ts +11 -0
- package/src/utils.ts +9 -3
- package/tsconfig.json +8 -1
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
|
|
7
7
|
import { KioskTransaction } from '@mysten/kiosk'
|
|
8
|
-
import type { SuiClient } from '@mysten/sui/client'
|
|
9
8
|
import type { TransactionObjectArgument } from '@mysten/sui/transactions'
|
|
10
9
|
import { Transaction } from '@mysten/sui/transactions'
|
|
11
10
|
import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
|
|
@@ -18,6 +17,7 @@ import type {
|
|
|
18
17
|
ISLPAPI,
|
|
19
18
|
ISLPCredential,
|
|
20
19
|
} from '../interfaces'
|
|
20
|
+
import type { SuiClient } from '../suiClient'
|
|
21
21
|
import { joinSymbol } from '../utils'
|
|
22
22
|
import { SLPDataAPI } from './SLPDataAPI'
|
|
23
23
|
|
|
@@ -1166,8 +1166,8 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
|
|
|
1166
1166
|
sponsoredTx?: boolean,
|
|
1167
1167
|
sender?: string,
|
|
1168
1168
|
): Promise<Transaction> {
|
|
1169
|
-
if (!coinObjects) {
|
|
1170
|
-
throw new Error(`${this.constructor.name}: coinObjects is required`)
|
|
1169
|
+
if (!coinObjects?.length && !sender) {
|
|
1170
|
+
throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
|
|
1171
1171
|
}
|
|
1172
1172
|
|
|
1173
1173
|
let tx = new Transaction()
|
|
@@ -1198,14 +1198,14 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
|
|
|
1198
1198
|
tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
|
|
1199
1199
|
}
|
|
1200
1200
|
|
|
1201
|
-
|
|
1202
|
-
const [feeObject] = this.processCoinSplitting(
|
|
1201
|
+
const feeObject = await this.resolveRelayerFeeObject(
|
|
1203
1202
|
tx,
|
|
1204
1203
|
collateralToken,
|
|
1205
|
-
coinObjects,
|
|
1206
|
-
|
|
1204
|
+
coinObjects ?? [],
|
|
1205
|
+
relayerFee,
|
|
1207
1206
|
sponsoredTx,
|
|
1208
1207
|
suiCoinObject,
|
|
1208
|
+
sender,
|
|
1209
1209
|
)
|
|
1210
1210
|
|
|
1211
1211
|
tx.moveCall({
|
|
@@ -2334,8 +2334,8 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
|
|
|
2334
2334
|
sponsoredTx?: boolean,
|
|
2335
2335
|
sender?: string,
|
|
2336
2336
|
): Promise<Transaction> {
|
|
2337
|
-
if (!coinObjects) {
|
|
2338
|
-
throw new Error(`${this.constructor.name}: coinObjects is required`)
|
|
2337
|
+
if (!coinObjects?.length && !sender) {
|
|
2338
|
+
throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
|
|
2339
2339
|
}
|
|
2340
2340
|
|
|
2341
2341
|
let tx = new Transaction()
|
|
@@ -2377,14 +2377,14 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
|
|
|
2377
2377
|
tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
|
|
2378
2378
|
}
|
|
2379
2379
|
|
|
2380
|
-
|
|
2381
|
-
const [feeObject] = this.processCoinSplitting(
|
|
2380
|
+
const feeObject = await this.resolveRelayerFeeObject(
|
|
2382
2381
|
tx,
|
|
2383
2382
|
collateralToken,
|
|
2384
|
-
coinObjects,
|
|
2385
|
-
|
|
2383
|
+
coinObjects ?? [],
|
|
2384
|
+
relayerFee,
|
|
2386
2385
|
sponsoredTx,
|
|
2387
2386
|
suiCoinObject,
|
|
2387
|
+
sender,
|
|
2388
2388
|
)
|
|
2389
2389
|
|
|
2390
2390
|
tx.moveCall({
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* Implements SLP-specific data access methods for Sudo SDK
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { DynamicFieldInfo, SuiClient } from '@mysten/sui/client'
|
|
10
9
|
import { Transaction } from '@mysten/sui/transactions'
|
|
11
10
|
import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
|
|
12
11
|
|
|
@@ -39,6 +38,7 @@ import type {
|
|
|
39
38
|
ISLPVaultInfo,
|
|
40
39
|
ISwapFeeBreakdown,
|
|
41
40
|
} from '../interfaces'
|
|
41
|
+
import type { DynamicFieldInfo, SuiClient } from '../suiClient'
|
|
42
42
|
import { joinSymbol, parseSymbolKey, parseValue, suiSymbolToSymbol } from '../utils'
|
|
43
43
|
|
|
44
44
|
export interface GetCumulativeAprResponse {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
|
|
7
7
|
import { KioskTransaction } from '@mysten/kiosk'
|
|
8
|
-
import type { SuiClient } from '@mysten/sui/client'
|
|
9
8
|
import type { TransactionObjectArgument } from '@mysten/sui/transactions'
|
|
10
9
|
import { Transaction } from '@mysten/sui/transactions'
|
|
11
10
|
import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
|
|
@@ -18,6 +17,7 @@ import type {
|
|
|
18
17
|
IUSDZAPI,
|
|
19
18
|
IUSDZCredential,
|
|
20
19
|
} from '../interfaces'
|
|
20
|
+
import type { SuiClient } from '../suiClient'
|
|
21
21
|
import { joinSymbol } from '../utils'
|
|
22
22
|
import { USDZDataAPI } from './USDZDataAPI'
|
|
23
23
|
|
|
@@ -828,8 +828,8 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
828
828
|
sponsoredTx?: boolean,
|
|
829
829
|
sender?: string,
|
|
830
830
|
): Promise<Transaction> {
|
|
831
|
-
if (!coinObjects) {
|
|
832
|
-
throw new Error(`${this.constructor.name}: coinObjects is required`)
|
|
831
|
+
if (!coinObjects?.length && !sender) {
|
|
832
|
+
throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
let tx = new Transaction()
|
|
@@ -871,14 +871,14 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
871
871
|
tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
|
|
872
872
|
}
|
|
873
873
|
|
|
874
|
-
|
|
875
|
-
const [feeObject] = this.processCoinSplitting(
|
|
874
|
+
const feeObject = await this.resolveRelayerFeeObject(
|
|
876
875
|
tx,
|
|
877
876
|
collateralToken,
|
|
878
|
-
coinObjects,
|
|
879
|
-
|
|
877
|
+
coinObjects ?? [],
|
|
878
|
+
relayerFee,
|
|
880
879
|
sponsoredTx,
|
|
881
880
|
suiCoinObject,
|
|
881
|
+
sender,
|
|
882
882
|
)
|
|
883
883
|
|
|
884
884
|
tx.moveCall({
|
|
@@ -2022,8 +2022,8 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2022
2022
|
sponsoredTx?: boolean,
|
|
2023
2023
|
sender?: string,
|
|
2024
2024
|
): Promise<Transaction> {
|
|
2025
|
-
if (!coinObjects) {
|
|
2026
|
-
throw new Error(`${this.constructor.name}: coinObjects is required`)
|
|
2025
|
+
if (!coinObjects?.length && !sender) {
|
|
2026
|
+
throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
|
|
2027
2027
|
}
|
|
2028
2028
|
|
|
2029
2029
|
let tx = new Transaction()
|
|
@@ -2054,14 +2054,14 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2054
2054
|
tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
|
|
2055
2055
|
}
|
|
2056
2056
|
|
|
2057
|
-
|
|
2058
|
-
const [feeObject] = this.processCoinSplitting(
|
|
2057
|
+
const feeObject = await this.resolveRelayerFeeObject(
|
|
2059
2058
|
tx,
|
|
2060
2059
|
collateralToken,
|
|
2061
|
-
coinObjects,
|
|
2062
|
-
|
|
2060
|
+
coinObjects ?? [],
|
|
2061
|
+
relayerFee,
|
|
2063
2062
|
sponsoredTx,
|
|
2064
2063
|
suiCoinObject,
|
|
2064
|
+
sender,
|
|
2065
2065
|
)
|
|
2066
2066
|
|
|
2067
2067
|
tx.moveCall({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements USDZ-specific data access methods
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { DynamicFieldInfo, SuiClient } from '
|
|
7
|
+
import type { DynamicFieldInfo, SuiClient } from '../suiClient'
|
|
8
8
|
import type { Transaction } from '@mysten/sui/transactions'
|
|
9
9
|
import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
|
|
10
10
|
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
|
|
7
7
|
import { KioskTransaction } from '@mysten/kiosk'
|
|
8
|
-
import type { SuiClient } from '@mysten/sui/client'
|
|
9
8
|
import { Transaction } from '@mysten/sui/transactions'
|
|
10
9
|
import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
|
|
11
10
|
|
|
@@ -17,6 +16,7 @@ import type {
|
|
|
17
16
|
IZBTCVCAPI,
|
|
18
17
|
IZBTCVCCredential,
|
|
19
18
|
} from '../interfaces'
|
|
19
|
+
import type { SuiClient } from '../suiClient'
|
|
20
20
|
import { joinSymbol } from '../utils'
|
|
21
21
|
import { ZBTCVCDataAPI } from './ZBTCVCDataAPI'
|
|
22
22
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Implements ZBTCVC-specific data access methods
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { DynamicFieldInfo, SuiClient } from '@mysten/sui/client'
|
|
8
7
|
import type { Transaction } from '@mysten/sui/transactions'
|
|
9
8
|
import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
|
|
10
9
|
|
|
@@ -31,6 +30,7 @@ import type {
|
|
|
31
30
|
IZBTCVCSymbolInfo,
|
|
32
31
|
IZBTCVCVaultInfo,
|
|
33
32
|
} from '../interfaces'
|
|
33
|
+
import type { DynamicFieldInfo, SuiClient } from '../suiClient'
|
|
34
34
|
import { joinSymbol, parseSymbolKey, parseValue, suiSymbolToSymbol } from '../utils'
|
|
35
35
|
|
|
36
36
|
export class ZBTCVCDataAPI extends BaseDataAPI implements IZBTCVCDataAPI {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
|
|
7
7
|
import { KioskTransaction } from '@mysten/kiosk'
|
|
8
|
-
import type { SuiClient } from '@mysten/sui/client'
|
|
9
8
|
import type { TransactionObjectArgument } from '@mysten/sui/transactions'
|
|
10
9
|
import { Transaction } from '@mysten/sui/transactions'
|
|
11
10
|
import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
|
|
@@ -18,6 +17,7 @@ import type {
|
|
|
18
17
|
IZLPAPI,
|
|
19
18
|
IZLPCredential,
|
|
20
19
|
} from '../interfaces'
|
|
20
|
+
import type { SuiClient } from '../suiClient'
|
|
21
21
|
import { joinSymbol } from '../utils'
|
|
22
22
|
import { ZLPDataAPI } from './ZLPDataAPI'
|
|
23
23
|
|
|
@@ -1147,8 +1147,8 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
|
|
|
1147
1147
|
sponsoredTx?: boolean,
|
|
1148
1148
|
sender?: string,
|
|
1149
1149
|
): Promise<Transaction> {
|
|
1150
|
-
if (!coinObjects) {
|
|
1151
|
-
throw new Error(`${this.constructor.name}: coinObjects is required`)
|
|
1150
|
+
if (!coinObjects?.length && !sender) {
|
|
1151
|
+
throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
1154
1154
|
let tx = new Transaction()
|
|
@@ -1179,14 +1179,14 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
|
|
|
1179
1179
|
tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
|
|
1180
1180
|
}
|
|
1181
1181
|
|
|
1182
|
-
|
|
1183
|
-
const [feeObject] = this.processCoinSplitting(
|
|
1182
|
+
const feeObject = await this.resolveRelayerFeeObject(
|
|
1184
1183
|
tx,
|
|
1185
1184
|
collateralToken,
|
|
1186
|
-
coinObjects,
|
|
1187
|
-
|
|
1185
|
+
coinObjects ?? [],
|
|
1186
|
+
relayerFee,
|
|
1188
1187
|
sponsoredTx,
|
|
1189
1188
|
suiCoinObject,
|
|
1189
|
+
sender,
|
|
1190
1190
|
)
|
|
1191
1191
|
|
|
1192
1192
|
tx.moveCall({
|
|
@@ -1983,8 +1983,8 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
|
|
|
1983
1983
|
sponsoredTx?: boolean,
|
|
1984
1984
|
sender?: string,
|
|
1985
1985
|
): Promise<Transaction> {
|
|
1986
|
-
if (!coinObjects) {
|
|
1987
|
-
throw new Error(`${this.constructor.name}: coinObjects is required`)
|
|
1986
|
+
if (!coinObjects?.length && !sender) {
|
|
1987
|
+
throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
|
|
1988
1988
|
}
|
|
1989
1989
|
|
|
1990
1990
|
let tx = new Transaction()
|
|
@@ -2026,14 +2026,14 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
|
|
|
2026
2026
|
tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
|
|
2027
2027
|
}
|
|
2028
2028
|
|
|
2029
|
-
|
|
2030
|
-
const [feeObject] = this.processCoinSplitting(
|
|
2029
|
+
const feeObject = await this.resolveRelayerFeeObject(
|
|
2031
2030
|
tx,
|
|
2032
2031
|
collateralToken,
|
|
2033
|
-
coinObjects,
|
|
2034
|
-
|
|
2032
|
+
coinObjects ?? [],
|
|
2033
|
+
relayerFee,
|
|
2035
2034
|
sponsoredTx,
|
|
2036
2035
|
suiCoinObject,
|
|
2036
|
+
sender,
|
|
2037
2037
|
)
|
|
2038
2038
|
|
|
2039
2039
|
tx.moveCall({
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Implements ZLP-specific data access methods
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { DynamicFieldInfo, SuiClient } from '@mysten/sui/client'
|
|
8
7
|
import type { Transaction } from '@mysten/sui/transactions'
|
|
9
8
|
import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
|
|
10
9
|
|
|
@@ -36,6 +35,7 @@ import type {
|
|
|
36
35
|
IZLPSymbolInfo,
|
|
37
36
|
IZLPVaultInfo,
|
|
38
37
|
} from '../interfaces'
|
|
38
|
+
import type { DynamicFieldInfo, SuiClient } from '../suiClient'
|
|
39
39
|
import { joinSymbol, parseSymbolKey, parseValue, suiSymbolToSymbol } from '../utils'
|
|
40
40
|
|
|
41
41
|
interface SwapImpactConfig {
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from './abstract'
|
|
|
20
20
|
export * from './factory/SDKFactory'
|
|
21
21
|
export * from './implementations'
|
|
22
22
|
export * from './interfaces'
|
|
23
|
+
export * from './suiClient'
|
|
23
24
|
|
|
24
25
|
// Export legacy components for backward compatibility
|
|
25
26
|
export * from './api'
|
|
@@ -31,7 +32,7 @@ export * from './oracle'
|
|
|
31
32
|
export * from './utils'
|
|
32
33
|
|
|
33
34
|
// Re-export commonly used types from Sui SDK
|
|
34
|
-
export type { SuiClient } from '
|
|
35
|
+
export type { SuiClient } from './suiClient'
|
|
35
36
|
export type { Transaction } from '@mysten/sui/transactions'
|
|
36
37
|
|
|
37
38
|
/**
|
package/src/interfaces/base.ts
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
|
|
7
|
-
import type { SuiClient } from '@mysten/sui/client'
|
|
8
7
|
import type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions'
|
|
9
8
|
import type { PriceFeed } from '@pythnetwork/pyth-sui-js'
|
|
10
9
|
|
|
11
10
|
import type { IConsts, LPToken, Network } from '../consts'
|
|
12
11
|
import type { IInitOracleTxbResult } from '../oracle'
|
|
12
|
+
import type { SuiClient } from '../suiClient'
|
|
13
13
|
|
|
14
14
|
// Common data interfaces
|
|
15
15
|
export interface IBaseMarketValuationInfo {
|
|
@@ -757,6 +757,7 @@ export interface IBaseAPI {
|
|
|
757
757
|
relayerFee?: bigint,
|
|
758
758
|
coinObjects?: string[],
|
|
759
759
|
sponsoredTx?: boolean,
|
|
760
|
+
sender?: string,
|
|
760
761
|
) => Promise<Transaction>
|
|
761
762
|
|
|
762
763
|
decreaseMultiPositionsWithSCardV2?: (
|
package/src/oracle.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SuiClient } from '@mysten/sui/client'
|
|
2
1
|
import type { TransactionObjectArgument } from '@mysten/sui/transactions'
|
|
3
2
|
import { Transaction } from '@mysten/sui/transactions'
|
|
4
3
|
import type { PriceFeed } from '@pythnetwork/pyth-sui-js'
|
|
@@ -7,6 +6,7 @@ import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-
|
|
|
7
6
|
import { resolveSpendableSuiCoin } from './coins'
|
|
8
7
|
import type { IConsts, Network } from './consts'
|
|
9
8
|
import { getConsts, getPriceIdToPythFeeder, getPythFeederToId, getPythFeederToPriceId, getSharedConfig, LPToken } from './consts'
|
|
9
|
+
import type { SuiClient } from './suiClient'
|
|
10
10
|
import { createJsonRpcProvider } from './utils'
|
|
11
11
|
|
|
12
12
|
export interface IInitOracleSponsorOptions {
|
|
@@ -47,7 +47,11 @@ export class OracleAPI {
|
|
|
47
47
|
this.PythFeederToPriceId = getPythFeederToPriceId(network)
|
|
48
48
|
this.PythFeederToId = getPythFeederToId(network)
|
|
49
49
|
this.provider = provider || createJsonRpcProvider(network)
|
|
50
|
-
this.client = new SuiPythClient(
|
|
50
|
+
this.client = new SuiPythClient(
|
|
51
|
+
this.provider as ConstructorParameters<typeof SuiPythClient>[0],
|
|
52
|
+
this.consts.pythFeeder.state,
|
|
53
|
+
this.consts.pythFeeder.wormhole.state,
|
|
54
|
+
)
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
validateCache() {
|
package/src/suiClient.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sui v2 client re-exports.
|
|
3
|
+
* SuiJsonRpcClient is the JSON-RPC replacement for the removed SuiClient.
|
|
4
|
+
*/
|
|
5
|
+
export type { ClientWithCoreApi } from '@mysten/sui/client'
|
|
6
|
+
export type { DynamicFieldInfo, SuiJsonRpcClient as SuiClient } from '@mysten/sui/jsonRpc'
|
|
7
|
+
export {
|
|
8
|
+
getJsonRpcFullnodeUrl,
|
|
9
|
+
JsonRpcHTTPTransport,
|
|
10
|
+
SuiJsonRpcClient,
|
|
11
|
+
} from '@mysten/sui/jsonRpc'
|
package/src/utils.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SuiClientTypes } from '@mysten/sui/client'
|
|
2
|
+
import { JsonRpcHTTPTransport, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'
|
|
2
3
|
|
|
3
4
|
import type { IConsts } from './consts'
|
|
4
5
|
import { Network } from './consts'
|
|
5
6
|
|
|
7
|
+
function toSuiNetwork(network: Network): SuiClientTypes.Network {
|
|
8
|
+
return network
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
export function createJsonRpcProvider(network: Network) {
|
|
7
12
|
let url = ''
|
|
8
13
|
switch (network) {
|
|
@@ -23,8 +28,9 @@ export function createJsonRpcProvider(network: Network) {
|
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
return new
|
|
27
|
-
transport: new
|
|
31
|
+
return new SuiJsonRpcClient({
|
|
32
|
+
transport: new JsonRpcHTTPTransport({ url }),
|
|
33
|
+
network: toSuiNetwork(network),
|
|
28
34
|
})
|
|
29
35
|
}
|
|
30
36
|
|
package/tsconfig.json
CHANGED
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2020",
|
|
4
4
|
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"baseUrl": ".",
|
|
7
|
+
"paths": {
|
|
8
|
+
"@mysten/sui/transactions": ["node_modules/@mysten/sui/dist/transactions/index.d.mts"],
|
|
9
|
+
"@mysten/sui/utils": ["node_modules/@mysten/sui/dist/utils/index.d.mts"],
|
|
10
|
+
"@mysten/sui/jsonRpc": ["node_modules/@mysten/sui/dist/jsonRpc/index.d.mts"],
|
|
11
|
+
"@mysten/sui/client": ["node_modules/@mysten/sui/dist/client/index.d.mts"]
|
|
12
|
+
},
|
|
6
13
|
"esModuleInterop": true,
|
|
7
14
|
"forceConsistentCasingInFileNames": true,
|
|
8
15
|
"strict": true,
|