@bsv/wallet-toolbox 2.0.8 → 2.0.10
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/CHANGELOG.md +4 -0
- package/docs/client.md +34 -20
- package/docs/services.md +5 -5
- package/docs/wallet.md +34 -20
- package/out/src/sdk/WalletServices.interfaces.d.ts +4 -2
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
- package/out/src/services/Services.d.ts +4 -3
- package/out/src/services/Services.d.ts.map +1 -1
- package/out/src/services/Services.js +87 -24
- package/out/src/services/Services.js.map +1 -1
- package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -1
- package/out/src/services/createDefaultWalletServicesOptions.js +5 -0
- package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -1
- package/out/src/services/providers/exchangeRates.d.ts +1 -1
- package/out/src/services/providers/exchangeRates.d.ts.map +1 -1
- package/out/src/services/providers/exchangeRates.js +20 -14
- package/out/src/services/providers/exchangeRates.js.map +1 -1
- package/out/src/storage/StorageIdb.d.ts.map +1 -1
- package/out/src/storage/StorageIdb.js +39 -26
- package/out/src/storage/StorageIdb.js.map +1 -1
- package/out/src/storage/methods/createAction.js +16 -9
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ This document captures the history of significant changes to the wallet-toolbox
|
|
|
4
4
|
The git commit history contains the details but is unable to draw
|
|
5
5
|
attention to changes that materially alter behavior or extend functionality.
|
|
6
6
|
|
|
7
|
+
## wallet-toolbox 2.0.9
|
|
8
|
+
|
|
9
|
+
Added support for more currency types.
|
|
10
|
+
|
|
7
11
|
## wallet-toolbox 2.0.8
|
|
8
12
|
|
|
9
13
|
Add check for cross session signAction errors.
|
package/docs/client.md
CHANGED
|
@@ -2486,11 +2486,14 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
2486
2486
|
```ts
|
|
2487
2487
|
export interface FiatExchangeRates {
|
|
2488
2488
|
timestamp: Date;
|
|
2489
|
-
base:
|
|
2489
|
+
base: FiatCurrencyCode;
|
|
2490
2490
|
rates: Record<string, number>;
|
|
2491
|
+
rateTimestamps?: Record<string, Date>;
|
|
2491
2492
|
}
|
|
2492
2493
|
```
|
|
2493
2494
|
|
|
2495
|
+
See also: [FiatCurrencyCode](./client.md#type-fiatcurrencycode)
|
|
2496
|
+
|
|
2494
2497
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2495
2498
|
|
|
2496
2499
|
---
|
|
@@ -7300,7 +7303,7 @@ export interface WalletServices {
|
|
|
7300
7303
|
getHeaderForHeight(height: number): Promise<number[]>;
|
|
7301
7304
|
getHeight(): Promise<number>;
|
|
7302
7305
|
getBsvExchangeRate(): Promise<number>;
|
|
7303
|
-
getFiatExchangeRate(currency:
|
|
7306
|
+
getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>;
|
|
7304
7307
|
getRawTx(txid: string, useNext?: boolean): Promise<GetRawTxResult>;
|
|
7305
7308
|
getMerklePath(txid: string, useNext?: boolean): Promise<GetMerklePathResult>;
|
|
7306
7309
|
postBeef(beef: Beef, txids: string[], logger?: WalletLoggerInterface): Promise<PostBeefResult[]>;
|
|
@@ -7316,7 +7319,7 @@ export interface WalletServices {
|
|
|
7316
7319
|
}
|
|
7317
7320
|
```
|
|
7318
7321
|
|
|
7319
|
-
See also: [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [PostBeefResult](./client.md#interface-postbeefresult), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
7322
|
+
See also: [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatCurrencyCode](./client.md#type-fiatcurrencycode), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [PostBeefResult](./client.md#interface-postbeefresult), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
7320
7323
|
|
|
7321
7324
|
###### Property chain
|
|
7322
7325
|
|
|
@@ -7368,8 +7371,9 @@ standard `ChainTracker` service which requires `options.chaintracks` be valid.
|
|
|
7368
7371
|
Approximate exchange rate currency per base.
|
|
7369
7372
|
|
|
7370
7373
|
```ts
|
|
7371
|
-
getFiatExchangeRate(currency:
|
|
7374
|
+
getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>
|
|
7372
7375
|
```
|
|
7376
|
+
See also: [FiatCurrencyCode](./client.md#type-fiatcurrencycode)
|
|
7373
7377
|
|
|
7374
7378
|
###### Method getHeaderForHeight
|
|
7375
7379
|
|
|
@@ -11714,7 +11718,8 @@ export class Services implements WalletServices {
|
|
|
11714
11718
|
getServicesCallHistory(reset?: boolean): ServicesCallHistory
|
|
11715
11719
|
async getChainTracker(): Promise<ChainTracker>
|
|
11716
11720
|
async getBsvExchangeRate(): Promise<number>
|
|
11717
|
-
async getFiatExchangeRate(currency:
|
|
11721
|
+
async getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>
|
|
11722
|
+
async getFiatExchangeRates(targetCurrencies: FiatCurrencyCode[]): Promise<FiatExchangeRates>
|
|
11718
11723
|
get getProofsCount()
|
|
11719
11724
|
get getRawTxsCount()
|
|
11720
11725
|
get postBeefServicesCount()
|
|
@@ -11732,14 +11737,13 @@ export class Services implements WalletServices {
|
|
|
11732
11737
|
async getHeight(): Promise<number>
|
|
11733
11738
|
async hashToHeader(hash: string): Promise<BlockHeader>
|
|
11734
11739
|
async getMerklePath(txid: string, useNext?: boolean, logger?: WalletLoggerInterface): Promise<GetMerklePathResult>
|
|
11735
|
-
targetCurrencies
|
|
11736
|
-
async updateFiatExchangeRates(rates?: FiatExchangeRates, updateMsecs?: number): Promise<FiatExchangeRates>
|
|
11740
|
+
async updateFiatExchangeRates(targetCurrencies: FiatCurrencyCode[], updateMsecs?: number): Promise<FiatExchangeRates>
|
|
11737
11741
|
async nLockTimeIsFinal(tx: string | number[] | BsvTransaction | number): Promise<boolean>
|
|
11738
11742
|
async getBeefForTxid(txid: string): Promise<Beef>
|
|
11739
11743
|
}
|
|
11740
11744
|
```
|
|
11741
11745
|
|
|
11742
|
-
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatExchangeRates](./client.md#interface-fiatexchangerates), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetMerklePathService](./client.md#type-getmerklepathservice), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetRawTxService](./client.md#type-getrawtxservice), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetScriptHashHistoryService](./client.md#type-getscripthashhistoryservice), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetStatusForTxidsService](./client.md#type-getstatusfortxidsservice), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [GetUtxoStatusService](./client.md#type-getutxostatusservice), [PostBeefResult](./client.md#interface-postbeefresult), [PostBeefService](./client.md#type-postbeefservice), [ServiceCollection](./services.md#class-servicecollection), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [UpdateFiatExchangeRateService](./client.md#type-updatefiatexchangerateservice), [WalletServices](./client.md#interface-walletservices), [WalletServicesOptions](./client.md#interface-walletservicesoptions), [WhatsOnChain](./services.md#class-whatsonchain), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
11746
|
+
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatCurrencyCode](./client.md#type-fiatcurrencycode), [FiatExchangeRates](./client.md#interface-fiatexchangerates), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetMerklePathService](./client.md#type-getmerklepathservice), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetRawTxService](./client.md#type-getrawtxservice), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetScriptHashHistoryService](./client.md#type-getscripthashhistoryservice), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetStatusForTxidsService](./client.md#type-getstatusfortxidsservice), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [GetUtxoStatusService](./client.md#type-getutxostatusservice), [PostBeefResult](./client.md#interface-postbeefresult), [PostBeefService](./client.md#type-postbeefservice), [ServiceCollection](./services.md#class-servicecollection), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [UpdateFiatExchangeRateService](./client.md#type-updatefiatexchangerateservice), [WalletServices](./client.md#interface-walletservices), [WalletServicesOptions](./client.md#interface-walletservicesoptions), [WhatsOnChain](./services.md#class-whatsonchain), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
11743
11747
|
|
|
11744
11748
|
###### Method hashOutputScript
|
|
11745
11749
|
|
|
@@ -17030,7 +17034,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
17030
17034
|
##### Function: getExchangeRatesIo
|
|
17031
17035
|
|
|
17032
17036
|
```ts
|
|
17033
|
-
export async function getExchangeRatesIo(key: string): Promise<ExchangeRatesIoApi>
|
|
17037
|
+
export async function getExchangeRatesIo(key: string, symbols?: string[]): Promise<ExchangeRatesIoApi>
|
|
17034
17038
|
```
|
|
17035
17039
|
|
|
17036
17040
|
See also: [ExchangeRatesIoApi](./services.md#interface-exchangeratesioapi)
|
|
@@ -18450,17 +18454,18 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
18450
18454
|
|
|
18451
18455
|
| | | |
|
|
18452
18456
|
| --- | --- | --- |
|
|
18453
|
-
| [Chain](#type-chain) | [GetUtxoStatusService](#type-getutxostatusservice) | [
|
|
18454
|
-
| [CounterpartyPermissionEventHandler](#type-counterpartypermissioneventhandler) | [GroupedPermissionEventHandler](#type-groupedpermissioneventhandler) | [
|
|
18455
|
-
| [DBType](#type-dbtype) | [HeaderListener](#type-headerlistener) | [
|
|
18456
|
-
| [EnqueueHandler](#type-enqueuehandler) | [InsertHeaderResult](#type-insertheaderresult) | [
|
|
18457
|
-
| [EntityStorage](#type-entitystorage) | [MonitorStorage](#type-monitorstorage) | [
|
|
18458
|
-
| [ErrorHandler](#type-errorhandler) | [PermissionEventHandler](#type-permissioneventhandler) | [
|
|
18459
|
-
| [
|
|
18460
|
-
| [
|
|
18461
|
-
| [
|
|
18462
|
-
| [
|
|
18463
|
-
| [
|
|
18457
|
+
| [Chain](#type-chain) | [GetUtxoStatusService](#type-getutxostatusservice) | [ReviewActionResultStatus](#type-reviewactionresultstatus) |
|
|
18458
|
+
| [CounterpartyPermissionEventHandler](#type-counterpartypermissioneventhandler) | [GroupedPermissionEventHandler](#type-groupedpermissioneventhandler) | [ScriptHashFormat](#type-scripthashformat) |
|
|
18459
|
+
| [DBType](#type-dbtype) | [HeaderListener](#type-headerlistener) | [ServicesCallHistory](#type-servicescallhistory) |
|
|
18460
|
+
| [EnqueueHandler](#type-enqueuehandler) | [InsertHeaderResult](#type-insertheaderresult) | [StopListenerToken](#type-stoplistenertoken) |
|
|
18461
|
+
| [EntityStorage](#type-entitystorage) | [MonitorStorage](#type-monitorstorage) | [StorageProvidedBy](#type-storageprovidedby) |
|
|
18462
|
+
| [ErrorHandler](#type-errorhandler) | [PermissionEventHandler](#type-permissioneventhandler) | [SyncProtocolVersion](#type-syncprotocolversion) |
|
|
18463
|
+
| [FiatCurrencyCode](#type-fiatcurrencycode) | [PostBeefService](#type-postbeefservice) | [SyncStatus](#type-syncstatus) |
|
|
18464
|
+
| [GetMerklePathService](#type-getmerklepathservice) | [PostReqsToNetworkDetailsStatus](#type-postreqstonetworkdetailsstatus) | [TransactionStatus](#type-transactionstatus) |
|
|
18465
|
+
| [GetRawTxService](#type-getrawtxservice) | [PostTxsService](#type-posttxsservice) | [UpdateFiatExchangeRateService](#type-updatefiatexchangerateservice) |
|
|
18466
|
+
| [GetScriptHashHistoryService](#type-getscripthashhistoryservice) | [ProvenTxReqStatus](#type-proventxreqstatus) | [WalletLoggerLevel](#type-walletloggerlevel) |
|
|
18467
|
+
| [GetStatusForTxidsService](#type-getstatusfortxidsservice) | [ReorgListener](#type-reorglistener) | |
|
|
18468
|
+
| [GetUtxoStatusOutputFormat](#type-getutxostatusoutputformat) | [ReqHistoryNote](#type-reqhistorynote) | |
|
|
18464
18469
|
|
|
18465
18470
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
18466
18471
|
|
|
@@ -18527,6 +18532,15 @@ export type ErrorHandler = (code: number, message: string) => boolean
|
|
|
18527
18532
|
|
|
18528
18533
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
18529
18534
|
|
|
18535
|
+
---
|
|
18536
|
+
##### Type: FiatCurrencyCode
|
|
18537
|
+
|
|
18538
|
+
```ts
|
|
18539
|
+
export type FiatCurrencyCode = "USD" | "EUR" | "GBP" | "JPY" | "CNY" | "INR" | "AUD" | "CAD" | "CHF" | "HKD" | "SGD" | "NZD" | "SEK" | "NOK" | "MXN"
|
|
18540
|
+
```
|
|
18541
|
+
|
|
18542
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
18543
|
+
|
|
18530
18544
|
---
|
|
18531
18545
|
##### Type: GetMerklePathService
|
|
18532
18546
|
|
package/docs/services.md
CHANGED
|
@@ -4586,7 +4586,8 @@ export class Services implements WalletServices {
|
|
|
4586
4586
|
getServicesCallHistory(reset?: boolean): ServicesCallHistory
|
|
4587
4587
|
async getChainTracker(): Promise<ChainTracker>
|
|
4588
4588
|
async getBsvExchangeRate(): Promise<number>
|
|
4589
|
-
async getFiatExchangeRate(currency:
|
|
4589
|
+
async getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>
|
|
4590
|
+
async getFiatExchangeRates(targetCurrencies: FiatCurrencyCode[]): Promise<FiatExchangeRates>
|
|
4590
4591
|
get getProofsCount()
|
|
4591
4592
|
get getRawTxsCount()
|
|
4592
4593
|
get postBeefServicesCount()
|
|
@@ -4604,14 +4605,13 @@ export class Services implements WalletServices {
|
|
|
4604
4605
|
async getHeight(): Promise<number>
|
|
4605
4606
|
async hashToHeader(hash: string): Promise<BlockHeader>
|
|
4606
4607
|
async getMerklePath(txid: string, useNext?: boolean, logger?: WalletLoggerInterface): Promise<GetMerklePathResult>
|
|
4607
|
-
targetCurrencies
|
|
4608
|
-
async updateFiatExchangeRates(rates?: FiatExchangeRates, updateMsecs?: number): Promise<FiatExchangeRates>
|
|
4608
|
+
async updateFiatExchangeRates(targetCurrencies: FiatCurrencyCode[], updateMsecs?: number): Promise<FiatExchangeRates>
|
|
4609
4609
|
async nLockTimeIsFinal(tx: string | number[] | BsvTransaction | number): Promise<boolean>
|
|
4610
4610
|
async getBeefForTxid(txid: string): Promise<Beef>
|
|
4611
4611
|
}
|
|
4612
4612
|
```
|
|
4613
4613
|
|
|
4614
|
-
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatExchangeRates](./client.md#interface-fiatexchangerates), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetMerklePathService](./client.md#type-getmerklepathservice), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetRawTxService](./client.md#type-getrawtxservice), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetScriptHashHistoryService](./client.md#type-getscripthashhistoryservice), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetStatusForTxidsService](./client.md#type-getstatusfortxidsservice), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [GetUtxoStatusService](./client.md#type-getutxostatusservice), [PostBeefResult](./client.md#interface-postbeefresult), [PostBeefService](./client.md#type-postbeefservice), [ServiceCollection](./services.md#class-servicecollection), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [UpdateFiatExchangeRateService](./client.md#type-updatefiatexchangerateservice), [WalletServices](./client.md#interface-walletservices), [WalletServicesOptions](./client.md#interface-walletservicesoptions), [WhatsOnChain](./services.md#class-whatsonchain), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
4614
|
+
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatCurrencyCode](./client.md#type-fiatcurrencycode), [FiatExchangeRates](./client.md#interface-fiatexchangerates), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetMerklePathService](./client.md#type-getmerklepathservice), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetRawTxService](./client.md#type-getrawtxservice), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetScriptHashHistoryService](./client.md#type-getscripthashhistoryservice), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetStatusForTxidsService](./client.md#type-getstatusfortxidsservice), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [GetUtxoStatusService](./client.md#type-getutxostatusservice), [PostBeefResult](./client.md#interface-postbeefresult), [PostBeefService](./client.md#type-postbeefservice), [ServiceCollection](./services.md#class-servicecollection), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [UpdateFiatExchangeRateService](./client.md#type-updatefiatexchangerateservice), [WalletServices](./client.md#interface-walletservices), [WalletServicesOptions](./client.md#interface-walletservicesoptions), [WhatsOnChain](./services.md#class-whatsonchain), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
4615
4615
|
|
|
4616
4616
|
###### Method hashOutputScript
|
|
4617
4617
|
|
|
@@ -5337,7 +5337,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
5337
5337
|
##### Function: getExchangeRatesIo
|
|
5338
5338
|
|
|
5339
5339
|
```ts
|
|
5340
|
-
export async function getExchangeRatesIo(key: string): Promise<ExchangeRatesIoApi>
|
|
5340
|
+
export async function getExchangeRatesIo(key: string, symbols?: string[]): Promise<ExchangeRatesIoApi>
|
|
5341
5341
|
```
|
|
5342
5342
|
|
|
5343
5343
|
See also: [ExchangeRatesIoApi](./services.md#interface-exchangeratesioapi)
|
package/docs/wallet.md
CHANGED
|
@@ -2486,11 +2486,14 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
2486
2486
|
```ts
|
|
2487
2487
|
export interface FiatExchangeRates {
|
|
2488
2488
|
timestamp: Date;
|
|
2489
|
-
base:
|
|
2489
|
+
base: FiatCurrencyCode;
|
|
2490
2490
|
rates: Record<string, number>;
|
|
2491
|
+
rateTimestamps?: Record<string, Date>;
|
|
2491
2492
|
}
|
|
2492
2493
|
```
|
|
2493
2494
|
|
|
2495
|
+
See also: [FiatCurrencyCode](./client.md#type-fiatcurrencycode)
|
|
2496
|
+
|
|
2494
2497
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2495
2498
|
|
|
2496
2499
|
---
|
|
@@ -7300,7 +7303,7 @@ export interface WalletServices {
|
|
|
7300
7303
|
getHeaderForHeight(height: number): Promise<number[]>;
|
|
7301
7304
|
getHeight(): Promise<number>;
|
|
7302
7305
|
getBsvExchangeRate(): Promise<number>;
|
|
7303
|
-
getFiatExchangeRate(currency:
|
|
7306
|
+
getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>;
|
|
7304
7307
|
getRawTx(txid: string, useNext?: boolean): Promise<GetRawTxResult>;
|
|
7305
7308
|
getMerklePath(txid: string, useNext?: boolean): Promise<GetMerklePathResult>;
|
|
7306
7309
|
postBeef(beef: Beef, txids: string[], logger?: WalletLoggerInterface): Promise<PostBeefResult[]>;
|
|
@@ -7316,7 +7319,7 @@ export interface WalletServices {
|
|
|
7316
7319
|
}
|
|
7317
7320
|
```
|
|
7318
7321
|
|
|
7319
|
-
See also: [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [PostBeefResult](./client.md#interface-postbeefresult), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
7322
|
+
See also: [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatCurrencyCode](./client.md#type-fiatcurrencycode), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [PostBeefResult](./client.md#interface-postbeefresult), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
7320
7323
|
|
|
7321
7324
|
###### Property chain
|
|
7322
7325
|
|
|
@@ -7368,8 +7371,9 @@ standard `ChainTracker` service which requires `options.chaintracks` be valid.
|
|
|
7368
7371
|
Approximate exchange rate currency per base.
|
|
7369
7372
|
|
|
7370
7373
|
```ts
|
|
7371
|
-
getFiatExchangeRate(currency:
|
|
7374
|
+
getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>
|
|
7372
7375
|
```
|
|
7376
|
+
See also: [FiatCurrencyCode](./client.md#type-fiatcurrencycode)
|
|
7373
7377
|
|
|
7374
7378
|
###### Method getHeaderForHeight
|
|
7375
7379
|
|
|
@@ -11714,7 +11718,8 @@ export class Services implements WalletServices {
|
|
|
11714
11718
|
getServicesCallHistory(reset?: boolean): ServicesCallHistory
|
|
11715
11719
|
async getChainTracker(): Promise<ChainTracker>
|
|
11716
11720
|
async getBsvExchangeRate(): Promise<number>
|
|
11717
|
-
async getFiatExchangeRate(currency:
|
|
11721
|
+
async getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>
|
|
11722
|
+
async getFiatExchangeRates(targetCurrencies: FiatCurrencyCode[]): Promise<FiatExchangeRates>
|
|
11718
11723
|
get getProofsCount()
|
|
11719
11724
|
get getRawTxsCount()
|
|
11720
11725
|
get postBeefServicesCount()
|
|
@@ -11732,14 +11737,13 @@ export class Services implements WalletServices {
|
|
|
11732
11737
|
async getHeight(): Promise<number>
|
|
11733
11738
|
async hashToHeader(hash: string): Promise<BlockHeader>
|
|
11734
11739
|
async getMerklePath(txid: string, useNext?: boolean, logger?: WalletLoggerInterface): Promise<GetMerklePathResult>
|
|
11735
|
-
targetCurrencies
|
|
11736
|
-
async updateFiatExchangeRates(rates?: FiatExchangeRates, updateMsecs?: number): Promise<FiatExchangeRates>
|
|
11740
|
+
async updateFiatExchangeRates(targetCurrencies: FiatCurrencyCode[], updateMsecs?: number): Promise<FiatExchangeRates>
|
|
11737
11741
|
async nLockTimeIsFinal(tx: string | number[] | BsvTransaction | number): Promise<boolean>
|
|
11738
11742
|
async getBeefForTxid(txid: string): Promise<Beef>
|
|
11739
11743
|
}
|
|
11740
11744
|
```
|
|
11741
11745
|
|
|
11742
|
-
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatExchangeRates](./client.md#interface-fiatexchangerates), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetMerklePathService](./client.md#type-getmerklepathservice), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetRawTxService](./client.md#type-getrawtxservice), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetScriptHashHistoryService](./client.md#type-getscripthashhistoryservice), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetStatusForTxidsService](./client.md#type-getstatusfortxidsservice), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [GetUtxoStatusService](./client.md#type-getutxostatusservice), [PostBeefResult](./client.md#interface-postbeefresult), [PostBeefService](./client.md#type-postbeefservice), [ServiceCollection](./services.md#class-servicecollection), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [UpdateFiatExchangeRateService](./client.md#type-updatefiatexchangerateservice), [WalletServices](./client.md#interface-walletservices), [WalletServicesOptions](./client.md#interface-walletservicesoptions), [WhatsOnChain](./services.md#class-whatsonchain), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
11746
|
+
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatCurrencyCode](./client.md#type-fiatcurrencycode), [FiatExchangeRates](./client.md#interface-fiatexchangerates), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetMerklePathService](./client.md#type-getmerklepathservice), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetRawTxService](./client.md#type-getrawtxservice), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetScriptHashHistoryService](./client.md#type-getscripthashhistoryservice), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetStatusForTxidsService](./client.md#type-getstatusfortxidsservice), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [GetUtxoStatusService](./client.md#type-getutxostatusservice), [PostBeefResult](./client.md#interface-postbeefresult), [PostBeefService](./client.md#type-postbeefservice), [ServiceCollection](./services.md#class-servicecollection), [ServicesCallHistory](./client.md#type-servicescallhistory), [TableOutput](./storage.md#interface-tableoutput), [UpdateFiatExchangeRateService](./client.md#type-updatefiatexchangerateservice), [WalletServices](./client.md#interface-walletservices), [WalletServicesOptions](./client.md#interface-walletservicesoptions), [WhatsOnChain](./services.md#class-whatsonchain), [getBeefForTxid](./services.md#function-getbeeffortxid), [logger](./client.md#variable-logger)
|
|
11743
11747
|
|
|
11744
11748
|
###### Method hashOutputScript
|
|
11745
11749
|
|
|
@@ -17030,7 +17034,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
17030
17034
|
##### Function: getExchangeRatesIo
|
|
17031
17035
|
|
|
17032
17036
|
```ts
|
|
17033
|
-
export async function getExchangeRatesIo(key: string): Promise<ExchangeRatesIoApi>
|
|
17037
|
+
export async function getExchangeRatesIo(key: string, symbols?: string[]): Promise<ExchangeRatesIoApi>
|
|
17034
17038
|
```
|
|
17035
17039
|
|
|
17036
17040
|
See also: [ExchangeRatesIoApi](./services.md#interface-exchangeratesioapi)
|
|
@@ -18450,17 +18454,18 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
18450
18454
|
|
|
18451
18455
|
| | | |
|
|
18452
18456
|
| --- | --- | --- |
|
|
18453
|
-
| [Chain](#type-chain) | [GetUtxoStatusService](#type-getutxostatusservice) | [
|
|
18454
|
-
| [CounterpartyPermissionEventHandler](#type-counterpartypermissioneventhandler) | [GroupedPermissionEventHandler](#type-groupedpermissioneventhandler) | [
|
|
18455
|
-
| [DBType](#type-dbtype) | [HeaderListener](#type-headerlistener) | [
|
|
18456
|
-
| [EnqueueHandler](#type-enqueuehandler) | [InsertHeaderResult](#type-insertheaderresult) | [
|
|
18457
|
-
| [EntityStorage](#type-entitystorage) | [MonitorStorage](#type-monitorstorage) | [
|
|
18458
|
-
| [ErrorHandler](#type-errorhandler) | [PermissionEventHandler](#type-permissioneventhandler) | [
|
|
18459
|
-
| [
|
|
18460
|
-
| [
|
|
18461
|
-
| [
|
|
18462
|
-
| [
|
|
18463
|
-
| [
|
|
18457
|
+
| [Chain](#type-chain) | [GetUtxoStatusService](#type-getutxostatusservice) | [ReviewActionResultStatus](#type-reviewactionresultstatus) |
|
|
18458
|
+
| [CounterpartyPermissionEventHandler](#type-counterpartypermissioneventhandler) | [GroupedPermissionEventHandler](#type-groupedpermissioneventhandler) | [ScriptHashFormat](#type-scripthashformat) |
|
|
18459
|
+
| [DBType](#type-dbtype) | [HeaderListener](#type-headerlistener) | [ServicesCallHistory](#type-servicescallhistory) |
|
|
18460
|
+
| [EnqueueHandler](#type-enqueuehandler) | [InsertHeaderResult](#type-insertheaderresult) | [StopListenerToken](#type-stoplistenertoken) |
|
|
18461
|
+
| [EntityStorage](#type-entitystorage) | [MonitorStorage](#type-monitorstorage) | [StorageProvidedBy](#type-storageprovidedby) |
|
|
18462
|
+
| [ErrorHandler](#type-errorhandler) | [PermissionEventHandler](#type-permissioneventhandler) | [SyncProtocolVersion](#type-syncprotocolversion) |
|
|
18463
|
+
| [FiatCurrencyCode](#type-fiatcurrencycode) | [PostBeefService](#type-postbeefservice) | [SyncStatus](#type-syncstatus) |
|
|
18464
|
+
| [GetMerklePathService](#type-getmerklepathservice) | [PostReqsToNetworkDetailsStatus](#type-postreqstonetworkdetailsstatus) | [TransactionStatus](#type-transactionstatus) |
|
|
18465
|
+
| [GetRawTxService](#type-getrawtxservice) | [PostTxsService](#type-posttxsservice) | [UpdateFiatExchangeRateService](#type-updatefiatexchangerateservice) |
|
|
18466
|
+
| [GetScriptHashHistoryService](#type-getscripthashhistoryservice) | [ProvenTxReqStatus](#type-proventxreqstatus) | [WalletLoggerLevel](#type-walletloggerlevel) |
|
|
18467
|
+
| [GetStatusForTxidsService](#type-getstatusfortxidsservice) | [ReorgListener](#type-reorglistener) | |
|
|
18468
|
+
| [GetUtxoStatusOutputFormat](#type-getutxostatusoutputformat) | [ReqHistoryNote](#type-reqhistorynote) | |
|
|
18464
18469
|
|
|
18465
18470
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
18466
18471
|
|
|
@@ -18527,6 +18532,15 @@ export type ErrorHandler = (code: number, message: string) => boolean
|
|
|
18527
18532
|
|
|
18528
18533
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
18529
18534
|
|
|
18535
|
+
---
|
|
18536
|
+
##### Type: FiatCurrencyCode
|
|
18537
|
+
|
|
18538
|
+
```ts
|
|
18539
|
+
export type FiatCurrencyCode = "USD" | "EUR" | "GBP" | "JPY" | "CNY" | "INR" | "AUD" | "CAD" | "CHF" | "HKD" | "SGD" | "NZD" | "SEK" | "NOK" | "MXN"
|
|
18540
|
+
```
|
|
18541
|
+
|
|
18542
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
18543
|
+
|
|
18530
18544
|
---
|
|
18531
18545
|
##### Type: GetMerklePathService
|
|
18532
18546
|
|
|
@@ -33,7 +33,7 @@ export interface WalletServices {
|
|
|
33
33
|
/**
|
|
34
34
|
* Approximate exchange rate currency per base.
|
|
35
35
|
*/
|
|
36
|
-
getFiatExchangeRate(currency:
|
|
36
|
+
getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>;
|
|
37
37
|
/**
|
|
38
38
|
* Attempts to obtain the raw transaction bytes associated with a 32 byte transaction hash (txid).
|
|
39
39
|
*
|
|
@@ -162,9 +162,11 @@ export interface BsvExchangeRate {
|
|
|
162
162
|
}
|
|
163
163
|
export interface FiatExchangeRates {
|
|
164
164
|
timestamp: Date;
|
|
165
|
-
base:
|
|
165
|
+
base: FiatCurrencyCode;
|
|
166
166
|
rates: Record<string, number>;
|
|
167
|
+
rateTimestamps?: Record<string, Date>;
|
|
167
168
|
}
|
|
169
|
+
export type FiatCurrencyCode = 'USD' | 'EUR' | 'GBP' | 'JPY' | 'CNY' | 'INR' | 'AUD' | 'CAD' | 'CHF' | 'HKD' | 'SGD' | 'NZD' | 'SEK' | 'NOK' | 'MXN';
|
|
168
170
|
export interface WalletServicesOptions {
|
|
169
171
|
/**
|
|
170
172
|
* 'main' or 'test': which BSV chain to use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletServices.interfaces.d.ts","sourceRoot":"","sources":["../../../src/sdk/WalletServices.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,WAAW,IAAI,cAAc,EAC7B,YAAY,EACZ,UAAU,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAA;AACpG;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,KAAK,CAAA;IAEZ;;OAEG;IACH,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAAA;IAExC;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAErD;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAE5B;;;;OAIG;IACH,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAErC;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"WalletServices.interfaces.d.ts","sourceRoot":"","sources":["../../../src/sdk/WalletServices.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,WAAW,IAAI,cAAc,EAC7B,YAAY,EACZ,UAAU,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAA;AACpG;;GAEG;AACH,MAAM,WAAW,cAAc;I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;IACH,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB;;OAEG;IACH,WAAW,EAAE,wBAAwB,CAAA;IACrC;;;;OAIG;IACH,WAAW,EAAE,wBAAwB,EAAE,CAAA;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;CACvD"}
|
|
@@ -4,6 +4,7 @@ import { WhatsOnChain } from './providers/WhatsOnChain';
|
|
|
4
4
|
import { ARC } from './providers/ARC';
|
|
5
5
|
import { Bitails } from './providers/Bitails';
|
|
6
6
|
import { BaseBlockHeader, BlockHeader, FiatExchangeRates, GetMerklePathResult, GetMerklePathService, GetRawTxResult, GetRawTxService, GetScriptHashHistoryResult, GetScriptHashHistoryService, GetStatusForTxidsResult, GetStatusForTxidsService, GetUtxoStatusOutputFormat, GetUtxoStatusResult, GetUtxoStatusService, PostBeefResult, PostBeefService, ServicesCallHistory, UpdateFiatExchangeRateService, WalletServices, WalletServicesOptions } from '../sdk/WalletServices.interfaces';
|
|
7
|
+
import type { FiatCurrencyCode } from '../sdk/WalletServices.interfaces';
|
|
7
8
|
import { Chain } from '../sdk/types';
|
|
8
9
|
import { TableOutput } from '../storage/schema/tables/TableOutput';
|
|
9
10
|
export declare class Services implements WalletServices {
|
|
@@ -25,7 +26,8 @@ export declare class Services implements WalletServices {
|
|
|
25
26
|
getServicesCallHistory(reset?: boolean): ServicesCallHistory;
|
|
26
27
|
getChainTracker(): Promise<ChainTracker>;
|
|
27
28
|
getBsvExchangeRate(): Promise<number>;
|
|
28
|
-
getFiatExchangeRate(currency:
|
|
29
|
+
getFiatExchangeRate(currency: FiatCurrencyCode, base?: FiatCurrencyCode): Promise<number>;
|
|
30
|
+
getFiatExchangeRates(targetCurrencies: FiatCurrencyCode[]): Promise<FiatExchangeRates>;
|
|
29
31
|
get getProofsCount(): number;
|
|
30
32
|
get getRawTxsCount(): number;
|
|
31
33
|
get postBeefServicesCount(): number;
|
|
@@ -53,8 +55,7 @@ export declare class Services implements WalletServices {
|
|
|
53
55
|
getHeight(): Promise<number>;
|
|
54
56
|
hashToHeader(hash: string): Promise<BlockHeader>;
|
|
55
57
|
getMerklePath(txid: string, useNext?: boolean, logger?: WalletLoggerInterface): Promise<GetMerklePathResult>;
|
|
56
|
-
targetCurrencies:
|
|
57
|
-
updateFiatExchangeRates(rates?: FiatExchangeRates, updateMsecs?: number): Promise<FiatExchangeRates>;
|
|
58
|
+
updateFiatExchangeRates(targetCurrencies: FiatCurrencyCode[], updateMsecs?: number): Promise<FiatExchangeRates>;
|
|
58
59
|
nLockTimeIsFinal(tx: string | number[] | BsvTransaction | number): Promise<boolean>;
|
|
59
60
|
getBeefForTxid(txid: string): Promise<Beef>;
|
|
60
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Services.d.ts","sourceRoot":"","sources":["../../../src/services/Services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,IAAI,EAAE,YAAY,EAAS,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAC1G,OAAO,EAAE,iBAAiB,EAAiB,MAAM,qBAAqB,CAAA;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EACL,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACtB,MAAM,kCAAkC,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AAC,cAAc,CAAC;IAyClE,0BAA0B,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAenE,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASrD,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAO5B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAahD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA0C5G,uBAAuB,CAC3B,gBAAgB,EAAE,gBAAgB,EAAE,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,iBAAiB,CAAC;IA0FvB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiCnF,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIlD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,yBAAyB,GAAG,MAAM,CAmBnG;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE,CAUzE"}
|
|
@@ -22,7 +22,6 @@ class Services {
|
|
|
22
22
|
}
|
|
23
23
|
constructor(optionsOrChain) {
|
|
24
24
|
this.postBeefMode = 'UntilSuccess';
|
|
25
|
-
this.targetCurrencies = ['USD', 'GBP', 'EUR'];
|
|
26
25
|
this.chain = typeof optionsOrChain === 'string' ? optionsOrChain : optionsOrChain.chain;
|
|
27
26
|
this.options = typeof optionsOrChain === 'string' ? Services.createDefaultOptions(this.chain) : optionsOrChain;
|
|
28
27
|
this.whatsonchain = new WhatsOnChain_1.WhatsOnChain(this.chain, { apiKey: this.options.whatsOnChainApiKey }, this);
|
|
@@ -59,7 +58,6 @@ class Services {
|
|
|
59
58
|
.add({ name: 'WhatsOnChain', service: this.whatsonchain.getScriptHashHistory.bind(this.whatsonchain) });
|
|
60
59
|
//prettier-ignore
|
|
61
60
|
this.updateFiatExchangeRateServices = new ServiceCollection_1.ServiceCollection('updateFiatExchangeRate')
|
|
62
|
-
.add({ name: 'ChaintracksService', service: exchangeRates_1.updateChaintracksFiatExchangeRates })
|
|
63
61
|
.add({ name: 'exchangeratesapi', service: exchangeRates_1.updateExchangeratesapi });
|
|
64
62
|
}
|
|
65
63
|
getServicesCallHistory(reset) {
|
|
@@ -84,11 +82,40 @@ class Services {
|
|
|
84
82
|
return this.options.bsvExchangeRate.rate;
|
|
85
83
|
}
|
|
86
84
|
async getFiatExchangeRate(currency, base) {
|
|
87
|
-
|
|
88
|
-
this.options.fiatExchangeRates = rates;
|
|
85
|
+
var _a, _b;
|
|
89
86
|
base || (base = 'USD');
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
if (currency === base)
|
|
88
|
+
return 1;
|
|
89
|
+
const required = base === 'USD' ? [currency] : [currency, base];
|
|
90
|
+
await this.updateFiatExchangeRates(required, this.options.fiatUpdateMsecs);
|
|
91
|
+
const rates = this.options.fiatExchangeRates;
|
|
92
|
+
const c = (_a = rates.rates) === null || _a === void 0 ? void 0 : _a[currency];
|
|
93
|
+
const b = (_b = rates.rates) === null || _b === void 0 ? void 0 : _b[base];
|
|
94
|
+
if (typeof c !== 'number') {
|
|
95
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('currency', `valid fiat currency '${currency}' with an exchange rate.`);
|
|
96
|
+
}
|
|
97
|
+
if (typeof b !== 'number') {
|
|
98
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('base', `valid fiat currency '${base}' with an exchange rate.`);
|
|
99
|
+
}
|
|
100
|
+
return c / b;
|
|
101
|
+
}
|
|
102
|
+
async getFiatExchangeRates(targetCurrencies) {
|
|
103
|
+
var _a;
|
|
104
|
+
await this.updateFiatExchangeRates(targetCurrencies, this.options.fiatUpdateMsecs);
|
|
105
|
+
const stored = this.options.fiatExchangeRates;
|
|
106
|
+
const rates = {};
|
|
107
|
+
for (const c of targetCurrencies) {
|
|
108
|
+
const v = (_a = stored.rates) === null || _a === void 0 ? void 0 : _a[c];
|
|
109
|
+
if (typeof v === 'number') {
|
|
110
|
+
rates[c] = v;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
timestamp: stored.timestamp,
|
|
115
|
+
base: 'USD',
|
|
116
|
+
rates,
|
|
117
|
+
rateTimestamps: stored.rateTimestamps
|
|
118
|
+
};
|
|
92
119
|
}
|
|
93
120
|
get getProofsCount() {
|
|
94
121
|
return this.getMerklePathServices.count;
|
|
@@ -413,25 +440,45 @@ class Services {
|
|
|
413
440
|
}
|
|
414
441
|
return r0;
|
|
415
442
|
}
|
|
416
|
-
async updateFiatExchangeRates(
|
|
417
|
-
|
|
443
|
+
async updateFiatExchangeRates(targetCurrencies, updateMsecs) {
|
|
444
|
+
var _a, _b, _c, _d, _e;
|
|
445
|
+
updateMsecs || (updateMsecs = 1000 * 60 * 60 * 24);
|
|
418
446
|
const freshnessDate = new Date(Date.now() - updateMsecs);
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
447
|
+
const stored = this.options.fiatExchangeRates;
|
|
448
|
+
const storedRates = (_a = stored.rates) !== null && _a !== void 0 ? _a : {};
|
|
449
|
+
const toFetch = [];
|
|
450
|
+
for (const c of targetCurrencies) {
|
|
451
|
+
if (c === 'USD') {
|
|
452
|
+
if (typeof storedRates.USD !== 'number') {
|
|
453
|
+
storedRates.USD = 1;
|
|
454
|
+
}
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
const v = storedRates[c];
|
|
458
|
+
const ts = (_c = (_b = stored.rateTimestamps) === null || _b === void 0 ? void 0 : _b[c]) !== null && _c !== void 0 ? _c : stored.timestamp;
|
|
459
|
+
const fresh = typeof v === 'number' && ts instanceof Date && ts > freshnessDate;
|
|
460
|
+
if (!fresh) {
|
|
461
|
+
toFetch.push(c);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
if (toFetch.length === 0) {
|
|
465
|
+
this.options.fiatExchangeRates = {
|
|
466
|
+
timestamp: stored.timestamp,
|
|
467
|
+
base: stored.base,
|
|
468
|
+
rates: storedRates,
|
|
469
|
+
rateTimestamps: stored.rateTimestamps
|
|
470
|
+
};
|
|
471
|
+
return this.options.fiatExchangeRates;
|
|
424
472
|
}
|
|
425
|
-
// Make sure we always start with the first service listed (chaintracks aggregator)
|
|
426
473
|
const services = this.updateFiatExchangeRateServices.clone();
|
|
427
|
-
let
|
|
474
|
+
let fetched;
|
|
428
475
|
for (let tries = 0; tries < services.count; tries++) {
|
|
429
476
|
const stc = services.serviceToCall;
|
|
430
477
|
try {
|
|
431
|
-
const r = await stc.service(
|
|
432
|
-
if (
|
|
478
|
+
const r = await stc.service(toFetch, this.options);
|
|
479
|
+
if (toFetch.every(c => { var _a; return c === 'USD' || typeof ((_a = r.rates) === null || _a === void 0 ? void 0 : _a[c]) === 'number'; })) {
|
|
433
480
|
services.addServiceCallSuccess(stc);
|
|
434
|
-
|
|
481
|
+
fetched = r;
|
|
435
482
|
break;
|
|
436
483
|
}
|
|
437
484
|
else {
|
|
@@ -444,13 +491,29 @@ class Services {
|
|
|
444
491
|
}
|
|
445
492
|
services.next();
|
|
446
493
|
}
|
|
447
|
-
if (!
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
494
|
+
if (!fetched) {
|
|
495
|
+
if (stored && Object.keys(storedRates).length > 0) {
|
|
496
|
+
return stored;
|
|
497
|
+
}
|
|
498
|
+
throw new WERR_errors_1.WERR_INTERNAL();
|
|
499
|
+
}
|
|
500
|
+
const nextRates = { ...storedRates };
|
|
501
|
+
const nextTimestamps = { ...((_d = stored.rateTimestamps) !== null && _d !== void 0 ? _d : {}) };
|
|
502
|
+
for (const c of toFetch) {
|
|
503
|
+
const v = (_e = fetched.rates) === null || _e === void 0 ? void 0 : _e[c];
|
|
504
|
+
if (typeof v === 'number') {
|
|
505
|
+
nextRates[c] = v;
|
|
506
|
+
nextTimestamps[c] = fetched.timestamp;
|
|
507
|
+
}
|
|
452
508
|
}
|
|
453
|
-
|
|
509
|
+
const nextTimestamp = new Date(Math.max(stored.timestamp instanceof Date ? stored.timestamp.getTime() : new Date(stored.timestamp).getTime(), fetched.timestamp.getTime()));
|
|
510
|
+
this.options.fiatExchangeRates = {
|
|
511
|
+
timestamp: nextTimestamp,
|
|
512
|
+
base: stored.base,
|
|
513
|
+
rates: nextRates,
|
|
514
|
+
rateTimestamps: nextTimestamps
|
|
515
|
+
};
|
|
516
|
+
return this.options.fiatExchangeRates;
|
|
454
517
|
}
|
|
455
518
|
async nLockTimeIsFinal(tx) {
|
|
456
519
|
const MAXINT = 0xffffffff;
|