@pyxisjs/chains 0.2.0 → 0.2.1
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -7072,7 +7072,7 @@ declare class EthereumChainAdapter extends BaseChainAdapter<PublicClient> implem
|
|
|
7072
7072
|
private viemChain;
|
|
7073
7073
|
constructor(chain: Chain);
|
|
7074
7074
|
/**
|
|
7075
|
-
* Create EVM client using viem
|
|
7075
|
+
* [DEPRECATED] Create EVM client using viem
|
|
7076
7076
|
*/
|
|
7077
7077
|
createClient(config?: any): PublicClient;
|
|
7078
7078
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -7072,7 +7072,7 @@ declare class EthereumChainAdapter extends BaseChainAdapter<PublicClient> implem
|
|
|
7072
7072
|
private viemChain;
|
|
7073
7073
|
constructor(chain: Chain);
|
|
7074
7074
|
/**
|
|
7075
|
-
* Create EVM client using viem
|
|
7075
|
+
* [DEPRECATED] Create EVM client using viem
|
|
7076
7076
|
*/
|
|
7077
7077
|
createClient(config?: any): PublicClient;
|
|
7078
7078
|
/**
|
package/dist/index.js
CHANGED
|
@@ -7444,10 +7444,9 @@ var AptosAnalyticsClient = class {
|
|
|
7444
7444
|
};
|
|
7445
7445
|
|
|
7446
7446
|
// src/evm/adapter.ts
|
|
7447
|
+
var import_core4 = require("@pyxisjs/core");
|
|
7447
7448
|
var import_viem = require("viem");
|
|
7448
7449
|
var import_chains = require("viem/chains");
|
|
7449
|
-
var import_core4 = require("@pyxisjs/core");
|
|
7450
|
-
var import_core5 = require("@pyxisjs/core");
|
|
7451
7450
|
var viemChainMap = {
|
|
7452
7451
|
[import_core4.ChainId.ETHEREUM_MAINNET]: import_chains.mainnet,
|
|
7453
7452
|
[import_core4.ChainId.ETHEREUM_SEPOLIA]: import_chains.sepolia,
|
|
@@ -7456,25 +7455,15 @@ var viemChainMap = {
|
|
|
7456
7455
|
var EthereumChainAdapter = class extends import_core4.BaseChainAdapter {
|
|
7457
7456
|
constructor(chain) {
|
|
7458
7457
|
super(chain);
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
name: config.name,
|
|
7466
|
-
nativeCurrency: config.nativeCurrency,
|
|
7467
|
-
rpcUrls: {
|
|
7468
|
-
default: { http: [chain.rpcUrl] }
|
|
7469
|
-
},
|
|
7470
|
-
blockExplorers: config.blockExplorerUrls?.length ? {
|
|
7471
|
-
default: { name: "Explorer", url: config.blockExplorerUrls[0] }
|
|
7472
|
-
} : void 0
|
|
7473
|
-
};
|
|
7474
|
-
this.createClient();
|
|
7458
|
+
this.viemChain = viemChainMap[chain.id];
|
|
7459
|
+
invariant(this.viemChain, `Chain ${chain.id} not found in viemChainMap`);
|
|
7460
|
+
this.client = (0, import_viem.createPublicClient)({
|
|
7461
|
+
chain: this.viemChain,
|
|
7462
|
+
transport: (0, import_viem.http)(this.chain.rpcUrl)
|
|
7463
|
+
});
|
|
7475
7464
|
}
|
|
7476
7465
|
/**
|
|
7477
|
-
* Create EVM client using viem
|
|
7466
|
+
* [DEPRECATED] Create EVM client using viem
|
|
7478
7467
|
*/
|
|
7479
7468
|
createClient(config) {
|
|
7480
7469
|
this.client = (0, import_viem.createPublicClient)({
|
|
@@ -7491,7 +7480,7 @@ var EthereumChainAdapter = class extends import_core4.BaseChainAdapter {
|
|
|
7491
7480
|
* Build an Ethereum transaction payload
|
|
7492
7481
|
*/
|
|
7493
7482
|
async buildPayload(params) {
|
|
7494
|
-
const config = (0,
|
|
7483
|
+
const config = (0, import_core4.getChainConfig)(this.chain.id);
|
|
7495
7484
|
if (!config.chainId) {
|
|
7496
7485
|
throw new Error("Chain ID is required for EVM transactions");
|
|
7497
7486
|
}
|
|
@@ -7617,7 +7606,7 @@ var EthereumChainAdapter = class extends import_core4.BaseChainAdapter {
|
|
|
7617
7606
|
* Get function signature using the new configuration system
|
|
7618
7607
|
*/
|
|
7619
7608
|
getFunctionSignature(contractName, functionName) {
|
|
7620
|
-
const config = (0,
|
|
7609
|
+
const config = (0, import_core4.getChainConfig)(this.chain.id);
|
|
7621
7610
|
const contractAddress = this.getContractAddress(contractName);
|
|
7622
7611
|
return getFunctionSignature(
|
|
7623
7612
|
config.type,
|
|
@@ -7630,7 +7619,7 @@ var EthereumChainAdapter = class extends import_core4.BaseChainAdapter {
|
|
|
7630
7619
|
* Get contract ABI using the new configuration system
|
|
7631
7620
|
*/
|
|
7632
7621
|
getContractABI(contractName) {
|
|
7633
|
-
const config = (0,
|
|
7622
|
+
const config = (0, import_core4.getChainConfig)(this.chain.id);
|
|
7634
7623
|
return getContractABI(config.type, contractName);
|
|
7635
7624
|
}
|
|
7636
7625
|
async getWithdrawRateInQuoteSafe(args) {
|