@lifi/perps-types 0.0.0-preview-e6f120b → 0.0.0-preview-e5e25c8

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.
Files changed (57) hide show
  1. package/dist/cjs/account.d.ts +2 -0
  2. package/dist/cjs/account.d.ts.map +1 -1
  3. package/dist/cjs/action.d.ts +6 -3
  4. package/dist/cjs/action.d.ts.map +1 -1
  5. package/dist/cjs/enums.d.ts +2 -2
  6. package/dist/cjs/enums.d.ts.map +1 -1
  7. package/dist/cjs/enums.js +2 -2
  8. package/dist/cjs/enums.js.map +1 -1
  9. package/dist/cjs/index.d.ts +0 -1
  10. package/dist/cjs/index.d.ts.map +1 -1
  11. package/dist/cjs/index.js +0 -1
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/metaProvider.d.ts +0 -2
  14. package/dist/cjs/metaProvider.d.ts.map +1 -1
  15. package/dist/cjs/metaProvider.js.map +1 -1
  16. package/dist/esm/account.d.ts +10 -0
  17. package/dist/esm/account.d.ts.map +1 -1
  18. package/dist/esm/action.d.ts +14 -3
  19. package/dist/esm/action.d.ts.map +1 -1
  20. package/dist/esm/enums.d.ts +4 -4
  21. package/dist/esm/enums.d.ts.map +1 -1
  22. package/dist/esm/enums.js +4 -4
  23. package/dist/esm/enums.js.map +1 -1
  24. package/dist/esm/index.d.ts +0 -1
  25. package/dist/esm/index.d.ts.map +1 -1
  26. package/dist/esm/index.js +0 -1
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/metaProvider.d.ts +0 -8
  29. package/dist/esm/metaProvider.d.ts.map +1 -1
  30. package/dist/esm/metaProvider.js.map +1 -1
  31. package/dist/types/account.d.ts +10 -0
  32. package/dist/types/account.d.ts.map +1 -1
  33. package/dist/types/action.d.ts +14 -3
  34. package/dist/types/action.d.ts.map +1 -1
  35. package/dist/types/enums.d.ts +4 -4
  36. package/dist/types/enums.d.ts.map +1 -1
  37. package/dist/types/index.d.ts +0 -1
  38. package/dist/types/index.d.ts.map +1 -1
  39. package/dist/types/metaProvider.d.ts +0 -8
  40. package/dist/types/metaProvider.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/account.ts +10 -0
  43. package/src/action.ts +15 -3
  44. package/src/enums.ts +4 -4
  45. package/src/index.ts +0 -1
  46. package/src/metaProvider.ts +0 -13
  47. package/dist/cjs/referral.d.ts +0 -93
  48. package/dist/cjs/referral.d.ts.map +0 -1
  49. package/dist/cjs/referral.js +0 -28
  50. package/dist/cjs/referral.js.map +0 -1
  51. package/dist/esm/referral.d.ts +0 -237
  52. package/dist/esm/referral.d.ts.map +0 -1
  53. package/dist/esm/referral.js +0 -46
  54. package/dist/esm/referral.js.map +0 -1
  55. package/dist/types/referral.d.ts +0 -237
  56. package/dist/types/referral.d.ts.map +0 -1
  57. package/src/referral.ts +0 -266
