@interest-protocol/xcore-sdk 1.0.0
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 +58 -0
- package/dist/constants.d.ts +45 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6224 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6208 -0
- package/dist/index.mjs.map +1 -0
- package/dist/ledger.d.ts +100 -0
- package/dist/ledger.d.ts.map +1 -0
- package/dist/ledger.types.d.ts +144 -0
- package/dist/ledger.types.d.ts.map +1 -0
- package/dist/xcore.d.ts +59 -0
- package/dist/xcore.d.ts.map +1 -0
- package/dist/xcore.types.d.ts +147 -0
- package/dist/xcore.types.d.ts.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @lattice/xcore-sdk
|
|
2
|
+
|
|
3
|
+
SDK for the multi-tenant balance ledger with dWallet management.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { XCore, ChainId } from '@lattice/xcore-sdk';
|
|
15
|
+
|
|
16
|
+
const xcore = new XCore({
|
|
17
|
+
suiClient,
|
|
18
|
+
packageId: XCORE_PACKAGE_ID,
|
|
19
|
+
xcoreSharedObjectData,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Initialize app (admin only)
|
|
23
|
+
const tx = xcore.initApp({
|
|
24
|
+
adminCapId,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Add wallet for an app
|
|
28
|
+
const tx = xcore.addWallet({
|
|
29
|
+
adminCapId,
|
|
30
|
+
chainId: ChainId.Solana,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Mint presign for faster signing
|
|
34
|
+
const tx = xcore.mintPresign({
|
|
35
|
+
walletKey: 0n,
|
|
36
|
+
fee: presignFee,
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Chain IDs
|
|
41
|
+
|
|
42
|
+
| Chain | ID |
|
|
43
|
+
|-------|-----|
|
|
44
|
+
| Solana | 1 |
|
|
45
|
+
| EVM | 2 |
|
|
46
|
+
| Sui | 3 |
|
|
47
|
+
|
|
48
|
+
## Development
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bun run build # Build package
|
|
52
|
+
bun run test # Run tests
|
|
53
|
+
bun run lint # Run linter
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Documentation
|
|
57
|
+
|
|
58
|
+
See [../CLAUDE.md](../CLAUDE.md) for SDK architecture patterns.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const MAINNET_PACKAGE_ID = "0x0966345c144f5c8daec0560b2d8ed054ed704db5d0d75fb29801aca7ac88977d";
|
|
2
|
+
export declare const INIT_CAP_OBJECT_ID = "0x53eedc121c129cfbc7328ec4b3e9b66e999b70e094c486f5cd04343c08a1bb08";
|
|
3
|
+
export declare const ADMIN_CAP_OBJECT_ID = "0x661289883a00671cff63d4260099bf48035032c6703e2d3754dfca2c66742de4";
|
|
4
|
+
export declare const UPGRADE_CAP_OBJECT_ID = "0xf641094313f8bf4b785de6c5f34cd0f7d19faebfa77b9b97d635f4e7d840d8cf";
|
|
5
|
+
export declare const XCORE_OBJECT_ID = "0xc316782b3129c2ff5cb39947b13484757cc12d35cc7ee480b2dbf17ba71ade60";
|
|
6
|
+
export declare const XCORE_INITIAL_SHARED_VERSION = "781617913";
|
|
7
|
+
export declare const UPGRADE_MANAGER_OBJECT_ID = "0x1fc6795ed996067fd8e5755c65c10cb68374a862ee3ff969584a665b3af01e53";
|
|
8
|
+
export declare const DISPLAY_MANAGER_OBJECT_ID = "0xd98d4a88a8c62dbfd8ba5777e7a6bd225fc9109db9972aca96f384e99ecb4fb3";
|
|
9
|
+
export declare const Modules: {
|
|
10
|
+
readonly XCore: "xcore";
|
|
11
|
+
readonly Events: "events";
|
|
12
|
+
};
|
|
13
|
+
export declare const Functions: {
|
|
14
|
+
readonly Initialize: "initialize";
|
|
15
|
+
readonly InitApp: "init_app";
|
|
16
|
+
readonly AddWallet: "add_wallet";
|
|
17
|
+
readonly IncrementBalance: "increment_balance";
|
|
18
|
+
readonly DecrementBalance: "decrement_balance";
|
|
19
|
+
readonly Sign: "sign";
|
|
20
|
+
readonly MintPresign: "mint_presign";
|
|
21
|
+
readonly AddIkaBalance: "add_ika_balance";
|
|
22
|
+
readonly AddSuiBalance: "add_sui_balance";
|
|
23
|
+
readonly UserBalance: "user_balance";
|
|
24
|
+
readonly AddAllowedChain: "add_allowed_chain";
|
|
25
|
+
readonly RemoveAllowedChain: "remove_allowed_chain";
|
|
26
|
+
readonly PauseApp: "pause_app";
|
|
27
|
+
readonly UnpauseApp: "unpause_app";
|
|
28
|
+
};
|
|
29
|
+
export declare const ChainId: {
|
|
30
|
+
readonly Solana: 1;
|
|
31
|
+
readonly Evm: 2;
|
|
32
|
+
readonly Sui: 3;
|
|
33
|
+
};
|
|
34
|
+
export type ChainId = (typeof ChainId)[keyof typeof ChainId];
|
|
35
|
+
export declare const MaxTokenLength: {
|
|
36
|
+
readonly 1: 32n;
|
|
37
|
+
readonly 2: 20n;
|
|
38
|
+
readonly 3: 128n;
|
|
39
|
+
};
|
|
40
|
+
export declare const XCORE_SHARED_OBJECT_DATA: {
|
|
41
|
+
readonly objectId: "0xc316782b3129c2ff5cb39947b13484757cc12d35cc7ee480b2dbf17ba71ade60";
|
|
42
|
+
readonly initialSharedVersion: "781617913";
|
|
43
|
+
};
|
|
44
|
+
export declare const IKA_COIN_TYPE = "0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA";
|
|
45
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,uEACyC,CAAC;AAEzE,eAAO,MAAM,kBAAkB,uEACyC,CAAC;AAEzE,eAAO,MAAM,mBAAmB,uEACwC,CAAC;AAEzE,eAAO,MAAM,qBAAqB,uEACsC,CAAC;AAEzE,eAAO,MAAM,eAAe,uEAAuE,CAAC;AAEpG,eAAO,MAAM,4BAA4B,cAAc,CAAC;AAExD,eAAO,MAAM,yBAAyB,uEACkC,CAAC;AAEzE,eAAO,MAAM,yBAAyB,uEACkC,CAAC;AAEzE,eAAO,MAAM,OAAO;;;CAGV,CAAC;AAEX,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;CAeZ,CAAC;AAEX,eAAO,MAAM,OAAO;;;;CAIV,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAE7D,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX,eAAO,MAAM,aAAa,iFACwD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC"}
|