I’m trying to resolve an issue with my dev environment in VS Code.
In dfx.json
I have the following:
"ckbtc_minter": {
"type": "custom",
"candid": "target/ckbtc_minter.did",
"wasm": "target/ckbtc_minter.wasm",
"remote": {
"id": {
"ic": "mqygn-kiaaa-aaaar-qaadq-cai"
}
}
}
The target/ckbtc_minter.did has the following type:
type Utxo = record {
outpoint : record { txid : vec nat8; vout : nat32 };
value : nat64;
height : nat32;
};
When I run dfx deploy ckbtc_minter
both the constructor.did and the service.did that are produced and put in .dfx/local/ckbtc_minter have the following:
type Utxo = record {
height : nat32;
value : nat64;
outpoint : record { txid : blob; vout : nat32 };
};
…and sure enough, through out my code I get the following errors:
expression of type
Blob
cannot produce expected type
[Nat8]
for
//details derive its type from CkBtcMinter.UtxoStatus (#Minted)
let _tnx_id: [Nat8] = details.utxo.outpoint.txid;
The dashboard has vec nat8 for this utxo type: https://dashboard.internetcomputer.org/canister/ml52i-qqaaa-aaaar-qaaba-cai (search for type utxo
And it is vec nat 8 here:
The reference in my file is: import CkBtcMinter "canister:ckbtc_minter";
I’m trying to figure out why dfx is converting the type from vec nat8 to blob. I think these are actually handled the same by the replica/moc, but the compiler doesn’t like it. It doesn’t make much sense that the language server and dfx build myCanister --check would be converting the vec nat8 in the did to blob.
This is dfx 0.24.0
but I get the same error with 0.27.0.
Where in the pipeline would it possibly covert this from vec nat8 to blob? Is it maybe pulling from somewhere on the IC? Even then, if the dashboard has it as a vec nat8
, what would make it write blob
into the .did file in .dfx/local/canisters? Is .dfx/local/canisters where it pulls things when you use the canister: syntax?