@@ -1,237 +0,0 @@
1
- import type { Pagination } from './account.js';
2
- import type { Address } from './primitives.js';
3
- import type { PerpsTypedData, TypedDataParameter } from './typedData.js';
4
- /**
5
- * Reason the backend will not attach a candidate internal referral code to an
6
- * address. The backend decides; the SDK relays the verdict.
7
- * @public
8
- */
9
- export declare enum ReferralCodeRejection {
10
- /** The candidate does not match the accepted code format. */
11
- MALFORMED = "MALFORMED",
12
- /** No internal referral code matches the candidate. */
13
- NOT_FOUND = "NOT_FOUND",
14
- /** The code exists but the backend has disabled it. */
15
- INACTIVE = "INACTIVE",
16
- /** The candidate is the queried address's own code. */
17
- SELF_REFERRAL = "SELF_REFERRAL",
18
- /** The address already has an attached code; attachment is first-touch. */
19
- ALREADY_ATTACHED = "ALREADY_ATTACHED",
20
- /** The address no longer meets the backend's conditions for attachment. */
21
- NOT_ELIGIBLE = "NOT_ELIGIBLE"
22
- }
23
- /**
24
- * Backend verdict for a candidate internal referral code.
25
- * @public
26
- */
27
- export interface ReferralCodeValidation {
28
- /** The candidate exactly as submitted. */
29
- code: string;
30
- valid: boolean;
31
- /** Backend-normalized form of `code`; absent when `valid` is false. */
32
- normalizedCode?: string;
33
- /** Present only when `valid` is false. */
34
- rejection?: ReferralCodeRejection;
35
- }
36
- /**
37
- * The internal referral code attached to an address. Attachment is first-touch:
38
- * once the backend records it, it does not change.
39
- * @public
40
- */
41
- export interface AttachedReferralCode {
42
- /** Normalized code this address is attached to. */
43
- code: string;
44
- /** Unix epoch milliseconds the attachment was recorded. */
45
- attachedAt: number;
46
- }
47
- /**
48
- * The shareable internal referral code an address owns.
49
- * @public
50
- */
51
- export interface OwnedReferralCode {
52
- code: string;
53
- /** Unix epoch milliseconds the code was created. */
54
- createdAt: number;
55
- /** Number of addresses attached to this code. */
56
- attachedCount: number;
57
- }
58
- /**
59
- * Whether an address may create an owned internal referral code. The backend
60
- * owns both the threshold and the decision.
61
- * @public
62
- */
63
- export interface OwnedReferralCodeEligibility {
64
- eligible: boolean;
65
- /**
66
- * Executed notional the address must reach, as a decimal string in the
67
- * backend's reporting currency. Absent when the backend does not disclose it.
68
- */
69
- requiredNotional?: string;
70
- /** The address's executed notional so far, in the same units as `requiredNotional`. */
71
- currentNotional?: string;
72
- }
73
- /**
74
- * What the one pending onboarding signature would commit for an address. A
75
- * present field is carried by the step; an absent field is not part of it.
76
- * @public
77
- */
78
- export interface OnboardingRequirement {
79
- /** Terms version the step accepts; absent when the address already accepted the current version. */
80
- termsVersion?: string;
81
- /** Normalized code the step attaches; absent when the step attaches none. */
82
- referralCode?: string;
83
- }
84
- /**
85
- * Address-scoped onboarding and internal-referral state, served by
86
- * `GET /v1/perps/meta/referral?address=`.
87
- *
88
- * An address the backend holds no record for still resolves to a well-formed
89
- * payload: `termsAccepted` is `false` and every optional state field is absent.
90
- * @public
91
- */
92
- export interface ReferralStatus {
93
- address: Address;
94
- /** Backend-owned version identifier for the current terms. */
95
- termsVersion: string;
96
- termsAccepted: boolean;
97
- attachedCode?: AttachedReferralCode;
98
- ownedCode?: OwnedReferralCode;
99
- ownedCodeEligibility: OwnedReferralCodeEligibility;
100
- /** Verdict for the request's candidate code; absent when the request passed none. */
101
- candidate?: ReferralCodeValidation;
102
- /**
103
- * The one onboarding step to sign next; absent when the backend requires no
104
- * consent from this address.
105
- */
106
- onboarding?: OnboardingRequirement;
107
- }
108
- /**
109
- * One address attached to the queried address's owned internal referral code.
110
- * @public
111
- */
112
- export interface ReferralActivityItem {
113
- address: Address;
114
- /** Unix epoch milliseconds the attachment was recorded. */
115
- attachedAt: number;
116
- /**
117
- * Executed notional recorded against this attachment, as a decimal string in
118
- * the backend's reporting currency.
119
- */
120
- notional: string;
121
- }
122
- /**
123
- * Paginated attachment records for an address's owned internal referral code,
124
- * served by `GET /v1/perps/meta/referral/activity?address=`.
125
- *
126
- * An address that owns no code resolves to `items: []` with `hasMore: false`
127
- * and no cursor.
128
- * @public
129
- */
130
- export interface ReferralActivityResponse {
131
- items: ReferralActivityItem[];
132
- pagination: Pagination;
133
- }
134
- /**
135
- * Params for an {@link "./enums.js".ActionType.META_ONBOARD} action: the terms
136
- * version to accept and the candidate internal referral code to attach.
137
- *
138
- * Both fields are requests, not commitments. The backend decides what the step
139
- * it returns actually carries, and returns no step when it needs no consent.
140
- *
141
- * Provider-independent: sent with the {@link "./metaProvider.js".META_PROVIDER}
142
- * sentinel in the transport `provider` field.
143
- * @public
144
- */
145
- export interface OnboardParams {
146
- /** Terms-of-Service version being accepted; backend-owned, relayed verbatim. */
147
- termsVersion?: string;
148
- /** Candidate code as the client captured it; the backend normalizes it. */
149
- referralCode?: string;
150
- }
151
- /**
152
- * EIP-712 message body for an `Onboard`. Field order matches
153
- * {@link onboardTypeFields}.
154
- *
155
- * Every mutable field is bound into the digest, so a term the signature does
156
- * not commit is carried as the empty string rather than dropped.
157
- * @public
158
- */
159
- export interface OnboardMessage {
160
- /** Human-readable action, e.g. `"Accept LI.FI Perps Terms of Service v3"`. */
161
- action: string;
162
- account: Address;
163
- /** Terms version accepted, or `''` when the signature accepts no terms. */
164
- termsVersion: string;
165
- /** Normalized code attached, or `''` when the signature attaches none. */
166
- referralCode: string;
167
- /** Replay-protection nonce as a decimal string (uint256). */
168
- nonce: string;
169
- /** Unix timestamp in milliseconds after which the signature is stale. */
170
- deadline: number;
171
- }
172
- /**
173
- * EIP-712 type member list for the `Onboard` primary type. Field order is part
174
- * of the signed digest and must match the backend's encoder.
175
- * @public
176
- */
177
- export declare const onboardTypeFields: readonly TypedDataParameter[];
178
- /**
179
- * EIP-712 typed data for a composite onboarding consent, as returned by
180
- * `createAction` and signed client-side. `primaryType` is always `'Onboard'`.
181
- * @public
182
- */
183
- export interface OnboardTypedData extends PerpsTypedData {
184
- primaryType: 'Onboard';
185
- types: {
186
- Onboard: readonly TypedDataParameter[];
187
- } & PerpsTypedData['types'];
188
- message: OnboardMessage;
189
- }
190
- /**
191
- * Params for an
192
- * {@link "./enums.js".ActionType.META_CREATE_REFERRAL_CODE} action.
193
- *
194
- * Provider-independent: sent with the {@link "./metaProvider.js".META_PROVIDER}
195
- * sentinel in the transport `provider` field.
196
- * @public
197
- */
198
- export interface CreateReferralCodeParams {
199
- /** Desired code; omit to let the backend generate one. */
200
- code?: string;
201
- }
202
- /**
203
- * EIP-712 message body for a `CreateReferralCode`. Field order matches
204
- * {@link createReferralCodeTypeFields}.
205
- * @public
206
- */
207
- export interface CreateReferralCodeMessage {
208
- /** Human-readable action, e.g. `"Create LI.FI Perps referral code ABC123"`. */
209
- action: string;
210
- account: Address;
211
- /** Normalized code the signature reserves. */
212
- code: string;
213
- /** Replay-protection nonce as a decimal string (uint256). */
214
- nonce: string;
215
- /** Unix timestamp in milliseconds after which the signature is stale. */
216
- deadline: number;
217
- }
218
- /**
219
- * EIP-712 type member list for the `CreateReferralCode` primary type. Field
220
- * order is part of the signed digest and must match the backend's encoder.
221
- * @public
222
- */
223
- export declare const createReferralCodeTypeFields: readonly TypedDataParameter[];
224
- /**
225
- * EIP-712 typed data for reserving an owned internal referral code, as
226
- * returned by `createAction` and signed client-side. `primaryType` is always
227
- * `'CreateReferralCode'`.
228
- * @public
229
- */
230
- export interface CreateReferralCodeTypedData extends PerpsTypedData {
231
- primaryType: 'CreateReferralCode';
232
- types: {
233
- CreateReferralCode: readonly TypedDataParameter[];
234
- } & PerpsTypedData['types'];
235
- message: CreateReferralCodeMessage;
236
- }
237
- //# sourceMappingURL=referral.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"referral.d.ts","sourceRoot":"","sources":["../../src/referral.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExE;;;;GAIG;AACH,oBAAY,qBAAqB;IAC/B,6DAA6D;IAC7D,SAAS,cAAc;IACvB,uDAAuD;IACvD,SAAS,cAAc;IACvB,uDAAuD;IACvD,QAAQ,aAAa;IACrB,uDAAuD;IACvD,aAAa,kBAAkB;IAC/B,2EAA2E;IAC3E,gBAAgB,qBAAqB;IACrC,2EAA2E;IAC3E,YAAY,iBAAiB;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,OAAO,CAAA;IACd,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,qBAAqB,CAAA;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH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AAA;IAChB,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAA;IACpB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAA;IACpB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,kBAAkB,EAO1D,CAAA;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,WAAW,EAAE,SAAS,CAAA;IACtB,KAAK,EAAE;QACL,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAA;KACvC,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAC3B,OAAO,EAAE,cAAc,CAAA;CACxB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,SAAS,kBAAkB,EAMrE,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IACjE,WAAW,EAAE,oBAAoB,CAAA;IACjC,KAAK,EAAE;QACL,kBAAkB,EAAE,SAAS,kBAAkB,EAAE,CAAA;KAClD,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAC3B,OAAO,EAAE,yBAAyB,CAAA;CACnC"}
@@ -1,46 +0,0 @@
1
- /**
2
- * Reason the backend will not attach a candidate internal referral code to an
3
- * address. The backend decides; the SDK relays the verdict.
4
- * @public
5
- */
6
- export var ReferralCodeRejection;
7
- (function (ReferralCodeRejection) {
8
- /** The candidate does not match the accepted code format. */
9
- ReferralCodeRejection["MALFORMED"] = "MALFORMED";
10
- /** No internal referral code matches the candidate. */
11
- ReferralCodeRejection["NOT_FOUND"] = "NOT_FOUND";
12
- /** The code exists but the backend has disabled it. */
13
- ReferralCodeRejection["INACTIVE"] = "INACTIVE";
14
- /** The candidate is the queried address's own code. */
15
- ReferralCodeRejection["SELF_REFERRAL"] = "SELF_REFERRAL";
16
- /** The address already has an attached code; attachment is first-touch. */
17
- ReferralCodeRejection["ALREADY_ATTACHED"] = "ALREADY_ATTACHED";
18
- /** The address no longer meets the backend's conditions for attachment. */
19
- ReferralCodeRejection["NOT_ELIGIBLE"] = "NOT_ELIGIBLE";
20
- })(ReferralCodeRejection || (ReferralCodeRejection = {}));
21
- /**
22
- * EIP-712 type member list for the `Onboard` primary type. Field order is part
23
- * of the signed digest and must match the backend's encoder.
24
- * @public
25
- */
26
- export const onboardTypeFields = [
27
- { name: 'action', type: 'string' },
28
- { name: 'account', type: 'address' },
29
- { name: 'termsVersion', type: 'string' },
30
- { name: 'referralCode', type: 'string' },
31
- { name: 'nonce', type: 'uint256' },
32
- { name: 'deadline', type: 'uint256' },
33
- ];
34
- /**
35
- * EIP-712 type member list for the `CreateReferralCode` primary type. Field
36
- * order is part of the signed digest and must match the backend's encoder.
37
- * @public
38
- */
39
- export const createReferralCodeTypeFields = [
40
- { name: 'action', type: 'string' },
41
- { name: 'account', type: 'address' },
42
- { name: 'code', type: 'string' },
43
- { name: 'nonce', type: 'uint256' },
44
- { name: 'deadline', type: 'uint256' },
45
- ];
46
- //# sourceMappingURL=referral.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"referral.js","sourceRoot":"","sources":["../../src/referral.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,CAAN,IAAY,qBAaX;AAbD,WAAY,qBAAqB;IAC/B,6DAA6D;IAC7D,gDAAuB,CAAA;IACvB,uDAAuD;IACvD,gDAAuB,CAAA;IACvB,uDAAuD;IACvD,8CAAqB,CAAA;IACrB,uDAAuD;IACvD,wDAA+B,CAAA;IAC/B,2EAA2E;IAC3E,8DAAqC,CAAA;IACrC,2EAA2E;IAC3E,sDAA6B,CAAA;AAC/B,CAAC,EAbW,qBAAqB,KAArB,qBAAqB,QAahC;AAiKD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAkC;IAC9D,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;CACtC,CAAA;AA6CD;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAkC;IACzE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;CACtC,CAAA"}
@@ -1,237 +0,0 @@
1
- import type { Pagination } from './account.js';
2
- import type { Address } from './primitives.js';
3
- import type { PerpsTypedData, TypedDataParameter } from './typedData.js';
4
- /**
5
- * Reason the backend will not attach a candidate internal referral code to an
6
- * address. The backend decides; the SDK relays the verdict.
7
- * @public
8
- */
9
- export declare enum ReferralCodeRejection {
10
- /** The candidate does not match the accepted code format. */
11
- MALFORMED = "MALFORMED",
12
- /** No internal referral code matches the candidate. */
13
- NOT_FOUND = "NOT_FOUND",
14
- /** The code exists but the backend has disabled it. */
15
- INACTIVE = "INACTIVE",
16
- /** The candidate is the queried address's own code. */
17
- SELF_REFERRAL = "SELF_REFERRAL",
18
- /** The address already has an attached code; attachment is first-touch. */
19
- ALREADY_ATTACHED = "ALREADY_ATTACHED",
20
- /** The address no longer meets the backend's conditions for attachment. */
21
- NOT_ELIGIBLE = "NOT_ELIGIBLE"
22
- }
23
- /**
24
- * Backend verdict for a candidate internal referral code.
25
- * @public
26
- */
27
- export interface ReferralCodeValidation {
28
- /** The candidate exactly as submitted. */
29
- code: string;
30
- valid: boolean;
31
- /** Backend-normalized form of `code`; absent when `valid` is false. */
32
- normalizedCode?: string;
33
- /** Present only when `valid` is false. */
34
- rejection?: ReferralCodeRejection;
35
- }
36
- /**
37
- * The internal referral code attached to an address. Attachment is first-touch:
38
- * once the backend records it, it does not change.
39
- * @public
40
- */
41
- export interface AttachedReferralCode {
42
- /** Normalized code this address is attached to. */
43
- code: string;
44
- /** Unix epoch milliseconds the attachment was recorded. */
45
- attachedAt: number;
46
- }
47
- /**
48
- * The shareable internal referral code an address owns.
49
- * @public
50
- */
51
- export interface OwnedReferralCode {
52
- code: string;
53
- /** Unix epoch milliseconds the code was created. */
54
- createdAt: number;
55
- /** Number of addresses attached to this code. */
56
- attachedCount: number;
57
- }
58
- /**
59
- * Whether an address may create an owned internal referral code. The backend
60
- * owns both the threshold and the decision.
61
- * @public
62
- */
63
- export interface OwnedReferralCodeEligibility {
64
- eligible: boolean;
65
- /**
66
- * Executed notional the address must reach, as a decimal string in the
67
- * backend's reporting currency. Absent when the backend does not disclose it.
68
- */
69
- requiredNotional?: string;
70
- /** The address's executed notional so far, in the same units as `requiredNotional`. */
71
- currentNotional?: string;
72
- }
73
- /**
74
- * What the one pending onboarding signature would commit for an address. A
75
- * present field is carried by the step; an absent field is not part of it.
76
- * @public
77
- */
78
- export interface OnboardingRequirement {
79
- /** Terms version the step accepts; absent when the address already accepted the current version. */
80
- termsVersion?: string;
81
- /** Normalized code the step attaches; absent when the step attaches none. */
82
- referralCode?: string;
83
- }
84
- /**
85
- * Address-scoped onboarding and internal-referral state, served by
86
- * `GET /v1/perps/meta/referral?address=`.
87
- *
88
- * An address the backend holds no record for still resolves to a well-formed
89
- * payload: `termsAccepted` is `false` and every optional state field is absent.
90
- * @public
91
- */
92
- export interface ReferralStatus {
93
- address: Address;
94
- /** Backend-owned version identifier for the current terms. */
95
- termsVersion: string;
96
- termsAccepted: boolean;
97
- attachedCode?: AttachedReferralCode;
98
- ownedCode?: OwnedReferralCode;
99
- ownedCodeEligibility: OwnedReferralCodeEligibility;
100
- /** Verdict for the request's candidate code; absent when the request passed none. */
101
- candidate?: ReferralCodeValidation;
102
- /**
103
- * The one onboarding step to sign next; absent when the backend requires no
104
- * consent from this address.
105
- */
106
- onboarding?: OnboardingRequirement;
107
- }
108
- /**
109
- * One address attached to the queried address's owned internal referral code.
110
- * @public
111
- */
112
- export interface ReferralActivityItem {
113
- address: Address;
114
- /** Unix epoch milliseconds the attachment was recorded. */
115
- attachedAt: number;
116
- /**
117
- * Executed notional recorded against this attachment, as a decimal string in
118
- * the backend's reporting currency.
119
- */
120
- notional: string;
121
- }
122
- /**
123
- * Paginated attachment records for an address's owned internal referral code,
124
- * served by `GET /v1/perps/meta/referral/activity?address=`.
125
- *
126
- * An address that owns no code resolves to `items: []` with `hasMore: false`
127
- * and no cursor.
128
- * @public
129
- */
130
- export interface ReferralActivityResponse {
131
- items: ReferralActivityItem[];
132
- pagination: Pagination;
133
- }
134
- /**
135
- * Params for an {@link "./enums.js".ActionType.META_ONBOARD} action: the terms
136
- * version to accept and the candidate internal referral code to attach.
137
- *
138
- * Both fields are requests, not commitments. The backend decides what the step
139
- * it returns actually carries, and returns no step when it needs no consent.
140
- *
141
- * Provider-independent: sent with the {@link "./metaProvider.js".META_PROVIDER}
142
- * sentinel in the transport `provider` field.
143
- * @public
144
- */
145
- export interface OnboardParams {
146
- /** Terms-of-Service version being accepted; backend-owned, relayed verbatim. */
147
- termsVersion?: string;
148
- /** Candidate code as the client captured it; the backend normalizes it. */
149
- referralCode?: string;
150
- }
151
- /**
152
- * EIP-712 message body for an `Onboard`. Field order matches
153
- * {@link onboardTypeFields}.
154
- *
155
- * Every mutable field is bound into the digest, so a term the signature does
156
- * not commit is carried as the empty string rather than dropped.
157
- * @public
158
- */
159
- export interface OnboardMessage {
160
- /** Human-readable action, e.g. `"Accept LI.FI Perps Terms of Service v3"`. */
161
- action: string;
162
- account: Address;
163
- /** Terms version accepted, or `''` when the signature accepts no terms. */
164
- termsVersion: string;
165
- /** Normalized code attached, or `''` when the signature attaches none. */
166
- referralCode: string;
167
- /** Replay-protection nonce as a decimal string (uint256). */
168
- nonce: string;
169
- /** Unix timestamp in milliseconds after which the signature is stale. */
170
- deadline: number;
171
- }
172
- /**
173
- * EIP-712 type member list for the `Onboard` primary type. Field order is part
174
- * of the signed digest and must match the backend's encoder.
175
- * @public
176
- */
177
- export declare const onboardTypeFields: readonly TypedDataParameter[];
178
- /**
179
- * EIP-712 typed data for a composite onboarding consent, as returned by
180
- * `createAction` and signed client-side. `primaryType` is always `'Onboard'`.
181
- * @public
182
- */
183
- export interface OnboardTypedData extends PerpsTypedData {
184
- primaryType: 'Onboard';
185
- types: {
186
- Onboard: readonly TypedDataParameter[];
187
- } & PerpsTypedData['types'];
188
- message: OnboardMessage;
189
- }
190
- /**
191
- * Params for an
192
- * {@link "./enums.js".ActionType.META_CREATE_REFERRAL_CODE} action.
193
- *
194
- * Provider-independent: sent with the {@link "./metaProvider.js".META_PROVIDER}
195
- * sentinel in the transport `provider` field.
196
- * @public
197
- */
198
- export interface CreateReferralCodeParams {
199
- /** Desired code; omit to let the backend generate one. */
200
- code?: string;
201
- }
202
- /**
203
- * EIP-712 message body for a `CreateReferralCode`. Field order matches
204
- * {@link createReferralCodeTypeFields}.
205
- * @public
206
- */
207
- export interface CreateReferralCodeMessage {
208
- /** Human-readable action, e.g. `"Create LI.FI Perps referral code ABC123"`. */
209
- action: string;
210
- account: Address;
211
- /** Normalized code the signature reserves. */
212
- code: string;
213
- /** Replay-protection nonce as a decimal string (uint256). */
214
- nonce: string;
215
- /** Unix timestamp in milliseconds after which the signature is stale. */
216
- deadline: number;
217
- }
218
- /**
219
- * EIP-712 type member list for the `CreateReferralCode` primary type. Field
220
- * order is part of the signed digest and must match the backend's encoder.
221
- * @public
222
- */
223
- export declare const createReferralCodeTypeFields: readonly TypedDataParameter[];
224
- /**
225
- * EIP-712 typed data for reserving an owned internal referral code, as
226
- * returned by `createAction` and signed client-side. `primaryType` is always
227
- * `'CreateReferralCode'`.
228
- * @public
229
- */
230
- export interface CreateReferralCodeTypedData extends PerpsTypedData {
231
- primaryType: 'CreateReferralCode';
232
- types: {
233
- CreateReferralCode: readonly TypedDataParameter[];
234
- } & PerpsTypedData['types'];
235
- message: CreateReferralCodeMessage;
236
- }
237
- //# sourceMappingURL=referral.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"referral.d.ts","sourceRoot":"","sources":["../../src/referral.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExE;;;;GAIG;AACH,oBAAY,qBAAqB;IAC/B,6DAA6D;IAC7D,SAAS,cAAc;IACvB,uDAAuD;IACvD,SAAS,cAAc;IACvB,uDAAuD;IACvD,QAAQ,aAAa;IACrB,uDAAuD;IACvD,aAAa,kBAAkB;IAC/B,2EAA2E;IAC3E,gBAAgB,qBAAqB;IACrC,2EAA2E;IAC3E,YAAY,iBAAiB;CAC9B;AAED;;;GAGG;AACH,M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