touch(privatekey, wallet)

Feature

Sign the operation created with createWallet with a private key and send it to the API. wait() can be used like send().

Used to create a single sig account.

Parameters

string private key, object wallet (output of createWallet)

Return Value

object http response

// [OperationResponse’s structure ]

{
   response: SuccessResponse || ErrorResponse,
   _api: api address,
   _delegateIP: delegateIP,
} 

example

const sender = "0xa88fD796EE13ac305f376C54bdfe3270b883643cfca";
const currencyID = "MIT";
const amount = 10;

// create new account and raw operation
const wallet = mitum.account.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.account.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-currency-transfer-operation-v0.0.1","fact":{"_hint":"mitum-currency-transfer-operation-fact-v0.0.1","hash":"9rcXMUkPjMXz9R8XnHQA6kBkX4jjyu4t5f8A4WtBhaNr","token":"MjAyNC0wNi0yNyAwNDo1Njo1OC4yODYgKzAwMDAgVVRD","sender":"0xa88fD796EE13ac305f376C54bdfe3270b883643cfca","items":[{"_hint":"mitum-currency-transfer-item-multi-amounts-v0.0.1","amounts":[{"_hint":"mitum-currency-amount-v0.0.1","currency":"MIT","amount":"10"}],"receiver":"0xCFF0cD5b59f411b5FbC4eAE913138E4f4173b3d8fca"}]},"hash":"EKVsoTKYoJypDjXwa7qyiMg1cfvSLDF8d57WnMEBsfBM","signs":[{"signer":"02a0d34b9b8657f31d4aca55d50f21e64636a6625a3a60f122333c5677acb5bb34fpu","signature":"5BpRZ89X4VJhCBgP7Q4zGSRDDsTV747zUugMYgxkuY3u8bbpZsqkfxS8JkcxZtCTdPANVwxjbyeyQa14Wqbr96nnCtGH9","signed_at":"2024-06-27T04:56:58.287Z"}]}',
  data: {
    hash: 'EKVsoTKYoJypDjXwa7qyiMg1cfvSLDF8d57WnMEBsfBM',
    fact: {
      hash: '9rcXMUkPjMXz9R8XnHQA6kBkX4jjyu4t5f8A4WtBhaNr',
      token: 'MjAyNC0wNi0yNyAwNDo1Njo1OC4yODYgKzAwMDAgVVRD',
      _hint: 'mitum-currency-transfer-operation-fact-v0.0.1',
      sender: '0xa88fD796EE13ac305f376C54bdfe3270b883643cfca',
      items: [Array]
    },
    signs: [ [Object] ],
    _hint: 'mitum-currency-transfer-operation-v0.0.1'
  }
}

Last updated