pub async fn int_create_supply(
    request: CreateSupplyRequest
) -> Response<SupplyId>
Expand description

Writes an offer to the ‘orderbook’ by msg.sender. The tokens are taken from his own account.

§Parameters

  • request: Supply creation request.

§Result

  • tx_id: Id of the transaction.
  • data: Id of the created supply.

§Sample request

UNIQUE_ASSET_ID_1=0xF94E2AD9DD5CBBC041430001
UNIQUE_ASSET_ID_2=0x123E2AD9DD5CBBC043210002
RECEIVER='principal "dimdt-vwpm3-tkwgu-c2nkv-txykr-atn2x-xras5-6xidt-wtti3-i4xr6-vqe"'
SUP_EX_RATE=1000000000000000000000000000000000000
SUP_AMOUNT=500
SUP_EXT_REF=SUP_EXT_REF=0x42
SUP_VALID_UNTIL=$(date -d "+10 days" +%s)000000000

dfx canister call coreledger_backend int_create_supply "(record { offered = $UNIQUE_ASSET_ID_1; desired = $UNIQUE_ASSET_ID_2; receiver_address = opt $RECEIVER; exchange_rate = $SUP_EX_RATE; max_amount = $SUP_AMOUNT; ext_ref = $SUP_EXT_REF; take_all = false; valid_until = $SUP_VALID_UNTIL; controller = null })"

§Sample response

( record {
  tx_id = 64_902_045_878_680_215_161_103_406_576_570_366_475_824_533_393_005_533_149_888_825_789_042_550_227_580 : nat;
  data = 8_251_471_539_482_211_562_355_238_650_337_652_682_089_590_676_002_818_286_951_709_100_188_048_031_744 : nat;
})