@settlemint/sdk-cli 2.5.11-pr837f8ae2 → 2.5.11-prc31ead65

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.
Files changed (3) hide show
  1. package/dist/cli.js +134 -35
  2. package/dist/cli.js.map +10 -10
  3. package/package.json +6 -6
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-pr837f8ae2",
264876
+ version: "2.5.11-prc31ead65",
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-pr837f8ae2",
264931
- "@settlemint/sdk-js": "2.5.11-pr837f8ae2",
264932
- "@settlemint/sdk-utils": "2.5.11-pr837f8ae2",
264933
- "@settlemint/sdk-viem": "2.5.11-pr837f8ae2",
264930
+ "@settlemint/sdk-hasura": "2.5.11-prc31ead65",
264931
+ "@settlemint/sdk-js": "2.5.11-prc31ead65",
264932
+ "@settlemint/sdk-utils": "2.5.11-prc31ead65",
264933
+ "@settlemint/sdk-viem": "2.5.11-prc31ead65",
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-pr837f8ae2"
264950
+ "@settlemint/sdk-js": "2.5.11-prc31ead65"
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,31 @@ 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;
269410
+
269411
+ if (!databaseUrl) {
269412
+ throw new Error('SETTLEMINT_HASURA_DATABASE_URL environment variable is required');
269413
+ }
269414
+
269415
+ export const client = new SQL(databaseUrl);
269416
+ `;
269417
+ } else {
269418
+ template = `import { createPostgresPool } from "${PACKAGE_NAME}/postgres";
269394
269419
 
269395
- export const postgresPool = createPostgresPool(process.env.SETTLEMINT_HASURA_DATABASE_URL ?? "");
269420
+ const databaseUrl = process.env.SETTLEMINT_HASURA_DATABASE_URL;
269421
+
269422
+ if (!databaseUrl) {
269423
+ throw new Error('SETTLEMINT_HASURA_DATABASE_URL environment variable is required');
269424
+ }
269425
+
269426
+ export const postgresPool = createPostgresPool(databaseUrl);
269396
269427
  `;
269397
- await writeTemplate(drizzleTemplate, "/lib/settlemint", "postgres.ts");
269428
+ }
269429
+ await writeTemplate(template, "/lib/settlemint", "postgres.ts");
269398
269430
  const projectDir = await projectRoot3();
269399
269431
  if (!await isPackageInstalled(PACKAGE_NAME, projectDir)) {
269400
269432
  await installDependencies(PACKAGE_NAME, projectDir);
@@ -269431,6 +269463,13 @@ import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-util
269431
269463
 
269432
269464
  const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });
269433
269465
 
269466
+ // Validate required environment variables
269467
+ const portalGraphqlEndpoint = process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT;
269468
+
269469
+ if (!portalGraphqlEndpoint) {
269470
+ throw new Error('SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT environment variable is required');
269471
+ }
269472
+
269434
269473
  export const { client: portalClient, graphql: portalGraphql } = createPortalClient<{
269435
269474
  introspection: introspection;
269436
269475
  disableMasking: true;
@@ -269439,14 +269478,14 @@ export const { client: portalClient, graphql: portalGraphql } = createPortalClie
269439
269478
  JSON: unknown;
269440
269479
  };
269441
269480
  }>({
269442
- instance: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
269481
+ instance: portalGraphqlEndpoint,
269443
269482
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
269444
269483
  }, {
269445
269484
  fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
269446
269485
  });
269447
269486
 
269448
269487
  export const portalWebsocketClient = getWebsocketClient({
269449
- portalGraphqlEndpoint: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
269488
+ portalGraphqlEndpoint: portalGraphqlEndpoint,
269450
269489
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
269451
269490
  });
269452
269491
  `;
@@ -271252,6 +271291,18 @@ import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-util
271252
271291
 
271253
271292
  const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });
271254
271293
 
