@settlemint/sdk-cli 2.5.11-pr94870e11 → 2.5.11-pra6b7b4b5
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 +153 -35
- package/dist/cli.js.map +10 -10
- 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-
|
264876
|
+
version: "2.5.11-pra6b7b4b5",
|
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-
|
264931
|
-
"@settlemint/sdk-js": "2.5.11-
|
264932
|
-
"@settlemint/sdk-utils": "2.5.11-
|
264933
|
-
"@settlemint/sdk-viem": "2.5.11-
|
264930
|
+
"@settlemint/sdk-hasura": "2.5.11-pra6b7b4b5",
|
264931
|
+
"@settlemint/sdk-js": "2.5.11-pra6b7b4b5",
|
264932
|
+
"@settlemint/sdk-utils": "2.5.11-pra6b7b4b5",
|
264933
|
+
"@settlemint/sdk-viem": "2.5.11-pra6b7b4b5",
|
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-
|
264950
|
+
"@settlemint/sdk-js": "2.5.11-pra6b7b4b5"
|
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:
|
269387
|
+
instance: hasuraEndpoint,
|
269376
269388
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
269377
|
-
adminSecret:
|
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:
|
269395
|
+
instance: hasuraEndpoint,
|
269384
269396
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
269385
|
-
adminSecret:
|
269397
|
+
adminSecret: hasuraAdminSecret,
|
269386
269398
|
}, logger);`;
|
269387
269399
|
await writeTemplate(hasuraTemplate, "/lib/settlemint", "hasura.ts");
|
269388
269400
|
} else {
|
@@ -269390,11 +269402,50 @@ export const hasuraMetadataClient = createHasuraMetadataClient({
|
|
269390
269402
|
}
|
269391
269403
|
const databaseUrl = env2.SETTLEMINT_HASURA_DATABASE_URL;
|
269392
269404
|
if (databaseUrl) {
|
269393
|
-
|
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
|
-
|
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: 20, // Maximum connections in pool
|
269420
|
+
idleTimeout: 30, // Close idle connections after 30 seconds
|
269421
|
+
connectionTimeout: 5, // Timeout when establishing new connections (5 seconds)
|
269422
|
+
|
269423
|
+
// Optional callbacks for monitoring
|
269424
|
+
onconnect: () => {
|
269425
|
+
if (process.env.NODE_ENV === 'development') {
|
269426
|
+
console.log('[Bun SQL] Connected to database');
|
269427
|
+
}
|
269428
|
+
},
|
269429
|
+
onclose: () => {
|
269430
|
+
if (process.env.NODE_ENV === 'development') {
|
269431
|
+
console.log('[Bun SQL] Connection closed');
|
269432
|
+
}
|
269433
|
+
},
|
269434
|
+
});
|
269435
|
+
`;
|
269436
|
+
} else {
|
269437
|
+
template = `import { createPostgresPool } from "${PACKAGE_NAME}/postgres";
|
269438
|
+
|
269439
|
+
const databaseUrl = process.env.SETTLEMINT_HASURA_DATABASE_URL;
|
269440
|
+
|
269441
|
+
if (!databaseUrl) {
|
269442
|
+
throw new Error('SETTLEMINT_HASURA_DATABASE_URL environment variable is required');
|
269443
|
+
}
|
269444
|
+
|
269445
|
+
export const postgresPool = createPostgresPool(databaseUrl);
|
269396
269446
|
`;
|
269397
|
-
|
269447
|
+
}
|
269448
|
+
await writeTemplate(template, "/lib/settlemint", "postgres.ts");
|
269398
269449
|
const projectDir = await projectRoot3();
|
269399
269450
|
if (!await isPackageInstalled(PACKAGE_NAME, projectDir)) {
|
269400
269451
|
await installDependencies(PACKAGE_NAME, projectDir);
|
@@ -269431,6 +269482,13 @@ import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-util
|
|
269431
269482
|
|
269432
269483
|
const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });
|
269433
269484
|
|
269485
|
+
// Validate required environment variables
|
269486
|
+
const portalGraphqlEndpoint = process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT;
|
269487
|
+
|
269488
|
+
if (!portalGraphqlEndpoint) {
|
269489
|
+
throw new Error('SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT environment variable is required');
|
269490
|
+
}
|
269491
|
+
|
269434
269492
|
export const { client: portalClient, graphql: portalGraphql } = createPortalClient<{
|
269435
269493
|
introspection: introspection;
|
269436
269494
|
disableMasking: true;
|
@@ -269439,14 +269497,14 @@ export const { client: portalClient, graphql: portalGraphql } = createPortalClie
|
|
269439
269497
|
JSON: unknown;
|
269440
269498
|
};
|
269441
269499
|
}>({
|
269442
|
-
instance:
|
269500
|
+
instance: portalGraphqlEndpoint,
|
269443
269501
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
269444
269502
|
}, {
|
269445
269503
|
fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
|
269446
269504
|
});
|
269447
269505
|
|
269448
269506
|
export const portalWebsocketClient = getWebsocketClient({
|
269449
|
-
portalGraphqlEndpoint:
|
269507
|
+
portalGraphqlEndpoint: portalGraphqlEndpoint,
|
269450
269508
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
269451
269509
|
});
|
269452
269510
|
`;
|
@@ -271252,6 +271310,18 @@ import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-util
|
|
271252
271310
|
|
271253
271311
|
const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });
|
271254
271312
|
|
271313
|
+
// Validate required environment variables
|
271314
|
+
const blockscoutEndpoint = process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT;
|
271315
|
+
const blockscoutUiEndpointVar = process.env.SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT;
|
271316
|
+
|
271317
|
+
if (!blockscoutEndpoint) {
|
271318
|
+
throw new Error('SETTLEMINT_BLOCKSCOUT_ENDPOINT environment variable is required');
|
271319
|
+
}
|
271320
|
+
|
271321
|
+
if (!blockscoutUiEndpointVar) {
|
271322
|
+
throw new Error('SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT environment variable is required');
|
271323
|
+
}
|
271324
|
+
|
271255
271325
|
export const { client: blockscoutClient, graphql: blockscoutGraphql } = createBlockscoutClient<{
|
271256
271326
|
introspection: introspection;
|
271257
271327
|
disableMasking: true;
|
@@ -271274,13 +271344,13 @@ export const { client: blockscoutClient, graphql: blockscoutGraphql } = createBl
|
|
271274
271344
|
Wei: string;
|
271275
271345
|
};
|
271276
271346
|
}>({
|
271277
|
-
instance:
|
271347
|
+
instance: blockscoutEndpoint,
|
271278
271348
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
271279
271349
|
}, {
|
271280
271350
|
fetch: requestLogger(logger, "blockscout", fetch) as typeof fetch,
|
271281
271351
|
});
|
271282
271352
|
|
271283
|
-
export const blockscoutUiEndpoint =
|
271353
|
+
export const blockscoutUiEndpoint = blockscoutUiEndpointVar;`;
|
271284
271354
|
await writeTemplate(template, "/lib/settlemint", "blockscout.ts");
|
271285
271355
|
const projectDir = await projectRoot3();
|
271286
271356
|
if (!await isPackageInstalled(PACKAGE_NAME4, projectDir)) {
|
@@ -271300,8 +271370,15 @@ async function codegenIpfs(env2) {
|
|
271300
271370
|
}
|
271301
271371
|
const clientTemplate = `import { createServerIpfsClient } from "${PACKAGE_NAME5}";
|
271302
271372
|
|
271373
|
+
// Validate required environment variables
|
271374
|
+
const ipfsApiEndpoint = process.env.SETTLEMINT_IPFS_API_ENDPOINT;
|
271375
|
+
|
271376
|
+
if (!ipfsApiEndpoint) {
|
271377
|
+
throw new Error('SETTLEMINT_IPFS_API_ENDPOINT environment variable is required');
|
271378
|
+
}
|
271379
|
+
|
271303
271380
|
export const { client } = createServerIpfsClient({
|
271304
|
-
instance:
|
271381
|
+
instance: ipfsApiEndpoint,
|
271305
271382
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
271306
271383
|
});`;
|
271307
271384
|
await writeTemplate(clientTemplate, "/lib/settlemint", "ipfs.ts");
|
@@ -271323,10 +271400,27 @@ async function codegenMinio(env2) {
|
|
271323
271400
|
}
|
271324
271401
|
const clientTemplate = `import { createServerMinioClient } from "${PACKAGE_NAME6}";
|
271325
271402
|
|
271403
|
+
// Validate required environment variables
|
271404
|
+
const minioEndpoint = process.env.SETTLEMINT_MINIO_ENDPOINT;
|
271405
|
+
const minioAccessKey = process.env.SETTLEMINT_MINIO_ACCESS_KEY;
|
271406
|
+
const minioSecretKey = process.env.SETTLEMINT_MINIO_SECRET_KEY;
|
271407
|
+
|
271408
|
+
if (!minioEndpoint) {
|
271409
|
+
throw new Error('SETTLEMINT_MINIO_ENDPOINT environment variable is required');
|
271410
|
+
}
|
271411
|
+
|
271412
|
+
if (!minioAccessKey) {
|
271413
|
+
throw new Error('SETTLEMINT_MINIO_ACCESS_KEY environment variable is required');
|
271414
|
+
}
|
271415
|
+
|
271416
|
+
if (!minioSecretKey) {
|
271417
|
+
throw new Error('SETTLEMINT_MINIO_SECRET_KEY environment variable is required');
|
271418
|
+
}
|
271419
|
+
|
271326
271420
|
export const { client } = createServerMinioClient({
|
271327
|
-
instance:
|
271328
|
-
accessKey:
|
271329
|
-
secretKey:
|
271421
|
+
instance: minioEndpoint,
|
271422
|
+
accessKey: minioAccessKey,
|
271423
|
+
secretKey: minioSecretKey
|
271330
271424
|
});`;
|
271331
271425
|
await writeTemplate(clientTemplate, "/lib/settlemint", "minio.ts");
|
271332
271426
|
const projectDir = await projectRoot3();
|
@@ -294125,26 +294219,50 @@ async function codegenViem(env2) {
|
|
294125
294219
|
const viemTemplate = [`import { ${imports.join(", ")} } from "${PACKAGE_NAME7}";`];
|
294126
294220
|
if (loadBalancerRpcEndpoint) {
|
294127
294221
|
viemTemplate.push(`
|
294222
|
+
// Validate required environment variables
|
294223
|
+
const blockchainNetwork = process.env.SETTLEMINT_BLOCKCHAIN_NETWORK;
|
294224
|
+
const loadBalancerRpcEndpoint = process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT;
|
294225
|
+
|
294226
|
+
if (!blockchainNetwork) {
|
294227
|
+
throw new Error('SETTLEMINT_BLOCKCHAIN_NETWORK environment variable is required');
|
294228
|
+
}
|
294229
|
+
|
294230
|
+
if (!loadBalancerRpcEndpoint) {
|
294231
|
+
throw new Error('SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT environment variable is required');
|
294232
|
+
}
|
294233
|
+
|
294128
294234
|
/**
|
294129
294235
|
* The public client. Use this if you need to read from the blockchain.
|
294130
294236
|
*/
|
294131
294237
|
export const publicClient = getPublicClient({
|
294132
294238
|
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
|
294133
|
-
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID
|
294134
|
-
chainName:
|
294135
|
-
rpcUrl:
|
294239
|
+
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
|
294240
|
+
chainName: blockchainNetwork,
|
294241
|
+
rpcUrl: loadBalancerRpcEndpoint,
|
294136
294242
|
});`);
|
294137
294243
|
}
|
294138
294244
|
if (blockchainNodeRpcEndpoint) {
|
294139
294245
|
viemTemplate.push(`
|
294246
|
+
${loadBalancerRpcEndpoint ? "" : `// Validate required environment variables
|
294247
|
+
const blockchainNetwork = process.env.SETTLEMINT_BLOCKCHAIN_NETWORK;
|
294248
|
+
`}const nodeRpcEndpoint = process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT;
|
294249
|
+
|
294250
|
+
${loadBalancerRpcEndpoint ? "" : `if (!blockchainNetwork) {
|
294251
|
+
throw new Error('SETTLEMINT_BLOCKCHAIN_NETWORK environment variable is required');
|
294252
|
+
}
|
294253
|
+
|
294254
|
+
`}if (!nodeRpcEndpoint) {
|
294255
|
+
throw new Error('SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT environment variable is required');
|
294256
|
+
}
|
294257
|
+
|
294140
294258
|
/**
|
294141
294259
|
* The wallet client. Use this if you need to write to the blockchain.
|
294142
294260
|
*/
|
294143
294261
|
export const walletClient = getWalletClient({
|
294144
294262
|
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
|
294145
|
-
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID
|
294146
|
-
chainName:
|
294147
|
-
rpcUrl:
|
294263
|
+
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
|
294264
|
+
chainName: blockchainNetwork,
|
294265
|
+
rpcUrl: nodeRpcEndpoint,
|
294148
294266
|
})();
|
294149
294267
|
|
294150
294268
|
/**
|
@@ -294153,9 +294271,9 @@ export const walletClient = getWalletClient({
|
|
294153
294271
|
*/
|
294154
294272
|
export const hdWalletClient = getWalletClient({
|
294155
294273
|
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
|
294156
|
-
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID
|
294157
|
-
chainName:
|
294158
|
-
rpcUrl:
|
294274
|
+
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID" : `"${chainId}"`},
|
294275
|
+
chainName: blockchainNetwork,
|
294276
|
+
rpcUrl: nodeRpcEndpoint,
|
294159
294277
|
});`);
|
294160
294278
|
}
|
294161
294279
|
await writeTemplate(viemTemplate.join(`
|
@@ -294165,7 +294283,7 @@ export const hdWalletClient = getWalletClient({
|
|
294165
294283
|
|
294166
294284
|
// src/commands/codegen.ts
|
294167
294285
|
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([
|
294286
|
+
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
294287
|
{
|
294170
294288
|
description: "Generate GraphQL types and queries for your dApp",
|
294171
294289
|
command: "codegen"
|
@@ -294178,7 +294296,7 @@ function codegenCommand() {
|
|
294178
294296
|
description: "Generate Viem resources",
|
294179
294297
|
command: "codegen --generate-viem"
|
294180
294298
|
}
|
294181
|
-
])).action(async ({ prod, thegraphSubgraphNames, generateViem }) => {
|
294299
|
+
])).action(async ({ prod, thegraphSubgraphNames, generateViem, bun }) => {
|
294182
294300
|
intro("Generating GraphQL types and queries for your dApp");
|
294183
294301
|
const env2 = await loadEnv(true, !!prod);
|
294184
294302
|
if (!Array.isArray(thegraphSubgraphNames)) {
|
@@ -294202,7 +294320,7 @@ function codegenCommand() {
|
|
294202
294320
|
}
|
294203
294321
|
if (hasura) {
|
294204
294322
|
note("Generating Hasura resources");
|
294205
|
-
await codegenHasura(env2);
|
294323
|
+
await codegenHasura(env2, bun);
|
294206
294324
|
}
|
294207
294325
|
if (portal) {
|
294208
294326
|
note("Generating Portal resources");
|
@@ -303999,4 +304117,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
303999
304117
|
// src/cli.ts
|
304000
304118
|
sdkCliCommand();
|
304001
304119
|
|
304002
|
-
//# debugId=
|
304120
|
+
//# debugId=9FD31F4ECB84690564756E2164756E21
|