Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ckbtc candid #476

Merged
merged 3 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Include timestamp and tags in the candid provenance record.
- Upgrade `didc` to `0.3.5`.
- Update ckbtc candid to ic commit `4de99bc27be74048f80d13200f3c75cf2a43438c`.

# 2023.10.15-0600Z

Expand Down
6 changes: 6 additions & 0 deletions packages/ckbtc/candid/minter.certified.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ export const idlFactory = ({ IDL }) => {
}),
'Checked' : Utxo,
});
const PendingUtxo = IDL.Record({
'confirmations' : IDL.Nat32,
'value' : IDL.Nat64,
'outpoint' : IDL.Record({ 'txid' : IDL.Vec(IDL.Nat8), 'vout' : IDL.Nat32 }),
});
const UpdateBalanceError = IDL.Variant({
'GenericError' : IDL.Record({
'error_message' : IDL.Text,
Expand All @@ -207,6 +212,7 @@ export const idlFactory = ({ IDL }) => {
'AlreadyProcessing' : IDL.Null,
'NoNewUtxos' : IDL.Record({
'required_confirmations' : IDL.Nat32,
'pending_utxos' : IDL.Opt(IDL.Vec(PendingUtxo)),
'current_confirmations' : IDL.Opt(IDL.Nat32),
}),
});
Expand Down
6 changes: 6 additions & 0 deletions packages/ckbtc/candid/minter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ export type Mode =
| { DepositsRestrictedTo: Array<Principal> }
| { ReadOnly: null }
| { GeneralAvailability: null };
export interface PendingUtxo {
confirmations: number;
value: bigint;
outpoint: { txid: Uint8Array | number[]; vout: number };
}
export type ReimbursementReason =
| { CallFailed: null }
| { TaintedDestination: { kyt_fee: bigint; kyt_provider: Principal } };
Expand Down Expand Up @@ -182,6 +187,7 @@ export type UpdateBalanceError =
| {
NoNewUtxos: {
required_confirmations: number;
pending_utxos: [] | [Array<PendingUtxo>];
current_confirmations: [] | [number];
};
};
Expand Down
12 changes: 10 additions & 2 deletions packages/ckbtc/candid/minter.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 8be68bc88db7332dd39a26509ddf62c564ca3415 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid
// Generated from IC repo commit 4de99bc27b (2023-11-20) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid
// Represents an account on the ckBTC ledger.
type Account = record { owner : principal; subaccount : opt blob };

Expand Down Expand Up @@ -101,11 +101,19 @@ type UtxoStatus = variant {
};
};

// Utxos that don't have enough confirmations to be processed.
type PendingUtxo = record {
outpoint : record { txid : vec nat8; vout : nat32 };
value : nat64;
confirmations: nat32;
};

type UpdateBalanceError = variant {
// There are no new UTXOs to process.
NoNewUtxos : record {
current_confirmations: opt nat32;
required_confirmations: nat32
required_confirmations: nat32;
pending_utxos: opt vec PendingUtxo;
};
// The minter is already processing another update balance request for the caller.
AlreadyProcessing;
Expand Down
6 changes: 6 additions & 0 deletions packages/ckbtc/candid/minter.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ export const idlFactory = ({ IDL }) => {
}),
'Checked' : Utxo,
});
const PendingUtxo = IDL.Record({
'confirmations' : IDL.Nat32,
'value' : IDL.Nat64,
'outpoint' : IDL.Record({ 'txid' : IDL.Vec(IDL.Nat8), 'vout' : IDL.Nat32 }),
});
const UpdateBalanceError = IDL.Variant({
'GenericError' : IDL.Record({
'error_message' : IDL.Text,
Expand All @@ -207,6 +212,7 @@ export const idlFactory = ({ IDL }) => {
'AlreadyProcessing' : IDL.Null,
'NoNewUtxos' : IDL.Record({
'required_confirmations' : IDL.Nat32,
'pending_utxos' : IDL.Opt(IDL.Vec(PendingUtxo)),
'current_confirmations' : IDL.Opt(IDL.Nat32),
}),
});
Expand Down
3 changes: 2 additions & 1 deletion packages/ckbtc/src/minter.canister.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ describe("ckBTC minter canister", () => {
NoNewUtxos: {
required_confirmations: 123,
current_confirmations: toNullable(456),
pending_utxos: [],
},
},
} as UpdateBalanceError,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either this or as [] after pending_utxos: [].
This seemed more future proof.

};
service.update_balance.mockResolvedValue(error);

Expand Down
Loading