@scallop-io/sui-scallop-sdk 1.3.4-alpha.5 → 1.3.4-alpha.6

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.
Files changed (126) hide show
  1. package/dist/index.js +96 -96
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +96 -96
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +2 -2
  6. package/src/builders/borrowIncentiveBuilder.ts +8 -8
  7. package/src/builders/coreBuilder.ts +5 -5
  8. package/src/builders/index.ts +2 -2
  9. package/src/builders/oracle.ts +4 -4
  10. package/src/builders/referralBuilder.ts +1 -1
  11. package/src/builders/spoolBuilder.ts +6 -6
  12. package/src/builders/vescaBuilder.ts +4 -4
  13. package/src/constants/coinGecko.ts +1 -1
  14. package/src/constants/enum.ts +1 -1
  15. package/src/constants/index.ts +1 -1
  16. package/src/models/scallop.ts +5 -5
  17. package/src/models/scallopAddress.ts +6 -9
  18. package/src/models/scallopBuilder.ts +5 -4
  19. package/src/models/scallopCache.ts +4 -4
  20. package/src/models/scallopClient.ts +4 -4
  21. package/src/models/scallopIndexer.ts +4 -3
  22. package/src/models/scallopQuery.ts +4 -8
  23. package/src/models/scallopUtils.ts +8 -11
  24. package/src/models/suiKit.ts +1 -1
  25. package/src/queries/borrowIncentiveQuery.ts +5 -5
  26. package/src/queries/coreQuery.ts +4 -4
  27. package/src/queries/isolatedAssetQuery.ts +2 -2
  28. package/src/queries/portfolioQuery.ts +4 -4
  29. package/src/queries/priceQuery.ts +2 -2
  30. package/src/queries/spoolQuery.ts +5 -5
  31. package/src/queries/supplyLimitQuery.ts +2 -2
  32. package/src/queries/vescaQuery.ts +2 -2
  33. package/src/types/address.ts +1 -1
  34. package/src/types/builder/borrowIncentive.ts +3 -3
  35. package/src/types/builder/core.ts +3 -3
  36. package/src/types/builder/index.ts +4 -5
  37. package/src/types/builder/referral.ts +1 -1
  38. package/src/types/builder/sCoin.ts +1 -1
  39. package/src/types/builder/spool.ts +2 -2
  40. package/src/types/constant/common.ts +1 -1
  41. package/src/types/model.ts +2 -2
  42. package/src/types/query/borrowIncentive.ts +2 -2
  43. package/src/types/query/core.ts +1 -1
  44. package/src/types/query/portfolio.ts +2 -2
  45. package/src/types/query/spool.ts +1 -1
  46. package/src/utils/builder.ts +1 -1
  47. package/src/utils/index.ts +2 -2
  48. package/src/utils/query.ts +3 -3
  49. package/src/utils/tokenBucket.ts +1 -1
  50. package/src/utils/util.ts +4 -4
  51. package/dist/builders/borrowIncentiveBuilder.d.ts +0 -12
  52. package/dist/builders/coreBuilder.d.ts +0 -12
  53. package/dist/builders/index.d.ts +0 -12
  54. package/dist/builders/loyaltyProgramBuilder.d.ts +0 -12
  55. package/dist/builders/oracle.d.ts +0 -14
  56. package/dist/builders/referralBuilder.d.ts +0 -12
  57. package/dist/builders/sCoinBuilder.d.ts +0 -4
  58. package/dist/builders/spoolBuilder.d.ts +0 -12
  59. package/dist/builders/vescaBuilder.d.ts +0 -25
  60. package/dist/constants/cache.d.ts +0 -14
  61. package/dist/constants/coinGecko.d.ts +0 -2
  62. package/dist/constants/common.d.ts +0 -20
  63. package/dist/constants/enum.d.ts +0 -14
  64. package/dist/constants/flashloan.d.ts +0 -2
  65. package/dist/constants/index.d.ts +0 -12
  66. package/dist/constants/poolAddress.d.ts +0 -5
  67. package/dist/constants/pyth.d.ts +0 -5
  68. package/dist/constants/queryKeys.d.ts +0 -56
  69. package/dist/constants/rpc.d.ts +0 -1
  70. package/dist/constants/testAddress.d.ts +0 -2
  71. package/dist/constants/tokenBucket.d.ts +0 -2
  72. package/dist/constants/vesca.d.ts +0 -5
  73. package/dist/index.d.ts +0 -3
  74. package/dist/models/index.d.ts +0 -8
  75. package/dist/models/scallop.d.ts +0 -74
  76. package/dist/models/scallopAddress.d.ts +0 -150
  77. package/dist/models/scallopBuilder.d.ts +0 -89
  78. package/dist/models/scallopCache.d.ts +0 -74
  79. package/dist/models/scallopClient.d.ts +0 -321
  80. package/dist/models/scallopIndexer.d.ts +0 -89
  81. package/dist/models/scallopQuery.d.ts +0 -489
  82. package/dist/models/scallopUtils.d.ts +0 -227
  83. package/dist/models/suiKit.d.ts +0 -2
  84. package/dist/queries/borrowIncentiveQuery.d.ts +0 -61
  85. package/dist/queries/coreQuery.d.ts +0 -167
  86. package/dist/queries/index.d.ts +0 -11
  87. package/dist/queries/isolatedAssetQuery.d.ts +0 -14
  88. package/dist/queries/loyaltyProgramQuery.d.ts +0 -10
  89. package/dist/queries/portfolioQuery.d.ts +0 -73
  90. package/dist/queries/priceQuery.d.ts +0 -16
  91. package/dist/queries/referralQuery.d.ts +0 -7
  92. package/dist/queries/sCoinQuery.d.ts +0 -41
  93. package/dist/queries/spoolQuery.d.ts +0 -70
  94. package/dist/queries/supplyLimitQuery.d.ts +0 -9
  95. package/dist/queries/vescaQuery.d.ts +0 -36
  96. package/dist/test.d.ts +0 -0
  97. package/dist/types/address.d.ts +0 -107
  98. package/dist/types/builder/borrowIncentive.d.ts +0 -35
  99. package/dist/types/builder/core.d.ts +0 -56
  100. package/dist/types/builder/index.d.ts +0 -25
  101. package/dist/types/builder/loyaltyProgram.d.ts +0 -23
  102. package/dist/types/builder/referral.d.ts +0 -30
  103. package/dist/types/builder/sCoin.d.ts +0 -37
  104. package/dist/types/builder/spool.d.ts +0 -29
  105. package/dist/types/builder/vesca.d.ts +0 -51
  106. package/dist/types/constant/common.d.ts +0 -24
  107. package/dist/types/constant/enum.d.ts +0 -48
  108. package/dist/types/constant/index.d.ts +0 -2
  109. package/dist/types/index.d.ts +0 -6
  110. package/dist/types/model.d.ts +0 -54
  111. package/dist/types/query/borrowIncentive.d.ts +0 -124
  112. package/dist/types/query/core.d.ts +0 -361
  113. package/dist/types/query/index.d.ts +0 -7
  114. package/dist/types/query/loyaltyProgram.d.ts +0 -5
  115. package/dist/types/query/portfolio.d.ts +0 -115
  116. package/dist/types/query/sCoin.d.ts +0 -1
  117. package/dist/types/query/spool.d.ts +0 -122
  118. package/dist/types/query/vesca.d.ts +0 -26
  119. package/dist/types/utils.d.ts +0 -21
  120. package/dist/utils/builder.d.ts +0 -15
  121. package/dist/utils/index.d.ts +0 -5
  122. package/dist/utils/indexer.d.ts +0 -17
  123. package/dist/utils/query.d.ts +0 -62
  124. package/dist/utils/tokenBucket.d.ts +0 -11
  125. package/dist/utils/util.d.ts +0 -26
  126. package/src/test.ts +0 -30
