Add FiatAPI methods to Liquid SDK (#331)

* Add FiatAPI methods to Liquid SDK

* Add mirrored structs of fiat crate on Dart bindings

* Re-generate bindings

* Fix sdk-common imports

* Avoid using hardcoded Breez Server URL, re-use sdk-common constant

* Update Cargo.lock

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
This commit is contained in:
ok300
2024-06-26 13:55:44 +00:00
committed by GitHub
parent 079be185c6
commit ef5cd28fa5
20 changed files with 3701 additions and 390 deletions

View File

@@ -51,6 +51,21 @@ export interface ConnectRequest {
mnemonic: string
}
export interface CurrencyInfo {
name: string
fractionSize: number
spacing?: number
symbol?: SymbolType
uniqSymbol?: SymbolType
localizedName: LocalizedName[]
localeOverrides: LocaleOverrides[]
}
export interface FiatCurrency {
id: string
info: CurrencyInfo
}
export interface GetInfoResponse {
balanceSat: number
pendingSendSat: number
@@ -131,6 +146,17 @@ export interface LnUrlWithdrawSuccessData {
invoice: LnInvoice
}
export interface LocaleOverrides {
locale: string
spacing?: number
symbol: SymbolType
}
export interface LocalizedName {
locale: string
name: string
}
export interface LogEntry {
line: string
level: string
@@ -206,6 +232,11 @@ export interface PrepareSendResponse {
feesSat: number
}
export interface Rate {
coin: string
value: number
}
export interface ReceiveOnchainRequest {
prepareRes: PrepareReceiveOnchainResponse
}
@@ -258,6 +289,13 @@ export interface SendPaymentResponse {
payment: Payment
}
export interface SymbolType {
grapheme?: string
template?: string
rtl?: boolean
position?: number
}
export interface UrlSuccessActionData {
description: string
url: string
@@ -571,3 +609,13 @@ export const lnurlAuth = async (reqData: LnUrlAuthRequestData): Promise<LnUrlCal
const response = await BreezLiquidSDK.lnurlAuth(reqData)
return response
}
export const fetchFiatRates = async (): Promise<Rate[]> => {
const response = await BreezLiquidSDK.fetchFiatRates()
return response
}
export const listFiatCurrencies = async (): Promise<FiatCurrency[]> => {
const response = await BreezLiquidSDK.listFiatCurrencies()
return response
}