Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alphafi-sdk and stsui-sdk upgrade #184

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@msafe/sui-app-store",
"version": "0.0.206",
"version": "0.0.208",
"description": "MSafe Sui app store repository",
"author": "Momentum Safe",
"license": "MIT",
Expand Down Expand Up @@ -45,8 +45,8 @@
"MSafe Sui"
],
"dependencies": {
"@alphafi/alphafi-sdk": "^0.0.55",
"@alphafi/stsui-sdk": "^0.0.15",
"@alphafi/alphafi-sdk": "^0.0.65",
"@alphafi/stsui-sdk": "^0.0.21",
"@cetusprotocol/aggregator-sdk": "^0.3.20",
"@cetusprotocol/cetus-periphery-sdk": "^3.4.0",
"@cetusprotocol/cetus-sui-clmm-sdk": "^5.2.0",
Expand Down
9 changes: 7 additions & 2 deletions src/apps/stsui/intentions/mint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mint } from '@alphafi/stsui-sdk';
import { LST, LstParams } from '@alphafi/stsui-sdk';
import { TransactionType } from '@msafe/sui3-utils';
import { Transaction } from '@mysten/sui/transactions';
import { WalletAccount } from '@mysten/wallet-standard';
Expand All @@ -19,7 +19,12 @@ export class MintIntention extends BaseIntention<MintIntentionData> {
async build(input: { account: WalletAccount }): Promise<Transaction> {
const { account } = input;
const { amount } = this.data;
const txb = await mint(amount, { address: account.address });
const lstParams: LstParams = {
lstInfo: '0x1adb343ab351458e151bc392fbf1558b3332467f23bda45ae67cd355a57fd5f5',
lstCointype: '0xd1b72982e40348d069bb1ff701e634c117bb5f741f44dff91e472d3b01461e55::stsui::STSUI',
};
const lst = new LST(lstParams);
const txb = await lst.mint(amount, account.address);
return txb;
}

Expand Down
9 changes: 7 additions & 2 deletions src/apps/stsui/intentions/redeem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { redeem } from '@alphafi/stsui-sdk';
import { LST, LstParams } from '@alphafi/stsui-sdk';
import { TransactionType } from '@msafe/sui3-utils';
import { Transaction } from '@mysten/sui/transactions';
import { WalletAccount } from '@mysten/wallet-standard';
Expand All @@ -19,7 +19,12 @@ export class RedeemIntention extends BaseIntention<RedeemIntentionData> {
async build(input: { account: WalletAccount }): Promise<Transaction> {
const { account } = input;
const { amount } = this.data;
const txb = await redeem(amount, { address: account.address });
const lstParams: LstParams = {
lstInfo: '0x1adb343ab351458e151bc392fbf1558b3332467f23bda45ae67cd355a57fd5f5',
lstCointype: '0xd1b72982e40348d069bb1ff701e634c117bb5f741f44dff91e472d3b01461e55::stsui::STSUI',
};
const lst = new LST(lstParams);
const txb = await lst.redeem(amount, account.address);
return txb;
}

Expand Down
26 changes: 19 additions & 7 deletions test/stsui.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mint, redeem } from '@alphafi/stsui-sdk';
import { LST, LstParams } from '@alphafi/stsui-sdk';
import { SuiClient } from '@mysten/sui/client';
import { Transaction } from '@mysten/sui/transactions';

Expand Down Expand Up @@ -28,9 +28,15 @@ describe('StSui App', () => {
const client = new SuiClient({ url: 'https://fullnode.mainnet.sui.io/' });

it('Deserialize withdraw BLUEFIN-SUI-USDC transaction', async () => {
const unresolvedTx = await mint('10000000', {
address: '0xe136f0b6faf27ee707725f38f2aeefc51c6c31cc508222bee5cbc4f5fcf222c3',
});
const lstParams: LstParams = {
lstInfo: '0x1adb343ab351458e151bc392fbf1558b3332467f23bda45ae67cd355a57fd5f5',
lstCointype: '0xd1b72982e40348d069bb1ff701e634c117bb5f741f44dff91e472d3b01461e55::stsui::STSUI',
};
const lst = new LST(lstParams);
const unresolvedTx = await lst.mint(
'10000000',
'0xe136f0b6faf27ee707725f38f2aeefc51c6c31cc508222bee5cbc4f5fcf222c3',
);

const resolvedTx = Transaction.from(await unresolvedTx.build({ client }));
const data = await helper.deserialize({ transaction: resolvedTx, suiClient: client } as any);
Expand All @@ -44,9 +50,15 @@ describe('StSui App', () => {
const client = new SuiClient({ url: 'https://fullnode.mainnet.sui.io/' });

it('Deserialize withdraw BLUEFIN-SUI-USDC transaction', async () => {
const unresolvedTx = await redeem('10000000', {
address: '0xe136f0b6faf27ee707725f38f2aeefc51c6c31cc508222bee5cbc4f5fcf222c3',
});
const lstParams: LstParams = {
lstInfo: '0x1adb343ab351458e151bc392fbf1558b3332467f23bda45ae67cd355a57fd5f5',
lstCointype: '0xd1b72982e40348d069bb1ff701e634c117bb5f741f44dff91e472d3b01461e55::stsui::STSUI',
};
const lst = new LST(lstParams);
const unresolvedTx = await lst.redeem(
'10000000',
'0xe136f0b6faf27ee707725f38f2aeefc51c6c31cc508222bee5cbc4f5fcf222c3',
);

const resolvedTx = Transaction.from(await unresolvedTx.build({ client }));
const data = await helper.deserialize({ transaction: resolvedTx, suiClient: client } as any);
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"@gql.tada/internal" "^1.0.0"
graphql "^15.5.0 || ^16.0.0 || ^17.0.0"

"@7kprotocol/sdk-ts@^2.2.2":
"@7kprotocol/sdk-ts@^2.3.4":
version "2.3.4"
resolved "https://registry.yarnpkg.com/@7kprotocol/sdk-ts/-/sdk-ts-2.3.4.tgz#bfaffd6487212fcbb334ca940ce4157dd72182eb"
integrity sha512-zoRPgPrSWwb8Bya/YN611TZ21uKLKuK2JkDxhz1ocrLJzQzIEb8HEaEmZLYszGiXTrapVQiiDWngQiF774DcBw==

"@alphafi/alphafi-sdk@^0.0.55":
version "0.0.55"
resolved "https://registry.yarnpkg.com/@alphafi/alphafi-sdk/-/alphafi-sdk-0.0.55.tgz#05c9ea6a5e8619a71075248c7e096c29401840ec"
integrity sha512-hAh+77kc8CuljdkmjZpINDYdgp5YpLOqkT+fk83VLhza+S/Ujx5JxVDJe7YDoUGMZKt969U3ABb+Y6TC8f3oKw==
"@alphafi/alphafi-sdk@^0.0.65":
version "0.0.65"
resolved "https://registry.yarnpkg.com/@alphafi/alphafi-sdk/-/alphafi-sdk-0.0.65.tgz#b0d1258b83ae451082415a38014c03b9bfa9f238"
integrity sha512-m1xMXkAUv53eqwCUe+bc5xTVmBOxRGyUG8sy5fHDUtRzI7ywOGFxzBAjksnH6DFCJMi72hkkJe7fJSvogG53jw==
dependencies:
"@7kprotocol/sdk-ts" "^2.2.2"
"@7kprotocol/sdk-ts" "^2.3.4"
"@alphafi/stsui-sdk" "^0.0.12"
"@apollo/client" "^3.11.4"
"@cetusprotocol/cetus-sui-clmm-sdk" "5.1.6"
Expand All @@ -47,10 +47,10 @@
ts-jest "^29.2.5"
typedoc "^0.27.5"

"@alphafi/stsui-sdk@^0.0.15":
version "0.0.15"
resolved "https://registry.yarnpkg.com/@alphafi/stsui-sdk/-/stsui-sdk-0.0.15.tgz#40b582046362e0cdccc90956189a0b73da95ef21"
integrity sha512-cvgV1wMRMfni6X/WP8H0g5miZVvHrb0oQv7dMYEHBb1z6y3kIHg1hJCjewdACSSSoIx5QTxYY6dfV7YHxUpe/A==
"@alphafi/stsui-sdk@^0.0.21":
version "0.0.21"
resolved "https://registry.yarnpkg.com/@alphafi/stsui-sdk/-/stsui-sdk-0.0.21.tgz#0d8457a10fc99d4963a9d02f5634c391d1b651cf"
integrity sha512-qWDjcBFhgd3K4T/keZbG3yBVq9aj8PMmWKlMb15lyW6GWg9imBJZMs58ireJtharKF+4nLNzvO0F4M9F+ck6kg==
dependencies:
"@types/bn.js" "^5.1.6"
decimal.js "^10.4.3"
Expand Down