-
Notifications
You must be signed in to change notification settings - Fork 8
Transfer Transaction
Chun Lam edited this page Feb 21, 2024
·
4 revisions
import {
TransferTransaction, Deadline, Account, NetworkType, PlainMessage,
PublicAccount
} from 'tsjs-xpx-chain-sdk';
import { Network } from '../utils';
const network = new Network('http://localhost:3000');
const sender = Account.createFromPrivateKey(
'28FCECEA252231D2C86E1BCF7DD541552BDBBEFBB09324758B3AC199B4AA7B78',
NetworkType.MIJIN_TEST, 1);
const recipient = PublicAccount.createFromPublicKey(
'0123456789012345678901234567890123456789012345678901234567890123',
NetworkType.MIJIN_TEST, 1);
const tx = TransferTransaction.create(
Deadline.create(),
recipient.address,
[],
PlainMessage.create('Hello!'),
NetworkType.MIJIN_TEST
);
network.networkProperties.then(networkProperties => {
const signedTx = sender.preV2Sign(tx, networkProperties.generationHash);
network.announceAndWaitForConfirmation(signedTx).then(tx => {
console.log('Confirmed:');
console.log(tx);
});
});