@layr-labs/ecloud-sdk 1.0.0-dev.1 → 1.0.0-dev.2
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/VERSION +2 -2
- package/dist/billing.cjs +17 -45
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +1 -3
- package/dist/billing.d.ts +1 -3
- package/dist/billing.js +17 -45
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +17 -39
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +4 -4
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +17 -39
- package/dist/browser.js.map +1 -1
- package/dist/{compute-Bn6KcW3x.d.cts → compute-Ckyn8ils.d.cts} +1 -1
- package/dist/{compute-Do2t0Fo8.d.ts → compute-Cnw6rwSB.d.ts} +1 -1
- package/dist/compute.cjs +9 -7
- package/dist/compute.cjs.map +1 -1
- package/dist/compute.d.cts +2 -2
- package/dist/compute.d.ts +2 -2
- package/dist/compute.js +9 -7
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-BRamdfGn.d.ts → helpers-DZL2bg9p.d.cts} +1 -5
- package/dist/{helpers-CfsfcGJO.d.cts → helpers-Dj2ME5rp.d.ts} +1 -5
- package/dist/{index-BbH7ZCIu.d.cts → index-U2vKBrry.d.cts} +1 -15
- package/dist/{index-BbH7ZCIu.d.ts → index-U2vKBrry.d.ts} +1 -15
- package/dist/index.cjs +18 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +18 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EnvironmentConfig,
|
|
1
|
+
import { E as EnvironmentConfig, a4 as SubscriptionStatus, f as BillingEnvironmentConfig, Y as ProductID, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, y as GetSubscriptionOptions, Z as ProductSubscriptionResponse, G as GasEstimate, F as Logger } from './index-U2vKBrry.cjs';
|
|
2
2
|
import { Address, Hex, WalletClient, PublicClient, SignAuthorizationReturnType, Chain } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -733,8 +733,6 @@ interface BillingApiClientOptions {
|
|
|
733
733
|
* When false (default), uses EIP-712 typed data signatures for each request.
|
|
734
734
|
*/
|
|
735
735
|
useSession?: boolean;
|
|
736
|
-
/** Log request/response details to stderr */
|
|
737
|
-
verbose?: boolean;
|
|
738
736
|
}
|
|
739
737
|
/**
|
|
740
738
|
* BillingAPI Client for managing product subscriptions.
|
|
@@ -798,8 +796,6 @@ declare class BillingApiClient {
|
|
|
798
796
|
createSubscription(productId?: ProductID, options?: CreateSubscriptionOptions): Promise<CreateSubscriptionResponse>;
|
|
799
797
|
getSubscription(productId?: ProductID, options?: GetSubscriptionOptions): Promise<ProductSubscriptionResponse>;
|
|
800
798
|
cancelSubscription(productId?: ProductID): Promise<void>;
|
|
801
|
-
getPaymentMethods(): Promise<PaymentMethodsResponse>;
|
|
802
|
-
purchaseCredits(amountCents: number, paymentMethodId?: string): Promise<CreditPurchaseResponse>;
|
|
803
799
|
/**
|
|
804
800
|
* Make an authenticated request to the billing API
|
|
805
801
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EnvironmentConfig,
|
|
1
|
+
import { E as EnvironmentConfig, a4 as SubscriptionStatus, f as BillingEnvironmentConfig, Y as ProductID, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, y as GetSubscriptionOptions, Z as ProductSubscriptionResponse, G as GasEstimate, F as Logger } from './index-U2vKBrry.js';
|
|
2
2
|
import { Address, Hex, WalletClient, PublicClient, SignAuthorizationReturnType, Chain } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -733,8 +733,6 @@ interface BillingApiClientOptions {
|
|
|
733
733
|
* When false (default), uses EIP-712 typed data signatures for each request.
|
|
734
734
|
*/
|
|
735
735
|
useSession?: boolean;
|
|
736
|
-
/** Log request/response details to stderr */
|
|
737
|
-
verbose?: boolean;
|
|
738
736
|
}
|
|
739
737
|
/**
|
|
740
738
|
* BillingAPI Client for managing product subscriptions.
|
|
@@ -798,8 +796,6 @@ declare class BillingApiClient {
|
|
|
798
796
|
createSubscription(productId?: ProductID, options?: CreateSubscriptionOptions): Promise<CreateSubscriptionResponse>;
|
|
799
797
|
getSubscription(productId?: ProductID, options?: GetSubscriptionOptions): Promise<ProductSubscriptionResponse>;
|
|
800
798
|
cancelSubscription(productId?: ProductID): Promise<void>;
|
|
801
|
-
getPaymentMethods(): Promise<PaymentMethodsResponse>;
|
|
802
|
-
purchaseCredits(amountCents: number, paymentMethodId?: string): Promise<CreditPurchaseResponse>;
|
|
803
799
|
/**
|
|
804
800
|
* Make an authenticated request to the billing API
|
|
805
801
|
*
|
|
@@ -749,20 +749,6 @@ interface SubscriptionOpts {
|
|
|
749
749
|
/** URL to redirect to if checkout is canceled */
|
|
750
750
|
cancelUrl?: string;
|
|
751
751
|
}
|
|
752
|
-
interface PaymentMethod {
|
|
753
|
-
id: string;
|
|
754
|
-
stripePaymentMethodId: string;
|
|
755
|
-
createdAt: string;
|
|
756
|
-
}
|
|
757
|
-
interface PaymentMethodsResponse {
|
|
758
|
-
paymentMethods: PaymentMethod[];
|
|
759
|
-
}
|
|
760
|
-
interface CreditPurchaseResponse {
|
|
761
|
-
purchaseId?: string;
|
|
762
|
-
checkoutSessionId?: string;
|
|
763
|
-
checkoutUrl?: string;
|
|
764
|
-
amountCents: string;
|
|
765
|
-
}
|
|
766
752
|
interface BillingEnvironmentConfig {
|
|
767
753
|
billingApiServerURL: string;
|
|
768
754
|
}
|
|
@@ -790,4 +776,4 @@ interface SequentialDeployResult {
|
|
|
790
776
|
};
|
|
791
777
|
}
|
|
792
778
|
|
|
793
|
-
export { type
|
|
779
|
+
export { type SendTransactionOptions as $, type AppId as A, type BatchedDeployResult as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EnvironmentConfig as E, type Logger as F, type GasEstimate as G, type PaymentIssueResponse as H, type ImageDigestResult as I, type PrepareDeployBatchOptions as J, type PrepareDeployFromVerifiableBuildOpts as K, type LifecycleOpts as L, type PrepareDeployOpts as M, type NoActiveSubscriptionResponse as N, type PrepareUpgradeBatchOptions as O, type ParsedEnvironment as P, type PrepareUpgradeFromVerifiableBuildOpts as Q, type PrepareUpgradeOpts as R, type PreparedDeploy as S, type PreparedDeployBatch as T, type PreparedDeployData as U, type PreparedUpgrade as V, type PreparedUpgradeBatch as W, type PreparedUpgradeData as X, type ProductID as Y, type ProductSubscriptionResponse as Z, type Release as _, type AlreadyActiveResponse as a, type SequentialDeployResult as a0, type SubscribeResponse as a1, type SubscriptionLineItem as a2, type SubscriptionOpts as a3, type SubscriptionStatus as a4, type SuspendOptions as a5, type UndelegateOptions as a6, type UpgradeAppOptions as a7, type UpgradeAppOpts as a8, calculateAppID as a9, getBlockTimestamps as aA, deployApp as aa, estimateTransactionGas as ab, executeDeployBatch as ac, executeDeployBatched as ad, executeDeploySequential as ae, executeUpgradeBatch as af, formatETH as ag, getActiveAppCount as ah, getAllAppsByDeveloper as ai, getAppsByBillingAccount as aj, getAppsByCreator as ak, getAppsByDeveloper as al, getBillingType as am, getMaxActiveAppsPerUser as an, isDelegated as ao, type logVisibility as ap, noopLogger as aq, prepareDeployBatch as ar, prepareUpgradeBatch as as, sendAndWaitForTransaction as at, supportsEIP5792 as au, supportsEIP7702 as av, suspend as aw, undelegate as ax, upgradeApp as ay, getAppLatestReleaseBlockNumbers as az, type AppConfig as b, type AppProfile as c, type AppProfileResponse as d, type AppRecord as e, type BillingEnvironmentConfig as f, type CancelResponse as g, type CancelSuccessResponse as h, type ChainID as i, type CheckoutCreatedResponse as j, type CreateSubscriptionOptions as k, type CreateSubscriptionResponse as l, type DeployAppOpts as m, type DeployOptions as n, type DeployProgressCallback as o, type DeployResult as p, type DeployStep as q, type DockerImageConfig as r, type EstimateGasOptions as s, type ExecuteDeployBatchedOptions as t, type ExecuteDeployResult as u, type ExecuteDeploySequentialOptions as v, type ExecuteUpgradeResult as w, type GasOpts as x, type GetSubscriptionOptions as y, type IsDelegatedOptions as z };
|
|
@@ -749,20 +749,6 @@ interface SubscriptionOpts {
|
|
|
749
749
|
/** URL to redirect to if checkout is canceled */
|
|
750
750
|
cancelUrl?: string;
|
|
751
751
|
}
|
|
752
|
-
interface PaymentMethod {
|
|
753
|
-
id: string;
|
|
754
|
-
stripePaymentMethodId: string;
|
|
755
|
-
createdAt: string;
|
|
756
|
-
}
|
|
757
|
-
interface PaymentMethodsResponse {
|
|
758
|
-
paymentMethods: PaymentMethod[];
|
|
759
|
-
}
|
|
760
|
-
interface CreditPurchaseResponse {
|
|
761
|
-
purchaseId?: string;
|
|
762
|
-
checkoutSessionId?: string;
|
|
763
|
-
checkoutUrl?: string;
|
|
764
|
-
amountCents: string;
|
|
765
|
-
}
|
|
766
752
|
interface BillingEnvironmentConfig {
|
|
767
753
|
billingApiServerURL: string;
|
|
768
754
|
}
|
|
@@ -790,4 +776,4 @@ interface SequentialDeployResult {
|
|
|
790
776
|
};
|
|
791
777
|
}
|
|
792
778
|
|
|
793
|
-
export { type
|
|
779
|
+
export { type SendTransactionOptions as $, type AppId as A, type BatchedDeployResult as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EnvironmentConfig as E, type Logger as F, type GasEstimate as G, type PaymentIssueResponse as H, type ImageDigestResult as I, type PrepareDeployBatchOptions as J, type PrepareDeployFromVerifiableBuildOpts as K, type LifecycleOpts as L, type PrepareDeployOpts as M, type NoActiveSubscriptionResponse as N, type PrepareUpgradeBatchOptions as O, type ParsedEnvironment as P, type PrepareUpgradeFromVerifiableBuildOpts as Q, type PrepareUpgradeOpts as R, type PreparedDeploy as S, type PreparedDeployBatch as T, type PreparedDeployData as U, type PreparedUpgrade as V, type PreparedUpgradeBatch as W, type PreparedUpgradeData as X, type ProductID as Y, type ProductSubscriptionResponse as Z, type Release as _, type AlreadyActiveResponse as a, type SequentialDeployResult as a0, type SubscribeResponse as a1, type SubscriptionLineItem as a2, type SubscriptionOpts as a3, type SubscriptionStatus as a4, type SuspendOptions as a5, type UndelegateOptions as a6, type UpgradeAppOptions as a7, type UpgradeAppOpts as a8, calculateAppID as a9, getBlockTimestamps as aA, deployApp as aa, estimateTransactionGas as ab, executeDeployBatch as ac, executeDeployBatched as ad, executeDeploySequential as ae, executeUpgradeBatch as af, formatETH as ag, getActiveAppCount as ah, getAllAppsByDeveloper as ai, getAppsByBillingAccount as aj, getAppsByCreator as ak, getAppsByDeveloper as al, getBillingType as am, getMaxActiveAppsPerUser as an, isDelegated as ao, type logVisibility as ap, noopLogger as aq, prepareDeployBatch as ar, prepareUpgradeBatch as as, sendAndWaitForTransaction as at, supportsEIP5792 as au, supportsEIP7702 as av, suspend as aw, undelegate as ax, upgradeApp as ay, getAppLatestReleaseBlockNumbers as az, type AppConfig as b, type AppProfile as c, type AppProfileResponse as d, type AppRecord as e, type BillingEnvironmentConfig as f, type CancelResponse as g, type CancelSuccessResponse as h, type ChainID as i, type CheckoutCreatedResponse as j, type CreateSubscriptionOptions as k, type CreateSubscriptionResponse as l, type DeployAppOpts as m, type DeployOptions as n, type DeployProgressCallback as o, type DeployResult as p, type DeployStep as q, type DockerImageConfig as r, type EstimateGasOptions as s, type ExecuteDeployBatchedOptions as t, type ExecuteDeployResult as u, type ExecuteDeploySequentialOptions as v, type ExecuteUpgradeResult as w, type GasOpts as x, type GetSubscriptionOptions as y, type IsDelegatedOptions as z };
|
package/dist/index.cjs
CHANGED
|
@@ -4986,7 +4986,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4986
4986
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4987
4987
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4988
4988
|
function getDefaultClientId() {
|
|
4989
|
-
const version = true ? "1.0.0-dev.
|
|
4989
|
+
const version = true ? "1.0.0-dev.2" : "0.0.0";
|
|
4990
4990
|
return `ecloud-sdk/v${version}`;
|
|
4991
4991
|
}
|
|
4992
4992
|
var UserApiClient = class {
|
|
@@ -5804,6 +5804,12 @@ var CHAIN_ID_TO_ENVIRONMENT = {
|
|
|
5804
5804
|
[SEPOLIA_CHAIN_ID.toString()]: "sepolia",
|
|
5805
5805
|
[MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
|
|
5806
5806
|
};
|
|
5807
|
+
function getApiUrlOverride() {
|
|
5808
|
+
const raw = process.env.ECLOUD_API_URL;
|
|
5809
|
+
if (!raw) return void 0;
|
|
5810
|
+
const trimmed = raw.trim().replace(/\/+$/, "");
|
|
5811
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
5812
|
+
}
|
|
5807
5813
|
function getEnvironmentConfig(environment, chainID) {
|
|
5808
5814
|
const env = ENVIRONMENTS[environment];
|
|
5809
5815
|
if (!env) {
|
|
@@ -5821,15 +5827,11 @@ function getEnvironmentConfig(environment, chainID) {
|
|
|
5821
5827
|
}
|
|
5822
5828
|
}
|
|
5823
5829
|
const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
|
|
5830
|
+
const apiUrlOverride = getApiUrlOverride();
|
|
5824
5831
|
return {
|
|
5825
5832
|
...env,
|
|
5826
5833
|
chainID: BigInt(resolvedChainID),
|
|
5827
|
-
...
|
|
5828
|
-
userApiServerURL: process.env.ECLOUD_USER_API_URL
|
|
5829
|
-
},
|
|
5830
|
-
...process.env.ECLOUD_RPC_URL && {
|
|
5831
|
-
defaultRPCURL: process.env.ECLOUD_RPC_URL
|
|
5832
|
-
}
|
|
5834
|
+
...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {}
|
|
5833
5835
|
};
|
|
5834
5836
|
}
|
|
5835
5837
|
function getBillingEnvironmentConfig(build) {
|
|
@@ -5837,12 +5839,11 @@ function getBillingEnvironmentConfig(build) {
|
|
|
5837
5839
|
if (!config) {
|
|
5838
5840
|
throw new Error(`Unknown billing environment: ${build}`);
|
|
5839
5841
|
}
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
};
|
|
5842
|
+
const apiUrlOverride = getApiUrlOverride();
|
|
5843
|
+
if (apiUrlOverride) {
|
|
5844
|
+
return { billingApiServerURL: apiUrlOverride };
|
|
5845
|
+
}
|
|
5846
|
+
return config;
|
|
5846
5847
|
}
|
|
5847
5848
|
function getBuildType() {
|
|
5848
5849
|
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
@@ -6147,20 +6148,6 @@ var BillingApiClient = class {
|
|
|
6147
6148
|
const endpoint = `${this.config.billingApiServerURL}/products/${productId}/subscription`;
|
|
6148
6149
|
await this.makeAuthenticatedRequest(endpoint, "DELETE", productId);
|
|
6149
6150
|
}
|
|
6150
|
-
async getPaymentMethods() {
|
|
6151
|
-
const endpoint = `${this.config.billingApiServerURL}/v1/payment-methods`;
|
|
6152
|
-
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
6153
|
-
return resp.json();
|
|
6154
|
-
}
|
|
6155
|
-
async purchaseCredits(amountCents, paymentMethodId) {
|
|
6156
|
-
const endpoint = `${this.config.billingApiServerURL}/v1/credits/purchase`;
|
|
6157
|
-
const body = { amountCents };
|
|
6158
|
-
if (paymentMethodId) {
|
|
6159
|
-
body.paymentMethodId = paymentMethodId;
|
|
6160
|
-
}
|
|
6161
|
-
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", body);
|
|
6162
|
-
return resp.json();
|
|
6163
|
-
}
|
|
6164
6151
|
// ==========================================================================
|
|
6165
6152
|
// Internal Methods
|
|
6166
6153
|
// ==========================================================================
|
|
@@ -6170,19 +6157,10 @@ var BillingApiClient = class {
|
|
|
6170
6157
|
* Uses session auth if useSession is true, otherwise uses EIP-712 signature auth.
|
|
6171
6158
|
*/
|
|
6172
6159
|
async makeAuthenticatedRequest(url, method, productId, body) {
|
|
6173
|
-
if (this.
|
|
6174
|
-
|
|
6175
|
-
}
|
|
6176
|
-
const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
|
|
6177
|
-
if (this.options.verbose) {
|
|
6178
|
-
const data = await resp.json();
|
|
6179
|
-
console.debug(`[BillingAPI] Response:`, JSON.stringify(data, null, 2));
|
|
6180
|
-
return {
|
|
6181
|
-
json: async () => data,
|
|
6182
|
-
text: async () => JSON.stringify(data)
|
|
6183
|
-
};
|
|
6160
|
+
if (this.useSession) {
|
|
6161
|
+
return this.makeSessionAuthenticatedRequest(url, method, body);
|
|
6184
6162
|
}
|
|
6185
|
-
return
|
|
6163
|
+
return this.makeSignatureAuthenticatedRequest(url, method, productId, body);
|
|
6186
6164
|
}
|
|
6187
6165
|
/**
|
|
6188
6166
|
* Make a request using session-based authentication (cookies)
|
|
@@ -8371,7 +8349,7 @@ function createBillingModule(config) {
|
|
|
8371
8349
|
const address = walletClient.account.address;
|
|
8372
8350
|
const logger = getLogger(verbose);
|
|
8373
8351
|
const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
|
|
8374
|
-
const billingApi = new BillingApiClient(billingEnvConfig, walletClient
|
|
8352
|
+
const billingApi = new BillingApiClient(billingEnvConfig, walletClient);
|
|
8375
8353
|
const environmentConfig = getEnvironmentConfig(environment);
|
|
8376
8354
|
const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
|
|
8377
8355
|
if (!usdcCreditsAddress) {
|
|
@@ -8535,12 +8513,6 @@ function createBillingModule(config) {
|
|
|
8535
8513
|
};
|
|
8536
8514
|
}
|
|
8537
8515
|
);
|
|
8538
|
-
},
|
|
8539
|
-
async getPaymentMethods() {
|
|
8540
|
-
return billingApi.getPaymentMethods();
|
|
8541
|
-
},
|
|
8542
|
-
async purchaseCredits(amountCents, paymentMethodId) {
|
|
8543
|
-
return billingApi.purchaseCredits(amountCents, paymentMethodId);
|
|
8544
8516
|
}
|
|
8545
8517
|
};
|
|
8546
8518
|
return module2;
|