@glamsystems/glam-sdk 1.0.12-alpha.3 → 1.0.13-test
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/LICENSE +201 -0
- package/README.md +1 -1
- package/index.cjs.js +1 -57320
- package/index.esm.js +1 -57081
- package/package.json +26 -15
- package/src/assets.d.ts +10 -17
- package/src/client/access.d.ts +13 -0
- package/src/client/base.d.ts +30 -7
- package/src/client/bridge.d.ts +183 -0
- package/src/client/bridgeRegistry.d.ts +32 -0
- package/src/client/epi.d.ts +78 -0
- package/src/client/fees.d.ts +4 -0
- package/src/client/invest.d.ts +1 -1
- package/src/client/jupiter.d.ts +27 -20
- package/src/client/loopscale.d.ts +84 -0
- package/src/client/mint.d.ts +54 -1
- package/src/client/price.d.ts +26 -39
- package/src/client.d.ts +9 -5
- package/src/constants.d.ts +11 -7
- package/src/deser/index.d.ts +1 -1
- package/src/deser/integrationPolicies.d.ts +30 -20
- package/src/deser/tokenAclLayouts.d.ts +67 -0
- package/src/error.d.ts +2 -1
- package/src/glamExports.d.ts +1351 -1546
- package/src/globalConfig.d.ts +27 -0
- package/src/index.d.ts +5 -1
- package/src/models/state.d.ts +2 -0
- package/src/utils/accounts.d.ts +9 -1
- package/src/utils/bitmask.d.ts +3 -0
- package/src/utils/common.d.ts +2 -0
- package/src/utils/glamPDAs.d.ts +6 -0
- package/src/utils/index.d.ts +0 -1
- package/src/utils/pkmap.d.ts +23 -18
- package/src/utils/positionCategorizer.d.ts +3 -21
- package/target/idl/ext_bridge-staging.json +2379 -0
- package/target/idl/ext_bridge.json +2379 -0
- package/target/idl/ext_cctp.json +1 -1
- package/target/idl/ext_drift.json +1613 -142
- package/target/idl/ext_epi-staging.json +2169 -0
- package/target/idl/ext_epi.json +2169 -0
- package/target/idl/ext_kamino-staging.json +1 -1
- package/target/idl/ext_kamino.json +109 -1
- package/target/idl/{ext_drift-staging.json → ext_loopscale-staging.json} +986 -1438
- package/target/idl/ext_loopscale.json +3541 -0
- package/target/idl/ext_marinade-staging.json +1587 -0
- package/target/idl/ext_spl-staging.json +1 -1
- package/target/idl/ext_spl.json +1 -1
- package/target/idl/glam_config.json +78 -9
- package/target/idl/glam_mint-staging.json +3002 -1244
- package/target/idl/glam_mint.json +239 -8
- package/target/idl/glam_policies.json +2 -7
- package/target/idl/glam_protocol-staging.json +187 -266
- package/target/idl/glam_protocol.json +217 -114
- package/target/idl/mock_layerzero_endpoint.json +144 -0
- package/target/idl/mock_layerzero_oft.json +155 -0
- package/target/types/ext_bridge-staging.d.ts +2385 -0
- package/target/types/ext_bridge-staging.ts +2385 -0
- package/target/types/ext_bridge.d.ts +2385 -0
- package/target/types/ext_bridge.ts +2385 -0
- package/target/types/ext_cctp.d.ts +1 -1
- package/target/types/ext_cctp.ts +1 -1
- package/target/types/ext_drift.d.ts +1609 -138
- package/target/types/ext_drift.ts +1613 -142
- package/target/types/ext_epi-staging.d.ts +2175 -0
- package/target/types/ext_epi-staging.ts +2175 -0
- package/target/types/ext_epi.d.ts +2175 -0
- package/target/types/ext_epi.ts +2175 -0
- package/target/types/ext_kamino-staging.d.ts +3433 -0
- package/target/types/ext_kamino-staging.ts +1 -1
- package/target/types/ext_kamino.d.ts +109 -1
- package/target/types/ext_kamino.ts +109 -1
- package/target/types/ext_loopscale-staging.d.ts +3547 -0
- package/target/types/{ext_drift-staging.ts → ext_loopscale-staging.ts} +988 -1440
- package/target/types/ext_loopscale.d.ts +3547 -0
- package/target/types/ext_loopscale.ts +3547 -0
- package/target/types/ext_marinade-staging.d.ts +1593 -0
- package/target/types/ext_marinade-staging.ts +1593 -0
- package/target/types/{ext_offchain.d.ts → ext_spl-staging.d.ts} +219 -19
- package/target/types/ext_spl-staging.ts +1 -1
- package/target/types/ext_spl.d.ts +1 -1
- package/target/types/ext_spl.ts +1 -1
- package/target/types/ext_stake_pool-staging.d.ts +1622 -0
- package/target/types/glam_config.d.ts +78 -9
- package/target/types/glam_config.ts +78 -9
- package/target/types/glam_mint-staging.d.ts +7856 -0
- package/target/types/glam_mint-staging.ts +3002 -1244
- package/target/types/glam_mint.d.ts +239 -8
- package/target/types/glam_mint.ts +239 -8
- package/target/types/glam_policies.d.ts +477 -0
- package/target/types/glam_policies.ts +2 -7
- package/target/types/glam_protocol-staging.d.ts +3292 -0
- package/target/types/glam_protocol-staging.ts +187 -266
- package/target/types/glam_protocol.d.ts +217 -114
- package/target/types/glam_protocol.ts +217 -114
- package/target/types/mock_layerzero_endpoint.d.ts +150 -0
- package/target/types/mock_layerzero_endpoint.ts +150 -0
- package/target/types/mock_layerzero_oft.d.ts +161 -0
- package/target/types/mock_layerzero_oft.ts +161 -0
- package/src/client/drift/index.d.ts +0 -2
- package/src/client/drift/protocol-v2.d.ts +0 -93
- package/src/client/drift/vaults.d.ts +0 -60
- package/src/deser/driftLayouts.d.ts +0 -217
- package/src/react/cluster-provider.d.ts +0 -22
- package/src/react/glam.d.ts +0 -51
- package/src/react/index.d.ts +0 -5
- package/src/react/query-keys.d.ts +0 -40
- package/src/react/useVaultBalanceSubscription.d.ts +0 -17
- package/src/utils/drift/index.d.ts +0 -2
- package/src/utils/drift/orderParams.d.ts +0 -28
- package/src/utils/drift/types.d.ts +0 -522
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
3
|
+
*
|
|
4
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
5
|
+
* IDL can be found at `target/idl/mock_layerzero_endpoint.json`.
|
|
6
|
+
*/
|
|
7
|
+
export type MockLayerzeroEndpoint = {
|
|
8
|
+
"address": "7VCSNNGUmS4f1qDE73PmkSWbV3kBhRPJko1g7t9YTSbM",
|
|
9
|
+
"metadata": {
|
|
10
|
+
"name": "mockLayerzeroEndpoint",
|
|
11
|
+
"version": "1.0.0",
|
|
12
|
+
"spec": "0.1.0"
|
|
13
|
+
},
|
|
14
|
+
"instructions": [
|
|
15
|
+
{
|
|
16
|
+
"name": "advanceNonce",
|
|
17
|
+
"discriminator": [
|
|
18
|
+
20,
|
|
19
|
+
17,
|
|
20
|
+
71,
|
|
21
|
+
131,
|
|
22
|
+
103,
|
|
23
|
+
35,
|
|
24
|
+
92,
|
|
25
|
+
6
|
|
26
|
+
],
|
|
27
|
+
"accounts": [
|
|
28
|
+
{
|
|
29
|
+
"name": "nonce",
|
|
30
|
+
"writable": true,
|
|
31
|
+
"pda": {
|
|
32
|
+
"seeds": [
|
|
33
|
+
{
|
|
34
|
+
"kind": "const",
|
|
35
|
+
"value": [
|
|
36
|
+
78,
|
|
37
|
+
111,
|
|
38
|
+
110,
|
|
39
|
+
99,
|
|
40
|
+
101
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"kind": "arg",
|
|
45
|
+
"path": "sender"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"kind": "arg",
|
|
49
|
+
"path": "dstEid"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"kind": "arg",
|
|
53
|
+
"path": "receiver"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"args": [
|
|
60
|
+
{
|
|
61
|
+
"name": "sender",
|
|
62
|
+
"type": "pubkey"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "dstEid",
|
|
66
|
+
"type": "u32"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "receiver",
|
|
70
|
+
"type": "pubkey"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "initializeNonce",
|
|
76
|
+
"discriminator": [
|
|
77
|
+
64,
|
|
78
|
+
206,
|
|
79
|
+
214,
|
|
80
|
+
231,
|
|
81
|
+
20,
|
|
82
|
+
15,
|
|
83
|
+
231,
|
|
84
|
+
41
|
|
85
|
+
],
|
|
86
|
+
"accounts": [
|
|
87
|
+
{
|
|
88
|
+
"name": "payer",
|
|
89
|
+
"writable": true,
|
|
90
|
+
"signer": true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "nonce",
|
|
94
|
+
"writable": true,
|
|
95
|
+
"pda": {
|
|
96
|
+
"seeds": [
|
|
97
|
+
{
|
|
98
|
+
"kind": "const",
|
|
99
|
+
"value": [
|
|
100
|
+
78,
|
|
101
|
+
111,
|
|
102
|
+
110,
|
|
103
|
+
99,
|
|
104
|
+
101
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"kind": "arg",
|
|
109
|
+
"path": "sender"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"kind": "arg",
|
|
113
|
+
"path": "dstEid"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"kind": "arg",
|
|
117
|
+
"path": "receiver"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "systemProgram",
|
|
124
|
+
"address": "11111111111111111111111111111111"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"args": [
|
|
128
|
+
{
|
|
129
|
+
"name": "sender",
|
|
130
|
+
"type": "pubkey"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "dstEid",
|
|
134
|
+
"type": "u32"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "receiver",
|
|
138
|
+
"type": "pubkey"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"errors": [
|
|
144
|
+
{
|
|
145
|
+
"code": 6000,
|
|
146
|
+
"name": "invalidNonceAccount",
|
|
147
|
+
"msg": "The nonce account layout is invalid"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
3
|
+
*
|
|
4
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
5
|
+
* IDL can be found at `target/idl/mock_layerzero_oft.json`.
|
|
6
|
+
*/
|
|
7
|
+
export type MockLayerzeroOft = {
|
|
8
|
+
"address": "G6cLMyeKew7B7RR1eAsYhKViYNcknwfwJ4ZbSDwWSS4z";
|
|
9
|
+
"metadata": {
|
|
10
|
+
"name": "mockLayerzeroOft";
|
|
11
|
+
"version": "1.0.0";
|
|
12
|
+
"spec": "0.1.0";
|
|
13
|
+
};
|
|
14
|
+
"instructions": [
|
|
15
|
+
{
|
|
16
|
+
"name": "send";
|
|
17
|
+
"discriminator": [
|
|
18
|
+
102,
|
|
19
|
+
251,
|
|
20
|
+
20,
|
|
21
|
+
187,
|
|
22
|
+
65,
|
|
23
|
+
75,
|
|
24
|
+
12,
|
|
25
|
+
69
|
|
26
|
+
];
|
|
27
|
+
"accounts": [
|
|
28
|
+
{
|
|
29
|
+
"name": "payer";
|
|
30
|
+
"writable": true;
|
|
31
|
+
"signer": true;
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "placeholder0";
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "oftStore";
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "placeholder1";
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "from";
|
|
44
|
+
"writable": true;
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "custody";
|
|
48
|
+
"writable": true;
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "mint";
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "tokenProgram";
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "placeholder2";
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "placeholder3";
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "mockLayerzeroEndpointProgram";
|
|
64
|
+
"address": "7VCSNNGUmS4f1qDE73PmkSWbV3kBhRPJko1g7t9YTSbM";
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "oftStoreDuplicate";
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "placeholder4";
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "placeholder5";
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "placeholder6";
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "placeholder7";
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "placeholder8";
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "nonce";
|
|
86
|
+
"writable": true;
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "systemProgram";
|
|
90
|
+
"address": "11111111111111111111111111111111";
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
"args": [
|
|
94
|
+
{
|
|
95
|
+
"name": "args";
|
|
96
|
+
"type": {
|
|
97
|
+
"defined": {
|
|
98
|
+
"name": "sendArgs";
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
"errors": [
|
|
106
|
+
{
|
|
107
|
+
"code": 6000;
|
|
108
|
+
"name": "invalidStoreDuplicate";
|
|
109
|
+
"msg": "The duplicated store account does not match";
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
"types": [
|
|
113
|
+
{
|
|
114
|
+
"name": "sendArgs";
|
|
115
|
+
"type": {
|
|
116
|
+
"kind": "struct";
|
|
117
|
+
"fields": [
|
|
118
|
+
{
|
|
119
|
+
"name": "dstEid";
|
|
120
|
+
"type": "u32";
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "to";
|
|
124
|
+
"type": {
|
|
125
|
+
"array": [
|
|
126
|
+
"u8",
|
|
127
|
+
32
|
|
128
|
+
];
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "amountLd";
|
|
133
|
+
"type": "u64";
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "minAmountLd";
|
|
137
|
+
"type": "u64";
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "options";
|
|
141
|
+
"type": "bytes";
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "composeMsg";
|
|
145
|
+
"type": {
|
|
146
|
+
"option": "bytes";
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "nativeFee";
|
|
151
|
+
"type": "u64";
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "lzTokenFee";
|
|
155
|
+
"type": "u64";
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
];
|
|
161
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
3
|
+
*
|
|
4
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
5
|
+
* IDL can be found at `target/idl/mock_layerzero_oft.json`.
|
|
6
|
+
*/
|
|
7
|
+
export type MockLayerzeroOft = {
|
|
8
|
+
"address": "G6cLMyeKew7B7RR1eAsYhKViYNcknwfwJ4ZbSDwWSS4z",
|
|
9
|
+
"metadata": {
|
|
10
|
+
"name": "mockLayerzeroOft",
|
|
11
|
+
"version": "1.0.0",
|
|
12
|
+
"spec": "0.1.0"
|
|
13
|
+
},
|
|
14
|
+
"instructions": [
|
|
15
|
+
{
|
|
16
|
+
"name": "send",
|
|
17
|
+
"discriminator": [
|
|
18
|
+
102,
|
|
19
|
+
251,
|
|
20
|
+
20,
|
|
21
|
+
187,
|
|
22
|
+
65,
|
|
23
|
+
75,
|
|
24
|
+
12,
|
|
25
|
+
69
|
|
26
|
+
],
|
|
27
|
+
"accounts": [
|
|
28
|
+
{
|
|
29
|
+
"name": "payer",
|
|
30
|
+
"writable": true,
|
|
31
|
+
"signer": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "placeholder0"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "oftStore"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "placeholder1"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "from",
|
|
44
|
+
"writable": true
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "custody",
|
|
48
|
+
"writable": true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "mint"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "tokenProgram"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "placeholder2"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "placeholder3"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "mockLayerzeroEndpointProgram",
|
|
64
|
+
"address": "7VCSNNGUmS4f1qDE73PmkSWbV3kBhRPJko1g7t9YTSbM"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "oftStoreDuplicate"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "placeholder4"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "placeholder5"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "placeholder6"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "placeholder7"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "placeholder8"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "nonce",
|
|
86
|
+
"writable": true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "systemProgram",
|
|
90
|
+
"address": "11111111111111111111111111111111"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"args": [
|
|
94
|
+
{
|
|
95
|
+
"name": "args",
|
|
96
|
+
"type": {
|
|
97
|
+
"defined": {
|
|
98
|
+
"name": "sendArgs"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"errors": [
|
|
106
|
+
{
|
|
107
|
+
"code": 6000,
|
|
108
|
+
"name": "invalidStoreDuplicate",
|
|
109
|
+
"msg": "The duplicated store account does not match"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"types": [
|
|
113
|
+
{
|
|
114
|
+
"name": "sendArgs",
|
|
115
|
+
"type": {
|
|
116
|
+
"kind": "struct",
|
|
117
|
+
"fields": [
|
|
118
|
+
{
|
|
119
|
+
"name": "dstEid",
|
|
120
|
+
"type": "u32"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "to",
|
|
124
|
+
"type": {
|
|
125
|
+
"array": [
|
|
126
|
+
"u8",
|
|
127
|
+
32
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "amountLd",
|
|
133
|
+
"type": "u64"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "minAmountLd",
|
|
137
|
+
"type": "u64"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "options",
|
|
141
|
+
"type": "bytes"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "composeMsg",
|
|
145
|
+
"type": {
|
|
146
|
+
"option": "bytes"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "nativeFee",
|
|
151
|
+
"type": "u64"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "lzTokenFee",
|
|
155
|
+
"type": "u64"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction, AccountMeta } from "@solana/web3.js";
|
|
3
|
-
import { MarketType, OrderParams, PositionDirection, ModifyOrderParams } from "../../utils/drift/types";
|
|
4
|
-
import { DriftPerpMarket, DriftSpotMarket, DriftUser } from "../../deser/driftLayouts";
|
|
5
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
|
|
6
|
-
import { VaultClient } from "../vault";
|
|
7
|
-
export declare const DRIFT_SIGNER: anchor.web3.PublicKey;
|
|
8
|
-
export declare const DRIFT_MARGIN_PRECISION = 10000;
|
|
9
|
-
export interface OrderConstants {
|
|
10
|
-
perpBaseScale: number;
|
|
11
|
-
quoteScale: number;
|
|
12
|
-
}
|
|
13
|
-
export declare class DriftMarketConfigs {
|
|
14
|
-
readonly orderConstants: OrderConstants;
|
|
15
|
-
readonly perpMarkets: DriftPerpMarket[];
|
|
16
|
-
readonly spotMarkets: DriftSpotMarket[];
|
|
17
|
-
constructor(orderConstants: OrderConstants, perpMarkets: DriftPerpMarket[], spotMarkets: DriftSpotMarket[]);
|
|
18
|
-
getPerp(marketIndex: number): DriftPerpMarket | undefined;
|
|
19
|
-
getSpot(mintOrIndex: PublicKey | number): DriftSpotMarket | undefined;
|
|
20
|
-
}
|
|
21
|
-
declare class TxBuilder extends BaseTxBuilder<DriftProtocolClient> {
|
|
22
|
-
initializeUserStatsIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
23
|
-
initializeUserIx(glamSigner: PublicKey, subAccountId: number): Promise<TransactionInstruction>;
|
|
24
|
-
updateUserPoolIdIx(subAccountId: number, poolId: number): Promise<TransactionInstruction>;
|
|
25
|
-
initializeIxs(subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
26
|
-
initializeTx(subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
27
|
-
depositIxs(amount: anchor.BN, marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
28
|
-
depositTx(amount: anchor.BN, marketIndex: number, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
29
|
-
withdrawIxs(amount: anchor.BN, marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
30
|
-
withdrawTx(amount: anchor.BN, marketIndex: number, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
31
|
-
updateUserCustomMarginRatioIx(maxLeverage: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
32
|
-
updateUserCustomMarginRatioTx(maxLeverage: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
33
|
-
updateUserMarginTradingEnabledIx(marginTradingEnabled: boolean, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
34
|
-
updateUserMarginTradingEnabledTx(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
35
|
-
updateUserDelegateIx(delegate: PublicKey | string, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
36
|
-
updateUserDelegateTx(delegate: PublicKey, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
37
|
-
deleteUserIx(subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
38
|
-
deleteUserTx(subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
39
|
-
placeOrderIx(orderParams: OrderParams, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
40
|
-
placeOrderTx(orderParams: OrderParams, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
41
|
-
modifyOrderIx(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
42
|
-
modifyOrderTx(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
43
|
-
cancelOrdersIx(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
44
|
-
cancelOrdersTx(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
45
|
-
cancelOrdersByIdsIx(orderIds: number[], subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
46
|
-
cancelOrdersByIdsTx(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
47
|
-
settlePnlIx(marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
48
|
-
settlePnlTx(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
49
|
-
}
|
|
50
|
-
export declare class DriftProtocolClient {
|
|
51
|
-
readonly base: BaseClient;
|
|
52
|
-
readonly vault: VaultClient;
|
|
53
|
-
private spotMarkets;
|
|
54
|
-
private perpMarkets;
|
|
55
|
-
private marketConfigs;
|
|
56
|
-
txBuilder: TxBuilder;
|
|
57
|
-
constructor(base: BaseClient, vault: VaultClient);
|
|
58
|
-
initialize(subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
59
|
-
updateUserCustomMarginRatio(maxLeverage: number, subAccountId?: number): Promise<TransactionSignature>;
|
|
60
|
-
updateUserMarginTradingEnabled(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
61
|
-
updateUserDelegate(delegate: PublicKey | string, subAccountId?: number): Promise<TransactionSignature>;
|
|
62
|
-
deleteUser(subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
63
|
-
deposit(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
64
|
-
withdraw(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
65
|
-
placeOrder(orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
66
|
-
modifyOrder(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
67
|
-
cancelOrders(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
68
|
-
cancelOrdersByIds(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
69
|
-
settlePnl(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
70
|
-
getMarketPda: (marketType: MarketType, marketIndex: number) => anchor.web3.PublicKey;
|
|
71
|
-
getUserPda: (authority: PublicKey, subAccountId?: number) => anchor.web3.PublicKey;
|
|
72
|
-
getUserStatsPda: (authority: PublicKey) => PublicKey;
|
|
73
|
-
getGlamReferrerPdas(): {
|
|
74
|
-
user: PublicKey;
|
|
75
|
-
userStats: PublicKey;
|
|
76
|
-
};
|
|
77
|
-
getDriftUserPdas(subAccountId?: number): {
|
|
78
|
-
user: PublicKey;
|
|
79
|
-
userStats: PublicKey;
|
|
80
|
-
};
|
|
81
|
-
getSubAccountId(driftUser: PublicKey): number;
|
|
82
|
-
get driftStatePda(): PublicKey;
|
|
83
|
-
fetchAndParseSpotMarket(marketIndex: number, skipCache?: boolean): Promise<DriftSpotMarket>;
|
|
84
|
-
fetchAndParseSpotMarkets(marketIndexes: number[], skipCache?: boolean): Promise<DriftSpotMarket[]>;
|
|
85
|
-
fetchAndParsePerpMarket(marketIndex: number, skipCache?: boolean): Promise<DriftPerpMarket>;
|
|
86
|
-
fetchAndParsePerpMarkets(marketIndexes: number[], skipCache?: boolean): Promise<DriftPerpMarket[]>;
|
|
87
|
-
fetchMarketConfigs(skipCache?: boolean): Promise<DriftMarketConfigs>;
|
|
88
|
-
fetchAndParseDriftUser(subAccountId?: number): Promise<DriftUser | null>;
|
|
89
|
-
fetchAndParseDriftUsers(): Promise<DriftUser[]>;
|
|
90
|
-
marketTypeEquals: (a: MarketType | undefined, b: MarketType) => boolean | undefined;
|
|
91
|
-
composeRemainingAccounts(subAccountId: number, marketType?: MarketType, marketIndex?: number): Promise<AccountMeta[]>;
|
|
92
|
-
}
|
|
93
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, AccountMeta, Commitment } from "@solana/web3.js";
|
|
2
|
-
import { DriftVault, PerpPosition, SpotPosition } from "../../deser/driftLayouts";
|
|
3
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
|
|
4
|
-
import { BN } from "@coral-xyz/anchor";
|
|
5
|
-
import { DriftProtocolClient } from "./protocol-v2";
|
|
6
|
-
declare class TxBuilder extends BaseTxBuilder<DriftVaultsClient> {
|
|
7
|
-
initializeVaultDepositorTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
8
|
-
depositTx(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
9
|
-
requestWithdrawTx(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
10
|
-
cancelWithdrawRequestTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
11
|
-
withdrawTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
12
|
-
}
|
|
13
|
-
export declare class DriftVaultsClient {
|
|
14
|
-
readonly base: BaseClient;
|
|
15
|
-
readonly drift: DriftProtocolClient;
|
|
16
|
-
txBuilder: TxBuilder;
|
|
17
|
-
constructor(base: BaseClient, drift: DriftProtocolClient);
|
|
18
|
-
fetchUserPositions(user: PublicKey): Promise<{
|
|
19
|
-
perpPositions: PerpPosition[];
|
|
20
|
-
spotPositions: SpotPosition[];
|
|
21
|
-
}>;
|
|
22
|
-
getDepositorPda(driftVault: PublicKey): PublicKey;
|
|
23
|
-
parseDriftVaults(driftVaults: PublicKey[]): Promise<DriftVault[]>;
|
|
24
|
-
parseDriftVault(driftVault: PublicKey): Promise<DriftVault>;
|
|
25
|
-
composeRemainingAccounts(user: PublicKey): Promise<AccountMeta[]>;
|
|
26
|
-
parseDepositor(depositor: PublicKey, data: Buffer): {
|
|
27
|
-
address: PublicKey;
|
|
28
|
-
driftVault: PublicKey;
|
|
29
|
-
shares: any;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Finds all drift vault depositors
|
|
33
|
-
*/
|
|
34
|
-
findAndParseVaultDepositors(commitment?: Commitment): Promise<{
|
|
35
|
-
address: PublicKey;
|
|
36
|
-
driftVault: PublicKey;
|
|
37
|
-
shares: any;
|
|
38
|
-
}[]>;
|
|
39
|
-
/**
|
|
40
|
-
* Initialize a vault depositor
|
|
41
|
-
*/
|
|
42
|
-
initializeVaultDepositor(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
43
|
-
/**
|
|
44
|
-
* Deposit to a drift vault
|
|
45
|
-
*/
|
|
46
|
-
deposit(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
47
|
-
/**
|
|
48
|
-
* Request withdrawal from a drift vault
|
|
49
|
-
*/
|
|
50
|
-
requestWithdraw(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
51
|
-
/**
|
|
52
|
-
* Cancel a withdrawal request
|
|
53
|
-
*/
|
|
54
|
-
cancelWithdrawRequest(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
55
|
-
/**
|
|
56
|
-
* Withdraw from a drift vault
|
|
57
|
-
*/
|
|
58
|
-
withdraw(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
59
|
-
}
|
|
60
|
-
export {};
|