271294
+ // Validate required environment variables
271295
+ const blockscoutEndpoint = process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT;
271296
+ const blockscoutUiEndpointVar = process.env.SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT;
271297
+
271298
+ if (!blockscoutEndpoint) {
271299
+ throw new Error('SETTLEMINT_BLOCKSCOUT_ENDPOINT environment variable is required');
271300
+ }
271301
+
271302
+ if (!blockscoutUiEndpointVar) {
271303
+ throw new Error('SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT environment variable is required');
271304
+ }
271305
+
271255
271306
  export const { client: blockscoutClient, graphql: blockscoutGraphql } = createBlockscoutClient<{
271256
271307
  introspection: introspection;
271257
271308
  disableMasking: true;
@@ -271274,13 +271325,13 @@ export const { client: blockscoutClient, graphql: blockscoutGraphql } = createBl
271274
271325
  Wei: string;
271275
271326
  };
271276
271327
  }>({
271277
- instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT!,
271328
+ instance: blockscoutEndpoint,
271278
271329
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
271279
271330
  }, {
271280
271331
  fetch: requestLogger(logger, "blockscout", fetch) as typeof fetch,
271281
271332
  });
271282
271333
 
271283
- export const blockscoutUiEndpoint = process.env.SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT!;`;
271334
+ export const blockscoutUiEndpoint = blockscoutUiEndpointVar;`;
271284
271335
  await writeTemplate(template, "/lib/settlemint", "blockscout.ts");
271285
271336
  const projectDir = await projectRoot3();
