@lifi/perps-types 0.1.1-alpha.0 → 0.1.1-alpha.1
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/package.json +1 -1
- package/src/_cjs/index.js +1 -0
- package/src/_cjs/index.js.map +1 -1
- package/src/_cjs/withdrawal.js +3 -0
- package/src/_cjs/withdrawal.js.map +1 -0
- package/src/_esm/index.js +1 -0
- package/src/_esm/index.js.map +1 -1
- package/src/_esm/withdrawal.js +2 -0
- package/src/_esm/withdrawal.js.map +1 -0
- package/src/_types/index.d.ts +1 -0
- package/src/_types/index.d.ts.map +1 -1
- package/src/_types/typedData.d.ts +2 -3
- package/src/_types/typedData.d.ts.map +1 -1
- package/src/_types/withdrawal.d.ts +37 -0
- package/src/_types/withdrawal.d.ts.map +1 -0
- package/src/index.ts +1 -0
- package/src/typedData.ts +2 -8
- package/src/withdrawal.ts +44 -0
package/package.json
CHANGED
package/src/_cjs/index.js
CHANGED
|
@@ -20,5 +20,6 @@ __exportStar(require("./market.js"), exports);
|
|
|
20
20
|
__exportStar(require("./authorization.js"), exports);
|
|
21
21
|
__exportStar(require("./account.js"), exports);
|
|
22
22
|
__exportStar(require("./trading.js"), exports);
|
|
23
|
+
__exportStar(require("./withdrawal.js"), exports);
|
|
23
24
|
__exportStar(require("./errors.js"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
package/src/_cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,6CAA0B;AAC1B,8CAA2B;AAC3B,qDAAkC;AAClC,+CAA4B;AAC5B,+CAA4B;AAC5B,8CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,6CAA0B;AAC1B,8CAA2B;AAC3B,qDAAkC;AAClC,+CAA4B;AAC5B,+CAA4B;AAC5B,kDAA+B;AAC/B,8CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawal.js","sourceRoot":"","sources":["../withdrawal.ts"],"names":[],"mappings":""}
|
package/src/_esm/index.js
CHANGED
package/src/_esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawal.js","sourceRoot":"","sources":["../withdrawal.ts"],"names":[],"mappings":""}
|
package/src/_types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { TypedData, SignedTypedData } from '@lifi/types';
|
|
2
2
|
import type { Address, Hex, TypedDataDomain, TypedDataParameter } from 'viem';
|
|
3
|
-
export type PerpsTypedDataPrimaryType = 'HyperliquidTransaction:ApproveAgent' | 'HyperliquidTransaction:ApproveBuilderFee' | 'HyperliquidTransaction:UserSetAbstraction' | 'Agent';
|
|
4
3
|
export type PerpsTypedData = Omit<TypedData, 'primaryType'> & {
|
|
5
|
-
primaryType:
|
|
4
|
+
primaryType: string;
|
|
6
5
|
};
|
|
7
6
|
export type PerpsSignedTypedData = Omit<SignedTypedData, 'primaryType'> & {
|
|
8
|
-
primaryType:
|
|
7
|
+
primaryType: string;
|
|
9
8
|
};
|
|
10
9
|
export type { Address, Hex, TypedDataDomain, TypedDataParameter };
|
|
11
10
|
//# sourceMappingURL=typedData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AAE7E,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AAE7E,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,GAAG;IAC5D,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG;IACxE,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAGD,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Address, Hex, PerpsTypedData } from './typedData.js';
|
|
2
|
+
export interface WithdrawalInput {
|
|
3
|
+
destination: Address;
|
|
4
|
+
amount: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CreateWithdrawalRequest {
|
|
7
|
+
dex: string;
|
|
8
|
+
address: Address;
|
|
9
|
+
withdrawal: WithdrawalInput;
|
|
10
|
+
}
|
|
11
|
+
export interface WithdrawalAction {
|
|
12
|
+
action: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
typedData: PerpsTypedData;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateWithdrawalResponse {
|
|
17
|
+
action: WithdrawalAction;
|
|
18
|
+
}
|
|
19
|
+
export interface SignedWithdrawal {
|
|
20
|
+
action: string;
|
|
21
|
+
typedData: PerpsTypedData;
|
|
22
|
+
signature: Hex;
|
|
23
|
+
}
|
|
24
|
+
export interface SubmitWithdrawalRequest {
|
|
25
|
+
dex: string;
|
|
26
|
+
address: Address;
|
|
27
|
+
action: SignedWithdrawal;
|
|
28
|
+
}
|
|
29
|
+
export interface WithdrawalResult {
|
|
30
|
+
action: string;
|
|
31
|
+
success: boolean;
|
|
32
|
+
error?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SubmitWithdrawalResponse {
|
|
35
|
+
result: WithdrawalResult;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=withdrawal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawal.d.ts","sourceRoot":"","sources":["../withdrawal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAElE,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,eAAe,CAAA;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,cAAc,CAAA;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,gBAAgB,CAAA;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,cAAc,CAAA;IACzB,SAAS,EAAE,GAAG,CAAA;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,gBAAgB,CAAA;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,gBAAgB,CAAA;CACzB"}
|
package/src/index.ts
CHANGED
package/src/typedData.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { TypedData, SignedTypedData } from '@lifi/types'
|
|
2
2
|
import type { Address, Hex, TypedDataDomain, TypedDataParameter } from 'viem'
|
|
3
3
|
|
|
4
|
-
export type PerpsTypedDataPrimaryType =
|
|
5
|
-
| 'HyperliquidTransaction:ApproveAgent'
|
|
6
|
-
| 'HyperliquidTransaction:ApproveBuilderFee'
|
|
7
|
-
| 'HyperliquidTransaction:UserSetAbstraction'
|
|
8
|
-
| 'Agent'
|
|
9
|
-
|
|
10
4
|
export type PerpsTypedData = Omit<TypedData, 'primaryType'> & {
|
|
11
|
-
primaryType:
|
|
5
|
+
primaryType: string
|
|
12
6
|
}
|
|
13
7
|
|
|
14
8
|
export type PerpsSignedTypedData = Omit<SignedTypedData, 'primaryType'> & {
|
|
15
|
-
primaryType:
|
|
9
|
+
primaryType: string
|
|
16
10
|
}
|
|
17
11
|
|
|
18
12
|
// Re-export viem primitives used across perps types
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Address, Hex, PerpsTypedData } from './typedData.js'
|
|
2
|
+
|
|
3
|
+
export interface WithdrawalInput {
|
|
4
|
+
destination: Address
|
|
5
|
+
amount: string // e.g., "100.5" — units are $1 USDC
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CreateWithdrawalRequest {
|
|
9
|
+
dex: string
|
|
10
|
+
address: Address
|
|
11
|
+
withdrawal: WithdrawalInput
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface WithdrawalAction {
|
|
15
|
+
action: string // "Withdraw"
|
|
16
|
+
description?: string
|
|
17
|
+
typedData: PerpsTypedData
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CreateWithdrawalResponse {
|
|
21
|
+
action: WithdrawalAction
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface SignedWithdrawal {
|
|
25
|
+
action: string
|
|
26
|
+
typedData: PerpsTypedData
|
|
27
|
+
signature: Hex
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface SubmitWithdrawalRequest {
|
|
31
|
+
dex: string
|
|
32
|
+
address: Address
|
|
33
|
+
action: SignedWithdrawal
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface WithdrawalResult {
|
|
37
|
+
action: string
|
|
38
|
+
success: boolean
|
|
39
|
+
error?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SubmitWithdrawalResponse {
|
|
43
|
+
result: WithdrawalResult
|
|
44
|
+
}
|