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

feat: add script to merge and split coins #255

Merged
merged 54 commits into from
Aug 21, 2024
Merged

Conversation

npty
Copy link
Member

@npty npty commented Jun 4, 2024

Description

AXE-4095

Added a script to manage coins including:

  • Merge coins for every coin types or give type into 1 object
  • Split all coins or given specific coin by provided amount
  • Shows total balance for each coin

Usage

1. Shows total balance for each coin

node sui/tokens.js list 

Output:

Action: List Coins

Wallet Address: 0xebafd8ef2ee5084a73f36eda4a6d0d36fe6b6a4e4a93e5ecda9bf337a7a1e7fa

Coin Type: 0x2::sui::SUI

Total Balance: 1999977577440 (1999.97757744)

Total Objects: 2

Coin Type: 0x3569c9e7452a68d7bfeffabc7f6343cbe48ff3dda607c9a1249d156d661b16e5::my_coin::MY_COIN

Total Balance: 1000000000000 (1000000.0)

Total Objects: 1

Coin Type: 0x5d6e299d0b1315fa1ee74605476e8635c8b7ad1de580c7e2a23a35640096c1bb::my_coin::MY_COIN

Total Balance: 1000000000000 (1000000.0)

Total Objects: 1

2. Merge coins

Merge all coins

node sui/tokens.js merge

Merge only specific coin type

 node sui/tokens.js merge --coin-type 0x3569c9e7452a68d7bfeffabc7f6343cbe48ff3dda607c9a1249d156d661b16e5::my_coin::MY_COIN

Output:

Action: Merge Coins

Merge Coins: 0x3569c9e7452a68d7bfeffabc7f6343cbe48ff3dda607c9a1249d156d661b16e5::my_coin::MY_COIN

3. Split coins

Split all coins to given amount

node sui/tokens.js split 100000

Split only specific coin type

 node sui/tokens.js split 100000 --coin-type 0xbb713fb5bb92d32d45754981d01942e0f1b191ea7b2ad12d745d0c9f4dd7ea10::my_coin::MY_COIN

Output:

will update later

@npty npty requested a review from a team as a code owner June 4, 2024 10:35
@npty npty self-assigned this Jun 4, 2024
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/manage-coins.js Outdated Show resolved Hide resolved
sui/tokens.js Outdated Show resolved Hide resolved
sui/tokens.js Outdated Show resolved Hide resolved
sui/tokens.js Outdated Show resolved Hide resolved
sui/tokens.js Outdated Show resolved Hide resolved
sui/tokens.js Outdated Show resolved Hide resolved
sui/tokens.js Outdated Show resolved Hide resolved
sui/tokens.js Outdated Show resolved Hide resolved
@npty npty requested review from milapsheth and blockchainguyy June 7, 2024 16:24
sui/tokens.js Show resolved Hide resolved
sui/tokens.js Show resolved Hide resolved
@npty npty merged commit c32f90d into main Aug 21, 2024
4 checks passed
@npty npty deleted the feat/script-merge-and-split-coins branch August 21, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants