forked from magicblock-labs/bolt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Bolt Typescript SDK (magicblock-labs#1)
* ✨ Bolt Typescript SDK * ♻️ Code Refactoring * ✨ Add Pdas derivation * ♻️ Code Refactoring * ♻️ Code Refactoring
- Loading branch information
1 parent
8a39a53
commit 873d5ba
Showing
88 changed files
with
13,938 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
clients/bolt-sdk/idl/world.ts | ||
.anchor | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
env: | ||
browser: true | ||
es2021: true | ||
extends: | ||
- standard-with-typescript | ||
- plugin:prettier/recommended | ||
plugins: | ||
- prettier | ||
ignorePatterns: | ||
- "**/idl/world.ts" | ||
parser: "@typescript-eslint/parser" | ||
parserOptions: | ||
ecmaVersion: latest | ||
sourceType: module | ||
project: [./tsconfig.json] | ||
rules: | ||
"@typescript-eslint/strict-boolean-expressions": | ||
- error | ||
- allowNullableObject: true | ||
"@typescript-eslint/return-await": | ||
- error | ||
- in-try-catch | ||
"@typescript-eslint/explicit-function-return-type": "off" | ||
"@typescript-eslint/restrict-template-expressions": "off" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
target | ||
**/*.rs.bk | ||
node_modules | ||
clients/sdk/node_modules | ||
test-ledger | ||
.yarn | ||
**/test-ledger | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[v1] | ||
"anchor-cli 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["anchor"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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"}}} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const path = require("path"); | ||
const programDir = path.join(__dirname, "../../", "programs", "world"); | ||
const idlDir = path.join(__dirname, "idl"); | ||
const sdkDir = path.join(__dirname, "src", "generated"); | ||
const binaryInstallDir = path.join(__dirname, ".crates"); | ||
|
||
module.exports = { | ||
idlGenerator: "anchor", | ||
programName: "world", | ||
programId: "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n", | ||
idlDir, | ||
sdkDir, | ||
binaryInstallDir, | ||
programDir, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# BOLT SDK | ||
|
||
This Typescript sdk provides a convenient interface and methods for interacting with bolt. | ||
|
||
## Installation | ||
|
||
To install the bolt sdk, run the following command: | ||
|
||
```bash | ||
npm install bolt-sdk | ||
``` | ||
|
||
## Contributing | ||
|
||
The community is encouraged to contribute to the Soar SDK. | ||
|
||
Fixes and features are always welcome! Please feel free to submit a PR for review. | ||
|
||
### Tests. | ||
|
||
Test files are located in `client/tests/*`. To run the tests, enter `anchor test` from the root directory of the repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,273 @@ | ||
{ | ||
"version": "0.0.1", | ||
"name": "world", | ||
"instructions": [ | ||
{ | ||
"name": "initializeRegistry", | ||
"accounts": [ | ||
{ | ||
"name": "registry", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "payer", | ||
"isMut": true, | ||
"isSigner": true | ||
}, | ||
{ | ||
"name": "systemProgram", | ||
"isMut": false, | ||
"isSigner": false | ||
} | ||
], | ||
"args": [] | ||
}, | ||
{ | ||
"name": "initializeNewWorld", | ||
"accounts": [ | ||
{ | ||
"name": "payer", | ||
"isMut": true, | ||
"isSigner": true | ||
}, | ||
{ | ||
"name": "world", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "registry", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "systemProgram", | ||
"isMut": false, | ||
"isSigner": false | ||
} | ||
], | ||
"args": [] | ||
}, | ||
{ | ||
"name": "addEntity", | ||
"accounts": [ | ||
{ | ||
"name": "payer", | ||
"isMut": true, | ||
"isSigner": true | ||
}, | ||
{ | ||
"name": "entity", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "world", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "systemProgram", | ||
"isMut": false, | ||
"isSigner": false | ||
} | ||
], | ||
"args": [ | ||
{ | ||
"name": "extraSeed", | ||
"type": { | ||
"option": "string" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "initializeComponent", | ||
"accounts": [ | ||
{ | ||
"name": "payer", | ||
"isMut": true, | ||
"isSigner": true | ||
}, | ||
{ | ||
"name": "data", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "entity", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "componentProgram", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "systemProgram", | ||
"isMut": false, | ||
"isSigner": false | ||
} | ||
], | ||
"args": [] | ||
}, | ||
{ | ||
"name": "apply", | ||
"accounts": [ | ||
{ | ||
"name": "componentProgram", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "boltSystem", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "boltComponent", | ||
"isMut": true, | ||
"isSigner": false | ||
} | ||
], | ||
"args": [ | ||
{ | ||
"name": "args", | ||
"type": "bytes" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "apply2", | ||
"accounts": [ | ||
{ | ||
"name": "boltSystem", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "componentProgram1", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "boltComponent1", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "componentProgram2", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "boltComponent2", | ||
"isMut": true, | ||
"isSigner": false | ||
} | ||
], | ||
"args": [ | ||
{ | ||
"name": "args", | ||
"type": "bytes" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "apply3", | ||
"accounts": [ | ||
{ | ||
"name": "boltSystem", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "componentProgram1", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "boltComponent1", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "componentProgram2", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "boltComponent2", | ||
"isMut": true, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "componentProgram3", | ||
"isMut": false, | ||
"isSigner": false | ||
}, | ||
{ | ||
"name": "boltComponent3", | ||
"isMut": true, | ||
"isSigner": false | ||
} | ||
], | ||
"args": [ | ||
{ | ||
"name": "args", | ||
"type": "bytes" | ||
} | ||
] | ||
} | ||
], | ||
"accounts": [ | ||
{ | ||
"name": "Registry", | ||
"type": { | ||
"kind": "struct", | ||
"fields": [ | ||
{ | ||
"name": "worlds", | ||
"type": "u64" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"name": "World", | ||
"type": { | ||
"kind": "struct", | ||
"fields": [ | ||
{ | ||
"name": "id", | ||
"type": "u64" | ||
}, | ||
{ | ||
"name": "entities", | ||
"type": "u64" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"name": "Entity", | ||
"type": { | ||
"kind": "struct", | ||
"fields": [ | ||
{ | ||
"name": "id", | ||
"type": "u64" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"address": "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n", | ||
"origin": "anchor", | ||
"binaryVersion": "0.29.0", | ||
"libVersion": "0.29.0" | ||
} | ||
} |
Oops, something went wrong.