271286
271337
  if (!await isPackageInstalled(PACKAGE_NAME4, projectDir)) {
@@ -271300,8 +271351,15 @@ async function codegenIpfs(env2) {
271300
271351
  }
271301
271352
  const clientTemplate = `import { createServerIpfsClient } from "${PACKAGE_NAME5}";
271302
271353
 
271354
+ // Validate required environment variables
271355
+ const ipfsApiEndpoint = process.env.SETTLEMINT_IPFS_API_ENDPOINT;
271356
+
271357
+ if (!ipfsApiEndpoint) {
271358
+ throw new Error('SETTLEMINT_IPFS_API_ENDPOINT environment variable is required');
271359
+ }
271360
+
271303
271361
  export const { client } = createServerIpfsClient({
271304
- instance: process.env.SETTLEMINT_IPFS_API_ENDPOINT!,
271362
+ instance: ipfsApiEndpoint,
271305
271363
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
271306
271364
  });`;
271307
271365
  await writeTemplate(clientTemplate, "/lib/settlemint", "ipfs.ts");
@@ -271323,10 +271381,27 @@ async function codegenMinio(env2) {
271323
271381
  }
271324
271382
  const clientTemplate = `import { createServerMinioClient } from "${PACKAGE_NAME6}";
271325
271383
 
271384
+ // Validate required environment variables
271385
+ const minioEndpoint = process.env.SETTLEMINT_MINIO_ENDPOINT;
271386
+ const minioAccessKey = process.env.SETTLEMINT_MINIO_ACCESS_KEY;
271387
+ const minioSecretKey = process.env.SETTLEMINT_MINIO_SECRET_KEY;
271388
+
271389
+ if (!minioEndpoint) {
271390
+ throw new Error('SETTLEMINT_MINIO_ENDPOINT environment variable is required');
271391
+ }
271392
+
271393
+ if (!minioAccessKey) {
271394
+ throw new Error('SETTLEMINT_MINIO_ACCESS_KEY environment variable is required');
271395
+ }
271396
+
271397
+ if (!minioSecretKey) {
271398
+ throw new Error('SETTLEMINT_MINIO_SECRET_KEY environment variable is required');
271399
+ }
271400
+
271326
271401
  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!
271402
+ instance: minioEndpoint,
271403
+ accessKey: minioAccessKey,
271404
+ secretKey: minioSecretKey
271330
271405
  });`;
271331
271406
  await writeTemplate(clientTemplate, "/lib/settlemint", "minio.ts");
271332
271407
  const projectDir = await projectRoot3();
@@ -294125,26 +294200,50 @@ async function codegenViem(env2) {
294125
294200
  const viemTemplate = [`import { ${imports.join(", ")} } from "${PACKAGE_NAME7}";`];
294126
294201
  if (loadBalancerRpcEndpoint) {
294127
294202
  viemTemplate.push(`
294203
+ // Validate required environment variables
294204
+ const blockchainNetwork = process.env.SETTLEMINT_BLOCKCHAIN_NETWORK;
294205
+ const loadBalancerRpcEndpoint = process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT;
294206
+
294207
+ if (!blockchainNetwork) {
294208
+ throw new Error('SETTLEMINT_BLOCKCHAIN_NETWORK environment variable is required');
294209
+ }
294210
+
294211
+ if (!loadBalancerRpcEndpoint) {
294212
+ throw new Error('SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT environment variable is required');
294213
+ }
294214
+
294128
294215
  /**
294129
294216
  * The public client. Use this if you need to read from the blockchain.
294130
294217
  */
294131
294218
  export const publicClient = getPublicClient({
294132
294219
  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!,
294220
+ chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
294221
+ chainName: blockchainNetwork,
294222
+ rpcUrl: loadBalancerRpcEndpoint,
294136
294223
  });`);
294137
294224
  }
294138
294225
  if (blockchainNodeRpcEndpoint) {
294139
294226
  viemTemplate.push(`
294227
+ ${loadBalancerRpcEndpoint ? "" : `// Validate required environment variables
294228
+ const blockchainNetwork = process.env.SETTLEMINT_BLOCKCHAIN_NETWORK;
294229
+ `}const nodeRpcEndpoint = process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT;
294230
+
294231
+ ${loadBalancerRpcEndpoint ? "" : `if (!blockchainNetwork) {
294232
+ throw new Error('SETTLEMINT_BLOCKCHAIN_NETWORK environment variable is required');
294233
+ }
294234
+
294235
+ `}if (!nodeRpcEndpoint) {
294236
+ throw new Error('SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT environment variable is required');
294237
+ }
294238
+
294140
294239
  /**
294141
294240
  * The wallet client. Use this if you need to write to the blockchain.
294142
294241
  */
294143
294242
  export const walletClient = getWalletClient({
294144
294243
  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!,
294244
+ chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
294245
+ chainName: blockchainNetwork,
294246
+ rpcUrl: nodeRpcEndpoint,
294148
294247
  })();
294149
294248
 
294150
294249
  /**
@@ -294153,9 +294252,9 @@ export const walletClient = getWalletClient({
294153
294252
  */
294154
294253
  export const hdWalletClient = getWalletClient({
294155
294254
  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!,
294255
+ chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
294256
+ chainName: blockchainNetwork,
294257
+ rpcUrl: nodeRpcEndpoint,
294159
294258
  });`);
294160
294259
  }
294161
294260
  await writeTemplate(viemTemplate.join(`
@@ -294165,7 +294264,7 @@ export const hdWalletClient = getWalletClient({
294165
294264
 
294166
294265
  // src/commands/codegen.ts
294167
294266
  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([
294267
+ 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
294268
  {
294170
294269
  description: "Generate GraphQL types and queries for your dApp",
294171
294270
  command: "codegen"
@@ -294178,7 +294277,7 @@ function codegenCommand() {
294178
294277
  description: "Generate Viem resources",
294179
294278
  command: "codegen --generate-viem"
294180
294279
  }
294181
- ])).action(async ({ prod, thegraphSubgraphNames, generateViem }) => {
294280
+ ])).action(async ({ prod, thegraphSubgraphNames, generateViem, bun }) => {
294182
294281
  intro("Generating GraphQL types and queries for your dApp");
294183
294282
  const env2 = await loadEnv(true, !!prod);
294184
294283
  if (!Array.isArray(thegraphSubgraphNames)) {
@@ -294202,7 +294301,7 @@ function codegenCommand() {
294202
294301
  }
294203
294302
  if (hasura) {
294204
294303
  note("Generating Hasura resources");
294205
- await codegenHasura(env2);
294304
+ await codegenHasura(env2, bun);
294206
294305
  }
294207
294306
  if (portal) {
294208
294307
  note("Generating Portal resources");
@@ -303999,4 +304098,4 @@ async function sdkCliCommand(argv = process.argv) {
303999
304098
  // src/cli.ts
304000
304099
  sdkCliCommand();
304001
304100
 
304002
- //# debugId=97B619C5D2DF919B64756E2164756E21
304101
+ //# debugId=033046A9458A3F7464756E2164756E21