hedge-web3 0.2.20 → 0.2.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/declarations/Constants.d.ts +15 -0
  2. package/declarations/idl/pyth.d.ts +44 -24
  3. package/declarations/idl/switchboard.d.ts +47 -0
  4. package/declarations/idl/vault.d.ts +857 -157
  5. package/declarations/index.d.ts +26 -20
  6. package/declarations/instructions/closeLiquidationPoolPosition.d.ts +2 -2
  7. package/declarations/instructions/createReferralAccount.d.ts +17 -0
  8. package/declarations/instructions/createUserReferralAccount.d.ts +5 -0
  9. package/declarations/instructions/depositLiquidationPool.d.ts +2 -2
  10. package/declarations/instructions/loanVault.d.ts +2 -2
  11. package/declarations/instructions/psmEditAccount.d.ts +12 -0
  12. package/declarations/instructions/psmMintUsh.d.ts +2 -2
  13. package/declarations/instructions/psmRedeemUsh.d.ts +2 -2
  14. package/declarations/instructions/referralClaimFees.d.ts +16 -0
  15. package/declarations/instructions/transferVault.d.ts +3 -17
  16. package/declarations/instructions/updateReferralAccount.d.ts +13 -0
  17. package/declarations/instructions/updateReferralState.d.ts +20 -0
  18. package/declarations/instructions/updateVaultType.d.ts +1 -0
  19. package/declarations/state/VaultAccount.d.ts +2 -1
  20. package/lib/Constants.js +36 -1
  21. package/lib/idl/pyth.js +44 -24
  22. package/lib/idl/switchboard.js +49 -0
  23. package/lib/idl/vault.js +850 -150
  24. package/lib/index.js +26 -20
  25. package/lib/instructions/closeLiquidationPoolPosition.js +16 -3
  26. package/lib/instructions/createReferralAccount.js +80 -0
  27. package/lib/instructions/createUserReferralAccount.js +61 -0
  28. package/lib/instructions/depositLiquidationPool.js +16 -5
  29. package/lib/instructions/loanVault.js +16 -3
  30. package/lib/instructions/psmEditAccount.js +60 -0
  31. package/lib/instructions/psmMintUsh.js +14 -3
  32. package/lib/instructions/psmRedeemUsh.js +14 -3
  33. package/lib/instructions/referralClaimFees.js +84 -0
  34. package/lib/instructions/transferVault.js +10 -24
  35. package/lib/instructions/updateReferralAccount.js +50 -0
  36. package/lib/instructions/updateReferralState.js +57 -0
  37. package/lib/instructions/updateVaultType.js +10 -9
  38. package/package.json +1 -1
  39. package/src/Constants.ts +42 -0
  40. package/src/idl/pyth.ts +88 -48
  41. package/src/idl/switchboard.ts +93 -0
  42. package/src/idl/vault.ts +1762 -362
  43. package/src/index.ts +28 -24
  44. package/src/instructions/closeLiquidationPoolPosition.ts +25 -1
  45. package/src/instructions/createReferralAccount.ts +127 -0
  46. package/src/instructions/createUserReferralAccount.ts +86 -0
  47. package/src/instructions/depositLiquidationPool.ts +24 -4
  48. package/src/instructions/loanVault.ts +20 -1
  49. package/src/instructions/{psmEditAccount.rs → psmEditAccount.ts} +0 -0
  50. package/src/instructions/psmMintUsh.ts +20 -1
  51. package/src/instructions/psmRedeemUsh.ts +20 -1
  52. package/src/instructions/referralClaimFees.ts +159 -0
  53. package/src/instructions/transferVault.ts +21 -58
  54. package/src/instructions/updateReferralAccount.ts +77 -0
  55. package/src/instructions/updateReferralState.ts +93 -0
  56. package/src/instructions/updateVaultType.ts +3 -0
  57. package/src/state/VaultAccount.ts +1 -1
@@ -23,6 +23,21 @@ export declare function getUshMintPublicKey(): Promise<PublicKey>;
23
23
  * @returns The Vault System State public key
24
24
  */
25
25
  export declare function getVaultSystemStatePublicKey(): Promise<PublicKey>;
