@layr-labs/ecloud-sdk 1.0.0-dev.3 → 1.0.0-dev.4
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 +98 -28
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +11 -3
- package/dist/billing.d.ts +11 -3
- package/dist/billing.js +98 -28
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +8 -4
- 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 +9 -5
- package/dist/browser.js.map +1 -1
- package/dist/{compute-BbgMH6Ef.d.ts → compute-B6SZ0VQG.d.ts} +1 -1
- package/dist/{compute-yAqGf5hM.d.cts → compute-BK4PxhNh.d.cts} +1 -1
- package/dist/compute.cjs +8 -4
- 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 -5
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-CnlJ5yPE.d.cts → helpers-F7CeDSVX.d.ts} +3 -2
- package/dist/{helpers-GWlLS3gz.d.ts → helpers-Qq5W-qNn.d.cts} +3 -2
- package/dist/{index-Bac4HjC0.d.cts → index-BoCE0hIh.d.cts} +2 -0
- package/dist/{index-Bac4HjC0.d.ts → index-BoCE0hIh.d.ts} +2 -0
- package/dist/index.cjs +67 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +67 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tools/tls-keygen-linux-amd64 +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as ComputeModule } from './compute-
|
|
2
|
-
export { a as ComputeModuleConfig, b as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, d as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, g as encodeTerminateAppData, h as getAvailableTemplates, l as logs } from './compute-
|
|
1
|
+
import { C as ComputeModule } from './compute-BK4PxhNh.cjs';
|
|
2
|
+
export { a as ComputeModuleConfig, b as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, d as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, g as encodeTerminateAppData, h as getAvailableTemplates, l as logs } from './compute-BK4PxhNh.cjs';
|
|
3
3
|
import { BillingModule } from './billing.cjs';
|
|
4
|
-
export { BillingModuleConfig, createBillingModule } from './billing.cjs';
|
|
4
|
+
export { BillingChain, BillingModuleConfig, TopUpInfo, TopUpOpts, TopUpResult, createBillingModule } from './billing.cjs';
|
|
5
5
|
import { WalletClient, PublicClient, Address, Hex } from 'viem';
|
|
6
6
|
export { AttestClient, AttestClientConfig, JwtProvider } from './attest.cjs';
|
|
7
|
-
import { V as PreparedDeploy, G as GasEstimate, E as EnvironmentConfig, H as Logger, q as DeployResult, Y as PreparedUpgrade, A as AppId } from './index-
|
|
8
|
-
export { a as AlreadyActiveResponse, c as AppProfile, d as AppProfileResponse, e as AppRecord, f as BillingEnvironmentConfig, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, m as CreditPurchaseResponse, n as DeployAppOpts, o as DeployOptions, p as DeployProgressCallback, r as DeployStep, s as DockerImageConfig, t as EstimateGasOptions, v as ExecuteDeployResult, x as ExecuteUpgradeResult, y as GasOpts, z as GetSubscriptionOptions, I as ImageDigestResult, L as LifecycleOpts, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, J as PaymentIssueResponse, K as PaymentMethod, M as PaymentMethodsResponse, Q as PrepareDeployFromVerifiableBuildOpts, R as PrepareDeployOpts, T as PrepareUpgradeFromVerifiableBuildOpts, U as PrepareUpgradeOpts, X as PreparedDeployData, _ as PreparedUpgradeData, $ as ProductID, a0 as ProductSubscriptionResponse, a1 as Release, a3 as SequentialDeployResult, a4 as SubscribeResponse, a5 as SubscriptionLineItem, a6 as SubscriptionOpts, a7 as SubscriptionStatus, ab as UpgradeAppOpts, ac as calculateAppID, ae as estimateTransactionGas, aj as formatETH, al as getAllAppsByDeveloper, aC as getAppLatestReleaseBlockNumbers, am as getAppsByBillingAccount, ap as getBillingType, aD as getBlockTimestamps, as as logVisibility, at as noopLogger } from './index-
|
|
9
|
-
import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-
|
|
10
|
-
export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams,
|
|
7
|
+
import { V as PreparedDeploy, G as GasEstimate, E as EnvironmentConfig, H as Logger, q as DeployResult, Y as PreparedUpgrade, A as AppId } from './index-BoCE0hIh.cjs';
|
|
8
|
+
export { a as AlreadyActiveResponse, c as AppProfile, d as AppProfileResponse, e as AppRecord, f as BillingEnvironmentConfig, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, m as CreditPurchaseResponse, n as DeployAppOpts, o as DeployOptions, p as DeployProgressCallback, r as DeployStep, s as DockerImageConfig, t as EstimateGasOptions, v as ExecuteDeployResult, x as ExecuteUpgradeResult, y as GasOpts, z as GetSubscriptionOptions, I as ImageDigestResult, L as LifecycleOpts, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, J as PaymentIssueResponse, K as PaymentMethod, M as PaymentMethodsResponse, Q as PrepareDeployFromVerifiableBuildOpts, R as PrepareDeployOpts, T as PrepareUpgradeFromVerifiableBuildOpts, U as PrepareUpgradeOpts, X as PreparedDeployData, _ as PreparedUpgradeData, $ as ProductID, a0 as ProductSubscriptionResponse, a1 as Release, a3 as SequentialDeployResult, a4 as SubscribeResponse, a5 as SubscriptionLineItem, a6 as SubscriptionOpts, a7 as SubscriptionStatus, ab as UpgradeAppOpts, ac as calculateAppID, ae as estimateTransactionGas, aj as formatETH, al as getAllAppsByDeveloper, aC as getAppLatestReleaseBlockNumbers, am as getAppsByBillingAccount, ap as getBillingType, aD as getBlockTimestamps, as as logVisibility, at as noopLogger } from './index-BoCE0hIh.cjs';
|
|
9
|
+
import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-Qq5W-qNn.cjs';
|
|
10
|
+
export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, an as BASE_SEPOLIA_CHAIN_ID, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams, ao as DeployParams, E as EstimateBatchGasOptions, G as GeneratedKey, o as LoginRequest, p as LoginResult, q as LogsParams, a as SessionError, S as SessionInfo, b as SiweMessageParams, r as SiweMessageResult, ap as UpgradeParams, U as UserApiClient, t as addHexPrefix, aq as assertValidFilePath, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, ar as createViemClients, y as estimateBatchGas, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, $ as loginToComputeApi, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, as as validateDeployParams, ab as validateDescription, at as validateFilePath, au as validateImagePath, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, av as validateResourceUsageMonitoring, ah as validateURL, aw as validateUpgradeParams, ai as validateXURL } from './helpers-Qq5W-qNn.cjs';
|
|
11
11
|
|
|
12
12
|
interface SubmitBuildRequest {
|
|
13
13
|
repoUrl: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as ComputeModule } from './compute-
|
|
2
|
-
export { a as ComputeModuleConfig, b as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, d as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, g as encodeTerminateAppData, h as getAvailableTemplates, l as logs } from './compute-
|
|
1
|
+
import { C as ComputeModule } from './compute-B6SZ0VQG.js';
|
|
2
|
+
export { a as ComputeModuleConfig, b as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, d as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, g as encodeTerminateAppData, h as getAvailableTemplates, l as logs } from './compute-B6SZ0VQG.js';
|
|
3
3
|
import { BillingModule } from './billing.js';
|
|
4
|
-
export { BillingModuleConfig, createBillingModule } from './billing.js';
|
|
4
|
+
export { BillingChain, BillingModuleConfig, TopUpInfo, TopUpOpts, TopUpResult, createBillingModule } from './billing.js';
|
|
5
5
|
import { WalletClient, PublicClient, Address, Hex } from 'viem';
|
|
6
6
|
export { AttestClient, AttestClientConfig, JwtProvider } from './attest.js';
|
|
7
|
-
import { V as PreparedDeploy, G as GasEstimate, E as EnvironmentConfig, H as Logger, q as DeployResult, Y as PreparedUpgrade, A as AppId } from './index-
|
|
8
|
-
export { a as AlreadyActiveResponse, c as AppProfile, d as AppProfileResponse, e as AppRecord, f as BillingEnvironmentConfig, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, m as CreditPurchaseResponse, n as DeployAppOpts, o as DeployOptions, p as DeployProgressCallback, r as DeployStep, s as DockerImageConfig, t as EstimateGasOptions, v as ExecuteDeployResult, x as ExecuteUpgradeResult, y as GasOpts, z as GetSubscriptionOptions, I as ImageDigestResult, L as LifecycleOpts, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, J as PaymentIssueResponse, K as PaymentMethod, M as PaymentMethodsResponse, Q as PrepareDeployFromVerifiableBuildOpts, R as PrepareDeployOpts, T as PrepareUpgradeFromVerifiableBuildOpts, U as PrepareUpgradeOpts, X as PreparedDeployData, _ as PreparedUpgradeData, $ as ProductID, a0 as ProductSubscriptionResponse, a1 as Release, a3 as SequentialDeployResult, a4 as SubscribeResponse, a5 as SubscriptionLineItem, a6 as SubscriptionOpts, a7 as SubscriptionStatus, ab as UpgradeAppOpts, ac as calculateAppID, ae as estimateTransactionGas, aj as formatETH, al as getAllAppsByDeveloper, aC as getAppLatestReleaseBlockNumbers, am as getAppsByBillingAccount, ap as getBillingType, aD as getBlockTimestamps, as as logVisibility, at as noopLogger } from './index-
|
|
9
|
-
import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-
|
|
10
|
-
export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams,
|
|
7
|
+
import { V as PreparedDeploy, G as GasEstimate, E as EnvironmentConfig, H as Logger, q as DeployResult, Y as PreparedUpgrade, A as AppId } from './index-BoCE0hIh.js';
|
|
8
|
+
export { a as AlreadyActiveResponse, c as AppProfile, d as AppProfileResponse, e as AppRecord, f as BillingEnvironmentConfig, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, m as CreditPurchaseResponse, n as DeployAppOpts, o as DeployOptions, p as DeployProgressCallback, r as DeployStep, s as DockerImageConfig, t as EstimateGasOptions, v as ExecuteDeployResult, x as ExecuteUpgradeResult, y as GasOpts, z as GetSubscriptionOptions, I as ImageDigestResult, L as LifecycleOpts, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, J as PaymentIssueResponse, K as PaymentMethod, M as PaymentMethodsResponse, Q as PrepareDeployFromVerifiableBuildOpts, R as PrepareDeployOpts, T as PrepareUpgradeFromVerifiableBuildOpts, U as PrepareUpgradeOpts, X as PreparedDeployData, _ as PreparedUpgradeData, $ as ProductID, a0 as ProductSubscriptionResponse, a1 as Release, a3 as SequentialDeployResult, a4 as SubscribeResponse, a5 as SubscriptionLineItem, a6 as SubscriptionOpts, a7 as SubscriptionStatus, ab as UpgradeAppOpts, ac as calculateAppID, ae as estimateTransactionGas, aj as formatETH, al as getAllAppsByDeveloper, aC as getAppLatestReleaseBlockNumbers, am as getAppsByBillingAccount, ap as getBillingType, aD as getBlockTimestamps, as as logVisibility, at as noopLogger } from './index-BoCE0hIh.js';
|
|
9
|
+
import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-F7CeDSVX.js';
|
|
10
|
+
export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, an as BASE_SEPOLIA_CHAIN_ID, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams, ao as DeployParams, E as EstimateBatchGasOptions, G as GeneratedKey, o as LoginRequest, p as LoginResult, q as LogsParams, a as SessionError, S as SessionInfo, b as SiweMessageParams, r as SiweMessageResult, ap as UpgradeParams, U as UserApiClient, t as addHexPrefix, aq as assertValidFilePath, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, ar as createViemClients, y as estimateBatchGas, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, $ as loginToComputeApi, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, as as validateDeployParams, ab as validateDescription, at as validateFilePath, au as validateImagePath, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, av as validateResourceUsageMonitoring, ah as validateURL, aw as validateUpgradeParams, ai as validateXURL } from './helpers-F7CeDSVX.js';
|
|
11
11
|
|
|
12
12
|
interface SubmitBuildRequest {
|
|
13
13
|
repoUrl: string;
|
package/dist/index.js
CHANGED
|
@@ -143,8 +143,8 @@ import * as child_process from "child_process";
|
|
|
143
143
|
import { promisify } from "util";
|
|
144
144
|
|
|
145
145
|
// src/client/common/constants.ts
|
|
146
|
-
import { sepolia, mainnet } from "viem/chains";
|
|
147
|
-
var SUPPORTED_CHAINS = [mainnet, sepolia];
|
|
146
|
+
import { sepolia, mainnet, baseSepolia } from "viem/chains";
|
|
147
|
+
var SUPPORTED_CHAINS = [mainnet, sepolia, baseSepolia];
|
|
148
148
|
var DOCKER_PLATFORM = "linux/amd64";
|
|
149
149
|
var REGISTRY_PROPAGATION_WAIT_SECONDS = 3;
|
|
150
150
|
var LAYERED_DOCKERFILE_NAME = "Dockerfile.eigencompute";
|
|
@@ -4837,7 +4837,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4837
4837
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4838
4838
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4839
4839
|
function getDefaultClientId() {
|
|
4840
|
-
const version = true ? "1.0.0-dev.
|
|
4840
|
+
const version = true ? "1.0.0-dev.4" : "0.0.0";
|
|
4841
4841
|
return `ecloud-sdk/v${version}`;
|
|
4842
4842
|
}
|
|
4843
4843
|
var UserApiClient = class {
|
|
@@ -5596,6 +5596,7 @@ function validateLogsParams(params) {
|
|
|
5596
5596
|
// src/client/common/config/environment.ts
|
|
5597
5597
|
var SEPOLIA_CHAIN_ID = 11155111;
|
|
5598
5598
|
var MAINNET_CHAIN_ID = 1;
|
|
5599
|
+
var BASE_SEPOLIA_CHAIN_ID = 84532;
|
|
5599
5600
|
var CommonAddresses = {
|
|
5600
5601
|
ERC7702Delegator: "0x63c0c19a282a1b52b07dd5a65b58948a07dae32b"
|
|
5601
5602
|
};
|
|
@@ -5625,7 +5626,9 @@ var ENVIRONMENTS = {
|
|
|
5625
5626
|
kmsServerURL: "http://10.128.0.57:8080",
|
|
5626
5627
|
userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
|
|
5627
5628
|
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
5628
|
-
usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376"
|
|
5629
|
+
usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
|
|
5630
|
+
baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
|
|
5631
|
+
baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
|
|
5629
5632
|
},
|
|
5630
5633
|
sepolia: {
|
|
5631
5634
|
name: "sepolia",
|
|
@@ -5637,7 +5640,9 @@ var ENVIRONMENTS = {
|
|
|
5637
5640
|
userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
|
|
5638
5641
|
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
5639
5642
|
billingRPCURL: "https://ethereum-rpc.publicnode.com",
|
|
5640
|
-
usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d"
|
|
5643
|
+
usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
|
|
5644
|
+
baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
|
|
5645
|
+
baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
|
|
5641
5646
|
},
|
|
5642
5647
|
"mainnet-alpha": {
|
|
5643
5648
|
name: "mainnet-alpha",
|
|
@@ -8230,7 +8235,7 @@ var ERC20_default = [
|
|
|
8230
8235
|
|
|
8231
8236
|
// src/client/modules/billing/index.ts
|
|
8232
8237
|
function createBillingModule(config) {
|
|
8233
|
-
const { verbose = false, skipTelemetry = false, walletClient, publicClient, environment } = config;
|
|
8238
|
+
const { verbose = false, skipTelemetry = false, walletClient, publicClient, environment, privateKey } = config;
|
|
8234
8239
|
if (!walletClient.account) {
|
|
8235
8240
|
throw new Error("WalletClient must have an account attached");
|
|
8236
8241
|
}
|
|
@@ -8239,35 +8244,69 @@ function createBillingModule(config) {
|
|
|
8239
8244
|
const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
|
|
8240
8245
|
const billingApi = new BillingApiClient(billingEnvConfig, walletClient, { verbose });
|
|
8241
8246
|
const environmentConfig = getEnvironmentConfig(environment);
|
|
8242
|
-
|
|
8243
|
-
if (!usdcCreditsAddress) {
|
|
8247
|
+
if (!environmentConfig.usdcCreditsAddress) {
|
|
8244
8248
|
throw new Error(`USDCCredits contract address not configured for environment "${environment}"`);
|
|
8245
8249
|
}
|
|
8250
|
+
const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
|
|
8251
|
+
const baseUsdcCreditsAddress = environmentConfig.baseUsdcCreditsAddress;
|
|
8252
|
+
const baseRPCURL = environmentConfig.baseRPCURL;
|
|
8253
|
+
function resolveChainConfig(chain) {
|
|
8254
|
+
if (chain === "base") {
|
|
8255
|
+
if (!baseUsdcCreditsAddress || !baseRPCURL) {
|
|
8256
|
+
throw new Error(`Base chain not configured for environment "${environment}"`);
|
|
8257
|
+
}
|
|
8258
|
+
if (!privateKey) {
|
|
8259
|
+
throw new Error("Private key required for Base chain transactions");
|
|
8260
|
+
}
|
|
8261
|
+
const baseClients = createClients({
|
|
8262
|
+
privateKey,
|
|
8263
|
+
rpcUrl: baseRPCURL,
|
|
8264
|
+
chainId: BigInt(BASE_SEPOLIA_CHAIN_ID)
|
|
8265
|
+
});
|
|
8266
|
+
return {
|
|
8267
|
+
pub: baseClients.publicClient,
|
|
8268
|
+
wallet: baseClients.walletClient,
|
|
8269
|
+
creditsAddress: baseUsdcCreditsAddress,
|
|
8270
|
+
envConfig: {
|
|
8271
|
+
...environmentConfig,
|
|
8272
|
+
chainID: BigInt(BASE_SEPOLIA_CHAIN_ID),
|
|
8273
|
+
defaultRPCURL: baseRPCURL
|
|
8274
|
+
}
|
|
8275
|
+
};
|
|
8276
|
+
}
|
|
8277
|
+
return {
|
|
8278
|
+
pub: publicClient,
|
|
8279
|
+
wallet: walletClient,
|
|
8280
|
+
creditsAddress: usdcCreditsAddress,
|
|
8281
|
+
envConfig: environmentConfig
|
|
8282
|
+
};
|
|
8283
|
+
}
|
|
8246
8284
|
const module = {
|
|
8247
8285
|
address,
|
|
8248
|
-
async getTopUpInfo() {
|
|
8249
|
-
const
|
|
8250
|
-
|
|
8286
|
+
async getTopUpInfo(opts) {
|
|
8287
|
+
const { pub, creditsAddress } = resolveChainConfig(opts?.chain);
|
|
8288
|
+
const usdcAddress = await pub.readContract({
|
|
8289
|
+
address: creditsAddress,
|
|
8251
8290
|
abi: USDCCredits_default,
|
|
8252
8291
|
functionName: "usdc"
|
|
8253
8292
|
});
|
|
8254
8293
|
const [minimumPurchase, usdcBalance, currentAllowance] = await Promise.all([
|
|
8255
|
-
|
|
8256
|
-
address:
|
|
8294
|
+
pub.readContract({
|
|
8295
|
+
address: creditsAddress,
|
|
8257
8296
|
abi: USDCCredits_default,
|
|
8258
8297
|
functionName: "minimumPurchase"
|
|
8259
8298
|
}),
|
|
8260
|
-
|
|
8299
|
+
pub.readContract({
|
|
8261
8300
|
address: usdcAddress,
|
|
8262
8301
|
abi: ERC20_default,
|
|
8263
8302
|
functionName: "balanceOf",
|
|
8264
8303
|
args: [address]
|
|
8265
8304
|
}),
|
|
8266
|
-
|
|
8305
|
+
pub.readContract({
|
|
8267
8306
|
address: usdcAddress,
|
|
8268
8307
|
abi: ERC20_default,
|
|
8269
8308
|
functionName: "allowance",
|
|
8270
|
-
args: [address,
|
|
8309
|
+
args: [address, creditsAddress]
|
|
8271
8310
|
})
|
|
8272
8311
|
]);
|
|
8273
8312
|
return { usdcAddress, minimumPurchase, usdcBalance, currentAllowance };
|
|
@@ -8277,11 +8316,12 @@ function createBillingModule(config) {
|
|
|
8277
8316
|
{
|
|
8278
8317
|
functionName: "topUp",
|
|
8279
8318
|
skipTelemetry,
|
|
8280
|
-
properties: { amount: opts.amount.toString() }
|
|
8319
|
+
properties: { amount: opts.amount.toString(), chain: opts.chain || "ethereum" }
|
|
8281
8320
|
},
|
|
8282
8321
|
async () => {
|
|
8283
8322
|
const targetAccount = opts.account ?? address;
|
|
8284
|
-
const {
|
|
8323
|
+
const { pub, wallet, creditsAddress, envConfig } = resolveChainConfig(opts.chain);
|
|
8324
|
+
const { usdcAddress, currentAllowance } = await module.getTopUpInfo({ chain: opts.chain });
|
|
8285
8325
|
const executions = [];
|
|
8286
8326
|
if (currentAllowance < opts.amount) {
|
|
8287
8327
|
executions.push({
|
|
@@ -8290,12 +8330,12 @@ function createBillingModule(config) {
|
|
|
8290
8330
|
callData: encodeFunctionData4({
|
|
8291
8331
|
abi: ERC20_default,
|
|
8292
8332
|
functionName: "approve",
|
|
8293
|
-
args: [
|
|
8333
|
+
args: [creditsAddress, opts.amount]
|
|
8294
8334
|
})
|
|
8295
8335
|
});
|
|
8296
8336
|
}
|
|
8297
8337
|
executions.push({
|
|
8298
|
-
target:
|
|
8338
|
+
target: creditsAddress,
|
|
8299
8339
|
value: 0n,
|
|
8300
8340
|
callData: encodeFunctionData4({
|
|
8301
8341
|
abi: USDCCredits_default,
|
|
@@ -8305,9 +8345,9 @@ function createBillingModule(config) {
|
|
|
8305
8345
|
});
|
|
8306
8346
|
const txHash = await executeBatch(
|
|
8307
8347
|
{
|
|
8308
|
-
walletClient,
|
|
8309
|
-
publicClient,
|
|
8310
|
-
environmentConfig,
|
|
8348
|
+
walletClient: wallet,
|
|
8349
|
+
publicClient: pub,
|
|
8350
|
+
environmentConfig: envConfig,
|
|
8311
8351
|
executions,
|
|
8312
8352
|
pendingMessage: "Submitting credit purchase..."
|
|
8313
8353
|
},
|
|
@@ -8407,6 +8447,9 @@ function createBillingModule(config) {
|
|
|
8407
8447
|
},
|
|
8408
8448
|
async purchaseCredits(amountCents, paymentMethodId) {
|
|
8409
8449
|
return billingApi.purchaseCredits(amountCents, paymentMethodId);
|
|
8450
|
+
},
|
|
8451
|
+
hasBaseSupport() {
|
|
8452
|
+
return !!baseUsdcCreditsAddress && !!baseRPCURL;
|
|
8410
8453
|
}
|
|
8411
8454
|
};
|
|
8412
8455
|
return module;
|
|
@@ -9379,6 +9422,7 @@ var JwtProvider = class {
|
|
|
9379
9422
|
export {
|
|
9380
9423
|
AttestClient,
|
|
9381
9424
|
AuthRequiredError,
|
|
9425
|
+
BASE_SEPOLIA_CHAIN_ID,
|
|
9382
9426
|
BUILD_STATUS,
|
|
9383
9427
|
BadRequestError,
|
|
9384
9428
|
BillingApiClient,
|