@5ive-tech/sdk 1.1.14 → 1.1.15

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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Client-agnostic TypeScript SDK for interacting with 5ive DSL programs on Solana.
4
4
 
5
+ ## Mainnet Program ID
6
+
7
+ **Program**: `5ive58PJUPaTyAe7tvU1bvBi25o7oieLLTRsJDoQNJst`
8
+
9
+ The Five VM is deployed and running on Solana mainnet. Use this program ID for production applications.
10
+
5
11
  ## Install
6
12
 
7
13
  ```bash
Binary file
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { validator } from '../validation/index.js';
6
6
  import { VmClusterConfigResolver } from './VmClusterConfigResolver.js';
7
+ import { FIVE_VM_PROGRAM_ID } from '../types.js';
7
8
  /**
8
9
  * Centralized resolver for program IDs across all SDK operations.
9
10
  * Ensures consistent validation and error messaging.
@@ -45,7 +46,7 @@ export class ProgramIdResolver {
45
46
  * ```
46
47
  */
47
48
  static resolve(explicit, options) {
48
- // Precedence: explicit → default → cluster-config
49
+ // Precedence: explicit → default → env → cluster-config → baked
49
50
  let resolved;
50
51
  if (explicit) {
51
52
  resolved = explicit;
@@ -53,12 +54,15 @@ export class ProgramIdResolver {
53
54
  else if (this.defaultProgramId) {
54
55
  resolved = this.defaultProgramId;
55
56
  }
57
+ else if (process.env.FIVE_PROGRAM_ID) {
58
+ resolved = process.env.FIVE_PROGRAM_ID;
59
+ }
56
60
  else {
57
61
  try {
58
62
  resolved = VmClusterConfigResolver.loadClusterConfig().programId;
59
63
  }
60
64
  catch {
61
- resolved = undefined;
65
+ resolved = FIVE_VM_PROGRAM_ID;
62
66
  }
63
67
  }
64
68
  if (!resolved && !options?.allowUndefined) {
@@ -13,13 +13,14 @@ const DEFAULT_FEE_VAULT_SHARD_COUNT = (() => {
13
13
  return 2;
14
14
  }
15
15
  })();
16
+ const MAX_FEE_VAULT_SHARD_COUNT = 8;
16
17
  const FEE_VAULT_NAMESPACE_SEED = Buffer.from([
17
18
  0xff, 0x66, 0x69, 0x76, 0x65, 0x5f, 0x76, 0x6d, 0x5f, 0x66, 0x65, 0x65,
18
19
  0x5f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x31,
19
20
  ]);
20
21
  function clampShardCount(rawCount) {
21
22
  const normalized = rawCount > 0 ? rawCount : DEFAULT_FEE_VAULT_SHARD_COUNT;
22
- return Math.max(1, Math.min(DEFAULT_FEE_VAULT_SHARD_COUNT, normalized));
23
+ return Math.max(1, Math.min(MAX_FEE_VAULT_SHARD_COUNT, normalized));
23
24
  }
24
25
  function normalizeRpcEndpoint(connection) {
25
26
  return String(connection?.rpcEndpoint || connection?._rpcEndpoint || "").toLowerCase();
@@ -17,6 +17,7 @@ const DEFAULT_FEE_VAULT_SHARD_COUNT = (() => {
17
17
  return 2;
18
18
  }
19
19
  })();
20
+ const MAX_FEE_VAULT_SHARD_COUNT = 8;
20
21
  const FEE_VAULT_NAMESPACE_SEED = Buffer.from([
21
22
  0xff, 0x66, 0x69, 0x76, 0x65, 0x5f, 0x76, 0x6d, 0x5f, 0x66, 0x65, 0x65,
22
23
  0x5f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x31,
@@ -25,7 +26,7 @@ const EXECUTE_FEE_HEADER_A = 0xff;
25
26
  const EXECUTE_FEE_HEADER_B = 0x53;
26
27
  function clampShardCount(rawCount) {
27
28
  const normalized = rawCount > 0 ? rawCount : DEFAULT_FEE_VAULT_SHARD_COUNT;
28
- return Math.max(1, Math.min(DEFAULT_FEE_VAULT_SHARD_COUNT, normalized));
29
+ return Math.max(1, Math.min(MAX_FEE_VAULT_SHARD_COUNT, normalized));
29
30
  }
30
31
  async function deriveProgramFeeVault(programId, shardIndex) {
31
32
  const { PublicKey } = await import("@solana/web3.js");
@@ -219,7 +219,7 @@ export class AccountTestFixture {
219
219
  else if (spec.type === 'state' || spec.type === 'mutable') {
220
220
  // Create state/mutable account with initial data
221
221
  const space = 1024; // Default space
222
- const owner = options.fiveVMProgramId || new PublicKey('4Qxf3pbCse2veUgZVMiAm3nWqJrYo2pT4suxHKMJdK1d');
222
+ const owner = options.fiveVMProgramId || new PublicKey('5ive58PJUPaTyAe7tvU1bvBi25o7oieLLTRsJDoQNJst');
223
223
  // Serialize state data if provided
224
224
  let initialData;
225
225
  if (spec.state && spec.type === 'state') {
@@ -242,7 +242,7 @@ export class AccountTestFixture {
242
242
  else if (spec.type === 'init') {
243
243
  // Create init account (will be initialized by script)
244
244
  const space = 1024;
245
- const owner = options.fiveVMProgramId || new PublicKey('4Qxf3pbCse2veUgZVMiAm3nWqJrYo2pT4suxHKMJdK1d');
245
+ const owner = options.fiveVMProgramId || new PublicKey('5ive58PJUPaTyAe7tvU1bvBi25o7oieLLTRsJDoQNJst');
246
246
  publicKey = await manager.createAccount(space, owner);
247
247
  if (options.debug) {
248
248
  console.log(` ${spec.name} (init): ${publicKey.toString()}`);
@@ -256,7 +256,7 @@ export class AccountTestFixture {
256
256
  else {
257
257
  // Create readonly account
258
258
  const space = 0;
259
- const owner = options.fiveVMProgramId || new PublicKey('4Qxf3pbCse2veUgZVMiAm3nWqJrYo2pT4suxHKMJdK1d');
259
+ const owner = options.fiveVMProgramId || new PublicKey('5ive58PJUPaTyAe7tvU1bvBi25o7oieLLTRsJDoQNJst');
260
260
  publicKey = await manager.createAccount(space, owner);
261
261
  if (options.debug) {
262
262
  console.log(` ${spec.name} (readonly): ${publicKey.toString()}`);
package/dist/types.d.ts CHANGED
@@ -224,7 +224,7 @@ export interface CLIError extends Error {
224
224
  details?: any;
225
225
  }
226
226
  /** @deprecated Use ProgramIdResolver with explicit config or cluster config instead. */
227
- export declare const FIVE_VM_PROGRAM_ID = "4Qxf3pbCse2veUgZVMiAm3nWqJrYo2pT4suxHKMJdK1d";
227
+ export declare const FIVE_VM_PROGRAM_ID = "5ive58PJUPaTyAe7tvU1bvBi25o7oieLLTRsJDoQNJst";
228
228
  export interface FiveSDKConfig {
229
229
  network?: string;
230
230
  connection?: any;
package/dist/types.js CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  // ==================== Legacy SDK Types (for compatibility) ====================
5
5
  /** @deprecated Use ProgramIdResolver with explicit config or cluster config instead. */
6
- export const FIVE_VM_PROGRAM_ID = "4Qxf3pbCse2veUgZVMiAm3nWqJrYo2pT4suxHKMJdK1d";
6
+ export const FIVE_VM_PROGRAM_ID = "5ive58PJUPaTyAe7tvU1bvBi25o7oieLLTRsJDoQNJst";
7
7
  export class FiveSDKError extends Error {
8
8
  constructor(message, code, details) {
9
9
  super(message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5ive-tech/sdk",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Client-agnostic TypeScript SDK for Five VM scripts on Solana",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",