26
+ /**
27
+ *
28
+ * @returns The Referral State public key
29
+ */
30
+ export declare function getReferralStatePublicKey(): Promise<PublicKey>;
31
+ /**
32
+ *
33
+ * @returns The Referral State public key based off the owner's public key
34
+ */
35
+ export declare function getReferralAccountPublicKey(ownerPublicKey: PublicKey): Promise<PublicKey>;
36
+ /**
37
+ *
38
+ * @returns The user referral account public key based off the user's public key
39
+ */
40
+ export declare function getUserReferralAccountPublicKey(ownerPublicKey: PublicKey): Promise<PublicKey>;
26
41
  /**
27
42
  *
28
43
  * @returns The HDG mint public key
@@ -5,19 +5,9 @@ export declare type Pyth = {
5
5
  {
6
6
  "name": "initialize";
7
7
  "accounts": [
8
- {
9
- "name": "payer";
10
- "isMut": true;
11
- "isSigner": true;
12
- },
13
8
  {
14
9
  "name": "price";
15
10
  "isMut": true;
16
- "isSigner": true;
17
- },
18
- {
19
- "name": "systemProgram";
20
- "isMut": false;
21
11
  "isSigner": false;
22
12
  }
23
13
  ];
@@ -53,27 +43,57 @@ export declare type Pyth = {
53
43
  ];
54
44
  }
55
45
  ];
56
- "accounts": [
46
+ "types": [
57
47
  {
58
- "name": "priceWrapper";
48
+ "name": "PriceStatus";
59
49
  "type": {
60
- "kind": "struct";
61
- "fields": [
50
+ "kind": "enum";
51
+ "variants": [
52
+ {
53
+ "name": "Unknown";
54
+ },
55
+ {
56
+ "name": "Trading";
57
+ },
62
58
  {
63
- "name": "price";
64
- "type": {
65
- "defined": "Price";
66
- };
59
+ "name": "Halted";
60
+ },
61
+ {
62
+ "name": "Auction";
67
63
  }
68
64
  ];
69
65
  };
70
- }
71
- ];
72
- "errors": [
66
+ },
67
+ {
68
+ "name": "CorpAction";
69
+ "type": {
70
+ "kind": "enum";
71
+ "variants": [
72
+ {
73
+ "name": "NoCorpAct";
74
+ }
75
+ ];
76
+ };
77
+ },
73
78
  {
74
- "code": 6000;
75
- "name": "InvalidTradingStatus";
76
- "msg": "invalid trading status";
79
+ "name": "PriceType";
80
+ "type": {
81
+ "kind": "enum";
82
+ "variants": [
83
+ {
84
+ "name": "Unknown";
85
+ },
86
+ {
87
+ "name": "Price";
88
+ },
89
+ {
90
+ "name": "TWAP";
91
+ },
92
+ {
93
+ "name": "Volatility";
94
+ }
95
+ ];
96
+ };
77
97
  }
78
98
  ];
79
99
  };
@@ -0,0 +1,47 @@
1
+ export declare type Switchboard = {
2
+ "version": "0.1.0";
3
+ "name": "switchboard";
4
+ "instructions": [
5
+ {
6
+ "name": "initialize";
7
+ "accounts": [
8
+ {
9
+ "name": "aggregator";
10
+ "isMut": true;
11
+ "isSigner": false;
12
+ }
13
+ ];
14
+ "args": [
15
+ {
16
+ "name": "price";
17
+ "type": "u64";
18
+ },
19
+ {
20
+ "name": "scale";
21
+ "type": "u16";
22
+ }
23
+ ];
24
+ },
25
+ {
26
+ "name": "setPrice";
27
+ "accounts": [
28
+ {
29
+ "name": "aggregator";
30
+ "isMut": true;
31
+ "isSigner": false;
32
+ }
33
+ ];
34
+ "args": [
35
+ {
36
+ "name": "price";
37
+ "type": "u64";
38
+ },
39
+ {
40
+ "name": "scale";
41
+ "type": "u16";
42
+ }
43
+ ];
44
+ }
45
+ ];
46
+ };
47
+ export declare const IDL: Switchboard;