Skip to content

Commit 879e80d

Browse files
authored
add send 0.1 sui example to ci (#133)
2 parents 17c5307 + 424004a commit 879e80d

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build Send SUI Transaction
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-send-sui-tx:
8+
runs-on: ubuntu-latest
9+
env:
10+
# Multisig specific config (can be secrets or vars)
11+
MULTISIG_ADDRESS: ${{ vars.MULTISIG_ADDRESS }}
12+
MULTISIG_SIGNERS_BASE64_PUBKEYS: ${{ vars.MULTISIG_SIGNERS_BASE64_PUBKEYS }}
13+
MULTISIG_THRESHOLD: ${{ vars.MULTISIG_THRESHOLD }}
14+
MULTISIG_WEIGHTS: ${{ vars.MULTISIG_WEIGHTS }}
15+
MULTISIG_ADMIN_CAP_HOLDER_ADDRESS: ${{ vars.MULTISIG_ADMIN_CAP_HOLDER_ADDRESS }}
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
25+
- name: Install Dependencies
26+
run: npm ci
27+
28+
- name: Build Send SUI Transaction
29+
run: npx tsx examples/send-coins/send-sui.ts

examples/send-coins/send-sui.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Transaction } from "@mysten/sui/transactions";
2+
import { buildAndLogMultisigTransaction } from "../multisig/buildAndLogMultisigTransaction";
3+
4+
const RECIPIENT = process.env.MULTISIG_ADMIN_CAP_HOLDER_ADDRESS;
5+
if (!RECIPIENT) {
6+
throw new Error("MULTISIG_ADMIN_CAP_HOLDER_ADDRESS environment variable is required.");
7+
}
8+
9+
// 0.1 SUI = 100_000_000 MIST (SUI has 9 decimals)
10+
const AMOUNT_MIST = 0.1 * 10 ** 9;
11+
12+
// Usage: npx tsx examples/send-coins/send-sui.ts > send-sui.log 2>&1
13+
(async () => {
14+
console.warn(`Building transaction to send 0.1 SUI to ${RECIPIENT}`);
15+
16+
const tx = new Transaction();
17+
18+
const [coin] = tx.splitCoins(tx.gas, [tx.pure.u64(AMOUNT_MIST)]);
19+
tx.transferObjects([coin], tx.pure.address(RECIPIENT));
20+
21+
await buildAndLogMultisigTransaction(tx);
22+
})();

0 commit comments

Comments
 (0)