@typus/typus-sdk 0.6.3 → 1.0.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.
- package/lib/config.json +17 -20
- package/lib/constants.d.ts +9 -7
- package/lib/constants.js +10 -8
- package/lib/test/authorized/testAuthorizedNewPortfolioVault.js +82 -0
- package/lib/test/{testClaim.js → authorized/testAuthorizedUpdateUpcomingVaultConfig.js} +19 -30
- package/lib/test/authorized/testAuthorizedUpdateWarmupVaultConfig.js +68 -0
- package/lib/test/getVaultData.js +1 -1
- package/lib/test/getWhiteListFromRegistry.js +1 -1
- package/lib/test/helper/getAuctionMaxSize.js +76 -0
- package/lib/test/helper/getUserStatus.js +75 -0
- package/lib/test/{testWithdraw.js → user/testClaim.js} +14 -17
- package/lib/test/{getMakersShares.js → user/testCompound.js} +20 -6
- package/lib/test/{testUnsubscribe.js → user/testDeposit.js} +28 -37
- package/lib/test/{getUsersShares.js → user/testHarvest.js} +20 -6
- package/lib/test/user/testNewBid.js +77 -0
- package/lib/test/user/testUnsubscribe.d.ts +1 -0
- package/lib/test/user/testUnsubscribe.js +69 -0
- package/lib/test/user/testWithdraw.d.ts +1 -0
- package/lib/test/{testDeposit.js → user/testWithdraw.js} +15 -19
- package/lib/utils/fetchData.d.ts +72 -61
- package/lib/utils/fetchData.js +26 -197
- package/lib/utils/getVaultData.d.ts +2 -2
- package/lib/utils/getVaultData.js +123 -161
- package/lib/utils/getWhiteListFromRegistry.js +0 -1
- package/lib/utils/portfolio/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.d.ts +1 -1
- package/lib/utils/portfolio/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.js +2 -2
- package/lib/utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx.d.ts +4 -3
- package/lib/utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx.js +5 -3
- package/lib/utils/portfolio/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.d.ts +1 -1
- package/lib/utils/portfolio/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.js +2 -2
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.d.ts +4 -0
- package/lib/utils/portfolio/authorized/{getAuthorizedUpdateNextVaultConfigTx.js → getAuthorizedUpdateUpcomingVaultConfigTx.js} +5 -5
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateWarmupVaultConfigTx.d.ts +1 -0
- package/lib/utils/portfolio/{manager/getUpdateVaultConfigTx.js → authorized/getAuthorizedUpdateWarmupVaultConfigTx.js} +4 -5
- package/lib/utils/portfolio/helper/getAuctionMaxSize.d.ts +8 -0
- package/lib/utils/portfolio/{manager/getLastEvolutionTx.js → helper/getAuctionMaxSize.js} +11 -7
- package/lib/utils/portfolio/helper/getUserStatus.d.ts +29 -0
- package/lib/utils/portfolio/{authorized/getAuthorizedEvolutionTx.js → helper/getUserStatus.js} +50 -9
- package/lib/utils/portfolio/manager/getAddAuthorizedUserTx.d.ts +8 -1
- package/lib/utils/portfolio/manager/getAddAuthorizedUserTx.js +9 -2
- package/lib/utils/portfolio/manager/getAddPortfolioVaultAuthorizedUserTx.d.ts +6 -0
- package/lib/utils/portfolio/manager/getAddPortfolioVaultAuthorizedUserTx.js +6 -0
- package/lib/utils/portfolio/manager/getEvolutionTx.d.ts +15 -1
- package/lib/utils/portfolio/manager/getEvolutionTx.js +14 -0
- package/lib/utils/portfolio/manager/getNewManagerTx.d.ts +8 -1
- package/lib/utils/portfolio/manager/getNewManagerTx.js +9 -2
- package/lib/utils/portfolio/manager/getNewPortfolioVaultTx.d.ts +5 -5
- package/lib/utils/portfolio/manager/getNewPortfolioVaultTx.js +5 -5
- package/lib/utils/portfolio/manager/getRemoveAuthorizedUserTx.d.ts +7 -0
- package/lib/utils/portfolio/manager/getRemoveAuthorizedUserTx.js +7 -0
- package/lib/utils/portfolio/manager/getRemoveManagerTx.d.ts +5 -0
- package/lib/utils/portfolio/manager/getRemoveManagerTx.js +5 -0
- package/lib/utils/portfolio/manager/getRemovePortfolioVaultAuthorizedUserTx.d.ts +7 -1
- package/lib/utils/portfolio/manager/getRemovePortfolioVaultAuthorizedUserTx.js +7 -1
- package/lib/utils/portfolio/user/getClaimAndHarvestTx.d.ts +9 -1
- package/lib/utils/portfolio/user/getClaimAndHarvestTx.js +11 -3
- package/lib/utils/portfolio/user/getClaimTx.d.ts +9 -1
- package/lib/utils/portfolio/user/getClaimTx.js +8 -0
- package/lib/utils/portfolio/user/getCompoundTx.d.ts +9 -0
- package/lib/utils/portfolio/{authorized/getAuthorizedLastEvolutionTx.js → user/getCompoundTx.js} +12 -6
- package/lib/utils/portfolio/user/getDepositTx.d.ts +10 -0
- package/lib/utils/portfolio/user/getDepositTx.js +10 -0
- package/lib/utils/portfolio/user/getHarvestTx.d.ts +9 -1
- package/lib/utils/portfolio/user/getHarvestTx.js +8 -0
- package/lib/utils/portfolio/user/getNewBidTx.d.ts +13 -1
- package/lib/utils/portfolio/user/getNewBidTx.js +12 -0
- package/lib/utils/portfolio/user/getUnsubscribeTx.d.ts +10 -1
- package/lib/utils/portfolio/user/getUnsubscribeTx.js +9 -0
- package/lib/utils/portfolio/user/getWithdrawTx.d.ts +10 -1
- package/lib/utils/portfolio/user/getWithdrawTx.js +9 -0
- package/package.json +1 -1
- package/lib/test/eventListener.d.ts +0 -5
- package/lib/test/eventListener.js +0 -397
- package/lib/test/testDepositV2.d.ts +0 -0
- package/lib/test/testDepositV2.js +0 -64
- package/lib/test/testNewAuction.js +0 -94
- package/lib/test/testNewVault.js +0 -153
- package/lib/test/testOracle.js +0 -94
- package/lib/test/testSettle.js +0 -590
- package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedDeliveryTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedDeliveryTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedEvolutionTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedEvolutionTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedLastEvolutionTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedLastEvolutionTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedNewAuctionTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedNewAuctionTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.js +0 -76
- package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedSettleTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedSettleTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedUpdateCapacityTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedUpdateCapacityTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.js +0 -65
- package/lib/utils/authorized/getAuthorizedUpdateVaultConfigTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedUpdateVaultConfigTx.js +0 -64
- package/lib/utils/coveredCall/createPriceOracle.d.ts +0 -1
- package/lib/utils/coveredCall/createPriceOracle.js +0 -93
- package/lib/utils/coveredCall/createTimeOracle.d.ts +0 -1
- package/lib/utils/coveredCall/createTimeOracle.js +0 -92
- package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.js +0 -61
- package/lib/utils/coveredCall/getClaimAllTx.d.ts +0 -1
- package/lib/utils/coveredCall/getClaimAllTx.js +0 -59
- package/lib/utils/coveredCall/getClaimTx.d.ts +0 -1
- package/lib/utils/coveredCall/getClaimTx.js +0 -59
- package/lib/utils/coveredCall/getCloseAuctionTx.d.ts +0 -1
- package/lib/utils/coveredCall/getCloseAuctionTx.js +0 -61
- package/lib/utils/coveredCall/getCloseVaultTx.d.ts +0 -1
- package/lib/utils/coveredCall/getCloseVaultTx.js +0 -60
- package/lib/utils/coveredCall/getDeliveryTx.d.ts +0 -1
- package/lib/utils/coveredCall/getDeliveryTx.js +0 -61
- package/lib/utils/coveredCall/getDepositTx.d.ts +0 -1
- package/lib/utils/coveredCall/getDepositTx.js +0 -65
- package/lib/utils/coveredCall/getEvolutionTx.d.ts +0 -1
- package/lib/utils/coveredCall/getEvolutionTx.js +0 -64
- package/lib/utils/coveredCall/getLastEvolutionTx.d.ts +0 -1
- package/lib/utils/coveredCall/getLastEvolutionTx.js +0 -63
- package/lib/utils/coveredCall/getMakerClaimAllTx.d.ts +0 -1
- package/lib/utils/coveredCall/getMakerClaimAllTx.js +0 -59
- package/lib/utils/coveredCall/getMakerClaimTx.d.ts +0 -1
- package/lib/utils/coveredCall/getMakerClaimTx.js +0 -59
- package/lib/utils/coveredCall/getNewAuctionTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewAuctionTx.js +0 -66
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +0 -64
- package/lib/utils/coveredCall/getNewBidTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewBidTx.js +0 -62
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +0 -77
- package/lib/utils/coveredCall/getNewManagerTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewManagerTx.js +0 -59
- package/lib/utils/coveredCall/getRefundTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRefundTx.js +0 -59
- package/lib/utils/coveredCall/getRemoveBidTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRemoveBidTx.js +0 -60
- package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.js +0 -61
- package/lib/utils/coveredCall/getRemoveManagerTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRemoveManagerTx.js +0 -58
- package/lib/utils/coveredCall/getRollOverTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRollOverTx.js +0 -60
- package/lib/utils/coveredCall/getSettleTx.d.ts +0 -1
- package/lib/utils/coveredCall/getSettleTx.js +0 -62
- package/lib/utils/coveredCall/getSettleWithRollOverTx.d.ts +0 -1
- package/lib/utils/coveredCall/getSettleWithRollOverTx.js +0 -62
- package/lib/utils/coveredCall/getSubscribeTx.d.ts +0 -1
- package/lib/utils/coveredCall/getSubscribeTx.js +0 -60
- package/lib/utils/coveredCall/getUnsubscribeTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUnsubscribeTx.js +0 -63
- package/lib/utils/coveredCall/getUpdateCapacityTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUpdateCapacityTx.js +0 -61
- package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.js +0 -66
- package/lib/utils/coveredCall/getUpdatePayoffConfigTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUpdatePayoffConfigTx.js +0 -62
- package/lib/utils/coveredCall/getUpdateVaultConfigTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUpdateVaultConfigTx.js +0 -65
- package/lib/utils/coveredCall/getWithdrawTx.d.ts +0 -1
- package/lib/utils/coveredCall/getWithdrawTx.js +0 -60
- package/lib/utils/fetchPortfolioData.d.ts +0 -93
- package/lib/utils/fetchPortfolioData.js +0 -205
- package/lib/utils/getCreateTokenRegistryTx.d.ts +0 -1
- package/lib/utils/getCreateTokenRegistryTx.js +0 -59
- package/lib/utils/getMakersShares.d.ts +0 -8
- package/lib/utils/getMakersShares.js +0 -145
- package/lib/utils/getNewOracleTx.d.ts +0 -1
- package/lib/utils/getNewOracleTx.js +0 -59
- package/lib/utils/getNewTimeOracleTx.d.ts +0 -1
- package/lib/utils/getNewTimeOracleTx.js +0 -56
- package/lib/utils/getUpdateOracleTx.d.ts +0 -1
- package/lib/utils/getUpdateOracleTx.js +0 -64
- package/lib/utils/getUpdateTimeOracleTx.d.ts +0 -1
- package/lib/utils/getUpdateTimeOracleTx.js +0 -60
- package/lib/utils/getUsersShares.d.ts +0 -9
- package/lib/utils/getUsersShares.js +0 -148
- package/lib/utils/getVaultIndexInRegistry.d.ts +0 -1
- package/lib/utils/getVaultIndexInRegistry.js +0 -61
- package/lib/utils/isObjAvailable.d.ts +0 -0
- package/lib/utils/isObjAvailable.js +0 -14
- package/lib/utils/loadUsersDepositData.d.ts +0 -8
- package/lib/utils/loadUsersDepositData.js +0 -160
- package/lib/utils/portfolio/authorized/getAuthorizedEvolutionTx.d.ts +0 -1
- package/lib/utils/portfolio/authorized/getAuthorizedLastEvolutionTx.d.ts +0 -1
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +0 -4
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateVaultConfigTx.d.ts +0 -1
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateVaultConfigTx.js +0 -64
- package/lib/utils/portfolio/manager/getLastEvolutionTx.d.ts +0 -1
- package/lib/utils/portfolio/manager/getUpdateNextVaultConfigTx.d.ts +0 -4
- package/lib/utils/portfolio/manager/getUpdateNextVaultConfigTx.js +0 -71
- package/lib/utils/portfolio/manager/getUpdateVaultConfigTx.d.ts +0 -1
- package/lib/utils/portfolio/user/getCompoundPremiumTx.d.ts +0 -1
- package/lib/utils/portfolio/user/getCompoundPremiumTx.js +0 -60
- /package/lib/test/{getMakersShares.d.ts → authorized/testAuthorizedNewPortfolioVault.d.ts} +0 -0
- /package/lib/test/{getUsersShares.d.ts → authorized/testAuthorizedUpdateUpcomingVaultConfig.d.ts} +0 -0
- /package/lib/test/{testClaim.d.ts → authorized/testAuthorizedUpdateWarmupVaultConfig.d.ts} +0 -0
- /package/lib/test/{testDeposit.d.ts → helper/getAuctionMaxSize.d.ts} +0 -0
- /package/lib/test/{testNewAuction.d.ts → helper/getUserStatus.d.ts} +0 -0
- /package/lib/test/{testNewVault.d.ts → user/testClaim.d.ts} +0 -0
- /package/lib/test/{testOracle.d.ts → user/testCompound.d.ts} +0 -0
- /package/lib/test/{testSettle.d.ts → user/testDeposit.d.ts} +0 -0
- /package/lib/test/{testUnsubscribe.d.ts → user/testHarvest.d.ts} +0 -0
- /package/lib/test/{testWithdraw.d.ts → user/testNewBid.d.ts} +0 -0
package/lib/config.json
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"RPC_ENDPOINT": "https://fullnode.devnet.sui.io:443",
|
|
3
|
-
"
|
|
4
|
-
"REGISTRY": "
|
|
5
|
-
"MANAGER_CAP": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"APT_ORACLE_KEY": "0x4c072cc9a43d5136b9d6a866780a12c9df23a01e",
|
|
21
|
-
"DOGE_ORACLE": "0x6857833c621fd4548b323c15289ad3d8b03db8a7",
|
|
22
|
-
"DOGE_ORACLE_KEY": "0x8d6d297978f91cec947ee25e278d690984559773"
|
|
3
|
+
"PORTFOLIO_PACKAGE": "0xec173aa0db809acf12578133c8fb69b6eb062072",
|
|
4
|
+
"REGISTRY": "0x02354de3b28ac37b3cc88cb4702d3f7e33dcc475",
|
|
5
|
+
"MANAGER_CAP": "0x8c27432f2f82e4fd165c1db12e321933e0cc1f5c",
|
|
6
|
+
"TOKEN_PACKAGE": "0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec",
|
|
7
|
+
"ORACLE_PACKAGE": "0xaf8a13019dbcda931baab67c4f13bf4adc7ebb14",
|
|
8
|
+
"TIME_ORACLE": "0xf09375b1a06e06897f79e61cdfef7baabf1a2da5",
|
|
9
|
+
"TIME_ORACLE_KEY": "0x4844842eabe4ab7f42a9e38c8be052122d1d3477",
|
|
10
|
+
"BTC_ORACLE": "0x2291059bfea5061676bf990ac26823f69cbd1523",
|
|
11
|
+
"BTC_ORACLE_KEY": "0x2bdbc4ed776c48b4cdfec6439d9eeca12947f4b5",
|
|
12
|
+
"ETH_ORACLE": "0x2867941517e1334cf5fb0eb1dd635e8d2cf39167",
|
|
13
|
+
"ETH_ORACLE_KEY": "0x662f2242f4a1ee3df299c4f459921ac72d657ae0",
|
|
14
|
+
"SUI_ORACLE": "0xcb19a040109e3f606c65d37c2b9118fdb1bd606e",
|
|
15
|
+
"SUI_ORACLE_KEY": "0x09818d7a532697c5d1a6867c818f8116a7a1f0e9",
|
|
16
|
+
"APT_ORACLE": "0xa17cb9fe11c57c7dbfff59910da90ac63fad8938",
|
|
17
|
+
"APT_ORACLE_KEY": "0x6d2ed8259baf387b8c5d2b8f1e15fdaf188ca4a0",
|
|
18
|
+
"DOGE_ORACLE": "0x48ab076f16e2bc3fdfb9be44990976dadcc30128",
|
|
19
|
+
"DOGE_ORACLE_KEY": "0x7942367add64cd9196ce283741acb01578fa249a"
|
|
23
20
|
}
|
package/lib/constants.d.ts
CHANGED
|
@@ -2,18 +2,20 @@ export declare const TOKEN_PACKAGE: string;
|
|
|
2
2
|
export declare const TOKEN_REGISTRY_SUI = "0x3b87b3f0403f527d28fd1301074a12446f43817a";
|
|
3
3
|
export declare const ORACLE_PACKAGE: string;
|
|
4
4
|
export declare const TIME_ORACLE: string;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
5
|
+
export declare const BTC_ORACLE: string;
|
|
6
|
+
export declare const ETH_ORACLE: string;
|
|
7
|
+
export declare const SUI_ORACLE: string;
|
|
8
|
+
export declare const APT_ORACLE: string;
|
|
9
|
+
export declare const DOGE_ORACLE: string;
|
|
10
|
+
export declare const PORTFOLIO_PACKAGE: string;
|
|
11
|
+
export declare const REGISTRY: string;
|
|
12
|
+
export declare const MANAGER_CAP: string;
|
|
11
13
|
export declare const TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
|
|
12
14
|
export declare const PRICE_DECIMAL = 8;
|
|
13
15
|
export declare const TOKEN_DECIMAL = 9;
|
|
14
16
|
export declare const DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
|
15
17
|
export declare const FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
|
|
16
|
-
export declare const TEST_MNEMONIC = "
|
|
18
|
+
export declare const TEST_MNEMONIC = "shock shop drink choice mystery bean love dream comic fetch boss canyon";
|
|
17
19
|
export declare const TOKEN_NAME: string[];
|
|
18
20
|
export declare const TOKEN_NAME_TO_MODULE: {
|
|
19
21
|
BTC: string;
|
package/lib/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TESTNET_RPC_ENDPOINT = exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.TEST_MNEMONIC = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.TEST_MINT_TOKEN = exports.
|
|
6
|
+
exports.TESTNET_RPC_ENDPOINT = exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.TEST_MNEMONIC = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.TEST_MINT_TOKEN = exports.MANAGER_CAP = exports.REGISTRY = exports.PORTFOLIO_PACKAGE = exports.DOGE_ORACLE = exports.APT_ORACLE = exports.SUI_ORACLE = exports.ETH_ORACLE = exports.BTC_ORACLE = exports.TIME_ORACLE = exports.ORACLE_PACKAGE = exports.TOKEN_REGISTRY_SUI = exports.TOKEN_PACKAGE = void 0;
|
|
7
7
|
var config_json_1 = __importDefault(require("./config.json"));
|
|
8
8
|
//publish from sui-dev-token
|
|
9
9
|
exports.TOKEN_PACKAGE = config_json_1.default.TOKEN_PACKAGE;
|
|
@@ -11,20 +11,22 @@ exports.TOKEN_REGISTRY_SUI = "0x3b87b3f0403f527d28fd1301074a12446f43817a";
|
|
|
11
11
|
//publish from typus-oracle
|
|
12
12
|
exports.ORACLE_PACKAGE = config_json_1.default.ORACLE_PACKAGE;
|
|
13
13
|
exports.TIME_ORACLE = config_json_1.default.TIME_ORACLE;
|
|
14
|
+
exports.BTC_ORACLE = config_json_1.default.BTC_ORACLE;
|
|
15
|
+
exports.ETH_ORACLE = config_json_1.default.ETH_ORACLE;
|
|
16
|
+
exports.SUI_ORACLE = config_json_1.default.SUI_ORACLE;
|
|
17
|
+
exports.APT_ORACLE = config_json_1.default.APT_ORACLE;
|
|
18
|
+
exports.DOGE_ORACLE = config_json_1.default.DOGE_ORACLE;
|
|
14
19
|
//publish from typus-dov/cover_call
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.USER_SHARE_TABLE = config_json_1.default.USER_SHARE_TABLE;
|
|
19
|
-
exports.USER_REFUND_TABLE = config_json_1.default.USER_REFUND_TABLE;
|
|
20
|
-
exports.MAKER_SHARE_TABLE = config_json_1.default.MAKER_SHARE_TABLE;
|
|
20
|
+
exports.PORTFOLIO_PACKAGE = config_json_1.default.PORTFOLIO_PACKAGE;
|
|
21
|
+
exports.REGISTRY = config_json_1.default.REGISTRY;
|
|
22
|
+
exports.MANAGER_CAP = config_json_1.default.MANAGER_CAP;
|
|
21
23
|
//publish from typus-dov/typus-dov
|
|
22
24
|
exports.TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
|
|
23
25
|
exports.PRICE_DECIMAL = 8;
|
|
24
26
|
exports.TOKEN_DECIMAL = 9;
|
|
25
27
|
exports.DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
|
26
28
|
exports.FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
|
|
27
|
-
exports.TEST_MNEMONIC = "
|
|
29
|
+
exports.TEST_MNEMONIC = "shock shop drink choice mystery bean love dream comic fetch boss canyon";
|
|
28
30
|
exports.TOKEN_NAME = ["BTC", "ETH", "SUI", "USDC", "USDT", "APT", "DOGE"];
|
|
29
31
|
exports.TOKEN_NAME_TO_MODULE = {
|
|
30
32
|
"BTC": "btc",
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var constants_1 = require("../../constants");
|
|
40
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
41
|
+
var getAuthorizedNewPortfolioVaultTx_1 = require("../../utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx");
|
|
42
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
43
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
44
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
45
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var typeArguments, optionType, period, activationTsMs, expirationTsMs, dTokenDecimal, bTokenDecimal, oTokenDecimal, capacity, strikePct, weight, isBuyer, strikeIncrement, lotSize, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, whitelist, leverage, hasNext, gasBudget, claimTx, res;
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
typeArguments = ["0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC", "0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC", "0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC"];
|
|
51
|
+
optionType = "0";
|
|
52
|
+
period = "0";
|
|
53
|
+
activationTsMs = "1678694400000";
|
|
54
|
+
expirationTsMs = "1678780800000";
|
|
55
|
+
dTokenDecimal = "9";
|
|
56
|
+
bTokenDecimal = "9";
|
|
57
|
+
oTokenDecimal = "9";
|
|
58
|
+
capacity = "1000000000000";
|
|
59
|
+
strikePct = ["10254"];
|
|
60
|
+
weight = ["1"];
|
|
61
|
+
isBuyer = [false];
|
|
62
|
+
strikeIncrement = "20000000000";
|
|
63
|
+
lotSize = "100000";
|
|
64
|
+
decaySpeed = "1";
|
|
65
|
+
initialPrice = "12176899";
|
|
66
|
+
finalPrice = "1791643";
|
|
67
|
+
auctionDurationInMs = "3600000";
|
|
68
|
+
whitelist = [];
|
|
69
|
+
leverage = "100";
|
|
70
|
+
hasNext = true;
|
|
71
|
+
gasBudget = 100000;
|
|
72
|
+
return [4 /*yield*/, (0, getAuthorizedNewPortfolioVaultTx_1.getAuthorizedNewPortfolioVaultTx)(gasBudget, constants_1.PORTFOLIO_PACKAGE, constants_1.REGISTRY, typeArguments, constants_1.TIME_ORACLE, optionType, period, activationTsMs, expirationTsMs, dTokenDecimal, bTokenDecimal, oTokenDecimal, capacity, strikePct, weight, isBuyer, strikeIncrement, lotSize, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, whitelist, leverage, hasNext)];
|
|
73
|
+
case 1:
|
|
74
|
+
claimTx = _a.sent();
|
|
75
|
+
return [4 /*yield*/, signer.executeMoveCall(claimTx)];
|
|
76
|
+
case 2:
|
|
77
|
+
res = _a.sent();
|
|
78
|
+
console.log(res);
|
|
79
|
+
return [2 /*return*/];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); })();
|
|
@@ -36,46 +36,35 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var
|
|
40
|
-
var getClaimAllTx_1 = require("../utils/coveredCall/getClaimAllTx");
|
|
41
|
-
var constants_1 = require("../constants");
|
|
39
|
+
var constants_1 = require("../../constants");
|
|
42
40
|
var sui_js_1 = require("@mysten/sui.js");
|
|
43
|
-
var
|
|
44
|
-
var provider = new sui_js_1.JsonRpcProvider(
|
|
41
|
+
var getAuthorizedUpdateUpcomingVaultConfigTx_1 = require("../../utils/portfolio/authorized/getAuthorizedUpdateUpcomingVaultConfigTx");
|
|
42
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
45
43
|
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
46
44
|
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
47
|
-
/*
|
|
48
|
-
after claim,
|
|
49
|
-
*/
|
|
50
45
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
-
var
|
|
46
|
+
var typeArguments, index, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, strikePct, weight, isBuyer, gasBudget, claimTx, res;
|
|
52
47
|
return __generator(this, function (_a) {
|
|
53
48
|
switch (_a.label) {
|
|
54
49
|
case 0:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
typeArguments = ["0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC", "0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC", "0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC"];
|
|
51
|
+
index = "0";
|
|
52
|
+
strikeIncrement = "20000000000";
|
|
53
|
+
decaySpeed = "1";
|
|
54
|
+
initialPrice = "12176899";
|
|
55
|
+
finalPrice = "1791643";
|
|
56
|
+
auctionDurationInMs = "1800000";
|
|
57
|
+
strikePct = ["10254"];
|
|
58
|
+
weight = ["1"];
|
|
59
|
+
isBuyer = [false];
|
|
64
60
|
gasBudget = 100000;
|
|
65
|
-
return [4 /*yield*/, (0,
|
|
66
|
-
case
|
|
61
|
+
return [4 /*yield*/, (0, getAuthorizedUpdateUpcomingVaultConfigTx_1.getAuthorizedUpdateUpcomingVaultConfigTx)(gasBudget, constants_1.PORTFOLIO_PACKAGE, constants_1.REGISTRY, typeArguments, index, strikePct, weight, isBuyer, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs)];
|
|
62
|
+
case 1:
|
|
67
63
|
claimTx = _a.sent();
|
|
68
64
|
return [4 /*yield*/, signer.executeMoveCall(claimTx)];
|
|
69
|
-
case
|
|
70
|
-
_a.sent();
|
|
71
|
-
console.log(
|
|
72
|
-
return [4 /*yield*/, (0, getClaimAllTx_1.getClaimAllTx)(gasBudget, constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex)];
|
|
73
|
-
case 4:
|
|
74
|
-
claimAllTx = _a.sent();
|
|
75
|
-
return [4 /*yield*/, signer.executeMoveCall(claimAllTx)];
|
|
76
|
-
case 5:
|
|
77
|
-
_a.sent();
|
|
78
|
-
console.log("claim all successfully");
|
|
65
|
+
case 2:
|
|
66
|
+
res = _a.sent();
|
|
67
|
+
console.log(res);
|
|
79
68
|
return [2 /*return*/];
|
|
80
69
|
}
|
|
81
70
|
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var constants_1 = require("../../constants");
|
|
40
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
41
|
+
var getAuthorizedUpdateWarmupVaultConfigTx_1 = require("../../utils/portfolio/authorized/getAuthorizedUpdateWarmupVaultConfigTx");
|
|
42
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
43
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
44
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
45
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var typeArguments, index, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, gasBudget, claimTx, res;
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
typeArguments = ["0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC", "0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC", "0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC"];
|
|
51
|
+
index = "0";
|
|
52
|
+
strikeIncrement = "20000000000";
|
|
53
|
+
decaySpeed = "1";
|
|
54
|
+
initialPrice = "12176899";
|
|
55
|
+
finalPrice = "1791643";
|
|
56
|
+
auctionDurationInMs = "1800000";
|
|
57
|
+
gasBudget = 100000;
|
|
58
|
+
return [4 /*yield*/, (0, getAuthorizedUpdateWarmupVaultConfigTx_1.getAuthorizedUpdateWarmupVaultConfigTx)(gasBudget, constants_1.PORTFOLIO_PACKAGE, typeArguments, constants_1.REGISTRY, index, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs)];
|
|
59
|
+
case 1:
|
|
60
|
+
claimTx = _a.sent();
|
|
61
|
+
return [4 /*yield*/, signer.executeMoveCall(claimTx)];
|
|
62
|
+
case 2:
|
|
63
|
+
res = _a.sent();
|
|
64
|
+
console.log(res);
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}); })();
|
package/lib/test/getVaultData.js
CHANGED
|
@@ -44,7 +44,7 @@ var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read
|
|
|
44
44
|
var res;
|
|
45
45
|
return __generator(this, function (_a) {
|
|
46
46
|
switch (_a.label) {
|
|
47
|
-
case 0: return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.
|
|
47
|
+
case 0: return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.REGISTRY, provider)];
|
|
48
48
|
case 1:
|
|
49
49
|
res = _a.sent();
|
|
50
50
|
console.log("vault: ");
|
|
@@ -44,7 +44,7 @@ var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read
|
|
|
44
44
|
var whiteLists;
|
|
45
45
|
return __generator(this, function (_a) {
|
|
46
46
|
switch (_a.label) {
|
|
47
|
-
case 0: return [4 /*yield*/, (0, getWhiteListFromRegistry_1.getWhiteListFromRegistry)(constants_1.
|
|
47
|
+
case 0: return [4 /*yield*/, (0, getWhiteListFromRegistry_1.getWhiteListFromRegistry)(constants_1.REGISTRY, provider)];
|
|
48
48
|
case 1:
|
|
49
49
|
whiteLists = _a.sent();
|
|
50
50
|
console.log("whiteLists: ");
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var constants_1 = require("../../constants");
|
|
40
|
+
var getVaultData_1 = require("../../utils/getVaultData");
|
|
41
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
42
|
+
var getAuctionMaxSize_1 = require("../../utils/portfolio/helper/getAuctionMaxSize");
|
|
43
|
+
var getUserStatus_1 = require("../../utils/portfolio/helper/getUserStatus");
|
|
44
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
45
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var user, dogeOracle, index, portfolioVaults, portfolioVault, tx, res, rawData;
|
|
47
|
+
var _a;
|
|
48
|
+
return __generator(this, function (_b) {
|
|
49
|
+
switch (_b.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
user = "0x4a3b00eac21bfbe062932a5c2b9710245edb2cc2";
|
|
52
|
+
dogeOracle = "0x48ab076f16e2bc3fdfb9be44990976dadcc30128";
|
|
53
|
+
index = "0";
|
|
54
|
+
return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.REGISTRY, provider)];
|
|
55
|
+
case 1:
|
|
56
|
+
portfolioVaults = _b.sent();
|
|
57
|
+
portfolioVault = portfolioVaults.find(function (portfolioVault) { return portfolioVault.info.index == index; });
|
|
58
|
+
console.log(portfolioVault);
|
|
59
|
+
_a = {
|
|
60
|
+
kind: 'moveCall'
|
|
61
|
+
};
|
|
62
|
+
return [4 /*yield*/, (0, getAuctionMaxSize_1.getAuctionMaxSize)(constants_1.PORTFOLIO_PACKAGE, portfolioVault.typeArgs, constants_1.REGISTRY, portfolioVault.info.index, dogeOracle)];
|
|
63
|
+
case 2:
|
|
64
|
+
tx = (_a.data = _b.sent(),
|
|
65
|
+
_a);
|
|
66
|
+
return [4 /*yield*/, provider.devInspectTransaction(user, tx)];
|
|
67
|
+
case 3:
|
|
68
|
+
res = _b.sent();
|
|
69
|
+
console.log(res);
|
|
70
|
+
rawData = res.results.Ok[0][1].returnValues[0][0];
|
|
71
|
+
console.log(rawData);
|
|
72
|
+
console.log((0, getUserStatus_1.intFromBytes)(rawData.reverse()));
|
|
73
|
+
return [2 /*return*/];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}); })();
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var constants_1 = require("../../constants");
|
|
40
|
+
var getVaultData_1 = require("../../utils/getVaultData");
|
|
41
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
42
|
+
var getUserStatus_1 = require("../../utils/portfolio/helper/getUserStatus");
|
|
43
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
44
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var user, index, portfolioVaults, portfolioVault, tx, res, rawData, userStatusResult;
|
|
46
|
+
var _a;
|
|
47
|
+
return __generator(this, function (_b) {
|
|
48
|
+
switch (_b.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
user = "0x4a3b00eac21bfbe062932a5c2b9710245edb2cc2";
|
|
51
|
+
index = "0";
|
|
52
|
+
return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.REGISTRY, provider)];
|
|
53
|
+
case 1:
|
|
54
|
+
portfolioVaults = _b.sent();
|
|
55
|
+
portfolioVault = portfolioVaults.find(function (portfolioVault) { return portfolioVault.info.index == index; });
|
|
56
|
+
console.log(portfolioVault);
|
|
57
|
+
_a = {
|
|
58
|
+
kind: 'moveCall'
|
|
59
|
+
};
|
|
60
|
+
return [4 /*yield*/, (0, getUserStatus_1.getUserStatus)(constants_1.PORTFOLIO_PACKAGE, portfolioVault.typeArgs, constants_1.REGISTRY, portfolioVault.info.index, user)];
|
|
61
|
+
case 2:
|
|
62
|
+
tx = (_a.data = _b.sent(),
|
|
63
|
+
_a);
|
|
64
|
+
return [4 /*yield*/, provider.devInspectTransaction(user, tx)];
|
|
65
|
+
case 3:
|
|
66
|
+
res = _b.sent();
|
|
67
|
+
console.log(res);
|
|
68
|
+
rawData = res.results.Ok[0][1].returnValues[0][0];
|
|
69
|
+
console.log(rawData);
|
|
70
|
+
userStatusResult = (0, getUserStatus_1.parseUserStatusResult)(rawData);
|
|
71
|
+
console.log(userStatusResult);
|
|
72
|
+
return [2 /*return*/];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); })();
|
|
@@ -36,35 +36,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var
|
|
40
|
-
var constants_1 = require("../constants");
|
|
39
|
+
var constants_1 = require("../../constants");
|
|
41
40
|
var sui_js_1 = require("@mysten/sui.js");
|
|
42
|
-
var
|
|
43
|
-
var
|
|
41
|
+
var getClaimTx_1 = require("../../utils/portfolio/user/getClaimTx");
|
|
42
|
+
var getVaultData_1 = require("../../utils/getVaultData");
|
|
43
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
44
44
|
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
45
45
|
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
46
46
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
-
var
|
|
47
|
+
var index, portfolioVaults, portfolioVault, typeArguments, gasBudget, claimTx;
|
|
48
48
|
return __generator(this, function (_a) {
|
|
49
49
|
switch (_a.label) {
|
|
50
50
|
case 0:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
token = "0x82416a9dacea43afa6570863f1bcd3e55e75448e" // minted token
|
|
54
|
-
;
|
|
55
|
-
vaultIndex = 0;
|
|
56
|
-
return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token, provider)];
|
|
51
|
+
index = "0";
|
|
52
|
+
return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.REGISTRY, provider)];
|
|
57
53
|
case 1:
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
portfolioVaults = _a.sent();
|
|
55
|
+
portfolioVault = portfolioVaults.find(function (portfolioVault) { return portfolioVault.info.index == index; });
|
|
56
|
+
typeArguments = portfolioVault.typeArgs;
|
|
57
|
+
console.log(portfolioVault);
|
|
60
58
|
gasBudget = 100000;
|
|
61
|
-
return [4 /*yield*/, (0,
|
|
59
|
+
return [4 /*yield*/, (0, getClaimTx_1.getClaimTx)(gasBudget, constants_1.PORTFOLIO_PACKAGE, constants_1.REGISTRY, typeArguments, index)];
|
|
62
60
|
case 2:
|
|
63
|
-
|
|
64
|
-
return [4 /*yield*/, signer.executeMoveCall(
|
|
61
|
+
claimTx = _a.sent();
|
|
62
|
+
return [4 /*yield*/, signer.executeMoveCall(claimTx)];
|
|
65
63
|
case 3:
|
|
66
64
|
_a.sent();
|
|
67
|
-
console.log("withdraw to vault successfully");
|
|
68
65
|
return [2 /*return*/];
|
|
69
66
|
}
|
|
70
67
|
});
|
|
@@ -36,18 +36,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var constants_1 = require("
|
|
39
|
+
var constants_1 = require("../../constants");
|
|
40
40
|
var sui_js_1 = require("@mysten/sui.js");
|
|
41
|
-
var
|
|
41
|
+
var getVaultData_1 = require("../../utils/getVaultData");
|
|
42
|
+
var getCompoundTx_1 = require("../../utils/portfolio/user/getCompoundTx");
|
|
42
43
|
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
44
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
45
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
43
46
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
-
var
|
|
47
|
+
var index, portfolioVaults, portfolioVault, typeArguments, gasBudget, claimTx;
|
|
45
48
|
return __generator(this, function (_a) {
|
|
46
49
|
switch (_a.label) {
|
|
47
|
-
case 0:
|
|
50
|
+
case 0:
|
|
51
|
+
index = "0";
|
|
52
|
+
return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.REGISTRY, provider)];
|
|
48
53
|
case 1:
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
portfolioVaults = _a.sent();
|
|
55
|
+
portfolioVault = portfolioVaults.find(function (portfolioVault) { return portfolioVault.info.index == index; });
|
|
56
|
+
typeArguments = portfolioVault.typeArgs;
|
|
57
|
+
console.log(portfolioVault);
|
|
58
|
+
gasBudget = 100000;
|
|
59
|
+
return [4 /*yield*/, (0, getCompoundTx_1.getCompoundTx)(gasBudget, constants_1.PORTFOLIO_PACKAGE, constants_1.REGISTRY, typeArguments, index)];
|
|
60
|
+
case 2:
|
|
61
|
+
claimTx = _a.sent();
|
|
62
|
+
return [4 /*yield*/, signer.executeMoveCall(claimTx)];
|
|
63
|
+
case 3:
|
|
64
|
+
_a.sent();
|
|
51
65
|
return [2 /*return*/];
|
|
52
66
|
}
|
|
53
67
|
});
|