Skip to content

how to send records similar to dfx #86

Open
@aknowel

Description

@aknowel

Hi I have a problem using ic-py library.

I would like to mint canister tokens and send request similar to

dfx canister --network ${NETWORK} call ${CANISTER_ADDRESS} transfer '(record {
  memo = 0 : nat64;
  amount = record { e8s = 100 : nat64 };
  fee = record { e8s = 0 : nat64 };
  from_subaccount = null;
  to = '${TOKENS_TRANSFER_ACCOUNT_ID_BYTES}' : vec nat8;
  created_at_time = null;
})'

But I am not sure how to use ic-py params to fulfill my needs. It would be ideal to do something similar to

params = {
	"memo": 0,
	"amount": { "e8s": 100 },
	"fee": { "e8s": 0 },
	"from_subaccount": None,
	"to": ["${TOKENS_TRANSFER_ACCOUNT_ID_BYTES}"],
	"created_at_time": None,
}
result = agent.update_raw("${CANISTER_ADDRESS}", "transfer", encode(params))
print(result)

If you have any idea what approach could I take, please share.
Library documentation has only few simple examples and so I couldn't get it done yet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions