Skip to content

Commit ea9fbcb

Browse files
committed
✨ Bolt Typescript SDK
1 parent 8a39a53 commit ea9fbcb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+13866
-13
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
clients/bolt-sdk/idl/world.ts
2+
.anchor
3+
target

.eslintrc.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
env:
2+
browser: true
3+
es2021: true
4+
extends:
5+
- standard-with-typescript
6+
- plugin:prettier/recommended
7+
plugins:
8+
- prettier
9+
ignorePatterns:
10+
- "**/idl/world.ts"
11+
parser: "@typescript-eslint/parser"
12+
parserOptions:
13+
ecmaVersion: latest
14+
sourceType: module
15+
project: [./tsconfig.json]
16+
rules:
17+
"@typescript-eslint/strict-boolean-expressions":
18+
- error
19+
- allowNullableObject: true
20+
"@typescript-eslint/return-await":
21+
- error
22+
- in-try-catch
23+
"@typescript-eslint/explicit-function-return-type": "off"
24+
"@typescript-eslint/restrict-template-expressions": "off"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
target
66
**/*.rs.bk
77
node_modules
8+
clients/sdk/node_modules
89
test-ledger
910
.yarn
1011
**/test-ledger

clients/bolt-sdk/.crates/.crates.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[v1]
2+
"anchor-cli 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["anchor"]
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"installs":{"anchor-cli 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)":{"version_req":"0.29.0","bins":["anchor"],"features":[],"all_features":false,"no_default_features":false,"profile":"release","target":"aarch64-apple-darwin","rustc":"rustc 1.73.0 (cc66ad468 2023-10-03)\nbinary: rustc\ncommit-hash: cc66ad468955717ab92600c770da8c1601a4ff33\ncommit-date: 2023-10-03\nhost: aarch64-apple-darwin\nrelease: 1.73.0\nLLVM version: 17.0.2\n"}}}

clients/bolt-sdk/.crates/bin/anchor

18.1 MB
Binary file not shown.

clients/bolt-sdk/.solitarc.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const path = require('path');
2+
const programDir = path.join(__dirname, '../../', 'programs', 'world');
3+
const idlDir = path.join(__dirname, 'idl');
4+
const sdkDir = path.join(__dirname, 'src', 'generated');
5+
const binaryInstallDir = path.join(__dirname, '.crates');
6+
7+
module.exports = {
8+
idlGenerator: 'anchor',
9+
programName: 'world',
10+
programId: 'WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n',
11+
idlDir,
12+
sdkDir,
13+
binaryInstallDir,
14+
programDir,
15+
};

clients/bolt-sdk/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# BOLT SDK
2+
3+
This Typescript sdk provides a convenient interface and methods for interacting with bolt.
4+
5+
## Installation
6+
7+
To install the bolt sdk, run the following command:
8+
9+
```bash
10+
npm install bolt-sdk
11+
```
12+
13+
## Contributing
14+
15+
The community is encouraged to contribute to the Soar SDK.
16+
17+
Fixes and features are always welcome! Please feel free to submit a PR for review.
18+
19+
### Tests.
20+
21+
Test files are located in `client/tests/*`. To run the tests, enter `anchor test` from the root directory of the repository.

clients/bolt-sdk/idl/world.json

