@dfinity/ckbtc 2.3.3 → 2.4.0-next-2024-06-05
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -3
- package/dist/candid/bitcoin.certified.idl.d.ts +2 -0
- package/dist/candid/bitcoin.certified.idl.js +168 -0
- package/dist/candid/bitcoin.d.ts +118 -0
- package/dist/candid/bitcoin.did +144 -0
- package/dist/candid/bitcoin.idl.d.ts +2 -0
- package/dist/candid/bitcoin.idl.js +168 -0
- package/dist/candid/minter.did +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +4 -4
- package/dist/esm/bitcoin.canister.js +2 -0
- package/dist/esm/bitcoin.canister.js.map +7 -0
- package/dist/esm/chunk-D2A54F3A.js +2 -0
- package/dist/esm/chunk-D2A54F3A.js.map +7 -0
- package/dist/esm/chunk-IS3C7V4B.js +2 -0
- package/dist/esm/chunk-IS3C7V4B.js.map +7 -0
- package/dist/esm/chunk-KL2UT2R6.js +2 -0
- package/dist/esm/chunk-KL2UT2R6.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/minter.canister.js +1 -1
- package/dist/types/bitcoin.canister.d.ts +20 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/minter.canister.d.ts +2 -2
- package/dist/types/types/bitcoin.params.d.ts +12 -0
- package/dist/types/types/canister.options.d.ts +1 -1
- package/package.json +6 -6
- package/dist/esm/chunk-D3EDBNHW.js +0 -2
- package/dist/esm/chunk-D3EDBNHW.js.map +0 -7
package/README.md
CHANGED
|
@@ -94,9 +94,9 @@ Parameters:
|
|
|
94
94
|
|
|
95
95
|
##### :gear: create
|
|
96
96
|
|
|
97
|
-
| Method | Type
|
|
98
|
-
| -------- |
|
|
99
|
-
| `create` | `(options:
|
|
97
|
+
| Method | Type |
|
|
98
|
+
| -------- | ------------------------------------------------------------------ |
|
|
99
|
+
| `create` | `(options: CkBTCCanisterOptions<_SERVICE>) => CkBTCMinterCanister` |
|
|
100
100
|
|
|
101
101
|
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L43)
|
|
102
102
|
|
|
@@ -274,6 +274,40 @@ Parameters:
|
|
|
274
274
|
|
|
275
275
|
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/minter.canister.ts#L266)
|
|
276
276
|
|
|
277
|
+
### :factory: BitcoinCanister
|
|
278
|
+
|
|
279
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L11)
|
|
280
|
+
|
|
281
|
+
#### Methods
|
|
282
|
+
|
|
283
|
+
- [create](#gear-create)
|
|
284
|
+
- [getUtxos](#gear-getutxos)
|
|
285
|
+
|
|
286
|
+
##### :gear: create
|
|
287
|
+
|
|
288
|
+
| Method | Type |
|
|
289
|
+
| -------- | -------------------------------------------------------------- |
|
|
290
|
+
| `create` | `(options: CkBTCCanisterOptions<_SERVICE>) => BitcoinCanister` |
|
|
291
|
+
|
|
292
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L12)
|
|
293
|
+
|
|
294
|
+
##### :gear: getUtxos
|
|
295
|
+
|
|
296
|
+
Given a `get_utxos_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet` or `testnet`), the function returns all unspent transaction outputs (UTXOs) associated with the provided address in the specified Bitcoin network based on the current view of the Bitcoin blockchain available to the Bitcoin component.
|
|
297
|
+
|
|
298
|
+
| Method | Type |
|
|
299
|
+
| ---------- | --------------------------------------------------------------------------- |
|
|
300
|
+
| `getUtxos` | `({ certified, ...params }: GetUtxosParams) => Promise<get_utxos_response>` |
|
|
301
|
+
|
|
302
|
+
Parameters:
|
|
303
|
+
|
|
304
|
+
- `params.network`: Tesnet or mainnet.
|
|
305
|
+
- `params.filter`: The optional filter parameter can be used to restrict the set of returned UTXOs, either providing a minimum number of confirmations or a page reference when pagination is used for addresses with many UTXOs.
|
|
306
|
+
- `params.address`: A Bitcoin address.
|
|
307
|
+
- `params.certified`: query or update call
|
|
308
|
+
|
|
309
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L35)
|
|
310
|
+
|
|
277
311
|
<!-- TSDOC_END -->
|
|
278
312
|
|
|
279
313
|
## Resources
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ckbtc/candid/bitcoin.did */
|
|
2
|
+
export const idlFactory = ({ IDL }) => {
|
|
3
|
+
const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });
|
|
4
|
+
const fees = IDL.Record({
|
|
5
|
+
'get_current_fee_percentiles' : IDL.Nat,
|
|
6
|
+
'get_utxos_maximum' : IDL.Nat,
|
|
7
|
+
'get_current_fee_percentiles_maximum' : IDL.Nat,
|
|
8
|
+
'send_transaction_per_byte' : IDL.Nat,
|
|
9
|
+
'get_balance' : IDL.Nat,
|
|
10
|
+
'get_utxos_cycles_per_ten_instructions' : IDL.Nat,
|
|
11
|
+
'get_utxos_base' : IDL.Nat,
|
|
12
|
+
'get_balance_maximum' : IDL.Nat,
|
|
13
|
+
'send_transaction_base' : IDL.Nat,
|
|
14
|
+
});
|
|
15
|
+
const network = IDL.Variant({
|
|
16
|
+
'mainnet' : IDL.Null,
|
|
17
|
+
'regtest' : IDL.Null,
|
|
18
|
+
'testnet' : IDL.Null,
|
|
19
|
+
});
|
|
20
|
+
const init_config = IDL.Record({
|
|
21
|
+
'api_access' : IDL.Opt(flag),
|
|
22
|
+
'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),
|
|
23
|
+
'blocks_source' : IDL.Opt(IDL.Principal),
|
|
24
|
+
'fees' : IDL.Opt(fees),
|
|
25
|
+
'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),
|
|
26
|
+
'network' : IDL.Opt(network),
|
|
27
|
+
'stability_threshold' : IDL.Opt(IDL.Nat),
|
|
28
|
+
'syncing' : IDL.Opt(flag),
|
|
29
|
+
'burn_cycles' : IDL.Opt(flag),
|
|
30
|
+
'disable_api_if_not_fully_synced' : IDL.Opt(flag),
|
|
31
|
+
});
|
|
32
|
+
const address = IDL.Text;
|
|
33
|
+
const get_balance_request = IDL.Record({
|
|
34
|
+
'network' : network,
|
|
35
|
+
'address' : address,
|
|
36
|
+
'min_confirmations' : IDL.Opt(IDL.Nat32),
|
|
37
|
+
});
|
|
38
|
+
const satoshi = IDL.Nat64;
|
|
39
|
+
const block_height = IDL.Nat32;
|
|
40
|
+
const get_block_headers_request = IDL.Record({
|
|
41
|
+
'start_height' : block_height,
|
|
42
|
+
'end_height' : IDL.Opt(block_height),
|
|
43
|
+
});
|
|
44
|
+
const block_header = IDL.Vec(IDL.Nat8);
|
|
45
|
+
const get_block_headers_response = IDL.Record({
|
|
46
|
+
'tip_height' : block_height,
|
|
47
|
+
'block_headers' : IDL.Vec(block_header),
|
|
48
|
+
});
|
|
49
|
+
const get_current_fee_percentiles_request = IDL.Record({
|
|
50
|
+
'network' : network,
|
|
51
|
+
});
|
|
52
|
+
const millisatoshi_per_byte = IDL.Nat64;
|
|
53
|
+
const get_utxos_request = IDL.Record({
|
|
54
|
+
'network' : network,
|
|
55
|
+
'filter' : IDL.Opt(
|
|
56
|
+
IDL.Variant({
|
|
57
|
+
'page' : IDL.Vec(IDL.Nat8),
|
|
58
|
+
'min_confirmations' : IDL.Nat32,
|
|
59
|
+
})
|
|
60
|
+
),
|
|
61
|
+
'address' : address,
|
|
62
|
+
});
|
|
63
|
+
const block_hash = IDL.Vec(IDL.Nat8);
|
|
64
|
+
const outpoint = IDL.Record({
|
|
65
|
+
'txid' : IDL.Vec(IDL.Nat8),
|
|
66
|
+
'vout' : IDL.Nat32,
|
|
67
|
+
});
|
|
68
|
+
const utxo = IDL.Record({
|
|
69
|
+
'height' : block_height,
|
|
70
|
+
'value' : satoshi,
|
|
71
|
+
'outpoint' : outpoint,
|
|
72
|
+
});
|
|
73
|
+
const get_utxos_response = IDL.Record({
|
|
74
|
+
'next_page' : IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
75
|
+
'tip_height' : block_height,
|
|
76
|
+
'tip_block_hash' : block_hash,
|
|
77
|
+
'utxos' : IDL.Vec(utxo),
|
|
78
|
+
});
|
|
79
|
+
const send_transaction_request = IDL.Record({
|
|
80
|
+
'transaction' : IDL.Vec(IDL.Nat8),
|
|
81
|
+
'network' : network,
|
|
82
|
+
});
|
|
83
|
+
const config = IDL.Record({
|
|
84
|
+
'api_access' : flag,
|
|
85
|
+
'lazily_evaluate_fee_percentiles' : flag,
|
|
86
|
+
'blocks_source' : IDL.Principal,
|
|
87
|
+
'fees' : fees,
|
|
88
|
+
'watchdog_canister' : IDL.Opt(IDL.Principal),
|
|
89
|
+
'network' : network,
|
|
90
|
+
'stability_threshold' : IDL.Nat,
|
|
91
|
+
'syncing' : flag,
|
|
92
|
+
'burn_cycles' : flag,
|
|
93
|
+
'disable_api_if_not_fully_synced' : flag,
|
|
94
|
+
});
|
|
95
|
+
const set_config_request = IDL.Record({
|
|
96
|
+
'api_access' : IDL.Opt(flag),
|
|
97
|
+
'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),
|
|
98
|
+
'fees' : IDL.Opt(fees),
|
|
99
|
+
'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),
|
|
100
|
+
'stability_threshold' : IDL.Opt(IDL.Nat),
|
|
101
|
+
'syncing' : IDL.Opt(flag),
|
|
102
|
+
'burn_cycles' : IDL.Opt(flag),
|
|
103
|
+
'disable_api_if_not_fully_synced' : IDL.Opt(flag),
|
|
104
|
+
});
|
|
105
|
+
return IDL.Service({
|
|
106
|
+
'bitcoin_get_balance' : IDL.Func([get_balance_request], [satoshi], []),
|
|
107
|
+
'bitcoin_get_balance_query' : IDL.Func(
|
|
108
|
+
[get_balance_request],
|
|
109
|
+
[satoshi],
|
|
110
|
+
[],
|
|
111
|
+
),
|
|
112
|
+
'bitcoin_get_block_headers' : IDL.Func(
|
|
113
|
+
[get_block_headers_request],
|
|
114
|
+
[get_block_headers_response],
|
|
115
|
+
[],
|
|
116
|
+
),
|
|
117
|
+
'bitcoin_get_current_fee_percentiles' : IDL.Func(
|
|
118
|
+
[get_current_fee_percentiles_request],
|
|
119
|
+
[IDL.Vec(millisatoshi_per_byte)],
|
|
120
|
+
[],
|
|
121
|
+
),
|
|
122
|
+
'bitcoin_get_utxos' : IDL.Func(
|
|
123
|
+
[get_utxos_request],
|
|
124
|
+
[get_utxos_response],
|
|
125
|
+
[],
|
|
126
|
+
),
|
|
127
|
+
'bitcoin_get_utxos_query' : IDL.Func(
|
|
128
|
+
[get_utxos_request],
|
|
129
|
+
[get_utxos_response],
|
|
130
|
+
[],
|
|
131
|
+
),
|
|
132
|
+
'bitcoin_send_transaction' : IDL.Func([send_transaction_request], [], []),
|
|
133
|
+
'get_config' : IDL.Func([], [config], []),
|
|
134
|
+
'set_config' : IDL.Func([set_config_request], [], []),
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
export const init = ({ IDL }) => {
|
|
138
|
+
const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });
|
|
139
|
+
const fees = IDL.Record({
|
|
140
|
+
'get_current_fee_percentiles' : IDL.Nat,
|
|
141
|
+
'get_utxos_maximum' : IDL.Nat,
|
|
142
|
+
'get_current_fee_percentiles_maximum' : IDL.Nat,
|
|
143
|
+
'send_transaction_per_byte' : IDL.Nat,
|
|
144
|
+
'get_balance' : IDL.Nat,
|
|
145
|
+
'get_utxos_cycles_per_ten_instructions' : IDL.Nat,
|
|
146
|
+
'get_utxos_base' : IDL.Nat,
|
|
147
|
+
'get_balance_maximum' : IDL.Nat,
|
|
148
|
+
'send_transaction_base' : IDL.Nat,
|
|
149
|
+
});
|
|
150
|
+
const network = IDL.Variant({
|
|
151
|
+
'mainnet' : IDL.Null,
|
|
152
|
+
'regtest' : IDL.Null,
|
|
153
|
+
'testnet' : IDL.Null,
|
|
154
|
+
});
|
|
155
|
+
const init_config = IDL.Record({
|
|
156
|
+
'api_access' : IDL.Opt(flag),
|
|
157
|
+
'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),
|
|
158
|
+
'blocks_source' : IDL.Opt(IDL.Principal),
|
|
159
|
+
'fees' : IDL.Opt(fees),
|
|
160
|
+
'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),
|
|
161
|
+
'network' : IDL.Opt(network),
|
|
162
|
+
'stability_threshold' : IDL.Opt(IDL.Nat),
|
|
163
|
+
'syncing' : IDL.Opt(flag),
|
|
164
|
+
'burn_cycles' : IDL.Opt(flag),
|
|
165
|
+
'disable_api_if_not_fully_synced' : IDL.Opt(flag),
|
|
166
|
+
});
|
|
167
|
+
return [init_config];
|
|
168
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { ActorMethod } from "@dfinity/agent";
|
|
2
|
+
import type { IDL } from "@dfinity/candid";
|
|
3
|
+
import type { Principal } from "@dfinity/principal";
|
|
4
|
+
|
|
5
|
+
export type address = string;
|
|
6
|
+
export type block_hash = Uint8Array | number[];
|
|
7
|
+
export type block_header = Uint8Array | number[];
|
|
8
|
+
export type block_height = number;
|
|
9
|
+
export interface config {
|
|
10
|
+
api_access: flag;
|
|
11
|
+
lazily_evaluate_fee_percentiles: flag;
|
|
12
|
+
blocks_source: Principal;
|
|
13
|
+
fees: fees;
|
|
14
|
+
watchdog_canister: [] | [Principal];
|
|
15
|
+
network: network;
|
|
16
|
+
stability_threshold: bigint;
|
|
17
|
+
syncing: flag;
|
|
18
|
+
burn_cycles: flag;
|
|
19
|
+
disable_api_if_not_fully_synced: flag;
|
|
20
|
+
}
|
|
21
|
+
export interface fees {
|
|
22
|
+
get_current_fee_percentiles: bigint;
|
|
23
|
+
get_utxos_maximum: bigint;
|
|
24
|
+
get_current_fee_percentiles_maximum: bigint;
|
|
25
|
+
send_transaction_per_byte: bigint;
|
|
26
|
+
get_balance: bigint;
|
|
27
|
+
get_utxos_cycles_per_ten_instructions: bigint;
|
|
28
|
+
get_utxos_base: bigint;
|
|
29
|
+
get_balance_maximum: bigint;
|
|
30
|
+
send_transaction_base: bigint;
|
|
31
|
+
}
|
|
32
|
+
export type flag = { disabled: null } | { enabled: null };
|
|
33
|
+
export interface get_balance_request {
|
|
34
|
+
network: network;
|
|
35
|
+
address: address;
|
|
36
|
+
min_confirmations: [] | [number];
|
|
37
|
+
}
|
|
38
|
+
export interface get_block_headers_request {
|
|
39
|
+
start_height: block_height;
|
|
40
|
+
end_height: [] | [block_height];
|
|
41
|
+
}
|
|
42
|
+
export interface get_block_headers_response {
|
|
43
|
+
tip_height: block_height;
|
|
44
|
+
block_headers: Array<block_header>;
|
|
45
|
+
}
|
|
46
|
+
export interface get_current_fee_percentiles_request {
|
|
47
|
+
network: network;
|
|
48
|
+
}
|
|
49
|
+
export interface get_utxos_request {
|
|
50
|
+
network: network;
|
|
51
|
+
filter:
|
|
52
|
+
| []
|
|
53
|
+
| [{ page: Uint8Array | number[] } | { min_confirmations: number }];
|
|
54
|
+
address: address;
|
|
55
|
+
}
|
|
56
|
+
export interface get_utxos_response {
|
|
57
|
+
next_page: [] | [Uint8Array | number[]];
|
|
58
|
+
tip_height: block_height;
|
|
59
|
+
tip_block_hash: block_hash;
|
|
60
|
+
utxos: Array<utxo>;
|
|
61
|
+
}
|
|
62
|
+
export interface init_config {
|
|
63
|
+
api_access: [] | [flag];
|
|
64
|
+
lazily_evaluate_fee_percentiles: [] | [flag];
|
|
65
|
+
blocks_source: [] | [Principal];
|
|
66
|
+
fees: [] | [fees];
|
|
67
|
+
watchdog_canister: [] | [[] | [Principal]];
|
|
68
|
+
network: [] | [network];
|
|
69
|
+
stability_threshold: [] | [bigint];
|
|
70
|
+
syncing: [] | [flag];
|
|
71
|
+
burn_cycles: [] | [flag];
|
|
72
|
+
disable_api_if_not_fully_synced: [] | [flag];
|
|
73
|
+
}
|
|
74
|
+
export type millisatoshi_per_byte = bigint;
|
|
75
|
+
export type network = { mainnet: null } | { regtest: null } | { testnet: null };
|
|
76
|
+
export interface outpoint {
|
|
77
|
+
txid: Uint8Array | number[];
|
|
78
|
+
vout: number;
|
|
79
|
+
}
|
|
80
|
+
export type satoshi = bigint;
|
|
81
|
+
export interface send_transaction_request {
|
|
82
|
+
transaction: Uint8Array | number[];
|
|
83
|
+
network: network;
|
|
84
|
+
}
|
|
85
|
+
export interface set_config_request {
|
|
86
|
+
api_access: [] | [flag];
|
|
87
|
+
lazily_evaluate_fee_percentiles: [] | [flag];
|
|
88
|
+
fees: [] | [fees];
|
|
89
|
+
watchdog_canister: [] | [[] | [Principal]];
|
|
90
|
+
stability_threshold: [] | [bigint];
|
|
91
|
+
syncing: [] | [flag];
|
|
92
|
+
burn_cycles: [] | [flag];
|
|
93
|
+
disable_api_if_not_fully_synced: [] | [flag];
|
|
94
|
+
}
|
|
95
|
+
export interface utxo {
|
|
96
|
+
height: block_height;
|
|
97
|
+
value: satoshi;
|
|
98
|
+
outpoint: outpoint;
|
|
99
|
+
}
|
|
100
|
+
export interface _SERVICE {
|
|
101
|
+
bitcoin_get_balance: ActorMethod<[get_balance_request], satoshi>;
|
|
102
|
+
bitcoin_get_balance_query: ActorMethod<[get_balance_request], satoshi>;
|
|
103
|
+
bitcoin_get_block_headers: ActorMethod<
|
|
104
|
+
[get_block_headers_request],
|
|
105
|
+
get_block_headers_response
|
|
106
|
+
>;
|
|
107
|
+
bitcoin_get_current_fee_percentiles: ActorMethod<
|
|
108
|
+
[get_current_fee_percentiles_request],
|
|
109
|
+
BigUint64Array | bigint[]
|
|
110
|
+
>;
|
|
111
|
+
bitcoin_get_utxos: ActorMethod<[get_utxos_request], get_utxos_response>;
|
|
112
|
+
bitcoin_get_utxos_query: ActorMethod<[get_utxos_request], get_utxos_response>;
|
|
113
|
+
bitcoin_send_transaction: ActorMethod<[send_transaction_request], undefined>;
|
|
114
|
+
get_config: ActorMethod<[], config>;
|
|
115
|
+
set_config: ActorMethod<[set_config_request], undefined>;
|
|
116
|
+
}
|
|
117
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
118
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Generated from dfinity/bitcoin-canister commit 3c4216c30768b2b64a49c8739216730bdaf90bdc for file 'canister/candid.did'
|
|
2
|
+
type network = variant {
|
|
3
|
+
mainnet;
|
|
4
|
+
testnet;
|
|
5
|
+
regtest;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type satoshi = nat64;
|
|
9
|
+
|
|
10
|
+
type address = text;
|
|
11
|
+
|
|
12
|
+
type block_hash = blob;
|
|
13
|
+
|
|
14
|
+
type block_header = blob;
|
|
15
|
+
|
|
16
|
+
type block_height = nat32;
|
|
17
|
+
|
|
18
|
+
type outpoint = record {
|
|
19
|
+
txid : blob;
|
|
20
|
+
vout : nat32;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type utxo = record {
|
|
24
|
+
outpoint : outpoint;
|
|
25
|
+
value : satoshi;
|
|
26
|
+
height : block_height;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type flag = variant {
|
|
30
|
+
enabled;
|
|
31
|
+
disabled;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type init_config = record {
|
|
35
|
+
stability_threshold : opt nat;
|
|
36
|
+
network : opt network;
|
|
37
|
+
blocks_source : opt principal;
|
|
38
|
+
syncing : opt flag;
|
|
39
|
+
fees : opt fees;
|
|
40
|
+
api_access : opt flag;
|
|
41
|
+
disable_api_if_not_fully_synced : opt flag;
|
|
42
|
+
watchdog_canister : opt opt principal;
|
|
43
|
+
burn_cycles : opt flag;
|
|
44
|
+
lazily_evaluate_fee_percentiles : opt flag;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type config = record {
|
|
48
|
+
stability_threshold : nat;
|
|
49
|
+
network : network;
|
|
50
|
+
blocks_source : principal;
|
|
51
|
+
syncing : flag;
|
|
52
|
+
fees : fees;
|
|
53
|
+
api_access : flag;
|
|
54
|
+
disable_api_if_not_fully_synced : flag;
|
|
55
|
+
watchdog_canister : opt principal;
|
|
56
|
+
burn_cycles : flag;
|
|
57
|
+
lazily_evaluate_fee_percentiles : flag;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type fees = record {
|
|
61
|
+
get_utxos_base : nat;
|
|
62
|
+
get_utxos_cycles_per_ten_instructions : nat;
|
|
63
|
+
get_utxos_maximum : nat;
|
|
64
|
+
get_balance : nat;
|
|
65
|
+
get_balance_maximum : nat;
|
|
66
|
+
get_current_fee_percentiles : nat;
|
|
67
|
+
get_current_fee_percentiles_maximum : nat;
|
|
68
|
+
send_transaction_base : nat;
|
|
69
|
+
send_transaction_per_byte : nat;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type get_balance_request = record {
|
|
73
|
+
network : network;
|
|
74
|
+
address : address;
|
|
75
|
+
min_confirmations : opt nat32;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type get_utxos_request = record {
|
|
79
|
+
network : network;
|
|
80
|
+
address : address;
|
|
81
|
+
filter : opt variant {
|
|
82
|
+
min_confirmations : nat32;
|
|
83
|
+
page : blob;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type get_utxos_response = record {
|
|
88
|
+
utxos : vec utxo;
|
|
89
|
+
tip_block_hash : block_hash;
|
|
90
|
+
tip_height : block_height;
|
|
91
|
+
next_page : opt blob;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
type get_current_fee_percentiles_request = record {
|
|
95
|
+
network : network;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
type send_transaction_request = record {
|
|
99
|
+
network : network;
|
|
100
|
+
transaction : blob;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type millisatoshi_per_byte = nat64;
|
|
104
|
+
|
|
105
|
+
type set_config_request = record {
|
|
106
|
+
stability_threshold : opt nat;
|
|
107
|
+
syncing : opt flag;
|
|
108
|
+
fees : opt fees;
|
|
109
|
+
api_access : opt flag;
|
|
110
|
+
disable_api_if_not_fully_synced : opt flag;
|
|
111
|
+
watchdog_canister : opt opt principal;
|
|
112
|
+
burn_cycles : opt flag;
|
|
113
|
+
lazily_evaluate_fee_percentiles : opt flag;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
type get_block_headers_request = record {
|
|
117
|
+
start_height : block_height;
|
|
118
|
+
end_height : opt block_height;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type get_block_headers_response = record {
|
|
122
|
+
tip_height : block_height;
|
|
123
|
+
block_headers : vec block_header;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
service bitcoin : (init_config) -> {
|
|
127
|
+
bitcoin_get_balance : (get_balance_request) -> (satoshi);
|
|
128
|
+
|
|
129
|
+
bitcoin_get_balance_query : (get_balance_request) -> (satoshi) query;
|
|
130
|
+
|
|
131
|
+
bitcoin_get_utxos : (get_utxos_request) -> (get_utxos_response);
|
|
132
|
+
|
|
133
|
+
bitcoin_get_utxos_query : (get_utxos_request) -> (get_utxos_response) query;
|
|
134
|
+
|
|
135
|
+
bitcoin_get_current_fee_percentiles : (get_current_fee_percentiles_request) -> (vec millisatoshi_per_byte);
|
|
136
|
+
|
|
137
|
+
bitcoin_get_block_headers : (get_block_headers_request) -> (get_block_headers_response);
|
|
138
|
+
|
|
139
|
+
bitcoin_send_transaction : (send_transaction_request) -> ();
|
|
140
|
+
|
|
141
|
+
get_config : () -> (config) query;
|
|
142
|
+
|
|
143
|
+
set_config : (set_config_request) -> ();
|
|
144
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ckbtc/candid/bitcoin.did */
|
|
2
|
+
export const idlFactory = ({ IDL }) => {
|
|
3
|
+
const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });
|
|
4
|
+
const fees = IDL.Record({
|
|
5
|
+
'get_current_fee_percentiles' : IDL.Nat,
|
|
6
|
+
'get_utxos_maximum' : IDL.Nat,
|
|
7
|
+
'get_current_fee_percentiles_maximum' : IDL.Nat,
|
|
8
|
+
'send_transaction_per_byte' : IDL.Nat,
|
|
9
|
+
'get_balance' : IDL.Nat,
|
|
10
|
+
'get_utxos_cycles_per_ten_instructions' : IDL.Nat,
|
|
11
|
+
'get_utxos_base' : IDL.Nat,
|
|
12
|
+
'get_balance_maximum' : IDL.Nat,
|
|
13
|
+
'send_transaction_base' : IDL.Nat,
|
|
14
|
+
});
|
|
15
|
+
const network = IDL.Variant({
|
|
16
|
+
'mainnet' : IDL.Null,
|
|
17
|
+
'regtest' : IDL.Null,
|
|
18
|
+
'testnet' : IDL.Null,
|
|
19
|
+
});
|
|
20
|
+
const init_config = IDL.Record({
|
|
21
|
+
'api_access' : IDL.Opt(flag),
|
|
22
|
+
'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),
|
|
23
|
+
'blocks_source' : IDL.Opt(IDL.Principal),
|
|
24
|
+
'fees' : IDL.Opt(fees),
|
|
25
|
+
'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),
|
|
26
|
+
'network' : IDL.Opt(network),
|
|
27
|
+
'stability_threshold' : IDL.Opt(IDL.Nat),
|
|
28
|
+
'syncing' : IDL.Opt(flag),
|
|
29
|
+
'burn_cycles' : IDL.Opt(flag),
|
|
30
|
+
'disable_api_if_not_fully_synced' : IDL.Opt(flag),
|
|
31
|
+
});
|
|
32
|
+
const address = IDL.Text;
|
|
33
|
+
const get_balance_request = IDL.Record({
|
|
34
|
+
'network' : network,
|
|
35
|
+
'address' : address,
|
|
36
|
+
'min_confirmations' : IDL.Opt(IDL.Nat32),
|
|
37
|
+
});
|
|
38
|
+
const satoshi = IDL.Nat64;
|
|
39
|
+
const block_height = IDL.Nat32;
|
|
40
|
+
const get_block_headers_request = IDL.Record({
|
|
41
|
+
'start_height' : block_height,
|
|
42
|
+
'end_height' : IDL.Opt(block_height),
|
|
43
|
+
});
|
|
44
|
+
const block_header = IDL.Vec(IDL.Nat8);
|
|
45
|
+
const get_block_headers_response = IDL.Record({
|
|
46
|
+
'tip_height' : block_height,
|
|
47
|
+
'block_headers' : IDL.Vec(block_header),
|
|
48
|
+
});
|
|
49
|
+
const get_current_fee_percentiles_request = IDL.Record({
|
|
50
|
+
'network' : network,
|
|
51
|
+
});
|
|
52
|
+
const millisatoshi_per_byte = IDL.Nat64;
|
|
53
|
+
const get_utxos_request = IDL.Record({
|
|
54
|
+
'network' : network,
|
|
55
|
+
'filter' : IDL.Opt(
|
|
56
|
+
IDL.Variant({
|
|
57
|
+
'page' : IDL.Vec(IDL.Nat8),
|
|
58
|
+
'min_confirmations' : IDL.Nat32,
|
|
59
|
+
})
|
|
60
|
+
),
|
|
61
|
+
'address' : address,
|
|
62
|
+
});
|
|
63
|
+
const block_hash = IDL.Vec(IDL.Nat8);
|
|
64
|
+
const outpoint = IDL.Record({
|
|
65
|
+
'txid' : IDL.Vec(IDL.Nat8),
|
|
66
|
+
'vout' : IDL.Nat32,
|
|
67
|
+
});
|
|
68
|
+
const utxo = IDL.Record({
|
|
69
|
+
'height' : block_height,
|
|
70
|
+
'value' : satoshi,
|
|
71
|
+
'outpoint' : outpoint,
|
|
72
|
+
});
|
|
73
|
+
const get_utxos_response = IDL.Record({
|
|
74
|
+
'next_page' : IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
75
|
+
'tip_height' : block_height,
|
|
76
|
+
'tip_block_hash' : block_hash,
|
|
77
|
+
'utxos' : IDL.Vec(utxo),
|
|
78
|
+
});
|
|
79
|
+
const send_transaction_request = IDL.Record({
|
|
80
|
+
'transaction' : IDL.Vec(IDL.Nat8),
|
|
81
|
+
'network' : network,
|
|
82
|
+
});
|
|
83
|
+
const config = IDL.Record({
|
|
84
|
+
'api_access' : flag,
|
|
85
|
+
'lazily_evaluate_fee_percentiles' : flag,
|
|
86
|
+
'blocks_source' : IDL.Principal,
|
|
87
|
+
'fees' : fees,
|
|
88
|
+
'watchdog_canister' : IDL.Opt(IDL.Principal),
|
|
89
|
+
'network' : network,
|
|
90
|
+
'stability_threshold' : IDL.Nat,
|
|
91
|
+
'syncing' : flag,
|
|
92
|
+
'burn_cycles' : flag,
|
|
93
|
+
'disable_api_if_not_fully_synced' : flag,
|
|
94
|
+
});
|
|
95
|
+
const set_config_request = IDL.Record({
|
|
96
|
+
'api_access' : IDL.Opt(flag),
|
|
97
|
+
'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),
|
|
98
|
+
'fees' : IDL.Opt(fees),
|
|
99
|
+
'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),
|
|
100
|
+
'stability_threshold' : IDL.Opt(IDL.Nat),
|
|
101
|
+
'syncing' : IDL.Opt(flag),
|
|
102
|
+
'burn_cycles' : IDL.Opt(flag),
|
|
103
|
+
'disable_api_if_not_fully_synced' : IDL.Opt(flag),
|
|
104
|
+
});
|
|
105
|
+
return IDL.Service({
|
|
106
|
+
'bitcoin_get_balance' : IDL.Func([get_balance_request], [satoshi], []),
|
|
107
|
+
'bitcoin_get_balance_query' : IDL.Func(
|
|
108
|
+
[get_balance_request],
|
|
109
|
+
[satoshi],
|
|
110
|
+
['query'],
|
|
111
|
+
),
|
|
112
|
+
'bitcoin_get_block_headers' : IDL.Func(
|
|
113
|
+
[get_block_headers_request],
|
|
114
|
+
[get_block_headers_response],
|
|
115
|
+
[],
|
|
116
|
+
),
|
|
117
|
+
'bitcoin_get_current_fee_percentiles' : IDL.Func(
|
|
118
|
+
[get_current_fee_percentiles_request],
|
|
119
|
+
[IDL.Vec(millisatoshi_per_byte)],
|
|
120
|
+
[],
|
|
121
|
+
),
|
|
122
|
+
'bitcoin_get_utxos' : IDL.Func(
|
|
123
|
+
[get_utxos_request],
|
|
124
|
+
[get_utxos_response],
|
|
125
|
+
[],
|
|
126
|
+
),
|
|
127
|
+
'bitcoin_get_utxos_query' : IDL.Func(
|
|
128
|
+
[get_utxos_request],
|
|
129
|
+
[get_utxos_response],
|
|
130
|
+
['query'],
|
|
131
|
+
),
|
|
132
|
+
'bitcoin_send_transaction' : IDL.Func([send_transaction_request], [], []),
|
|
133
|
+
'get_config' : IDL.Func([], [config], ['query']),
|
|
134
|
+
'set_config' : IDL.Func([set_config_request], [], []),
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
export const init = ({ IDL }) => {
|
|
138
|
+
const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });
|
|
139
|
+
const fees = IDL.Record({
|
|
140
|
+
'get_current_fee_percentiles' : IDL.Nat,
|
|
141
|
+
'get_utxos_maximum' : IDL.Nat,
|
|
142
|
+
'get_current_fee_percentiles_maximum' : IDL.Nat,
|
|
143
|
+
'send_transaction_per_byte' : IDL.Nat,
|
|
144
|
+
'get_balance' : IDL.Nat,
|
|
145
|
+
'get_utxos_cycles_per_ten_instructions' : IDL.Nat,
|
|
146
|
+
'get_utxos_base' : IDL.Nat,
|
|
147
|
+
'get_balance_maximum' : IDL.Nat,
|
|
148
|
+
'send_transaction_base' : IDL.Nat,
|
|
149
|
+
});
|
|
150
|
+
const network = IDL.Variant({
|
|
151
|
+
'mainnet' : IDL.Null,
|
|
152
|
+
'regtest' : IDL.Null,
|
|
153
|
+
'testnet' : IDL.Null,
|
|
154
|
+
});
|
|
155
|
+
const init_config = IDL.Record({
|
|
156
|
+
'api_access' : IDL.Opt(flag),
|
|
157
|
+
'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),
|
|
158
|
+
'blocks_source' : IDL.Opt(IDL.Principal),
|
|
159
|
+
'fees' : IDL.Opt(fees),
|
|
160
|
+
'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),
|
|
161
|
+
'network' : IDL.Opt(network),
|
|
162
|
+
'stability_threshold' : IDL.Opt(IDL.Nat),
|
|
163
|
+
'syncing' : IDL.Opt(flag),
|
|
164
|
+
'burn_cycles' : IDL.Opt(flag),
|
|
165
|
+
'disable_api_if_not_fully_synced' : IDL.Opt(flag),
|
|
166
|
+
});
|
|
167
|
+
return [init_config];
|
|
168
|
+
};
|
package/dist/candid/minter.did
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit b9a0f18 (2024-05-29 tags: release-2024-05-29_23-02-base) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid
|
|
2
2
|
// Represents an account on the ckBTC ledger.
|
|
3
3
|
type Account = record { owner : principal; subaccount : opt blob };
|
|
4
4
|
|