I have written a contract to implement FA2 and I have a Truffle/JavaScript setup to test this contract while running against a sandboxed node. I can test the transfer
endpoint and the update_operators
endpoint, but I don't know how to construct the right JavaScript object to test the balance_of
or the token_metadata_registry
endpoint.
The input value as defined in LIGO (Pascal dialect) to token_metadata_registry
is:
type token_metadata_registry_parameter is contract(address);
The input type to the balance_of
endpoint is balance_of_parameter_michelson
defined as
type balance_of_request is record
owner: token_owner;
token_id: token_id;
end;
type balance_of_response is record
request: balance_of_request;
balance: token_balance;
end;
type balance_of_callback is contract(list(balance_of_response));
type balance_of_parameter is record
requests: list(balance_of_request);
callback: balance_of_callback;
end;
type balance_of_request_michelson is michelson_pair_right_comb(balance_of_request);
type balance_of_response_auxiliary is record [
balance: token_balance;
request: balance_of_request_michelson;
]
type balance_of_response_michelson is michelson_pair_right_comb(balance_of_response_auxiliary);
type balance_of_callback_michelson is contract(list(balance_of_response_michelson));
type balance_of_parameter_auxiliary is record [
requests: list(balance_of_request_michelson);
callback: balance_of_callback_michelson;
]
type balance_of_parameter_michelson is michelson_pair_right_comb(balance_of_parameter_auxiliary);