Send
The Send operation is used to transfer tokens from one account to another on the Keeta Network. It’s the most basic transaction you can perform.
Below is a minimal example that sends 1 KTA
to a target address using the KeetaNet SDK. Let’s walk through the minimal example for sending tokens using KeetaNet.
Add the send operation
builder.send(recipient, 1n, client.baseToken);
This is the core of the operation. Let’s break it down:
recipient
The recipient account object (created earlier)
1n
The amount to send, in tokens (as a BigInt
). 1n
= 1 KTA
client.baseToken
The token to send (usually Keeta's native token, KTA)
So this line is saying:
“Send 1 KTA to the specified recipient.”
If all goes well, you’ve just sent 1 KTA to the recipient. You can now build on this with more operations, like minting, delegating, or managing tokens.
Complete Code Example
const KeetaNet = require('@keetanetwork/keetanet-client');
// ⚠️ Demo seed, replace with working seed
const DEMO_ACCOUNT_SEED = 'D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0';
async function main() {
const sender = KeetaNet.lib.Account.fromSeed(DEMO_ACCOUNT_SEED, 0);
const client = KeetaNet.UserClient.fromNetwork('test', sender);
const recipient = KeetaNet.lib.Account.fromPublicKeyString(
'keeta_aabszsbrqppriqddrkptq5awubshpq3cgsoi4rc624xm6phdt74vo5w7wipwtmi'
);
const builder = client.initBuilder();
builder.send(recipient, 1n, client.baseToken); // send 1 KTA
await client.computeBuilderBlocks(builder); // optional but recommended
await client.publishBuilder(builder); // send it to the network
console.log('✅ Sent 1 KTA');
}
main().catch(console.error);
Last updated