aa.createUserOperation(fact, contract, authentication_id)
Feature
Returns a draft of the user operation created from an operation fact.
Parameters
object operation fact, // operation.fact or operation.toHintedObject().fact string contract address, // did registry contract address
string authentication_id // did + “#” + fragment
Return Value
instance UserOperation, The fields of proof_data and op_sender of settlement is empty.
example 1. create userOperation from operation.fact
const sender = "0x5279AebbF6e284594521d44612157147dF5ff248fca";
const receiver = "0x9E14a47B76F154A8e0f22cb213b3A1966800Ea0efca";
const currency = "MCC";
const op = mitum.currency.transfer(sender,receiver, currency, 10);
const contract = "0xdC521b33609647F949427A2330c136EfC3171535fca";
const userOp = mitum.aa.createUserOperation(op.fact, contract, "did:dxd:0x5279AebbF6e284594521d44612157147dF5ff248fca#auth_key");
console.log(userOp.toHintedObject());
// output
{
_hint: 'mitum-currency-transfer-operation-v0.0.1',
fact: {
_hint: 'mitum-currency-transfer-operation-fact-v0.0.1',
hash: '4WANXQWBh4H3zSnAeqLXXoyrzXVRQuQWrYg9qhBRvNBq',
token: 'MjAyNC0xMi0xNyAwNjoyNTo1MS4wMTQgKzAwMDAgVVRD',
sender: '0x5279AebbF6e284594521d44612157147dF5ff248fca',
items: [ [Object] ]
},
extension: {
authentication: {
_hint: 'mitum-extension-base-authentication-v0.0.1',
contract: '0xdC521b33609647F949427A2330c136EfC3171535fca',
authentication_id: 'did:dxd:0x5279AebbF6e284594521d44612157147dF5ff248fca#auth_key',
proof_data: ''
},
settlement: { _hint: 'mitum-extension-base-settlement-v0.0.1', op_sender: '' }
},
hash: '',
signs: []
}example 2. create userOperation from FactJson
Last updated