@5ive-tech/sdk 1.1.3 → 1.1.5
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 +14 -14
- package/dist/assets/vm/five_vm_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 5IVE SDK
|
|
2
2
|
|
|
3
3
|
Client-agnostic TypeScript SDK for interacting with 5ive DSL programs on Solana.
|
|
4
4
|
|
|
@@ -10,13 +10,13 @@ npm install @5ive-tech/sdk @solana/web3.js
|
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
|
-
### 1
|
|
13
|
+
### 1) Compile to `.five`
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
16
|
+
5ive compile src/main.v -o build/my-program.five
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
### 1b
|
|
19
|
+
### 1b) Compile directly with SDK (optional)
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
22
|
import { FiveSDK } from '@5ive-tech/sdk';
|
|
@@ -56,7 +56,7 @@ const multi = await FiveSDK.compileModules(
|
|
|
56
56
|
);
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
### 2
|
|
59
|
+
### 2) Load ABI from `.five`
|
|
60
60
|
|
|
61
61
|
```ts
|
|
62
62
|
import fs from 'fs';
|
|
@@ -66,7 +66,7 @@ const fiveFileText = fs.readFileSync('build/my-program.five', 'utf-8');
|
|
|
66
66
|
const { abi } = await FiveSDK.loadFiveFile(fiveFileText);
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
### 3
|
|
69
|
+
### 3) Configure program ID resolution
|
|
70
70
|
|
|
71
71
|
On-chain instruction generation requires a resolvable Five VM program ID.
|
|
72
72
|
Resolution precedence:
|
|
@@ -81,7 +81,7 @@ import { FiveSDK } from '@5ive-tech/sdk';
|
|
|
81
81
|
FiveSDK.setDefaultProgramId('YourFiveVMProgramIdBase58');
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
### 4
|
|
84
|
+
### 4) Create `FiveProgram`
|
|
85
85
|
|
|
86
86
|
```ts
|
|
87
87
|
import { FiveProgram } from '@5ive-tech/sdk';
|
|
@@ -173,11 +173,11 @@ Recommended send pattern:
|
|
|
173
173
|
3. assert `meta.err` is null
|
|
174
174
|
4. record CU from `meta.computeUnitsConsumed`
|
|
175
175
|
|
|
176
|
-
## Advanced
|
|
176
|
+
## Advanced APIs (Optional)
|
|
177
177
|
|
|
178
178
|
Most builders should use `FiveProgram` first. Use these lower-level APIs when you need finer control.
|
|
179
179
|
|
|
180
|
-
###
|
|
180
|
+
### Local VM testing without RPC
|
|
181
181
|
|
|
182
182
|
```ts
|
|
183
183
|
const run = await FiveSDK.compileAndExecuteLocally(
|
|
@@ -188,7 +188,7 @@ const run = await FiveSDK.compileAndExecuteLocally(
|
|
|
188
188
|
);
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
###
|
|
191
|
+
### Instruction-only generation
|
|
192
192
|
|
|
193
193
|
```ts
|
|
194
194
|
const deploy = await FiveSDK.generateDeployInstruction(bytecode, deployerPubkeyBase58, {
|
|
@@ -205,7 +205,7 @@ const exec = await FiveSDK.generateExecuteInstruction(
|
|
|
205
205
|
);
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
###
|
|
208
|
+
### On-chain convenience helpers
|
|
209
209
|
|
|
210
210
|
```ts
|
|
211
211
|
const deployResult = await FiveSDK.deployToSolana(bytecode, connection, payerKeypair, {
|
|
@@ -223,7 +223,7 @@ const execResult = await FiveSDK.executeOnSolana(
|
|
|
223
223
|
);
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
###
|
|
226
|
+
### Metadata and decoding helpers
|
|
227
227
|
|
|
228
228
|
```ts
|
|
229
229
|
const meta = await FiveSDK.getScriptMetadataWithConnection(scriptAccountBase58, connection);
|
|
@@ -233,14 +233,14 @@ const account = await FiveSDK.fetchAccountAndDeserialize(scriptAccountBase58, co
|
|
|
233
233
|
});
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-
###
|
|
236
|
+
### Namespace helpers (5NS)
|
|
237
237
|
|
|
238
238
|
```ts
|
|
239
239
|
const ns = FiveSDK.canonicalizeNamespace('@acme/payments');
|
|
240
240
|
const derived = await FiveSDK.deriveNamespaceAccounts(ns.canonical, 'YourFiveVMProgramIdBase58');
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
###
|
|
243
|
+
### Test utilities
|
|
244
244
|
|
|
245
245
|
```ts
|
|
246
246
|
import { FiveTestRunner } from '@5ive-tech/sdk';
|
|
Binary file
|