touch(privatekey, operation)
// [OperationResponse’s structure ]
{
response: SuccessResponse || ErrorResponse,
_api: api address,
_delegateIP: delegateIP,
}
example
const sender = "0xa88fD796EE13ac305f376C54bdfe3270b883643cfca";
const currencyID = "MIT";
const amount = 10;
// create new contract account and raw operation
const wallet = mitum.contract.createWallet(sender, currencyID, amount);
// private key of sender to sign the operation
const privatekey = "16a4771cfd9c8fb25a8c261d912b83ee78315d4f9c980e68b1039cb51d496194fpr";
// sign and send the operation to API server
const accountCreate = async () => {
const res = await mitum.contract.touch(privatekey, wallet);
console.log(res.response);
};
accountCreate();
// output
{
status: 200,
method: 'post',
url: 'http://127.0.0.1:54320/builder/send',
request_body: '{"_hint":"mitum-extension-create-contract-account-operation-v0.0.1","fact":{"_hint":"mitum-extension-create-contract-account-operation-fact-v0.0.1","hash":"65gQYhNwRVUcLVPxWGnZ6vuNZLo2MgsH7cdgBLMg64AY","token":"MjAyNC0wNi0yNyAwNDo1OToxNy4yNTYgKzAwMDAgVVRD","sender":"0xa88fD796EE13ac305f376C54bdfe3270b883643cfca","items":[{"_hint":"mitum-extension-create-contract-account-multiple-amounts-v0.0.1","amounts":[{"_hint":"mitum-currency-amount-v0.0.1","currency":"MIT","amount":"10"}],"keys":{"_hint":"mitum-currency-keys-v0.0.1","hash":"625a58926b46119b52a1b40239779f1c3196addc","keys":[{"_hint":"mitum-currency-key-v0.0.1","weight":100,"key":"022bf34bf47fde3796c303c162f077d1bb58d168ec7a57f8e8066e91cc0880a262fpu"}],"threshold":100}}]},"hash":"DXjwtQTmwzqXwe6xVZkCDFeaSc8XaaJiCHZvUo5jdJ3x", "signs":[{"signer":"02a0d34b9b8657f31d4aca55d50f21e64636a6625a3a60f122333c5677acb5bb34fpu","signature":"5BpRZ7v2nCKTyzeSydxzZzs2Kz89gVjUhJx563oG2bYUGKaZtTUKx5EHpQkQo2dhUtq8UubE7zG3WX9GWS816DuNboHwx","signed_at":"2024-06-27T04:59:17.258Z"}]}',
data: {
hash: 'DXjwtQTmwzqXwe6xVZkCDFeaSc8XaaJiCHZvUo5jdJ3x',
fact: {
hash: '65gQYhNwRVUcLVPxWGnZ6vuNZLo2MgsH7cdgBLMg64AY',
token: 'MjAyNC0wNi0yNyAwNDo1OToxNy4yNTYgKzAwMDAgVVRD',
_hint: 'mitum-extension-create-contract-account-operation-fact-v0.0.1',
sender: '0xa88fD796EE13ac305f376C54bdfe3270b883643cfca',
items: [Array]
},
signs: [ [Object] ],
_hint: 'mitum-extension-create-contract-account-operation-v0.0.1'
}
}
Previous⚠️ createBatchWallet(sender, n, currencyID, amount)NextcreateAccount(sender, key, currency, amount)
Last updated