📩 Transfer Tokens
🚨 Read Before 🚨
Create Transaction
- Python3
- Node.js
- Web
from lunespy.tx.transfer import transfer_token_factory
from lunespy.wallet import wallet_factory
sender = wallet_factory()
tx = transfer_token_factory(
sender_public_key=sender.public_key,
receiver_address="37sEXsHBBUagA3jmzHPz1ZGA3vDtCLUNs5Z",
amount=249.99
)
import lunesjs from "lunesjs"
const sender = lunesjs.walletFactory({})
const tx = lunesjs.transferTokenFactory({
senderPublicKey: sender.public_key,
receiverAddress: "37sEXsHBBUagA3jmzHPz1ZGA3vDtCLUNs5Z",
amount: 249.99
})
Comming Soon
Sign Transaction
- Python3
- Node.js
- Web
tx.sign(sender.private_key)
tx.sign(wallet.privateKey)
Comming Soon
Broadcast Transaction
- Python3
- Node.js
- Web
tx.broadcast()
tx.broadcast()
Comming Soon
Full Example
- Python3
- Node.js
- Web
from lunespy.tx.transfer import transfer_token_factory
from lunespy.wallet import wallet_factory
sender = wallet_factory()
tx = transfer_token_factory(
# public key of sender
sender_public_key=sender.public_key,
# address that will receiver tokens
receiver_address="37sEXsHBBUagA3jmzHPz1ZGA3vDtCLUNs5Z",
# amount of tokens to send
amount=249.99,
# omit if you want to send lunes, pass only if you want to send some token
assetId="E3ZpxkM2kvS78aFYG2xFfngchMgik4ogLLRa6CBJvVgz",
# if you want to send a different fee amount, the default is 100000 (0.01 Lunes)
fee=100000,
# to which chain the transaction should be mounted, the defaul is 1 (MAINNET)
# should be passed 0 for works in TESTNET
chain=0
)
tx.sign(
# private key of sender for sign the transaction
sender.private_key
)
tx.broadcast(
# url or ip:port of the node that will broadcast the transaction,
# (MAINNET) is https://lunesnode.lunes.io (defaul)
# (TESTNET) https://lunesnode-testnet.lunes.io
node = "https://my-full-node.com"
)
import lunesjs from "lunesjs"
const sender = walletFactory({})
const tx = lunesjs.transferTokenFactory({
// public key of sender
senderPublicKey: sender.public_key,
// address that will receiver tokens
receiverAddress: "37sEXsHBBUagA3jmzHPz1ZGA3vDtCLUNs5Z",
// amount of tokens to send
amount: 249.99,
// omit if you want to send lunes, pass only if you want to send some token
assetId: "E3ZpxkM2kvS78aFYG2xFfngchMgik4ogLLRa6CBJvVgz",
// if you want to send a different fee amount, the default is 100000 (0.01 Lunes)
fee: 100000,
// to which chain the transaction should be mounted, the defaul is 1 (MAINNET)
// should be passed 0 for works in TESTNET
chain: 0
})
tx.sign(
// private key of sender for sign the transaction
sender.privateKey
)
tx.broadcast(
// url or ip:port of the node that will broadcast the transaction,
// (MAINNET) is https://lunesnode.lunes.io (defaul)
// (TESTNET) https://lunesnode-testnet.lunes.io
"https://my-full-node.com"
)
Comming Soon