@lifi/perps-sdk 0.0.0-preview-c95cec0 → 0.0.0-preview-e1b82a0
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 +17 -1
- package/dist/cjs/client/PerpsClient.d.ts +9 -8
- package/dist/cjs/client/PerpsClient.d.ts.map +1 -1
- package/dist/cjs/client/PerpsClient.js +23 -19
- package/dist/cjs/client/PerpsClient.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -4
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/api.d.ts +4 -0
- package/dist/cjs/types/api.d.ts.map +1 -1
- package/dist/cjs/types/config.d.ts +0 -1
- package/dist/cjs/types/config.d.ts.map +1 -1
- package/dist/cjs/types/provider.d.ts +5 -1
- package/dist/cjs/types/provider.d.ts.map +1 -1
- package/dist/cjs/types/withdrawal.d.ts +12 -4
- package/dist/cjs/types/withdrawal.d.ts.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/PerpsClient.d.ts +23 -10
- package/dist/esm/client/PerpsClient.d.ts.map +1 -1
- package/dist/esm/client/PerpsClient.js +37 -21
- package/dist/esm/client/PerpsClient.js.map +1 -1
- package/dist/esm/index.d.ts +3 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/api.d.ts +9 -0
- package/dist/esm/types/api.d.ts.map +1 -1
- package/dist/esm/types/config.d.ts +0 -11
- package/dist/esm/types/config.d.ts.map +1 -1
- package/dist/esm/types/provider.d.ts +22 -5
- package/dist/esm/types/provider.d.ts.map +1 -1
- package/dist/esm/types/withdrawal.d.ts +32 -7
- package/dist/esm/types/withdrawal.d.ts.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/client/PerpsClient.d.ts +23 -10
- package/dist/types/client/PerpsClient.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/api.d.ts +9 -0
- package/dist/types/types/api.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +0 -11
- package/dist/types/types/config.d.ts.map +1 -1
- package/dist/types/types/provider.d.ts +22 -5
- package/dist/types/types/provider.d.ts.map +1 -1
- package/dist/types/types/withdrawal.d.ts +32 -7
- package/dist/types/types/withdrawal.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/client/PerpsClient.ts +73 -29
- package/src/index.ts +4 -2
- package/src/types/api.ts +10 -0
- package/src/types/config.ts +0 -11
- package/src/types/provider.ts +31 -5
- package/src/types/withdrawal.ts +35 -8
- package/src/version.ts +1 -1
- package/dist/cjs/decimal/compare.d.ts +0 -3
- package/dist/cjs/decimal/compare.d.ts.map +0 -1
- package/dist/cjs/decimal/compare.js +0 -8
- package/dist/cjs/decimal/compare.js.map +0 -1
- package/dist/esm/decimal/compare.d.ts +0 -11
- package/dist/esm/decimal/compare.d.ts.map +0 -1
- package/dist/esm/decimal/compare.js +0 -13
- package/dist/esm/decimal/compare.js.map +0 -1
- package/dist/types/decimal/compare.d.ts +0 -11
- package/dist/types/decimal/compare.d.ts.map +0 -1
- package/src/decimal/compare.ts +0 -17
|
@@ -60,6 +60,7 @@ import type {
|
|
|
60
60
|
GetPortfolioHistoryParams,
|
|
61
61
|
GetSetupParams,
|
|
62
62
|
GetWithdrawableBalancesParams,
|
|
63
|
+
GetWithdrawalTypesParams,
|
|
63
64
|
GetWithdrawFlowParams,
|
|
64
65
|
ModifyOrdersParams,
|
|
65
66
|
PerpsClientOptions,
|
|
@@ -85,7 +86,11 @@ import type {
|
|
|
85
86
|
SignActionProgress,
|
|
86
87
|
SignActionsContext,
|
|
87
88
|
} from '../types/provider.js'
|
|
88
|
-
import type {
|
|
89
|
+
import type {
|
|
90
|
+
WithdrawableBalance,
|
|
91
|
+
WithdrawalSourceTypes,
|
|
92
|
+
WithdrawFlow,
|
|
93
|
+
} from '../types/withdrawal.js'
|
|
89
94
|
import { isUserFacingSetupStep } from '../utils/setupActions.js'
|
|
90
95
|
import { signTypedDataWithSigner } from '../utils/signTypedData.js'
|
|
91
96
|
import {
|
|
@@ -648,13 +653,16 @@ export class PerpsClient {
|
|
|
648
653
|
* backend account fetch fails.
|
|
649
654
|
* @public
|
|
650
655
|
*/
|
|
651
|
-
async getAccount(
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
656
|
+
async getAccount(
|
|
657
|
+
params: {
|
|
658
|
+
provider: string
|
|
659
|
+
address: Address
|
|
660
|
+
},
|
|
661
|
+
options?: SDKRequestOptions
|
|
662
|
+
): Promise<GetAccountResult> {
|
|
655
663
|
const plugin = this.requireProvider(params.provider)
|
|
656
664
|
const [response, metadata] = await Promise.all([
|
|
657
|
-
fetchAccount(this.sdkClient, params),
|
|
665
|
+
fetchAccount(this.sdkClient, params, options),
|
|
658
666
|
this.getProviderMetadata(params.provider),
|
|
659
667
|
])
|
|
660
668
|
const settings = plugin.projectConfig(response.config, metadata.setup)
|
|
@@ -674,16 +682,19 @@ export class PerpsClient {
|
|
|
674
682
|
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
675
683
|
* @public
|
|
676
684
|
*/
|
|
677
|
-
async getMarketSettings(
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
685
|
+
async getMarketSettings(
|
|
686
|
+
params: {
|
|
687
|
+
provider: string
|
|
688
|
+
address: Address
|
|
689
|
+
market: MarketRef
|
|
690
|
+
},
|
|
691
|
+
options?: SDKRequestOptions
|
|
692
|
+
): Promise<MarketSettings> {
|
|
682
693
|
const plugin = this.requireProvider(params.provider)
|
|
683
|
-
return plugin.getMarketSettings(
|
|
684
|
-
address: params.address,
|
|
685
|
-
|
|
686
|
-
|
|
694
|
+
return plugin.getMarketSettings(
|
|
695
|
+
{ address: params.address, market: params.market },
|
|
696
|
+
options
|
|
697
|
+
)
|
|
687
698
|
}
|
|
688
699
|
|
|
689
700
|
/**
|
|
@@ -787,8 +798,12 @@ export class PerpsClient {
|
|
|
787
798
|
* plugin's existence probe fails.
|
|
788
799
|
* @public
|
|
789
800
|
*/
|
|
790
|
-
async accountExists(
|
|
791
|
-
|
|
801
|
+
async accountExists(
|
|
802
|
+
provider: string,
|
|
803
|
+
address: Address,
|
|
804
|
+
options?: SDKRequestOptions
|
|
805
|
+
): Promise<boolean> {
|
|
806
|
+
return this.requireProvider(provider).accountExists({ address }, options)
|
|
792
807
|
}
|
|
793
808
|
|
|
794
809
|
/**
|
|
@@ -802,10 +817,11 @@ export class PerpsClient {
|
|
|
802
817
|
* @public
|
|
803
818
|
*/
|
|
804
819
|
async getDepositFlow(
|
|
805
|
-
params: GetDepositFlowParams
|
|
820
|
+
params: GetDepositFlowParams,
|
|
821
|
+
options?: SDKRequestOptions
|
|
806
822
|
): Promise<DepositFlow | undefined> {
|
|
807
823
|
const plugin = this.requireProvider(params.provider)
|
|
808
|
-
return plugin.getDepositFlow?.({ address: params.address })
|
|
824
|
+
return plugin.getDepositFlow?.({ address: params.address }, options)
|
|
809
825
|
}
|
|
810
826
|
|
|
811
827
|
/**
|
|
@@ -819,15 +835,17 @@ export class PerpsClient {
|
|
|
819
835
|
* @public
|
|
820
836
|
*/
|
|
821
837
|
async getWithdrawFlow(
|
|
822
|
-
params: GetWithdrawFlowParams
|
|
838
|
+
params: GetWithdrawFlowParams,
|
|
839
|
+
options?: SDKRequestOptions
|
|
823
840
|
): Promise<WithdrawFlow | undefined> {
|
|
824
841
|
const plugin = this.requireProvider(params.provider)
|
|
825
|
-
return plugin.getWithdrawFlow?.({ address: params.address })
|
|
842
|
+
return plugin.getWithdrawFlow?.({ address: params.address }, options)
|
|
826
843
|
}
|
|
827
844
|
|
|
828
845
|
/**
|
|
829
|
-
* The `(asset,
|
|
830
|
-
* `params.provider`. The venue owns how its balances split across
|
|
846
|
+
* The `(asset, category)` selections `params.address` can actually withdraw
|
|
847
|
+
* at `params.provider`. The venue owns how its balances split across
|
|
848
|
+
* categories;
|
|
831
849
|
* this join adds the core `/assets` metadata — precision, L1 identity and
|
|
832
850
|
* the per-asset minimum — and drops every row the minimum rules out, plus
|
|
833
851
|
* any row whose asset the provider's registry does not carry, since without
|
|
@@ -845,12 +863,14 @@ export class PerpsClient {
|
|
|
845
863
|
* @public
|
|
846
864
|
*/
|
|
847
865
|
async getWithdrawableBalances(
|
|
848
|
-
params: GetWithdrawableBalancesParams
|
|
866
|
+
params: GetWithdrawableBalancesParams,
|
|
867
|
+
options?: SDKRequestOptions
|
|
849
868
|
): Promise<WithdrawableBalance[] | undefined> {
|
|
850
869
|
const plugin = this.requireProvider(params.provider)
|
|
851
|
-
const rows = await plugin.getWithdrawableBalances?.(
|
|
852
|
-
address: params.address,
|
|
853
|
-
|
|
870
|
+
const rows = await plugin.getWithdrawableBalances?.(
|
|
871
|
+
{ address: params.address },
|
|
872
|
+
options
|
|
873
|
+
)
|
|
854
874
|
if (rows === undefined) {
|
|
855
875
|
return undefined
|
|
856
876
|
}
|
|
@@ -879,7 +899,12 @@ export class PerpsClient {
|
|
|
879
899
|
}
|
|
880
900
|
if (row.withdrawalFee === undefined) {
|
|
881
901
|
return [
|
|
882
|
-
{
|
|
902
|
+
{
|
|
903
|
+
asset,
|
|
904
|
+
categoryId: row.categoryId,
|
|
905
|
+
available: row.available,
|
|
906
|
+
max: row.max,
|
|
907
|
+
},
|
|
883
908
|
]
|
|
884
909
|
}
|
|
885
910
|
if (!isNonNegativeDecimal(row.withdrawalFee)) {
|
|
@@ -891,7 +916,7 @@ export class PerpsClient {
|
|
|
891
916
|
return [
|
|
892
917
|
{
|
|
893
918
|
asset,
|
|
894
|
-
|
|
919
|
+
categoryId: row.categoryId,
|
|
895
920
|
available: row.available,
|
|
896
921
|
max: row.max,
|
|
897
922
|
withdrawalFee: row.withdrawalFee,
|
|
@@ -903,6 +928,25 @@ export class PerpsClient {
|
|
|
903
928
|
})
|
|
904
929
|
}
|
|
905
930
|
|
|
931
|
+
/**
|
|
932
|
+
* The withdrawal types `params.address` can choose per holding at
|
|
933
|
+
* `params.provider`, each with its cap and the `withdrawalOptions` to pass
|
|
934
|
+
* unchanged in `WithdrawalParams`.
|
|
935
|
+
*
|
|
936
|
+
* @returns `undefined` when the registered plugin declares no withdrawal
|
|
937
|
+
* types read.
|
|
938
|
+
* @throws {PerpsError} When the provider plugin is not registered, or when
|
|
939
|
+
* the plugin read fails.
|
|
940
|
+
* @public
|
|
941
|
+
*/
|
|
942
|
+
async getWithdrawalTypes(
|
|
943
|
+
params: GetWithdrawalTypesParams,
|
|
944
|
+
options?: SDKRequestOptions
|
|
945
|
+
): Promise<WithdrawalSourceTypes[] | undefined> {
|
|
946
|
+
const plugin = this.requireProvider(params.provider)
|
|
947
|
+
return plugin.getWithdrawalTypes?.({ address: params.address }, options)
|
|
948
|
+
}
|
|
949
|
+
|
|
906
950
|
/**
|
|
907
951
|
* The account's portfolio value and cumulative PnL over `params.range` at
|
|
908
952
|
* `params.provider`, read directly from the venue.
|
package/src/index.ts
CHANGED
|
@@ -17,7 +17,6 @@ export {
|
|
|
17
17
|
} from './client/createPerpsClient.js'
|
|
18
18
|
export { PerpsClient } from './client/PerpsClient.js'
|
|
19
19
|
export { requireProvider } from './client/requireProvider.js'
|
|
20
|
-
export { isDecimalStringGreaterThan } from './decimal/compare.js'
|
|
21
20
|
export type { BaseUnitsRounding } from './decimal/convert.js'
|
|
22
21
|
export {
|
|
23
22
|
baseUnitsToDecimal,
|
|
@@ -173,6 +172,7 @@ export type {
|
|
|
173
172
|
GetPortfolioHistoryParams,
|
|
174
173
|
GetSetupParams,
|
|
175
174
|
GetWithdrawableBalancesParams,
|
|
175
|
+
GetWithdrawalTypesParams,
|
|
176
176
|
GetWithdrawFlowParams,
|
|
177
177
|
ModifyOrdersParams,
|
|
178
178
|
PerpsClientOptions,
|
|
@@ -219,6 +219,7 @@ export type {
|
|
|
219
219
|
ProviderGetPositionsParams,
|
|
220
220
|
ProviderGetQuoteParams,
|
|
221
221
|
ProviderGetWithdrawableBalancesParams,
|
|
222
|
+
ProviderGetWithdrawalTypesParams,
|
|
222
223
|
ProviderGetWithdrawFlowParams,
|
|
223
224
|
QuoteListener,
|
|
224
225
|
SignActionProgress,
|
|
@@ -227,7 +228,8 @@ export type {
|
|
|
227
228
|
export type {
|
|
228
229
|
ProviderWithdrawableBalance,
|
|
229
230
|
WithdrawableBalance,
|
|
230
|
-
|
|
231
|
+
WithdrawalSourceTypes,
|
|
232
|
+
WithdrawalTypeOption,
|
|
231
233
|
WithdrawFlow,
|
|
232
234
|
WithdrawFlowReady,
|
|
233
235
|
WithdrawFlowSetupRequired,
|
package/src/types/api.ts
CHANGED
|
@@ -293,6 +293,16 @@ export interface GetWithdrawableBalancesParams {
|
|
|
293
293
|
address: Address
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Parameters for {@link PerpsClient.getWithdrawalTypes}.
|
|
298
|
+
*
|
|
299
|
+
* @public
|
|
300
|
+
*/
|
|
301
|
+
export interface GetWithdrawalTypesParams {
|
|
302
|
+
provider: string
|
|
303
|
+
address: Address
|
|
304
|
+
}
|
|
305
|
+
|
|
296
306
|
/**
|
|
297
307
|
* Parameters for {@link PerpsClient.getPortfolioHistory}.
|
|
298
308
|
*
|
package/src/types/config.ts
CHANGED
|
@@ -41,17 +41,6 @@ export type RequestInterceptor = (
|
|
|
41
41
|
export interface SDKRequestOptions {
|
|
42
42
|
/** Abort the request and any pending backoff delay. */
|
|
43
43
|
signal?: AbortSignal
|
|
44
|
-
/**
|
|
45
|
-
* Lighter auth token consumed by provider-direct venue reads (getOrders,
|
|
46
|
-
* getOrder, getActivity, getAccount). Create via
|
|
47
|
-
* `lighterSigner.createAuthToken(deadline, context)`. Sent only to Lighter
|
|
48
|
-
* venue endpoints, never to the LI.FI backend — read-only by design
|
|
49
|
-
* (8h max TTL, cannot authorize writes). Each call routes to a single Lighter
|
|
50
|
-
* instance via `params.provider`, so this token scopes to that instance's
|
|
51
|
-
* venue; token caches are held per `lighterProvider()` instance and do not
|
|
52
|
-
* cross between instances.
|
|
53
|
-
*/
|
|
54
|
-
lighterAuthToken?: string
|
|
55
44
|
}
|
|
56
45
|
|
|
57
46
|
/**
|
package/src/types/provider.ts
CHANGED
|
@@ -37,7 +37,11 @@ import type {
|
|
|
37
37
|
SDKRequestOptions,
|
|
38
38
|
} from './config.js'
|
|
39
39
|
import type { DepositFlow } from './deposit.js'
|
|
40
|
-
import type {
|
|
40
|
+
import type {
|
|
41
|
+
ProviderWithdrawableBalance,
|
|
42
|
+
WithdrawalSourceTypes,
|
|
43
|
+
WithdrawFlow,
|
|
44
|
+
} from './withdrawal.js'
|
|
41
45
|
|
|
42
46
|
/**
|
|
43
47
|
* Low-level SDK client: resolved config, the optional end-user wallet, and the
|
|
@@ -199,6 +203,15 @@ export interface ProviderGetWithdrawableBalancesParams {
|
|
|
199
203
|
address: Address
|
|
200
204
|
}
|
|
201
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Read params for {@link PerpsProviderPlugin.getWithdrawalTypes}.
|
|
208
|
+
*
|
|
209
|
+
* @public
|
|
210
|
+
*/
|
|
211
|
+
export interface ProviderGetWithdrawalTypesParams {
|
|
212
|
+
address: Address
|
|
213
|
+
}
|
|
214
|
+
|
|
202
215
|
/**
|
|
203
216
|
* Read params for {@link PerpsProvider.getPositions}.
|
|
204
217
|
*
|
|
@@ -434,20 +447,33 @@ export interface PerpsProviderPlugin {
|
|
|
434
447
|
): Promise<WithdrawFlow>
|
|
435
448
|
|
|
436
449
|
/**
|
|
437
|
-
* The `(asset,
|
|
450
|
+
* The `(asset, category)` pairs `params.address` currently has something to
|
|
438
451
|
* withdraw from, keyed by provider-native asset id. Only the venue knows how
|
|
439
|
-
* its balance payload splits across
|
|
452
|
+
* its balance payload splits across categories, so the split is owned here; the
|
|
440
453
|
* per-asset venue minimum is applied by `PerpsClient.getWithdrawableBalances`,
|
|
441
454
|
* which holds the core asset registry.
|
|
442
455
|
*
|
|
443
|
-
* Optional: a provider whose withdrawals are not a per-
|
|
444
|
-
* it, and `PerpsClient.getWithdrawableBalances` then resolves
|
|
456
|
+
* Optional: a provider whose withdrawals are not a per-category selection
|
|
457
|
+
* omits it, and `PerpsClient.getWithdrawableBalances` then resolves
|
|
458
|
+
* `undefined`.
|
|
445
459
|
*/
|
|
446
460
|
getWithdrawableBalances?(
|
|
447
461
|
params: ProviderGetWithdrawableBalancesParams,
|
|
448
462
|
options?: SDKRequestOptions
|
|
449
463
|
): Promise<ProviderWithdrawableBalance[]>
|
|
450
464
|
|
|
465
|
+
/**
|
|
466
|
+
* The withdrawal types `params.address` can choose per withdrawable holding,
|
|
467
|
+
* each with its cap and the `withdrawalOptions` to send with it.
|
|
468
|
+
*
|
|
469
|
+
* Optional: a provider with one withdrawal type omits it, and
|
|
470
|
+
* `PerpsClient.getWithdrawalTypes` then resolves `undefined`.
|
|
471
|
+
*/
|
|
472
|
+
getWithdrawalTypes?(
|
|
473
|
+
params: ProviderGetWithdrawalTypesParams,
|
|
474
|
+
options?: SDKRequestOptions
|
|
475
|
+
): Promise<WithdrawalSourceTypes[]>
|
|
476
|
+
|
|
451
477
|
getPositions(
|
|
452
478
|
params: ProviderGetPositionsParams,
|
|
453
479
|
options?: SDKRequestOptions
|
package/src/types/withdrawal.ts
CHANGED
|
@@ -2,22 +2,22 @@ import type {
|
|
|
2
2
|
ActionType,
|
|
3
3
|
Asset,
|
|
4
4
|
DecimalString,
|
|
5
|
-
|
|
5
|
+
WithdrawalAssetRef,
|
|
6
|
+
WithdrawalType,
|
|
6
7
|
} from '@lifi/perps-types'
|
|
7
8
|
import type { Address } from 'viem'
|
|
8
9
|
|
|
9
|
-
export type { WithdrawalRoute }
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
|
-
* One withdrawable `(asset,
|
|
13
|
-
* by provider-native asset id and awaiting the core asset-metadata join.
|
|
11
|
+
* One withdrawable `(asset, category)` selection as the provider reports it,
|
|
12
|
+
* keyed by provider-native asset id and awaiting the core asset-metadata join.
|
|
14
13
|
*
|
|
15
14
|
* @public
|
|
16
15
|
*/
|
|
17
16
|
export interface ProviderWithdrawableBalance {
|
|
18
17
|
/** Provider-native `Asset.id`; never a display symbol. */
|
|
19
18
|
assetId: string
|
|
20
|
-
|
|
19
|
+
/** The provider category the row draws from; the same value as `Balance.categoryId`. */
|
|
20
|
+
categoryId: string
|
|
21
21
|
/** Withdrawable amount in the asset's own units. Always greater than zero. */
|
|
22
22
|
available: DecimalString
|
|
23
23
|
/**
|
|
@@ -41,7 +41,7 @@ export interface ProviderWithdrawableBalance {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* One withdrawable `(asset,
|
|
44
|
+
* One withdrawable `(asset, category)` selection a caller can act on: the amount
|
|
45
45
|
* clears the asset's venue minimum, and `asset` carries the precision and
|
|
46
46
|
* minimum needed to scale and validate the withdrawal.
|
|
47
47
|
*
|
|
@@ -49,7 +49,8 @@ export interface ProviderWithdrawableBalance {
|
|
|
49
49
|
*/
|
|
50
50
|
export interface WithdrawableBalance {
|
|
51
51
|
asset: Asset
|
|
52
|
-
|
|
52
|
+
/** The provider category the row draws from; the same value as `Balance.categoryId`. */
|
|
53
|
+
categoryId: string
|
|
53
54
|
/** Withdrawable amount in the asset's own units. */
|
|
54
55
|
available: DecimalString
|
|
55
56
|
/**
|
|
@@ -77,6 +78,32 @@ export interface WithdrawableBalance {
|
|
|
77
78
|
isFeeDeducted?: boolean
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
/**
|
|
82
|
+
* One way a venue can settle a withdrawal from a holding.
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export interface WithdrawalTypeOption {
|
|
87
|
+
type: WithdrawalType
|
|
88
|
+
/** Largest `amount` this type accepts from the holding, in the asset's own units. */
|
|
89
|
+
max: DecimalString
|
|
90
|
+
/**
|
|
91
|
+
* Provider-specific options to pass unchanged as
|
|
92
|
+
* `WithdrawalParams.withdrawalOptions` when the user picks this type.
|
|
93
|
+
*/
|
|
94
|
+
withdrawalOptions: Record<string, unknown>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The withdrawal types a venue offers for one holding.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export interface WithdrawalSourceTypes {
|
|
103
|
+
source: WithdrawalAssetRef
|
|
104
|
+
options: WithdrawalTypeOption[]
|
|
105
|
+
}
|
|
106
|
+
|
|
80
107
|
/**
|
|
81
108
|
* The venue accepts a withdrawal to `destination` now.
|
|
82
109
|
*
|
package/src/version.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../src/decimal/compare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAWtD,wBAAgB,0BAA0B,CACxC,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,GACf,OAAO,CAET"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDecimalStringGreaterThan = isDecimalStringGreaterThan;
|
|
4
|
-
const requireDecimal_js_1 = require("./requireDecimal.js");
|
|
5
|
-
function isDecimalStringGreaterThan(a, b) {
|
|
6
|
-
return (0, requireDecimal_js_1.requireDecimal)(a, 'a').gt((0, requireDecimal_js_1.requireDecimal)(b, 'b'));
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=compare.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../src/decimal/compare.ts"],"names":[],"mappings":";;AAWA,gEAKC;AAfD,2DAAoD;AAUpD,SAAgB,0BAA0B,CACxC,CAAgB,EAChB,CAAgB;IAEhB,OAAO,IAAA,kCAAc,EAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,IAAA,kCAAc,EAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1D,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DecimalString } from '@lifi/perps-types';
|
|
2
|
-
/**
|
|
3
|
-
* Exact `a > b` on two {@link DecimalString}s, with no float rounding, so a
|
|
4
|
-
* funds gate can tell `'1.0000000000000001'` from `'1'`. The other relations
|
|
5
|
-
* follow from it: `a <= b` is `!isDecimalStringGreaterThan(a, b)`.
|
|
6
|
-
*
|
|
7
|
-
* @throws {PerpsError} `ValidationError` when either operand is not a decimal string.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare function isDecimalStringGreaterThan(a: DecimalString, b: DecimalString): boolean;
|
|
11
|
-
//# sourceMappingURL=compare.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../src/decimal/compare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGtD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,GACf,OAAO,CAET"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { requireDecimal } from './requireDecimal.js';
|
|
2
|
-
/**
|
|
3
|
-
* Exact `a > b` on two {@link DecimalString}s, with no float rounding, so a
|
|
4
|
-
* funds gate can tell `'1.0000000000000001'` from `'1'`. The other relations
|
|
5
|
-
* follow from it: `a <= b` is `!isDecimalStringGreaterThan(a, b)`.
|
|
6
|
-
*
|
|
7
|
-
* @throws {PerpsError} `ValidationError` when either operand is not a decimal string.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export function isDecimalStringGreaterThan(a, b) {
|
|
11
|
-
return requireDecimal(a, 'a').gt(requireDecimal(b, 'b'));
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=compare.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../src/decimal/compare.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CACxC,CAAgB,EAChB,CAAgB;IAEhB,OAAO,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1D,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DecimalString } from '@lifi/perps-types';
|
|
2
|
-
/**
|
|
3
|
-
* Exact `a > b` on two {@link DecimalString}s, with no float rounding, so a
|
|
4
|
-
* funds gate can tell `'1.0000000000000001'` from `'1'`. The other relations
|
|
5
|
-
* follow from it: `a <= b` is `!isDecimalStringGreaterThan(a, b)`.
|
|
6
|
-
*
|
|
7
|
-
* @throws {PerpsError} `ValidationError` when either operand is not a decimal string.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare function isDecimalStringGreaterThan(a: DecimalString, b: DecimalString): boolean;
|
|
11
|
-
//# sourceMappingURL=compare.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../src/decimal/compare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGtD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,GACf,OAAO,CAET"}
|
package/src/decimal/compare.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { DecimalString } from '@lifi/perps-types'
|
|
2
|
-
import { requireDecimal } from './requireDecimal.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Exact `a > b` on two {@link DecimalString}s, with no float rounding, so a
|
|
6
|
-
* funds gate can tell `'1.0000000000000001'` from `'1'`. The other relations
|
|
7
|
-
* follow from it: `a <= b` is `!isDecimalStringGreaterThan(a, b)`.
|
|
8
|
-
*
|
|
9
|
-
* @throws {PerpsError} `ValidationError` when either operand is not a decimal string.
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export function isDecimalStringGreaterThan(
|
|
13
|
-
a: DecimalString,
|
|
14
|
-
b: DecimalString
|
|
15
|
-
): boolean {
|
|
16
|
-
return requireDecimal(a, 'a').gt(requireDecimal(b, 'b'))
|
|
17
|
-
}
|