Skip to content

Commit

Permalink
add examples for reclaim phase & start-reclaim-phase
Browse files Browse the repository at this point in the history
  • Loading branch information
avernikoz committed Mar 21, 2024
1 parent b2e7c4c commit 44a7ce2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/refund/reclaim-funds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui.js/utils";
import { RefundManagerSingleton } from "../../src";
import { RefundPoolPhase } from "../../src/managers/refund/utils";
import { keypair, provider, signAndExecuteTransaction, suiProviderUrl, user } from "../common";
import { delegateeKeypair, delegateeUser } from "../dca/common";

// yarn ts-node examples/refund/reclaim-funds.ts
(async () => {
const txData = RefundManagerSingleton.getReclaimFundsTransaction({
poolObjectId: RefundManagerSingleton.REFUND_POOL_OBJECT_ID,
});

// const res = await provider.devInspectTransactionBlock({
// sender: delegateeUser,
// transactionBlock: txData.tx,
// });

const res = await signAndExecuteTransaction(txData.tx, delegateeKeypair);

console.debug("txData: ", txData);
console.debug("res: ", res);
})();
23 changes: 23 additions & 0 deletions examples/refund/start-reclaim-phase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui.js/utils";
import { RefundManagerSingleton } from "../../src";
import { RefundPoolPhase } from "../../src/managers/refund/utils";
import { keypair, provider, signAndExecuteTransaction, suiProviderUrl, user } from "../common";
import { delegateeKeypair, delegateeUser } from "../dca/common";

// yarn ts-node examples/refund/start-reclaim-phase.ts
(async () => {
const txData = RefundManagerSingleton.startReclaimPhase({
poolObjectId: RefundManagerSingleton.REFUND_POOL_OBJECT_ID,
clock: SUI_CLOCK_OBJECT_ID,
});

// const res = await provider.devInspectTransactionBlock({
// sender: delegateeUser,
// transactionBlock: txData.tx,
// });

const res = await signAndExecuteTransaction(txData.tx, delegateeKeypair);

console.debug("txData: ", txData);
console.debug("res: ", res);
})();

0 comments on commit 44a7ce2

Please sign in to comment.