Skip to content

Commit

Permalink
Merge pull request #184 from ardriveapp/alpha
Browse files Browse the repository at this point in the history
chore: release v1.18.0
  • Loading branch information
fedellen authored Sep 27, 2024
2 parents 0d87cfb + 92121cb commit 24d6573
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ npx turbo --help
- `-h, --help` - display help for command
- `--dev` - Enable development endpoints (default: false)
- `-g, --gateway <url>` - Set a custom crypto gateway URL
- `--upload-url <url>` - Set a custom upload service URL
- `--payment-url <url>` - Set a custom payment service URL
- `-t, --token <token>` - Token type for the command or connected wallet (default: "arweave")

- `-w, --wallet-file <filePath>` - Wallet file to use with the action. Formats accepted: JWK.json, KYVE, ETH, or POL private key as a string, or SOL Secret Key as a Uint8Array
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ardrive/turbo-sdk",
"version": "1.17.0",
"version": "1.18.0-alpha.1",
"main": "./lib/cjs/node/index.js",
"types": "./lib/types/node/index.d.ts",
"module": "./lib/esm/node/index.js",
Expand Down
13 changes: 12 additions & 1 deletion src/cli/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,21 @@ export const optionMap = {
alias: '-p, --private-key <key>',
description: 'Private key to use with the action',
},

gateway: {
alias: '-g, --gateway <url>',
description: 'Set a custom crypto gateway URL',
default: undefined,
},
uploadUrl: {
alias: '--upload-url <url>',
description: 'Set a custom upload service URL',
default: undefined,
},
paymentUrl: {
alias: '--payment-url <url>',
description: 'Set a custom payment service URL',
default: undefined,
},
dev: {
alias: '--dev',
description: 'Enable development endpoints',
Expand Down Expand Up @@ -126,6 +135,8 @@ export const globalOptions = [
optionMap.quiet,
optionMap.token,
optionMap.skipConfirmation,
optionMap.paymentUrl,
optionMap.uploadUrl,
];

export const uploadFolderOptions = [
Expand Down
2 changes: 2 additions & 0 deletions src/cli/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export type GlobalOptions = {
quiet: boolean;
skipConfirmation: boolean;
token: string;
paymentUrl: string | undefined;
uploadUrl: string | undefined;
};

export type WalletOptions = GlobalOptions & {
Expand Down
34 changes: 26 additions & 8 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,40 @@ const tokenToDevGatewayMap: Record<TokenType, string> = {
export function configFromOptions(
options: GlobalOptions,
): TurboUnauthenticatedConfiguration {
let config: TurboUnauthenticatedConfiguration = {};

const token = tokenFromOptions(options);

let paymentUrl: string | undefined = undefined;
let uploadUrl: string | undefined = undefined;
let gatewayUrl: string | undefined = undefined;

if (options.dev) {
config = developmentTurboConfiguration;
config.gatewayUrl = tokenToDevGatewayMap[token];
// Use development endpoints
paymentUrl = developmentTurboConfiguration.paymentServiceConfig.url;
uploadUrl = developmentTurboConfiguration.uploadServiceConfig.url;
gatewayUrl = tokenToDevGatewayMap[token];
} else {
config = defaultTurboConfiguration;
// Use default endpoints
paymentUrl = defaultTurboConfiguration.paymentServiceConfig.url;
uploadUrl = defaultTurboConfiguration.uploadServiceConfig.url;
}

// If gateway is provided, override the default or dev gateway
// Override gateway, payment, and upload service default endpoints if provided
if (options.gateway !== undefined) {
config.gatewayUrl = options.gateway;
gatewayUrl = options.gateway;
}
if (options.paymentUrl !== undefined) {
paymentUrl = options.paymentUrl;
}
config.token = token;
if (options.uploadUrl !== undefined) {
uploadUrl = options.uploadUrl;
}

const config = {
paymentServiceConfig: { url: paymentUrl },
uploadServiceConfig: { url: uploadUrl },
gatewayUrl,
token,
};

return config;
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
*/

// AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
export const version = '1.17.0';
export const version = '1.18.0-alpha.1';

0 comments on commit 24d6573

Please sign in to comment.