navi-sdk
Version:
The NAVI SDK Client provides tools for interacting with the Sui blockchain networks, designed for handling transactions, accounts, and smart contracts efficiently. This documentation covers the setup, account management, and transaction handling within th
40 lines (36 loc) • 1.05 kB
text/typescript
import { Transaction } from "@mysten/sui/transactions";
import { AggregatorConfig } from "../config";
import { vSuiConfig } from "../../../address";
export async function makeHASUIPTB(
txb: Transaction,
pathTempCoin: any,
a2b: boolean
) {
const func = a2b ? "request_stake_coin" : "request_unstake_instant_coin";
let coinB;
if (a2b) {
[coinB] = txb.moveCall({
target: `${AggregatorConfig.haSuiPackageId}::staking::${func}`,
typeArguments: [],
arguments: [
txb.object(vSuiConfig.wrapper),
txb.object(AggregatorConfig.haSuiConfigId),
pathTempCoin,
txb.pure.address(
"0x0000000000000000000000000000000000000000000000000000000000000000"
),
],
});
} else {
[coinB] = txb.moveCall({
target: `${AggregatorConfig.haSuiPackageId}::staking::${func}`,
typeArguments: [],
arguments: [
txb.object(vSuiConfig.wrapper),
txb.object(AggregatorConfig.haSuiConfigId),
pathTempCoin,
],
});
}
return coinB;
}