@xitadel-fi/sdk 0.1.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/README.md +90 -0
- package/dist/sdk/src/constants.d.ts +11 -0
- package/dist/sdk/src/constants.js +15 -0
- package/dist/sdk/src/index.d.ts +3 -0
- package/dist/sdk/src/index.js +12 -0
- package/dist/sdk/src/meteora.d.ts +1229 -0
- package/dist/sdk/src/meteora.js +1231 -0
- package/dist/sdk/src/program.d.ts +433 -0
- package/dist/sdk/src/program.js +825 -0
- package/dist/sdk/src/utils.d.ts +17 -0
- package/dist/sdk/src/utils.js +75 -0
- package/dist/target/idl/xitadel.json +4978 -0
- package/dist/target/types/xitadel.d.ts +4984 -0
- package/dist/target/types/xitadel.js +2 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Xitadel SDK
|
|
2
|
+
|
|
3
|
+
This SDK provides a TypeScript interface for interacting with the Xitadel program on Solana.
|
|
4
|
+
|
|
5
|
+
## Current Status
|
|
6
|
+
|
|
7
|
+
The SDK is currently set up for local development with the Anchor workspace. To use it:
|
|
8
|
+
|
|
9
|
+
1. First, build the Anchor program to generate types:
|
|
10
|
+
```bash
|
|
11
|
+
anchor build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. Link the SDK locally:
|
|
15
|
+
```bash
|
|
16
|
+
cd sdk
|
|
17
|
+
npm link
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. In your project:
|
|
21
|
+
```bash
|
|
22
|
+
npm link @xitadel/sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Development Setup
|
|
26
|
+
|
|
27
|
+
1. The SDK uses path aliases to import Anchor-generated types:
|
|
28
|
+
```typescript
|
|
29
|
+
import type { Xitadel } from "@program/xitadel";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. TypeScript is configured to resolve these imports in `tsconfig.json`:
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"paths": {
|
|
36
|
+
"@program/*": ["../target/types/*"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
3. Make sure to build the Anchor program before working on the SDK:
|
|
42
|
+
```bash
|
|
43
|
+
anchor build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Known Issues
|
|
47
|
+
|
|
48
|
+
1. The current setup has some type issues with the Anchor workspace that need to be resolved. We're tracking these issues and will update the SDK once they're fixed.
|
|
49
|
+
|
|
50
|
+
2. For now, you can use the SDK by importing the workspace directly in your tests:
|
|
51
|
+
```typescript
|
|
52
|
+
import { Program } from "@coral-xyz/anchor";
|
|
53
|
+
import { Xitadel } from "../target/types/xitadel";
|
|
54
|
+
|
|
55
|
+
const program = anchor.workspace.Xitadel as Program<Xitadel>;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Next Steps
|
|
59
|
+
|
|
60
|
+
1. Resolve type issues with Anchor workspace integration
|
|
61
|
+
2. Add proper error handling and type definitions
|
|
62
|
+
3. Add more instruction handlers
|
|
63
|
+
4. Add comprehensive tests
|
|
64
|
+
5. Publish to npm
|
|
65
|
+
|
|
66
|
+
## Contributing
|
|
67
|
+
|
|
68
|
+
1. Build the program:
|
|
69
|
+
```bash
|
|
70
|
+
anchor build
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. Install dependencies:
|
|
74
|
+
```bash
|
|
75
|
+
npm install
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. Build the SDK:
|
|
79
|
+
```bash
|
|
80
|
+
npm run build
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
4. Run tests:
|
|
84
|
+
```bash
|
|
85
|
+
npm test
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
ISC
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
export declare const DEV_VAULT_PROGRAM_ID: PublicKey;
|
|
3
|
+
export declare const DEV_CP_AMM_PROGRAM_ID: PublicKey;
|
|
4
|
+
export declare const METADATA_PROGRAM_ID: PublicKey;
|
|
5
|
+
export declare const AMM_CONFIG_ID: PublicKey;
|
|
6
|
+
export declare const AMM_CONFIG_ID_B: PublicKey;
|
|
7
|
+
export declare const LTT_DECIMALS = 3;
|
|
8
|
+
export declare const POOL_AUTHORITY_SEED: Buffer<ArrayBuffer>;
|
|
9
|
+
export declare const EVENT_AUTHORITY_SEED: Buffer<ArrayBuffer>;
|
|
10
|
+
export declare const POSITION_SEED: Buffer<ArrayBuffer>;
|
|
11
|
+
export declare const POSITION_NFT_ACCOUNT_SEED: Buffer<ArrayBuffer>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POSITION_NFT_ACCOUNT_SEED = exports.POSITION_SEED = exports.EVENT_AUTHORITY_SEED = exports.POOL_AUTHORITY_SEED = exports.LTT_DECIMALS = exports.AMM_CONFIG_ID_B = exports.AMM_CONFIG_ID = exports.METADATA_PROGRAM_ID = exports.DEV_CP_AMM_PROGRAM_ID = exports.DEV_VAULT_PROGRAM_ID = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
exports.DEV_VAULT_PROGRAM_ID = new web3_js_1.PublicKey('24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi');
|
|
6
|
+
exports.DEV_CP_AMM_PROGRAM_ID = new web3_js_1.PublicKey('cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG');
|
|
7
|
+
exports.METADATA_PROGRAM_ID = new web3_js_1.PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s');
|
|
8
|
+
exports.AMM_CONFIG_ID = new web3_js_1.PublicKey('csiJGCGb1GgeUJJfC72h4hhkLp8uqnAGrbsJZ3y5Ui7');
|
|
9
|
+
exports.AMM_CONFIG_ID_B = new web3_js_1.PublicKey('6qKYJYp9xiHoN76F2ik8AvTU8FX6M8rqhMaxav8uEsJD');
|
|
10
|
+
exports.LTT_DECIMALS = 3;
|
|
11
|
+
// CP AMM related constants
|
|
12
|
+
exports.POOL_AUTHORITY_SEED = Buffer.from('pool_authority');
|
|
13
|
+
exports.EVENT_AUTHORITY_SEED = Buffer.from('__event_authority');
|
|
14
|
+
exports.POSITION_SEED = Buffer.from('position');
|
|
15
|
+
exports.POSITION_NFT_ACCOUNT_SEED = Buffer.from('position_nft_account');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveMintMetadata = exports.deriveProtocolFeeKey = exports.getVaultPda = exports.derivePoolKey = exports.getSecondKey = exports.getFirstKey = exports.XitadelProgram = void 0;
|
|
4
|
+
var program_1 = require("./program");
|
|
5
|
+
Object.defineProperty(exports, "XitadelProgram", { enumerable: true, get: function () { return program_1.XitadelProgram; } });
|
|
6
|
+
var utils_1 = require("./utils");
|
|
7
|
+
Object.defineProperty(exports, "getFirstKey", { enumerable: true, get: function () { return utils_1.getFirstKey; } });
|
|
8
|
+
Object.defineProperty(exports, "getSecondKey", { enumerable: true, get: function () { return utils_1.getSecondKey; } });
|
|
9
|
+
Object.defineProperty(exports, "derivePoolKey", { enumerable: true, get: function () { return utils_1.derivePoolKey; } });
|
|
10
|
+
Object.defineProperty(exports, "getVaultPda", { enumerable: true, get: function () { return utils_1.getVaultPda; } });
|
|
11
|
+
Object.defineProperty(exports, "deriveProtocolFeeKey", { enumerable: true, get: function () { return utils_1.deriveProtocolFeeKey; } });
|
|
12
|
+
Object.defineProperty(exports, "deriveMintMetadata", { enumerable: true, get: function () { return utils_1.deriveMintMetadata; } });
|