-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1252 from demergent-labs/functional_syntax_bitcoin
bitcoin example completed
- Loading branch information
Showing
6 changed files
with
97 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,30 @@ | ||
import { blob, Principal, Service, update } from '../../src/lib_functional'; | ||
import { | ||
blob, | ||
Principal, | ||
Service, | ||
update, | ||
Vec, | ||
Void | ||
} from '../../src/lib_functional'; | ||
import { | ||
GetBalanceArgs, | ||
GetCurrentFeePercentilesArgs, | ||
GetUtxosArgs, | ||
GetUtxosResult, | ||
MillisatoshiPerByte, | ||
Satoshi, | ||
SendTransactionArgs | ||
} from './bitcoin'; | ||
|
||
export * from './bitcoin'; | ||
|
||
export const managementCanister = Service({ | ||
bitcoin_get_balance: update([GetBalanceArgs], Satoshi), | ||
bitcoin_get_current_fee_percentiles: update( | ||
[GetCurrentFeePercentilesArgs], | ||
Vec(MillisatoshiPerByte) | ||
), | ||
bitcoin_get_utxos: update([GetUtxosArgs], GetUtxosResult), | ||
bitcoin_send_transaction: update([SendTransactionArgs], Void), | ||
raw_rand: update([], blob) | ||
})(Principal.fromText('aaaaa-aa')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
type rec_2 = record {txid:vec nat8; vout:nat32}; | ||
type rec_1 = record {height:nat32; value:nat64; outpoint:rec_2}; | ||
type rec_0 = record {next_page:opt vec nat8; tip_height:nat32; tip_block_hash:vec nat8; utxos:vec rec_1}; | ||
type rec_14 = record {txid:vec nat8; vout:nat32}; | ||
type rec_13 = record {height:nat32; value:nat64; outpoint:rec_14}; | ||
type rec_12 = record {next_page:opt vec nat8; tip_height:nat32; tip_block_hash:vec nat8; utxos:vec rec_13}; | ||
service: () -> { | ||
getBalance: (text) -> (nat64); | ||
getCurrentFeePercentiles: () -> (vec nat64); | ||
getUtxos: (text) -> (rec_0); | ||
getUtxos: (text) -> (rec_12); | ||
sendTransaction: (vec nat8) -> (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters