@settlemint/sdk-cli 2.5.11-main6d937271 → 2.5.11-main80e4ef74

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/dist/cli.js CHANGED
@@ -264873,7 +264873,7 @@ function pruneCurrentEnv(currentEnv, env2) {
264873
264873
  var package_default = {
264874
264874
  name: "@settlemint/sdk-cli",
264875
264875
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
264876
- version: "2.5.11-main6d937271",
264876
+ version: "2.5.11-main80e4ef74",
264877
264877
  type: "module",
264878
264878
  private: false,
264879
264879
  license: "FSL-1.1-MIT",
@@ -264927,10 +264927,10 @@ var package_default = {
264927
264927
  "@inquirer/input": "4.2.1",
264928
264928
  "@inquirer/password": "4.0.17",
264929
264929
  "@inquirer/select": "4.3.1",
264930
- "@settlemint/sdk-hasura": "2.5.11-main6d937271",
264931
- "@settlemint/sdk-js": "2.5.11-main6d937271",
264932
- "@settlemint/sdk-utils": "2.5.11-main6d937271",
264933
- "@settlemint/sdk-viem": "2.5.11-main6d937271",
264930
+ "@settlemint/sdk-hasura": "2.5.11-main80e4ef74",
264931
+ "@settlemint/sdk-js": "2.5.11-main80e4ef74",
264932
+ "@settlemint/sdk-utils": "2.5.11-main80e4ef74",
264933
+ "@settlemint/sdk-viem": "2.5.11-main80e4ef74",
264934
264934
  "@types/node": "24.3.0",
264935
264935
  "@types/semver": "7.7.0",
264936
264936
  "@types/which": "3.0.4",
@@ -264947,7 +264947,7 @@ var package_default = {
264947
264947
  },
264948
264948
  peerDependencies: {
264949
264949
  hardhat: "<= 4",
264950
- "@settlemint/sdk-js": "2.5.11-main6d937271"
264950
+ "@settlemint/sdk-js": "2.5.11-main80e4ef74"
264951
264951
  },
264952
264952
  peerDependenciesMeta: {
264953
264953
  hardhat: {
@@ -269331,7 +269331,7 @@ var getApplicationOrPersonalAccessToken = async ({
269331
269331
 
269332
269332
  // src/commands/codegen/codegen-hasura.ts
269333
269333
  var PACKAGE_NAME = "@settlemint/sdk-hasura";
269334
- async function codegenHasura(env2) {
269334
+ async function codegenHasura(env2, useBun) {
269335
269335
  const gqlEndpoint = env2.SETTLEMINT_HASURA_ENDPOINT;
269336
269336
  const instance = env2.SETTLEMINT_INSTANCE;
269337
269337
  const accessToken = instance === STANDALONE_INSTANCE2 || instance === LOCAL_INSTANCE2 ? undefined : await getApplicationOrPersonalAccessToken({
@@ -269356,6 +269356,18 @@ import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-util
269356
269356
 
269357
269357
  const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });
269358
269358
 
269359
+ // Validate required environment variables
269360
+ const hasuraEndpoint = process.env.SETTLEMINT_HASURA_ENDPOINT;
269361
+ const hasuraAdminSecret = process.env.SETTLEMINT_HASURA_ADMIN_SECRET;
269362
+
269363
+ if (!hasuraEndpoint) {
269364
+ throw new Error('SETTLEMINT_HASURA_ENDPOINT environment variable is required');
269365
+ }
269366
+
269367
+ if (!hasuraAdminSecret) {
269368
+ throw new Error('SETTLEMINT_HASURA_ADMIN_SECRET environment variable is required');
269369
+ }
269370
+
269359
269371
  export const { client: hasuraClient, graphql: hasuraGraphql } = createHasuraClient<{
269360
269372
  introspection: introspection;
269361
269373
  disableMasking: true;
@@ -269372,17 +269384,17 @@ export const { client: hasuraClient, graphql: hasuraGraphql } = createHasuraClie
269372
269384
  geography: string;
269373
269385
  };
269374
269386
  }>({
269375
- instance: process.env.SETTLEMINT_HASURA_ENDPOINT!,
269387
+ instance: hasuraEndpoint,
269376
269388
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
269377
- adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET!,
269389
+ adminSecret: hasuraAdminSecret,
269378
269390
  }, {
269379
269391
  fetch: requestLogger(logger, "hasura", fetch) as typeof fetch,
269380
269392
  });
269381
269393
 
269382
269394
  export const hasuraMetadataClient = createHasuraMetadataClient({
269383
- instance: process.env.SETTLEMINT_HASURA_ENDPOINT!,
269395
+ instance: hasuraEndpoint,
269384
269396
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
269385
- adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET!,
269397
+ adminSecret: hasuraAdminSecret,
269386
269398
  }, logger);`;
269387
269399
  await writeTemplate(hasuraTemplate, "/lib/settlemint", "hasura.ts");
269388
269400
  } else {
@@ -269390,11 +269402,39 @@ export const hasuraMetadataClient = createHasuraMetadataClient({
269390
269402
  }
269391
269403
  const databaseUrl = env2.SETTLEMINT_HASURA_DATABASE_URL;
269392
269404
  if (databaseUrl) {
269393
- const drizzleTemplate = `import { createPostgresPool } from "${PACKAGE_NAME}/postgres";
269405
+ let template;
269406
+ if (useBun) {
269407
+ template = `import { SQL } from 'bun';
269408
+
269409
+ const databaseUrl = process.env.SETTLEMINT_HASURA_DATABASE_URL;
269394
269410
 
269395
- export const postgresPool = createPostgresPool(process.env.SETTLEMINT_HASURA_DATABASE_URL ?? "");
269411
+ if (!databaseUrl) {
269412
+ throw new Error('SETTLEMINT_HASURA_DATABASE_URL environment variable is required');
269413
+ }
269414
+
269415
+ export const client = new SQL({
269416
+ url: databaseUrl,
269417
+
269418
+ // Connection pool settings (matching PostgreSQL pool configuration)
269419
+ max: 10, // Maximum connections in pool
269420
+ idleTimeout: 30, // Close idle connections after 30 seconds
269421
+ connectionTimeout: 5, // Timeout when establishing new connections (5 seconds)
269422
+ maxLifetime: 0, // Connection lifetime in seconds (0 = forever)
269423
+ });
269396
269424
  `;
269397
- await writeTemplate(drizzleTemplate, "/lib/settlemint", "postgres.ts");
269425
+ } else {
269426
+ template = `import { createPostgresPool } from "${PACKAGE_NAME}/postgres";
269427
+
269428
+ const databaseUrl = process.env.SETTLEMINT_HASURA_DATABASE_URL;
269429
+
269430
+ if (!databaseUrl) {
269431
+ throw new Error('SETTLEMINT_HASURA_DATABASE_URL environment variable is required');
269432
+ }
269433
+
269434
+ export const postgresPool = createPostgresPool(databaseUrl);
269435
+ `;
269436
+ }
269437
+ await writeTemplate(template, "/lib/settlemint", "postgres.ts");
269398
269438
  const projectDir = await projectRoot3();
269399
269439
  if (!await isPackageInstalled(PACKAGE_NAME, projectDir)) {
269400
269440
  await installDependencies(PACKAGE_NAME, projectDir);
@@ -269431,6 +269471,13 @@ import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-util
269431
269471
 
269432
269472
  const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });
269433
269473
 
269474
+ // Validate required environment variables
269475
+ const portalGraphqlEndpoint = process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT;
269476
+
269477
+ if (!portalGraphqlEndpoint) {
269478
+ throw new Error('SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT environment variable is required');
269479
+ }
269480
+
269434
269481
  export const { client: portalClient, graphql: portalGraphql } = createPortalClient<{
269435
269482
  introspection: introspection;
269436
269483
  disableMasking: true;
@@ -269439,14 +269486,14 @@ export const { client: portalClient, graphql: portalGraphql } = createPortalClie
269439
269486
  JSON: unknown;
269440
269487
  };
269441
269488
  }>({
269442
- instance: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
269489
+ instance: portalGraphqlEndpoint,
269443
269490
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
269444
269491
  }, {
269445
269492
  fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
269446
269493
  });
269447
269494
 
269448
269495
  export const portalWebsocketClient = getWebsocketClient({
269449
- portalGraphqlEndpoint: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
269496
+ portalGraphqlEndpoint: portalGraphqlEndpoint,
269450
269497
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
269451
269498
  });
269452
269499
  `;
@@ -271252,6 +271299,18 @@ import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-util
271252
271299
 
271253
271300
  const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });
271254
271301
 
271302
+ // Validate required environment variables
271303
+ const blockscoutEndpoint = process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT;
271304
+ const blockscoutUiEndpointVar = process.env.SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT;
271305
+
271306
+ if (!blockscoutEndpoint) {
271307
+ throw new Error('SETTLEMINT_BLOCKSCOUT_ENDPOINT environment variable is required');
271308
+ }
271309
+
271310
+ if (!blockscoutUiEndpointVar) {
271311
+ throw new Error('SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT environment variable is required');
271312
+ }
271313
+
271255
271314
  export const { client: blockscoutClient, graphql: blockscoutGraphql } = createBlockscoutClient<{
271256
271315
  introspection: introspection;
271257
271316
  disableMasking: true;
@@ -271274,13 +271333,13 @@ export const { client: blockscoutClient, graphql: blockscoutGraphql } = createBl
271274
271333
  Wei: string;
271275
271334
  };
271276
271335
  }>({
271277
- instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT!,
271336
+ instance: blockscoutEndpoint,
271278
271337
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
271279
271338
  }, {
271280
271339
  fetch: requestLogger(logger, "blockscout", fetch) as typeof fetch,
271281
271340
  });
271282
271341
 
271283
- export const blockscoutUiEndpoint = process.env.SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT!;`;
271342
+ export const blockscoutUiEndpoint = blockscoutUiEndpointVar;`;
271284
271343
  await writeTemplate(template, "/lib/settlemint", "blockscout.ts");
271285
271344
  const projectDir = await projectRoot3();
271286
271345
  if (!await isPackageInstalled(PACKAGE_NAME4, projectDir)) {
@@ -271300,8 +271359,15 @@ async function codegenIpfs(env2) {
271300
271359
  }
271301
271360
  const clientTemplate = `import { createServerIpfsClient } from "${PACKAGE_NAME5}";
271302
271361
 
271362
+ // Validate required environment variables
271363
+ const ipfsApiEndpoint = process.env.SETTLEMINT_IPFS_API_ENDPOINT;
271364
+
271365
+ if (!ipfsApiEndpoint) {
271366
+ throw new Error('SETTLEMINT_IPFS_API_ENDPOINT environment variable is required');
271367
+ }
271368
+
271303
271369
  export const { client } = createServerIpfsClient({
271304
- instance: process.env.SETTLEMINT_IPFS_API_ENDPOINT!,
271370
+ instance: ipfsApiEndpoint,
271305
271371
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
271306
271372
  });`;
271307
271373
  await writeTemplate(clientTemplate, "/lib/settlemint", "ipfs.ts");
@@ -271323,10 +271389,27 @@ async function codegenMinio(env2) {
271323
271389
  }
271324
271390
  const clientTemplate = `import { createServerMinioClient } from "${PACKAGE_NAME6}";
271325
271391
 
271392
+ // Validate required environment variables
271393
+ const minioEndpoint = process.env.SETTLEMINT_MINIO_ENDPOINT;
271394
+ const minioAccessKey = process.env.SETTLEMINT_MINIO_ACCESS_KEY;
271395
+ const minioSecretKey = process.env.SETTLEMINT_MINIO_SECRET_KEY;
271396
+
271397
+ if (!minioEndpoint) {
271398
+ throw new Error('SETTLEMINT_MINIO_ENDPOINT environment variable is required');
271399
+ }
271400
+
271401
+ if (!minioAccessKey) {
271402
+ throw new Error('SETTLEMINT_MINIO_ACCESS_KEY environment variable is required');
271403
+ }
271404
+
271405
+ if (!minioSecretKey) {
271406
+ throw new Error('SETTLEMINT_MINIO_SECRET_KEY environment variable is required');
271407
+ }
271408
+
271326
271409
  export const { client } = createServerMinioClient({
271327
- instance: process.env.SETTLEMINT_MINIO_ENDPOINT!,
271328
- accessKey: process.env.SETTLEMINT_MINIO_ACCESS_KEY!,
271329
- secretKey: process.env.SETTLEMINT_MINIO_SECRET_KEY!
271410
+ instance: minioEndpoint,
271411
+ accessKey: minioAccessKey,
271412
+ secretKey: minioSecretKey
271330
271413
  });`;
271331
271414
  await writeTemplate(clientTemplate, "/lib/settlemint", "minio.ts");
271332
271415
  const projectDir = await projectRoot3();
@@ -294125,26 +294208,50 @@ async function codegenViem(env2) {
294125
294208
  const viemTemplate = [`import { ${imports.join(", ")} } from "${PACKAGE_NAME7}";`];
294126
294209
  if (loadBalancerRpcEndpoint) {
294127
294210
  viemTemplate.push(`
294211
+ // Validate required environment variables
294212
+ const blockchainNetwork = process.env.SETTLEMINT_BLOCKCHAIN_NETWORK;
294213
+ const loadBalancerRpcEndpoint = process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT;
294214
+
294215
+ if (!blockchainNetwork) {
294216
+ throw new Error('SETTLEMINT_BLOCKCHAIN_NETWORK environment variable is required');
294217
+ }
294218
+
294219
+ if (!loadBalancerRpcEndpoint) {
294220
+ throw new Error('SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT environment variable is required');
294221
+ }
294222
+
294128
294223
  /**
294129
294224
  * The public client. Use this if you need to read from the blockchain.
294130
294225
  */
294131
294226
  export const publicClient = getPublicClient({
294132
294227
  accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
294133
- chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!" : `"${chainId}"`},
294134
- chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
294135
- rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,
294228
+ chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
294229
+ chainName: blockchainNetwork,
294230
+ rpcUrl: loadBalancerRpcEndpoint,
294136
294231
  });`);
294137
294232
  }
294138
294233
  if (blockchainNodeRpcEndpoint) {
294139
294234
  viemTemplate.push(`
294235
+ ${loadBalancerRpcEndpoint ? "" : `// Validate required environment variables
294236
+ const blockchainNetwork = process.env.SETTLEMINT_BLOCKCHAIN_NETWORK;
294237
+ `}const nodeRpcEndpoint = process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT;
294238
+
294239
+ ${loadBalancerRpcEndpoint ? "" : `if (!blockchainNetwork) {
294240
+ throw new Error('SETTLEMINT_BLOCKCHAIN_NETWORK environment variable is required');
294241
+ }
294242
+
294243
+ `}if (!nodeRpcEndpoint) {
294244
+ throw new Error('SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT environment variable is required');
294245
+ }
294246
+
294140
294247
  /**
294141
294248
  * The wallet client. Use this if you need to write to the blockchain.
294142
294249
  */
294143
294250
  export const walletClient = getWalletClient({
294144
294251
  accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
294145
- chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!" : `"${chainId}"`},
294146
- chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
294147
- rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT!,
294252
+ chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
294253
+ chainName: blockchainNetwork,
294254
+ rpcUrl: nodeRpcEndpoint,
294148
294255
  })();
294149
294256
 
294150
294257
  /**
@@ -294153,9 +294260,9 @@ export const walletClient = getWalletClient({
294153
294260
  */
294154
294261
  export const hdWalletClient = getWalletClient({
294155
294262
  accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
294156
- chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!" : `"${chainId}"`},
294157
- chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
294158
- rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT!,
294263
+ chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
294264
+ chainName: blockchainNetwork,
294265
+ rpcUrl: nodeRpcEndpoint,
294159
294266
  });`);
294160
294267
  }
294161
294268
  await writeTemplate(viemTemplate.join(`
@@ -294165,7 +294272,7 @@ export const hdWalletClient = getWalletClient({
294165
294272
 
294166
294273
  // src/commands/codegen.ts
294167
294274
  function codegenCommand() {
294168
- return new Command("codegen").option("--prod", "Connect to your production environment").option("--thegraph-subgraph-names <subgraph-names...>", "The name(s) of the TheGraph subgraph(s) to generate (skip if you want to generate all)").option("--generate-viem", "Generate Viem resources").description("Generate GraphQL and REST types and queries").usage(createExamples([
294275
+ return new Command("codegen").option("--prod", "Connect to your production environment").option("--thegraph-subgraph-names <subgraph-names...>", "The name(s) of the TheGraph subgraph(s) to generate (skip if you want to generate all)").option("--generate-viem", "Generate Viem resources").option("--bun", "Generate Bun SQL code instead of PostgreSQL pool for Hasura").description("Generate GraphQL and REST types and queries").usage(createExamples([
294169
294276
  {
294170
294277
  description: "Generate GraphQL types and queries for your dApp",
294171
294278
  command: "codegen"
@@ -294178,7 +294285,7 @@ function codegenCommand() {
294178
294285
  description: "Generate Viem resources",
294179
294286
  command: "codegen --generate-viem"
294180
294287
  }
294181
- ])).action(async ({ prod, thegraphSubgraphNames, generateViem }) => {
294288
+ ])).action(async ({ prod, thegraphSubgraphNames, generateViem, bun }) => {
294182
294289
  intro("Generating GraphQL types and queries for your dApp");
294183
294290
  const env2 = await loadEnv(true, !!prod);
294184
294291
  if (!Array.isArray(thegraphSubgraphNames)) {
@@ -294202,7 +294309,7 @@ function codegenCommand() {
294202
294309
  }
294203
294310
  if (hasura) {
294204
294311
  note("Generating Hasura resources");
294205
- await codegenHasura(env2);
294312
+ await codegenHasura(env2, bun);
294206
294313
  }
294207
294314
  if (portal) {
294208
294315
  note("Generating Portal resources");
@@ -303999,4 +304106,4 @@ async function sdkCliCommand(argv = process.argv) {
303999
304106
  // src/cli.ts
304000
304107
  sdkCliCommand();
304001
304108
 
304002
- //# debugId=A8AA8E8F2D95CA6964756E2164756E21
304109
+ //# debugId=9A2E1CDB8EAC684964756E2164756E21