+266
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
{
2+
"version": "0.0.1",
3+
"name": "world",
4+
"instructions": [
5+
{
6+
"name": "initializeRegistry",
7+
"accounts": [
8+
{
9+
"name": "registry",
10+
"isMut": true,
11+
"isSigner": false
12+
},
13+
{
14+
"name": "payer",
15+
"isMut": true,
16+
"isSigner": true
17+
},
18+
{
19+
"name": "systemProgram",
20+
"isMut": false,
21+
"isSigner": false
22+
}
23+
],
24+
"args": []
25+
},
26+
{
27+
"name": "initializeNewWorld",
28+
"accounts": [
29+
{
30+
"name": "payer",
31+
"isMut": true,
32+
"isSigner": true
33+
},
34+
{
35+
"name": "world",
36+
"isMut": true,
37+
"isSigner": false
38+
},
39+
{
40+
"name": "registry",
41+
"isMut": true,
42+
"isSigner": false
43+
},
44+
{
45+
"name": "systemProgram",
46+
"isMut": false,
47+
"isSigner": false
48+
}
49+
],
50+
"args": []
51+
},
52+
{
53+
"name": "addEntity",
54+
"accounts": [
55+
{
56+
"name": "payer",
57+
"isMut": true,
58+
"isSigner": true
59+
},
60+
{
61+
"name": "entity",
62+
"isMut": true,
63+
"isSigner": false
64+
},
65+
{
66+
"name": "world",
67+
"isMut": true,
68+
"isSigner": false
69+
},
70+
{
71+
"name": "systemProgram",
72+
"isMut": false,
73+
"isSigner": false
74+
}
75+
],
76+
"args": []
77+
},
78+
{
79+
"name": "initializeComponent",
80+
"accounts": [
81+
{
82+
"name": "payer",
83+
"isMut": true,
84+
"isSigner": true
85+
},
86+
{
87+
"name": "data",
88+
"isMut": true,
89+
"isSigner": false
90+
},
91+
{
92+
"name": "entity",
93+
"isMut": false,
94+
"isSigner": false
95+
},
96+
{
97+
"name": "componentProgram",
98+
"isMut": false,
99+
"isSigner": false
100+
},
101+
{
102+
"name": "systemProgram",
103+
"isMut": false,
104+
"isSigner": false
105+
}
106+
],
107+
"args": []
108+
},
109+
{
110+
"name": "apply",
111+
"accounts": [
112+
{
113+
"name": "componentProgram",
114+
"isMut": false,
115+
"isSigner": false
116+
},
117+
{
118+
"name": "boltSystem",
119+
"isMut": false,
120+
"isSigner": false
121+
},
122+
{
123+
"name": "boltComponent",
124+
"isMut": true,
125+
"isSigner": false
126+
}
127+
],
128+
"args": [
129+
{
130+
"name": "args",
131+
"type": "bytes"
132+
}
133+
]
134+
},
135+
{
136+
"name": "apply2",
137+
"accounts": [
138+
{
139+
"name": "boltSystem",
140+
"isMut": false,
141+
"isSigner": false
142+
},
143+
{
144+
"name": "componentProgram1",
145+
"isMut": false,
146+
"isSigner": false
147+
},
148+
{
149+
"name": "boltComponent1",
150+
"isMut": true,
151+
"isSigner": false
152+
},
153+
{
154+
"name": "componentProgram2",
155+
"isMut": false,
156+
"isSigner": false
157+
},
158+
{
159+
"name": "boltComponent2",
160+
"isMut": true,
161+
"isSigner": false
162+
}
163+
],
164+
"args": [
165+
{
166+
"name": "args",
167+
"type": "bytes"
168+
}
169+
]
170+
},
171+
{
172+
"name": "apply3",
173+
"accounts": [
174+
{
175+
"name": "boltSystem",
176+
"isMut": false,
177+
"isSigner": false
178+
},
179+
{
180+
"name": "componentProgram1",
181+
"isMut": false,
182+
"isSigner": false
183+
},
184+
{
185+
"name": "boltComponent1",
186+
"isMut": true,
187+
"isSigner": false
188+
},
189+
{
190+
"name": "componentProgram2",
191+
"isMut": false,
192+
"isSigner": false
193+
},
194+
{
195+
"name": "boltComponent2",
196+
"isMut": true,
197+
"isSigner": false
198+
},
199+
{
200+
"name": "componentProgram3",
201+
"isMut": false,
202+
"isSigner": false
203+
},
204+
{
205+
"name": "boltComponent3",
206+
"isMut": true,
207+
"isSigner": false
208+
}
209+
],
210+
"args": [
211+
{
212+
"name": "args",
213+
"type": "bytes"
214+
}
215+
]
216+
}
217+
],
218+
"accounts": [
219+
{
220+
"name": "Registry",
221+
"type": {
222+
"kind": "struct",
223+
"fields": [
224+
{
225+
"name": "worlds",
226+
"type": "u64"
227+
}
228+
]
229+
}
230+
},
231+
{
232+
"name": "World",
233+
"type": {
234+
"kind": "struct",
235+
"fields": [
236+
{
237+
"name": "id",
238+
"type": "u64"
239+
},
240+
{
241+
"name": "entities",
242+
"type": "u64"
243+
}
244+
]
245+
}
246+
},
247+
{
248+
"name": "Entity",
249+
"type": {
250+
"kind": "struct",
251+
"fields": [
252+
{
253+
"name": "id",
254+
"type": "u64"
255+
}
256+
]
257+
}
258+
}
259+
],
260+
"metadata": {
261+
"address": "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n",
262+
"origin": "anchor",
263+
"binaryVersion": "0.29.0",
264+
"libVersion": "0.29.0"
265+
}
266+
}
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/// <reference types="node" />
2+
import * as beet from "@metaplex-foundation/beet";
3+
import * as web3 from "@solana/web3.js";
4+
import * as beetSolana from "@metaplex-foundation/beet-solana";
5+
export interface EntityArgs {
6+
id: beet.bignum;
7+
}
8+
export declare const entityDiscriminator: number[];
9+
export declare class Entity implements EntityArgs {
10+
readonly id: beet.bignum;
11+
private constructor();
12+
static fromArgs(args: EntityArgs): Entity;
13+
static fromAccountInfo(accountInfo: web3.AccountInfo<Buffer>, offset?: number): [Entity, number];
14+
static fromAccountAddress(connection: web3.Connection, address: web3.PublicKey, commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig): Promise<Entity>;
15+
static gpaBuilder(programId?: web3.PublicKey): beetSolana.GpaBuilder<{
16+
accountDiscriminator: any;
17+
id: any;
18+
}>;
19+
static deserialize(buf: Buffer, offset?: number): [Entity, number];
20+
serialize(): [Buffer, number];
21+
static get byteSize(): number;
22+
static getMinimumBalanceForRentExemption(connection: web3.Connection, commitment?: web3.Commitment): Promise<number>;
23+
static hasCorrectByteSize(buf: Buffer, offset?: number): boolean;
24+
pretty(): {
25+
id: number | {
26+
toNumber: () => number;
27+
};
28+
};
29+
}
30+
export declare const entityBeet: beet.BeetStruct<Entity, EntityArgs & {
31+
accountDiscriminator: number[];
32+
}>;
33+
//# sourceMappingURL=Entity.d.ts.map

clients/bolt-sdk/lib/accounts/Entity.d.ts.map

+1
Original file line numberDiff line numberDiff line change

0 commit comments

Comments
 (0)