Post request through delegate server
After setting up the server, you can use all methods using post in the same way as usual.
Example of sending an account creation operation via send()
const mitum = new Mitum("http://{mainnet address}", "http://{delegate server address}");
const sender = "0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca";
const currencyID = "MIT";
const amount = 1;
const seed = "slfjdkfjwleiflskdfnlkwessflkjdsflkwwrjksdlfqfpwbaared";
const wallet = mitum.account.createWallet(sender, currencyID, amount, seed);
const privatekey = "..." //insert private key
const signedOp = mitum.operation.sign(privatekey, wallet.operation);
const sendOperation = async () => {
const info = await mitum.operation.send(signedOp);
console.log(info.response.data);
};
sendOperation();
//output
{
hash: 'EfYPTkPQYx5qAwJToXRWNoLsoXgHDJs9JgtJLMFu5hQX',
fact: {
hash: 'FXGQN7y9BYLdhLdMTpsjKQ7YDxqSA4te1JFGMK2QKmFy',
token: 'MjAyMy0xMi0yNiAwMjoxNjo0My41MDEgKzAwMDAgVVRD',
_hint: 'mitum-currency-create-account-operation-fact-v0.0.1',
sender: '0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca',
items: [Array]
},
signs: [ [Object] ],
_hint: 'mitum-currency-create-account-operation-v0.0.1'
}
Last updated