@@ -1,70 +0,0 @@
1
- import type { ScallopQuery, ScallopUtils } from 'src/models';
2
- import { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, SupportStakeMarketCoins, CoinPrices, MarketPools } from 'src/types';
3
- /**
4
- * Get spools data.
5
- *
6
- * @param query - The Scallop query instance.
7
- * @param marketCoinNames - Specific an array of support stake market coin name.
8
- * @param indexer - Whether to use indexer.
9
- * @return Spools data.
10
- */
11
- export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
12
- susdc?: Spool | undefined;
13
- sweth?: Spool | undefined;
14
- swusdc?: Spool | undefined;
15
- swusdt?: Spool | undefined;
16
- ssui?: Spool | undefined;
17
- scetus?: Spool | undefined;
18
- safsui?: Spool | undefined;
19
- shasui?: Spool | undefined;
20
- svsui?: Spool | undefined;
21
- }>;
22
- /**
23
- * Get spool data.
24
- *
25
- * @param query - The Scallop query instance.
26
- * @param marketCoinName - Specific support stake market coin name.
27
- * @param indexer - Whether to use indexer.
28
- * @param marketPool - The market pool data.
29
- * @param coinPrices - The coin prices.
30
- * @return Spool data.
31
- */
32
- export declare const getSpool: (query: ScallopQuery, marketCoinName: SupportStakeMarketCoins, indexer?: boolean, marketPool?: MarketPool, coinPrices?: CoinPrices) => Promise<Spool | undefined>;
33
- /**
34
- * Get all stake accounts of the owner.
35
- *
36
- * @param query - The Scallop query instance.
37
- * @param ownerAddress - Owner address.
38
- * @return Stake accounts.
39
- */
40
- export declare const getStakeAccounts: ({ utils, }: {
41
- utils: ScallopUtils;
42
- }, ownerAddress?: string) => Promise<StakeAccounts>;
43
- /**
44
- * Get stake pool data.
45
- *
46
- * @description
47
- * For backward compatible, it is recommended to use `getSpool` method
48
- * to get stake pool info in spool data.
49
- *
50
- * @param query - The Scallop query instance.
51
- * @param marketCoinName - Specific support stake market coin name.
52
- * @return Stake pool data.
53
- */
54
- export declare const getStakePool: ({ utils, }: {
55
- utils: ScallopUtils;
56
- }, marketCoinName: SupportStakeMarketCoins) => Promise<StakePool | undefined>;
57
- /**
58
- * Get stake reward pool of the owner.
59
- *
60
- * @description
61
- * For backward compatible, it is recommended to use `getSpool` method
62
- * to get reward info in spool data.
63
- *
64
- * @param query - The Scallop query instance.
65
- * @param marketCoinName - Specific support stake market coin name.
66
- * @return Stake reward pool.
67
- */
68
- export declare const getStakeRewardPool: ({ utils, }: {
69
- utils: ScallopUtils;
70
- }, marketCoinName: SupportStakeMarketCoins) => Promise<StakeRewardPool | undefined>;
@@ -1,9 +0,0 @@
1
- import { ScallopUtils } from 'src/models';
2
- import { SupportPoolCoins } from 'src/types';
3
- /**
4
- * Return supply limit of a pool (including the decimals)
5
- * @param utils
6
- * @param poolName
7
- * @returns supply limit (decimals included)
8
- */
9
- export declare const getSupplyLimit: (utils: ScallopUtils, poolName: SupportPoolCoins) => Promise<string | null>;
@@ -1,36 +0,0 @@
1
- import { type SuiObjectData } from '@mysten/sui/client';
2
- import type { ScallopUtils } from 'src/models';
3
- import { Vesca, VeScaTreasuryInfo } from 'src/types';
4
- /**
5
- * Query all owned veSca key.
6
- *
7
- * @param query - The Scallop query instance.
8
- * @param ownerAddress - The owner address.
9
- * @return Owned veSca key.
10
- */
11
- export declare const getVescaKeys: (utils: ScallopUtils, ownerAddress?: string) => Promise<SuiObjectData[]>;
12
- /**
13
- * Query all owned veSca.
14
- *
15
- * @param query - The Scallop query instance.
16
- * @param ownerAddress - The owner address.
17
- * @return Owned veScas.
18
- */
19
- export declare const getVeScas: ({ utils, }: {
20
- utils: ScallopUtils;
21
- }, ownerAddress: string, excludeEmpty?: boolean) => Promise<Vesca[]>;
22
- /**
23
- * Get veSca data.
24
- *
25
- * @param query - The Scallop query instance.
26
- * @param veScaKey - The vesca key id.
27
- * @param ownerAddress - The owner address.
28
- * @returns Vesca data.
29
- */
30
- export declare const getVeSca: (utils: ScallopUtils, veScaKey: string | SuiObjectData) => Promise<Vesca | undefined>;
31
- /**
32
- * Get veSCA treasury informations
33
- * @param query
34
- * @returns VeScaTreasuryInfo
35
- */
36
- export declare const getVeScaTreasuryInfo: (utils: ScallopUtils) => Promise<VeScaTreasuryInfo | null>;
package/dist/test.d.ts DELETED
File without changes
@@ -1,107 +0,0 @@
1
- import { SUPPORT_ORACLES } from 'src/constants';
2
- import type { SupportAssetCoins, SupportOracleType, SupportPackageType, SupportSCoin, SupportStakeMarketCoins } from './constant';
3
- export interface AddressesInterface {
4
- core: {
5
- version: string;
6
- versionCap: string;
7
- object: string;
8
- market: string;
9
- adminCap: string;
10
- coinDecimalsRegistry: string;
11
- obligationAccessStore: string;
12
- coins: Partial<Record<SupportAssetCoins, {
13
- id: string;
14
- treasury: string;
15
- metaData: string;
16
- oracle: {
17
- [K in SupportOracleType]: K extends (typeof SUPPORT_ORACLES)[0] ? string : K extends (typeof SUPPORT_ORACLES)[1] ? string : K extends (typeof SUPPORT_ORACLES)[2] ? {
18
- feed: string;
19
- feedObject: string;
20
- } : never;
21
- };
22
- }>>;
23
- oracles: {
24
- [K in SupportOracleType]: K extends (typeof SUPPORT_ORACLES)[0] ? {
25
- registry: string;
26
- registryCap: string;
27
- holder: string;
28
- } : K extends (typeof SUPPORT_ORACLES)[1] ? {
29
- registry: string;
30
- registryCap: string;
31
- } : K extends (typeof SUPPORT_ORACLES)[2] ? {
32
- registry: string;
33
- registryCap: string;
34
- state: string;
35
- wormhole: string;
36
- wormholeState: string;
37
- } : never;
38
- } & {
39
- xOracle: string;
40
- xOracleCap: string;
41
- };
42
- packages: Partial<Record<SupportPackageType, {
43
- id: string;
44
- upgradeCap: string;
45
- }>>;
46
- };
47
- spool: {
48
- id: string;
49
- adminCap: string;
50
- object: string;
51
- config: string;
52
- pools: Partial<Record<SupportStakeMarketCoins, {
53
- id: string;
54
- rewardPoolId: string;
55
- }>>;
56
- };
57
- borrowIncentive: {
58
- id: string;
59
- adminCap: string;
60
- object: string;
61
- query: string;
62
- config: string;
63
- incentivePools: string;
64
- incentiveAccounts: string;
65
- };
66
- vesca: {
67
- id: string;
68
- object: string;
69
- adminCap: string;
70
- tableId: string;
71
- table: string;
72
- treasury: string;
73
- config: string;
74
- };
75
- referral: {
76
- id: string;
77
- version: string;
78
- object: string;
79
- adminCap: string;
80
- referralBindings: string;
81
- bindingTableId: string;
82
- referralRevenuePool: string;
83
- revenueTableId: string;
84
- referralTiers: string;
85
- tiersTableId: string;
86
- authorizedWitnessList: string;
87
- };
88
- loyaltyProgram: {
89
- id: string;
90
- object: string;
91
- rewardPool: string;
92
- userRewardTableId: string;
93
- };
94
- scoin: {
95
- id: string;
96
- coins: Partial<Record<SupportSCoin, {
97
- coinType: string;
98
- treasury: string;
99
- }>>;
100
- };
101
- }
102
- type AddressPathsProps<T> = T extends string ? [] : {
103
- [K in Extract<keyof T, string>]: [K, ...AddressPathsProps<T[K]>];
104
- }[Extract<keyof T, string>];
105
- type Join<T extends string[], D extends string> = T extends [] ? never : T extends [infer F] ? F : T extends [infer F, ...infer R] ? F extends string ? `${F}${D}${Join<Extract<R, string[]>, D>}` : never : string;
106
- export type AddressStringPath = Join<AddressPathsProps<AddressesInterface>, '.'>;
107
- export {};
@@ -1,35 +0,0 @@
1
- import type { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
2
- import type { TransactionResult } from '@mysten/sui/transactions';
3
- import type { ScallopBuilder } from 'src/models';
4
- import { SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins } from 'src/types';
5
- export type BorrowIncentiveIds = {
6
- borrowIncentivePkg: string;
7
- query: string;
8
- config: string;
9
- incentivePools: string;
10
- incentiveAccounts: string;
11
- obligationAccessStore: string;
12
- };
13
- export type BorrowIncentiveNormalMethods = {
14
- stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
15
- stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => void;
16
- unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
17
- claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins) => TransactionResult;
18
- deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
19
- };
20
- export type BorrowIncentiveQuickMethods = {
21
- stakeObligationQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<void>;
22
- stakeObligationWithVeScaQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg, veScaKey?: SuiObjectArg): Promise<void>;
23
- unstakeObligationQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<void>;
24
- claimBorrowIncentiveQuick(coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins, obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<TransactionResult>;
25
- };
26
- export type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiKitTxBlock & BorrowIncentiveNormalMethods;
27
- export type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
28
- export type GenerateBorrowIncentiveNormalMethod = (params: {
29
- builder: ScallopBuilder;
30
- txBlock: SuiKitTxBlock;
31
- }) => BorrowIncentiveNormalMethods;
32
- export type GenerateBorrowIncentiveQuickMethod = (params: {
33
- builder: ScallopBuilder;
34
- txBlock: SuiTxBlockWithBorrowIncentiveNormalMethods;
35
- }) => BorrowIncentiveQuickMethods;
@@ -1,56 +0,0 @@
1
- import type { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
2
- import type { Argument, TransactionResult } from '@mysten/sui/transactions';
3
- import type { ScallopBuilder } from 'src/models';
4
- import { SupportCollateralCoins, SupportPoolCoins, SupportAssetCoins } from 'src/types';
5
- import { SuiTxBlockWithSpool } from '.';
6
- export type CoreIds = {
7
- protocolPkg: string;
8
- market: string;
9
- version: string;
10
- coinDecimalsRegistry: string;
11
- xOracle: string;
12
- };
13
- export type NestedResult = Extract<Argument, {
14
- $kind: 'NestedResult';
15
- }>;
16
- type Obligation = NestedResult;
17
- type ObligationKey = NestedResult;
18
- type ObligationHotPotato = NestedResult;
19
- export type CoreNormalMethods = {
20
- openObligation: () => [Obligation, ObligationKey, ObligationHotPotato];
21
- returnObligation: (obligation: SuiObjectArg, obligationHotPotato: SuiObjectArg) => void;
22
- openObligationEntry: () => void;
23
- addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: SupportCollateralCoins) => void;
24
- takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: SupportCollateralCoins) => TransactionResult;
25
- deposit: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
26
- depositEntry: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
27
- withdraw: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
28
- withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
29
- borrow: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => TransactionResult;
30
- borrowWithReferral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, borrowReferral: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => TransactionResult;
31
- borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => void;
32
- repay: (obligation: SuiObjectArg, coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
33
- borrowFlashLoan: (amount: number, poolCoinName: SupportPoolCoins) => TransactionResult;
34
- repayFlashLoan: (coin: SuiObjectArg, loan: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
35
- };
36
- export type CoreQuickMethods = {
37
- addCollateralQuick: (amount: number, collateralCoinName: SupportCollateralCoins, obligationId?: SuiObjectArg) => Promise<void>;
38
- takeCollateralQuick: (amount: number, collateralCoinName: SupportCollateralCoins, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
39
- borrowQuick: (amount: number, poolCoinName: SupportPoolCoins, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
40
- borrowWithReferralQuick: (amount: number, poolCoinName: SupportPoolCoins, borrowReferral: SuiObjectArg, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
41
- depositQuick: (amount: number, poolCoinName: SupportPoolCoins, returnSCoin?: boolean) => Promise<TransactionResult>;
42
- withdrawQuick: (amount: number, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
43
- repayQuick: (amount: number, poolCoinName: SupportPoolCoins, obligationId?: SuiObjectArg) => Promise<void>;
44
- updateAssetPricesQuick: (assetCoinNames?: SupportAssetCoins[]) => Promise<void>;
45
- };
46
- export type SuiTxBlockWithCoreNormalMethods = SuiKitTxBlock & SuiTxBlockWithSpool & CoreNormalMethods;
47
- export type CoreTxBlock = SuiTxBlockWithCoreNormalMethods & CoreQuickMethods;
48
- export type GenerateCoreNormalMethod = (params: {
49
- builder: ScallopBuilder;
50
- txBlock: SuiKitTxBlock;
51
- }) => CoreNormalMethods;
52
- export type GenerateCoreQuickMethod = (params: {
53
- builder: ScallopBuilder;
54
- txBlock: SuiTxBlockWithCoreNormalMethods;
55
- }) => CoreQuickMethods;
56
- export {};
@@ -1,25 +0,0 @@
1
- import type { CoreTxBlock, NestedResult } from './core';
2
- import type { SpoolTxBlock } from './spool';
3
- import type { BorrowIncentiveTxBlock } from './borrowIncentive';
4
- import type { VeScaTxBlock } from './vesca';
5
- import type { ReferralTxBlock } from './referral';
6
- import { LoyaltyProgramTxBlock } from './loyaltyProgram';
7
- import { SCoinTxBlock } from './sCoin';
8
- import { SupportAssetCoins } from 'src/types';
9
- export type * from './borrowIncentive';
10
- export type * from './core';
11
- export type * from './loyaltyProgram';
12
- export type * from './referral';
13
- export type * from './sCoin';
14
- export type * from './spool';
15
- export type * from './vesca';
16
- export type BaseScallopTxBlock = ReferralTxBlock & LoyaltyProgramTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
17
- export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
18
- export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
19
- export type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
20
- export type SelectCoinReturnType<T extends SupportAssetCoins> = T extends 'sui' ? {
21
- takeCoin: NestedResult;
22
- } : {
23
- takeCoin: NestedResult;
24
- leftCoin: NestedResult;
25
- };
@@ -1,23 +0,0 @@
1
- import { SuiObjectArg, SuiTxBlock as SuiKitTxBlock, TransactionResult } from '@scallop-io/sui-kit';
2
- import { type ScallopBuilder } from 'src/models';
3
- export type LoyaltyProgramIds = {
4
- loyaltyProgramPkgId: string;
5
- rewardPool: string;
6
- userRewardTableId: string;
7
- };
8
- export type LoyaltyProgramNormalMethods = {
9
- claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult;
10
- };
11
- export type LoyaltyProgramQuickMethods = {
12
- claimLoyaltyRevenueQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
13
- };
14
- export type SuiTxBlockWithLoyaltyProgramNormalMethods = SuiKitTxBlock & LoyaltyProgramNormalMethods;
15
- export type LoyaltyProgramTxBlock = SuiTxBlockWithLoyaltyProgramNormalMethods & LoyaltyProgramQuickMethods;
16
- export type GenerateLoyaltyProgramNormalMethod = (params: {
17
- builder: ScallopBuilder;
18
- txBlock: SuiKitTxBlock;
19
- }) => LoyaltyProgramNormalMethods;
20
- export type GenerateLoyaltyProgramQuickMethod = (params: {
21
- builder: ScallopBuilder;
22
- txBlock: SuiTxBlockWithLoyaltyProgramNormalMethods;
23
- }) => LoyaltyProgramQuickMethods;
@@ -1,30 +0,0 @@
1
- import { SuiObjectArg, TransactionResult, SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
2
- import { ScallopBuilder } from 'src/models';
3
- import { SupportPoolCoins } from 'src/types';
4
- export type ReferralIds = {
5
- referralPgkId: string;
6
- referralBindings: string;
7
- referralRevenuePool: string;
8
- referralTiers: string;
9
- authorizedWitnessList: string;
10
- version: string;
11
- };
12
- export type ReferralNormalMethods = {
13
- bindToReferral: (veScaKeyId: string) => void;
14
- claimReferralTicket: (poolCoinName: SupportPoolCoins) => TransactionResult;
15
- burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
16
- claimReferralRevenue: (veScaKey: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
17
- };
18
- export type ReferralQuickMethods = {
19
- claimReferralRevenueQuick: (veScaKey: SuiObjectArg, coinNames: SupportPoolCoins[]) => Promise<void>;
20
- };
21
- export type SuiTxBlockWithReferralNormalMethods = SuiKitTxBlock & ReferralNormalMethods;
22
- export type ReferralTxBlock = SuiTxBlockWithReferralNormalMethods & ReferralQuickMethods;
23
- export type GenerateReferralNormalMethod = (params: {
24
- builder: ScallopBuilder;
25
- txBlock: SuiKitTxBlock;
26
- }) => ReferralNormalMethods;
27
- export type GenerateReferralQuickMethod = (params: {
28
- builder: ScallopBuilder;
29
- txBlock: SuiTxBlockWithReferralNormalMethods;
30
- }) => ReferralQuickMethods;
@@ -1,37 +0,0 @@
1
- import { SuiObjectArg, SuiTxBlock as SuiKitTxBlock, TransactionResult } from '@scallop-io/sui-kit';
2
- import { SupportSCoin } from 'src/types';
3
- import { ScallopBuilder } from 'src/models';
4
- import { BaseScallopTxBlock } from '.';
5
- export type sCoinPkgIds = {
6
- pkgId: string;
7
- };
8
- export type sCoinNormalMethods = {
9
- /**
10
- * Lock marketCoin and return sCoin
11
- * @param marketCoinName
12
- * @param marketCoin
13
- * @returns
14
- */
15
- mintSCoin: (marketCoinName: SupportSCoin, marketCoin: SuiObjectArg) => TransactionResult;
16
- /**
17
- * Burn sCoin and return marketCoin
18
- * @param sCoinName
19
- * @param sCoin
20
- * @returns
21
- */
22
- burnSCoin: (sCoinName: SupportSCoin, sCoin: SuiObjectArg) => TransactionResult;
23
- };
24
- export type sCoinQuickMethods = {
25
- mintSCoinQuick: (marketCoinName: SupportSCoin, amount: number) => Promise<TransactionResult>;
26
- burnSCoinQuick: (sCoinName: SupportSCoin, amount: number) => Promise<TransactionResult>;
27
- };
28
- export type SuiTxBlockWithSCoinNormalMethods = SuiKitTxBlock & BaseScallopTxBlock & sCoinNormalMethods;
29
- export type SCoinTxBlock = SuiTxBlockWithSCoinNormalMethods & sCoinQuickMethods;
30
- export type GenerateSCoinNormalMethod = (params: {
31
- builder: ScallopBuilder;
32
- txBlock: SuiKitTxBlock;
33
- }) => sCoinNormalMethods;
34
- export type GenerateSCoinQuickMethod = (params: {
35
- builder: ScallopBuilder;
36
- txBlock: SuiTxBlockWithSCoinNormalMethods;
37
- }) => sCoinQuickMethods;
@@ -1,29 +0,0 @@
1
- import type { SuiTxBlock as SuiKitTxBlock, SuiAddressArg, SuiObjectArg } from '@scallop-io/sui-kit';
2
- import type { TransactionResult } from '@mysten/sui/transactions';
3
- import type { ScallopBuilder } from 'src/models';
4
- import { SupportStakeMarketCoins } from 'src/types';
5
- import { SuiTxBlockWithSCoin } from '.';
6
- export type SpoolIds = {
7
- spoolPkg: string;
8
- };
9
- export type SpoolNormalMethods = {
10
- createStakeAccount: (stakeMarketCoinName: SupportStakeMarketCoins) => TransactionResult;
11
- stake: (stakeAccount: SuiAddressArg, coin: SuiObjectArg, stakeMarketCoinName: SupportStakeMarketCoins) => void;
12
- unstake: (stakeAccount: SuiAddressArg, amount: number, stakeMarketCoinName: SupportStakeMarketCoins) => TransactionResult;
13
- claim: (stakeAccount: SuiAddressArg, stakeMarketCoinName: SupportStakeMarketCoins) => TransactionResult;
14
- };
15
- export type SpoolQuickMethods = {
16
- stakeQuick(amountOrMarketCoin: SuiObjectArg | number, stakeMarketCoinName: SupportStakeMarketCoins, stakeAccountId?: SuiAddressArg): Promise<void>;
17
- unstakeQuick(amount: number, stakeMarketCoinName: SupportStakeMarketCoins, stakeAccountId?: SuiAddressArg, returnSCoin?: boolean): Promise<TransactionResult | undefined>;
18
- claimQuick(stakeMarketCoinName: SupportStakeMarketCoins, stakeAccountId?: SuiAddressArg): Promise<TransactionResult[]>;
19
- };
20
- export type SuiTxBlockWithSpoolNormalMethods = SuiKitTxBlock & SuiTxBlockWithSCoin & SpoolNormalMethods;
21
- export type SpoolTxBlock = SuiTxBlockWithSpoolNormalMethods & SpoolQuickMethods;
22
- export type GenerateSpoolNormalMethod = (params: {
23
- builder: ScallopBuilder;
24
- txBlock: SuiKitTxBlock;
25
- }) => SpoolNormalMethods;
26
- export type GenerateSpoolQuickMethod = (params: {
27
- builder: ScallopBuilder;
28
- txBlock: SuiTxBlockWithSpoolNormalMethods;
29
- }) => SpoolQuickMethods;
@@ -1,51 +0,0 @@
1
- import { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
2
- import type { TransactionResult } from '@mysten/sui/transactions';
3
- import { ScallopBuilder } from 'src/models';
4
- export type VescaIds = {
5
- pkgId: string;
6
- table: string;
7
- treasury: string;
8
- config: string;
9
- };
10
- export type VeScaNormalMethods = {
11
- lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: number) => TransactionResult;
12
- extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
13
- extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
14
- renewExpiredVeSca: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
15
- redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
16
- mintEmptyVeSca: () => TransactionResult;
17
- };
18
- export type RedeemScaQuickReturnType<T extends boolean> = T extends true ? void : TransactionResult | undefined;
19
- export type VeScaQuickMethods = {
20
- /**
21
- * Quick methods to automate
22
- * lock initial SCA, extend lock period, lock more SCA, renew expired VeSCA, and redeem SCA
23
- *
24
- * **Flow:**
25
- * - If only `amountOrCoin` is provided, it will lock the amount of existing not expired veSCA
26
- * - If only `lockPeriodInDays` is provided, it will extend the lock period of existing not expired veSCA
27
- *
28
- * **Note:**
29
- * - If one or both flow above is used on a expired veSCA, it will claim the unlocked SCA
30
- * and renew the veSCA first, and then flow continues
31
- * - If users has no veSCA yet, they need to provide both `amountOrCoin` and `lockPeriodInDays` for initial lock
32
- * @param amountOrCoin
33
- * @param lockPeriodInDays
34
- * @param autoCheck
35
- */
36
- lockScaQuick(amountOrCoin?: SuiObjectArg | number, lockPeriodInDays?: number, autoCheck?: boolean): Promise<void>;
37
- extendLockPeriodQuick: (lockPeriodInDays: number, veScaKey?: SuiObjectArg, autoCheck?: boolean) => Promise<void>;
38
- extendLockAmountQuick: (scaAmount: number, veScaKey?: SuiObjectArg, autoCheck?: boolean) => Promise<void>;
39
- renewExpiredVeScaQuick: (scaAmount: number, lockPeriodInDays: number, veScaKey?: SuiObjectArg, autoCheck?: boolean) => Promise<void>;
40
- redeemScaQuick: <T extends boolean>(veSCaKey?: SuiObjectArg, transferSca?: T) => Promise<RedeemScaQuickReturnType<T>>;
41
- };
42
- export type SuiTxBlockWithVeScaNormalMethods = SuiKitTxBlock & VeScaNormalMethods;
43
- export type VeScaTxBlock = SuiTxBlockWithVeScaNormalMethods & VeScaQuickMethods;
44
- export type GenerateVeScaNormalMethod = (params: {
45
- builder: ScallopBuilder;
46
- txBlock: SuiKitTxBlock;
47
- }) => VeScaNormalMethods;
48
- export type GenerateVeScaQuickMethod = (params: {
49
- builder: ScallopBuilder;
50
- txBlock: SuiTxBlockWithVeScaNormalMethods;
51
- }) => VeScaQuickMethods;
@@ -1,24 +0,0 @@
1
- import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES, SUPPORT_SPOOLS, SUPPORT_SPOOLS_REWARDS, SUPPORT_BORROW_INCENTIVE_POOLS, SUPPORT_BORROW_INCENTIVE_REWARDS, SUPPORT_SCOIN, SUPPORT_SUI_BRIDGE, SUPPORT_WORMHOLE } from 'src/constants';
2
- type ParseMarketCoins<T extends string> = `s${T}`;
3
- type ParseCoins<T extends string> = T extends `s${infer R}` ? R : never;
4
- export type SupportCoins = SupportAssetCoins | SupportMarketCoins | SupportStakeMarketCoins | SupportSCoin;
5
- export type SupportAssetCoins = SupportPoolCoins | SupportCollateralCoins | SupportStakeRewardCoins | SupportBorrowIncentiveRewardCoins;
6
- export type SupportPoolCoins = (typeof SUPPORT_POOLS)[number];
7
- export type SupportCollateralCoins = (typeof SUPPORT_COLLATERALS)[number];
8
- export type SupportMarketCoins = ParseMarketCoins<SupportPoolCoins> | SupportStakeMarketCoins;
9
- export type SupportStakeMarketCoins = (typeof SUPPORT_SPOOLS)[number];
10
- export type SupportSuiBridgeCoins = (typeof SUPPORT_SUI_BRIDGE)[number];
11
- export type SupportWormholeCoins = (typeof SUPPORT_WORMHOLE)[number];
12
- export type SupportStakeCoins = Extract<SupportPoolCoins, ParseCoins<SupportStakeMarketCoins>>;
13
- export type SupportStakeRewardCoins = (typeof SUPPORT_SPOOLS_REWARDS)[number];
14
- export type SupportBorrowIncentiveCoins = (typeof SUPPORT_BORROW_INCENTIVE_POOLS)[number];
15
- export type SupportBorrowIncentiveRewardCoins = (typeof SUPPORT_BORROW_INCENTIVE_REWARDS)[number];
16
- export type SupportSCoin = (typeof SUPPORT_SCOIN)[number];
17
- export type SupportOracleType = (typeof SUPPORT_ORACLES)[number];
18
- export type SupportPackageType = (typeof SUPPORT_PACKAGES)[number];
19
- export type SupportCoinDecimals = Record<SupportCoins, number>;
20
- export type CoinWrappedType = {
21
- from: string;
22
- type: string;
23
- } | undefined;
24
- export {};
@@ -1,48 +0,0 @@
1
- import { SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, SupportStakeRewardCoins, SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins, SupportSCoin, SupportSuiBridgeCoins } from './common';
2
- export type Coins = {
3
- [K in SupportCoins]: K;
4
- };
5
- export type AssetCoins = {
6
- [K in SupportAssetCoins]: K;
7
- };
8
- export type MarketCoins = {
9
- [K in SupportMarketCoins]: K;
10
- };
11
- export type SCoins = {
12
- [K in SupportSCoin]: K;
13
- };
14
- export type StakeMarketCoins = {
15
- [K in SupportStakeMarketCoins]: K;
16
- };
17
- export type StakeRewardCoins = {
18
- [key in SupportStakeMarketCoins]: SupportStakeRewardCoins;
19
- };
20
- export type SuiBridgeCoins = {
21
- [K in SupportSuiBridgeCoins]: K;
22
- };
23
- export type BorrowIncentiveRewardCoins = {
24
- [key in SupportBorrowIncentiveCoins]: SupportBorrowIncentiveRewardCoins[];
25
- };
26
- export type AssetCoinIds = {
27
- [key in SupportAssetCoins]: string;
28
- };
29
- export type SCoinIds = {
30
- [key in SupportSCoin]: string;
31
- };
32
- export type SCoinTreasuryCaps = {
33
- [key in SupportSCoin]: string;
34
- };
35
- export type SCoinConverterTreasury = {
36
- [key in SupportSCoin]: string;
37
- };
38
- type PickFromUnion<T, K extends string> = K extends T ? K : never;
39
- export type WormholeCoinIds = {
40
- [key in PickFromUnion<SupportAssetCoins, 'weth' | 'wbtc' | 'wusdc' | 'wusdt' | 'wapt' | 'wsol'>]: string;
41
- };
42
- export type VoloCoinIds = {
43
- [key in PickFromUnion<SupportAssetCoins, 'vsui'>]: string;
44
- };
45
- export type SuiBridgedCoinPackageIds = {
46
- [key in SupportSuiBridgeCoins]: string;
47
- };
48
- export {};
@@ -1,2 +0,0 @@
1
- export type * from './common';
2
- export type * from './enum';
@@ -1,6 +0,0 @@
1
- export type * from './builder';
2
- export type * from './constant';
3
- export type * from './query';
4
- export type * from './address';
5
- export type * from './model';
6
- export type * from './utils';
@@ -1,54 +0,0 @@
1
- import type { SuiTransactionBlockResponse } from '@mysten/sui/client';
2
- import type { Transaction, TransactionResult } from '@mysten/sui/transactions';
3
- import type { SuiKit, SuiKitParams, NetworkType } from '@scallop-io/sui-kit';
4
- import type { ScallopAddress, ScallopQuery, ScallopUtils, ScallopBuilder, ScallopIndexer } from 'src/models';
5
- import { ScallopCache } from 'src/models';
6
- import { AddressesInterface } from './address';
7
- export type ScallopClientFnReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : Transaction;
8
- export type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : {
9
- tx: Transaction;
10
- scaCoin: TransactionResult;
11
- };
12
- export type ScallopBaseInstanceParams = {
13
- suiKit?: SuiKit;
14
- };
15
- export type ScallopCacheInstanceParams = ScallopBaseInstanceParams;
16
- export type ScallopAddressInstanceParams = ScallopBaseInstanceParams & {
17
- cache?: ScallopCache;
18
- };
19
- export type ScallopIndexerInstanceParams = {
20
- cache?: ScallopCache;
21
- };
22
- export type ScallopUtilsInstanceParams = ScallopBaseInstanceParams & {
23
- address?: ScallopAddress;
24
- };
25
- export type ScallopQueryInstanceParams = ScallopBaseInstanceParams & {
26
- utils?: ScallopUtils;
27
- indexer?: ScallopIndexer;
28
- };
29
- export type ScallopBuilderInstanceParams = ScallopBaseInstanceParams & {
30
- query?: ScallopQuery;
31
- };
32
- export type ScallopClientInstanceParams = ScallopBaseInstanceParams & {
33
- builder?: ScallopBuilder;
34
- };
35
- export type ScallopAddressParams = {
36
- id: string;
37
- auth?: string;
38
- network?: NetworkType;
39
- forceInterface?: Partial<Record<NetworkType, AddressesInterface>>;
40
- };
41
- export type ScallopParams = {
42
- addressesId?: string;
43
- forceAddressesInterface?: Partial<Record<NetworkType, AddressesInterface>>;
44
- walletAddress?: string;
45
- } & SuiKitParams;
46
- export type ScallopClientParams = ScallopParams & ScallopBuilderParams & ScallopQueryParams & ScallopUtilsParams;
47
- export type ScallopBuilderParams = ScallopParams & {
48
- pythEndpoints?: string[];
49
- usePythPullModel?: boolean;
50
- } & ScallopQueryParams;
51
- export type ScallopQueryParams = ScallopParams & ScallopUtilsParams;
52
- export type ScallopUtilsParams = ScallopParams & {
53
- pythEndpoints?: string[];
54
- };