@lifi/perps-types 16.1.0 → 17.0.0
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/dist/cjs/account.d.ts.map +1 -1
- package/dist/cjs/action.d.ts +8 -0
- package/dist/cjs/action.d.ts.map +1 -1
- package/dist/cjs/enums.d.ts +8 -0
- package/dist/cjs/enums.d.ts.map +1 -1
- package/dist/cjs/enums.js +10 -1
- package/dist/cjs/enums.js.map +1 -1
- package/dist/cjs/providers.d.ts +17 -4
- package/dist/cjs/providers.d.ts.map +1 -1
- package/dist/esm/account.d.ts +4 -1
- package/dist/esm/account.d.ts.map +1 -1
- package/dist/esm/action.d.ts +19 -0
- package/dist/esm/action.d.ts.map +1 -1
- package/dist/esm/enums.d.ts +21 -1
- package/dist/esm/enums.d.ts.map +1 -1
- package/dist/esm/enums.js +22 -1
- package/dist/esm/enums.js.map +1 -1
- package/dist/esm/providers.d.ts +50 -8
- package/dist/esm/providers.d.ts.map +1 -1
- package/dist/types/account.d.ts +4 -1
- package/dist/types/account.d.ts.map +1 -1
- package/dist/types/action.d.ts +19 -0
- package/dist/types/action.d.ts.map +1 -1
- package/dist/types/enums.d.ts +21 -1
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/providers.d.ts +50 -8
- package/dist/types/providers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/account.ts +4 -1
- package/src/action.ts +20 -0
- package/src/enums.ts +22 -1
- package/src/providers.ts +57 -8
package/src/providers.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import type { ActionParamsMap } from './action.js'
|
|
1
2
|
import type { Asset } from './asset.js'
|
|
2
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
ActionRelay,
|
|
5
|
+
ActionType,
|
|
6
|
+
PerpsSigner,
|
|
7
|
+
SigningMethod,
|
|
8
|
+
} from './enums.js'
|
|
3
9
|
import type { OhlcvInterval } from './market.js'
|
|
4
10
|
|
|
5
11
|
/** A fixed option value presented for a provider action parameter. @public */
|
|
@@ -30,19 +36,20 @@ export interface Param {
|
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
/**
|
|
33
|
-
* A single provider action. The same shape backs `Provider.setup
|
|
34
|
-
* `Provider.
|
|
35
|
-
*
|
|
39
|
+
* A single provider action. The same shape backs `Provider.setup` and
|
|
40
|
+
* `Provider.actions` — categorisation lives in which array it sits in, not in
|
|
41
|
+
* the type. `type`, `signer`, `signingMethod` and `relay` are always present;
|
|
36
42
|
* the rest are presentation/ordering hints provided per-action in the
|
|
37
43
|
* provider's hardcoded metadata.
|
|
38
44
|
* @public
|
|
39
45
|
*/
|
|
40
46
|
export interface ProviderAction {
|
|
41
47
|
type: ActionType
|
|
42
|
-
|
|
48
|
+
signer: PerpsSigner
|
|
43
49
|
signingMethod: SigningMethod
|
|
50
|
+
relay: ActionRelay
|
|
44
51
|
/**
|
|
45
|
-
* Human label. Drives the card heading in the setup
|
|
52
|
+
* Human label. Drives the card heading in the setup modal, and may
|
|
46
53
|
* also front an in-flight trading action ("{title} is working…").
|
|
47
54
|
*/
|
|
48
55
|
title?: string
|
|
@@ -64,6 +71,49 @@ export interface ProviderAction {
|
|
|
64
71
|
* nothing, so a consumer tests `=== true` rather than truthiness.
|
|
65
72
|
*/
|
|
66
73
|
gatesAccountReads?: boolean
|
|
74
|
+
/**
|
|
75
|
+
* A link to the venue's own documentation for this action, which a UI can
|
|
76
|
+
* show as a "Documentation" link.
|
|
77
|
+
*/
|
|
78
|
+
docsUrl?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* One selectable value of a choice setup step, bound to the action that
|
|
83
|
+
* applies it.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export interface SetupOption<T extends ActionType = ActionType> {
|
|
88
|
+
/** Display title, e.g. `'Plus'`. */
|
|
89
|
+
title: string
|
|
90
|
+
/**
|
|
91
|
+
* Option-specific prose a UI shows beside the option in its selector.
|
|
92
|
+
* `SetupAction.description` stays the general prose for the whole choice.
|
|
93
|
+
*/
|
|
94
|
+
description?: string
|
|
95
|
+
/** The action executed when the option is chosen. */
|
|
96
|
+
type: T
|
|
97
|
+
/** The action's sole param, bound, e.g. `{ tier: 'plus' }`. */
|
|
98
|
+
params: ActionParamsMap[T]
|
|
99
|
+
/**
|
|
100
|
+
* The recommended option a UI pre-selects. The SDK never executes it on its
|
|
101
|
+
* own; at most one option per step marks it.
|
|
102
|
+
*/
|
|
103
|
+
default?: true
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* One `Provider.setup` step. A choice step (`options !== null`) declares no
|
|
108
|
+
* `params`: each option carries its own bound params.
|
|
109
|
+
*
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
export interface SetupAction extends ProviderAction {
|
|
113
|
+
/** `null` when the step is not a choice. */
|
|
114
|
+
options: SetupOption[] | null
|
|
115
|
+
/** A `Provider.actions` entry that undoes the satisfied step, or `null`. */
|
|
116
|
+
revoke: ActionType | null
|
|
67
117
|
}
|
|
68
118
|
|
|
69
119
|
/**
|
|
@@ -118,8 +168,7 @@ export interface Provider {
|
|
|
118
168
|
signingMethod: SigningMethod
|
|
119
169
|
/** When false, the provider is announced but not yet selectable in clients. */
|
|
120
170
|
active: boolean
|
|
121
|
-
setup:
|
|
122
|
-
options: ProviderAction[]
|
|
171
|
+
setup: SetupAction[]
|
|
123
172
|
actions: ProviderAction[]
|
|
124
173
|
categories: ProviderCategory[]
|
|
125
174
|
wsUrl?: string
|