Skip to content

Commit caa5f98

Browse files
committed
add: sui network types
1 parent 35e68d3 commit caa5f98

File tree

5 files changed

+5
-11
lines changed

5 files changed

+5
-11
lines changed

packages/plugin-sui/src/actions/convertNameToAddress.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
1717
import { SuinsClient } from "@mysten/suins";
1818

1919
import { walletProvider } from "../providers/wallet";
20-
21-
type SuiNetwork = "mainnet" | "testnet" | "devnet" | "localnet";
20+
import { SuiNetwork } from "../types";
2221

2322
export interface NameToAddressContent extends Content {
2423
recipientName: string;

packages/plugin-sui/src/actions/swap.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import { Aftermath } from "aftermath-ts-sdk";
1919

2020
import { walletProvider } from "../providers/wallet";
2121
import { parseAccount } from "../utils";
22-
23-
type SuiNetwork = "mainnet" | "testnet" | "devnet" | "localnet";
22+
import { SuiNetwork } from "../types";
2423

2524
export interface SwapContent extends Content {
2625
recipient: string;
@@ -148,10 +147,7 @@ export default {
148147
const suiClient = new SuiClient({
149148
url: getFullnodeUrl(network as SuiNetwork),
150149
});
151-
// TODO: make this dynamic
152150
const router = new Aftermath("MAINNET").Router();
153-
154-
// TODO: change this to use the correct decimals for any coin
155151
const adjustedAmount = BigInt(
156152
Number(swapContent.amount) * Math.pow(10, SUI_DECIMALS)
157153
);

packages/plugin-sui/src/actions/transfer.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import { isValidSuiNSName, SUI_DECIMALS } from "@mysten/sui/utils";
1919

2020
import { walletProvider } from "../providers/wallet";
2121
import { parseAccount, getSuiAddress } from "../utils";
22-
23-
type SuiNetwork = "mainnet" | "testnet" | "devnet" | "localnet";
22+
import { SuiNetwork } from "../types";
2423

2524
export interface TransferContent extends Content {
2625
recipient: string;

packages/plugin-sui/src/providers/wallet.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import BigNumber from "bignumber.js";
1313
import NodeCache from "node-cache";
1414
import * as path from "path";
1515
import { parseAccount } from "../utils";
16+
import { SuiNetwork } from "../types";
1617

1718
// Provider configuration
1819
const PROVIDER_CONFIG = {
@@ -29,8 +30,6 @@ interface Prices {
2930
sui: { usd: string };
3031
}
3132

32-
type SuiNetwork = "mainnet" | "testnet" | "devnet" | "localnet";
33-
3433
export class WalletProvider {
3534
private cache: NodeCache;
3635
private cacheKey: string = "sui/wallet";

packages/plugin-sui/src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type SuiNetwork = "mainnet" | "testnet" | "devnet" | "localnet";

0 commit comments

Comments
 (0)