@atxp/client 0.7.0 → 0.7.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/README.md +3 -1
- package/dist/baseConstants.js +18 -1
- package/dist/baseConstants.js.map +1 -1
- package/dist/index.cjs +80 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +74 -1
- package/dist/index.js.map +1 -1
- package/dist/worldConstants.js +57 -1
- package/dist/worldConstants.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,14 @@ declare class ATXPAccount implements Account {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
declare const USDC_CONTRACT_ADDRESS_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
188
|
+
declare const USDC_CONTRACT_ADDRESS_BASE_SEPOLIA = "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
189
|
+
/**
|
|
190
|
+
* Get USDC contract address for Base chain by chain ID
|
|
191
|
+
* @param chainId - Chain ID (8453 for mainnet, 84532 for sepolia)
|
|
192
|
+
* @returns USDC contract address
|
|
193
|
+
* @throws Error if chain ID is not supported
|
|
194
|
+
*/
|
|
195
|
+
declare const getBaseUSDCAddress: (chainId: number) => string;
|
|
188
196
|
|
|
189
197
|
/**
|
|
190
198
|
* World Chain configuration type, compatible with viem's Chain interface
|
|
@@ -211,12 +219,33 @@ type WorldChain = {
|
|
|
211
219
|
readonly testnet?: boolean;
|
|
212
220
|
};
|
|
213
221
|
declare const USDC_CONTRACT_ADDRESS_WORLD_MAINNET = "0x79A02482A880bCE3F13e09Da970dC34db4CD24d1";
|
|
222
|
+
declare const USDC_CONTRACT_ADDRESS_WORLD_SEPOLIA = "0x79A02482A880bCE3F13e09Da970dC34db4CD24d1";
|
|
214
223
|
declare const WORLD_CHAIN_MAINNET: WorldChain;
|
|
224
|
+
declare const WORLD_CHAIN_SEPOLIA: WorldChain;
|
|
215
225
|
/**
|
|
216
226
|
* Get World Chain Mainnet configuration with custom RPC URL (e.g., with API key)
|
|
217
227
|
* @param rpcUrl - Custom RPC URL, e.g., 'https://worldchain-mainnet.g.alchemy.com/v2/YOUR_API_KEY'
|
|
218
228
|
*/
|
|
219
229
|
declare const getWorldChainMainnetWithRPC: (rpcUrl: string) => WorldChain;
|
|
230
|
+
/**
|
|
231
|
+
* Get World Chain Sepolia configuration with custom RPC URL (e.g., with API key)
|
|
232
|
+
* @param rpcUrl - Custom RPC URL, e.g., 'https://worldchain-sepolia.g.alchemy.com/v2/YOUR_API_KEY'
|
|
233
|
+
*/
|
|
234
|
+
declare const getWorldChainSepoliaWithRPC: (rpcUrl: string) => WorldChain;
|
|
235
|
+
/**
|
|
236
|
+
* Get World Chain configuration by chain ID
|
|
237
|
+
* @param chainId - Chain ID (480 for mainnet, 4801 for sepolia)
|
|
238
|
+
* @returns World Chain configuration
|
|
239
|
+
* @throws Error if chain ID is not supported
|
|
240
|
+
*/
|
|
241
|
+
declare const getWorldChainByChainId: (chainId: number) => WorldChain;
|
|
242
|
+
/**
|
|
243
|
+
* Get USDC contract address for World Chain by chain ID
|
|
244
|
+
* @param chainId - Chain ID (480 for mainnet, 4801 for sepolia)
|
|
245
|
+
* @returns USDC contract address
|
|
246
|
+
* @throws Error if chain ID is not supported
|
|
247
|
+
*/
|
|
248
|
+
declare const getWorldChainUSDCAddress: (chainId: number) => string;
|
|
220
249
|
|
|
221
250
|
declare class BaseAccount implements Account {
|
|
222
251
|
accountId: string;
|
|
@@ -281,5 +310,5 @@ declare class ATXPLocalAccount implements LocalAccount {
|
|
|
281
310
|
readonly source: "custom";
|
|
282
311
|
}
|
|
283
312
|
|
|
284
|
-
export { ATXPAccount, ATXPLocalAccount, BaseAccount, BasePaymentMaker, DEFAULT_CLIENT_CONFIG, InsufficientFundsError, OAuthAuthenticationRequiredError, OAuthClient, PaymentNetworkError, SolanaAccount, SolanaPaymentMaker, USDC_CONTRACT_ADDRESS_BASE, USDC_CONTRACT_ADDRESS_WORLD_MAINNET, ValidateTransferError, WORLD_CHAIN_MAINNET, atxpClient, atxpFetch, buildClientConfig, buildStreamableTransport, getWorldChainMainnetWithRPC };
|
|
313
|
+
export { ATXPAccount, ATXPLocalAccount, BaseAccount, BasePaymentMaker, DEFAULT_CLIENT_CONFIG, InsufficientFundsError, OAuthAuthenticationRequiredError, OAuthClient, PaymentNetworkError, SolanaAccount, SolanaPaymentMaker, USDC_CONTRACT_ADDRESS_BASE, USDC_CONTRACT_ADDRESS_BASE_SEPOLIA, USDC_CONTRACT_ADDRESS_WORLD_MAINNET, USDC_CONTRACT_ADDRESS_WORLD_SEPOLIA, ValidateTransferError, WORLD_CHAIN_MAINNET, WORLD_CHAIN_SEPOLIA, atxpClient, atxpFetch, buildClientConfig, buildStreamableTransport, getBaseUSDCAddress, getWorldChainByChainId, getWorldChainMainnetWithRPC, getWorldChainSepoliaWithRPC, getWorldChainUSDCAddress };
|
|
285
314
|
export type { Account, AccountIdString, ClientArgs, ClientConfig, FetchWrapper, Hex, OAuthClientConfig, PaymentMaker, ProspectivePayment, WorldChain };
|
package/dist/index.js
CHANGED
|
@@ -15978,6 +15978,23 @@ class SolanaPaymentMaker {
|
|
|
15978
15978
|
}
|
|
15979
15979
|
|
|
15980
15980
|
const USDC_CONTRACT_ADDRESS_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; // USDC on Base mainnet
|
|
15981
|
+
const USDC_CONTRACT_ADDRESS_BASE_SEPOLIA = "0x036CbD53842c5426634e7929541eC2318f3dCF7e"; // USDC on Base Sepolia testnet
|
|
15982
|
+
/**
|
|
15983
|
+
* Get USDC contract address for Base chain by chain ID
|
|
15984
|
+
* @param chainId - Chain ID (8453 for mainnet, 84532 for sepolia)
|
|
15985
|
+
* @returns USDC contract address
|
|
15986
|
+
* @throws Error if chain ID is not supported
|
|
15987
|
+
*/
|
|
15988
|
+
const getBaseUSDCAddress = (chainId) => {
|
|
15989
|
+
switch (chainId) {
|
|
15990
|
+
case 8453: // Base mainnet
|
|
15991
|
+
return USDC_CONTRACT_ADDRESS_BASE;
|
|
15992
|
+
case 84532: // Base Sepolia
|
|
15993
|
+
return USDC_CONTRACT_ADDRESS_BASE_SEPOLIA;
|
|
15994
|
+
default:
|
|
15995
|
+
throw new Error(`Unsupported Base Chain ID: ${chainId}. Supported chains: 8453 (mainnet), 84532 (sepolia)`);
|
|
15996
|
+
}
|
|
15997
|
+
};
|
|
15981
15998
|
|
|
15982
15999
|
// Helper function to convert to base64url that works in both Node.js and browsers
|
|
15983
16000
|
function toBase64Url(data) {
|
|
@@ -16329,6 +16346,7 @@ class ATXPAccount {
|
|
|
16329
16346
|
}
|
|
16330
16347
|
|
|
16331
16348
|
const USDC_CONTRACT_ADDRESS_WORLD_MAINNET = "0x79A02482A880bCE3F13e09Da970dC34db4CD24d1"; // USDC.e on World Chain mainnet
|
|
16349
|
+
const USDC_CONTRACT_ADDRESS_WORLD_SEPOLIA = "0x79A02482A880bCE3F13e09Da970dC34db4CD24d1"; // USDC.e on World Chain Sepolia (placeholder - update with actual address)
|
|
16332
16350
|
// World Chain Mainnet (Chain ID: 480)
|
|
16333
16351
|
const WORLD_CHAIN_MAINNET = {
|
|
16334
16352
|
id: 480,
|
|
@@ -16341,6 +16359,19 @@ const WORLD_CHAIN_MAINNET = {
|
|
|
16341
16359
|
default: { name: 'WorldScan', url: 'https://worldscan.org' }
|
|
16342
16360
|
}
|
|
16343
16361
|
};
|
|
16362
|
+
// World Chain Sepolia Testnet (Chain ID: 4801)
|
|
16363
|
+
const WORLD_CHAIN_SEPOLIA = {
|
|
16364
|
+
id: 4801,
|
|
16365
|
+
name: 'World Chain Sepolia',
|
|
16366
|
+
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
16367
|
+
rpcUrls: {
|
|
16368
|
+
default: { http: ['https://worldchain-sepolia.g.alchemy.com/public'] }
|
|
16369
|
+
},
|
|
16370
|
+
blockExplorers: {
|
|
16371
|
+
default: { name: 'WorldScan Sepolia', url: 'https://sepolia.worldscan.org' }
|
|
16372
|
+
},
|
|
16373
|
+
testnet: true
|
|
16374
|
+
};
|
|
16344
16375
|
/**
|
|
16345
16376
|
* Get World Chain Mainnet configuration with custom RPC URL (e.g., with API key)
|
|
16346
16377
|
* @param rpcUrl - Custom RPC URL, e.g., 'https://worldchain-mainnet.g.alchemy.com/v2/YOUR_API_KEY'
|
|
@@ -16351,6 +16382,48 @@ const getWorldChainMainnetWithRPC = (rpcUrl) => ({
|
|
|
16351
16382
|
default: { http: [rpcUrl] }
|
|
16352
16383
|
}
|
|
16353
16384
|
});
|
|
16385
|
+
/**
|
|
16386
|
+
* Get World Chain Sepolia configuration with custom RPC URL (e.g., with API key)
|
|
16387
|
+
* @param rpcUrl - Custom RPC URL, e.g., 'https://worldchain-sepolia.g.alchemy.com/v2/YOUR_API_KEY'
|
|
16388
|
+
*/
|
|
16389
|
+
const getWorldChainSepoliaWithRPC = (rpcUrl) => ({
|
|
16390
|
+
...WORLD_CHAIN_SEPOLIA,
|
|
16391
|
+
rpcUrls: {
|
|
16392
|
+
default: { http: [rpcUrl] }
|
|
16393
|
+
}
|
|
16394
|
+
});
|
|
16395
|
+
/**
|
|
16396
|
+
* Get World Chain configuration by chain ID
|
|
16397
|
+
* @param chainId - Chain ID (480 for mainnet, 4801 for sepolia)
|
|
16398
|
+
* @returns World Chain configuration
|
|
16399
|
+
* @throws Error if chain ID is not supported
|
|
16400
|
+
*/
|
|
16401
|
+
const getWorldChainByChainId = (chainId) => {
|
|
16402
|
+
switch (chainId) {
|
|
16403
|
+
case 480:
|
|
16404
|
+
return WORLD_CHAIN_MAINNET;
|
|
16405
|
+
case 4801:
|
|
16406
|
+
return WORLD_CHAIN_SEPOLIA;
|
|
16407
|
+
default:
|
|
16408
|
+
throw new Error(`Unsupported World Chain ID: ${chainId}. Supported chains: 480 (mainnet), 4801 (sepolia)`);
|
|
16409
|
+
}
|
|
16410
|
+
};
|
|
16411
|
+
/**
|
|
16412
|
+
* Get USDC contract address for World Chain by chain ID
|
|
16413
|
+
* @param chainId - Chain ID (480 for mainnet, 4801 for sepolia)
|
|
16414
|
+
* @returns USDC contract address
|
|
16415
|
+
* @throws Error if chain ID is not supported
|
|
16416
|
+
*/
|
|
16417
|
+
const getWorldChainUSDCAddress = (chainId) => {
|
|
16418
|
+
switch (chainId) {
|
|
16419
|
+
case 480:
|
|
16420
|
+
return USDC_CONTRACT_ADDRESS_WORLD_MAINNET;
|
|
16421
|
+
case 4801:
|
|
16422
|
+
return USDC_CONTRACT_ADDRESS_WORLD_SEPOLIA;
|
|
16423
|
+
default:
|
|
16424
|
+
throw new Error(`Unsupported World Chain ID: ${chainId}. Supported chains: 480 (mainnet), 4801 (sepolia)`);
|
|
16425
|
+
}
|
|
16426
|
+
};
|
|
16354
16427
|
|
|
16355
16428
|
class BaseAccount {
|
|
16356
16429
|
constructor(baseRPCUrl, sourceSecretKey) {
|
|
@@ -16381,5 +16454,5 @@ class BaseAccount {
|
|
|
16381
16454
|
}
|
|
16382
16455
|
}
|
|
16383
16456
|
|
|
16384
|
-
export { ATXPAccount, ATXPLocalAccount, BaseAccount, BasePaymentMaker, DEFAULT_CLIENT_CONFIG, InsufficientFundsError, OAuthAuthenticationRequiredError, OAuthClient, PaymentNetworkError, SolanaAccount, SolanaPaymentMaker, USDC_CONTRACT_ADDRESS_BASE, USDC_CONTRACT_ADDRESS_WORLD_MAINNET, ValidateTransferError, WORLD_CHAIN_MAINNET, atxpClient, atxpFetch, buildClientConfig, buildStreamableTransport, getWorldChainMainnetWithRPC };
|
|
16457
|
+
export { ATXPAccount, ATXPLocalAccount, BaseAccount, BasePaymentMaker, DEFAULT_CLIENT_CONFIG, InsufficientFundsError, OAuthAuthenticationRequiredError, OAuthClient, PaymentNetworkError, SolanaAccount, SolanaPaymentMaker, USDC_CONTRACT_ADDRESS_BASE, USDC_CONTRACT_ADDRESS_BASE_SEPOLIA, USDC_CONTRACT_ADDRESS_WORLD_MAINNET, USDC_CONTRACT_ADDRESS_WORLD_SEPOLIA, ValidateTransferError, WORLD_CHAIN_MAINNET, WORLD_CHAIN_SEPOLIA, atxpClient, atxpFetch, buildClientConfig, buildStreamableTransport, getBaseUSDCAddress, getWorldChainByChainId, getWorldChainMainnetWithRPC, getWorldChainSepoliaWithRPC, getWorldChainUSDCAddress };
|
|
16385
16458
|
//# sourceMappingURL=index.js.map
|