@joai/warps-adapter-evm 1.3.0 → 1.4.0

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.cts CHANGED
@@ -256,9 +256,8 @@ declare class WarpEvmOutput implements AdapterWarpOutput {
256
256
  private readonly chain;
257
257
  private readonly serializer;
258
258
  private readonly provider;
259
- private readonly cache;
260
259
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
261
- getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
260
+ getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction, injectedInputs?: ResolvedInput[]): Promise<WarpActionExecutionResult>;
262
261
  private createFailedExecution;
263
262
  private handleWarpChainAction;
264
263
  private handleTransactionReceipt;
@@ -309,7 +308,7 @@ declare class WarpEvmWallet implements AdapterWarpWallet {
309
308
  delete(provider: WarpWalletProvider, externalId: string): Promise<void>;
310
309
  getAddress(): string | null;
311
310
  getPublicKey(): string | null;
312
- registerX402Handlers(client: unknown): Promise<Record<string, () => void>>;
311
+ getMppAccount(): Promise<unknown>;
313
312
  private createProvider;
314
313
  private getAddressAsync;
315
314
  private createProviderForOperation;
package/dist/index.d.ts CHANGED
@@ -256,9 +256,8 @@ declare class WarpEvmOutput implements AdapterWarpOutput {
256
256
  private readonly chain;
257
257
  private readonly serializer;
258
258
  private readonly provider;
259
- private readonly cache;
260
259
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
261
- getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
260
+ getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction, injectedInputs?: ResolvedInput[]): Promise<WarpActionExecutionResult>;
262
261
  private createFailedExecution;
263
262
  private handleWarpChainAction;
264
263
  private handleTransactionReceipt;
@@ -309,7 +308,7 @@ declare class WarpEvmWallet implements AdapterWarpWallet {
309
308
  delete(provider: WarpWalletProvider, externalId: string): Promise<void>;
310
309
  getAddress(): string | null;
311
310
  getPublicKey(): string | null;
312
- registerX402Handlers(client: unknown): Promise<Record<string, () => void>>;
311
+ getMppAccount(): Promise<unknown>;
313
312
  private createProvider;
314
313
  private getAddressAsync;
315
314
  private createProviderForOperation;
package/dist/index.js CHANGED
@@ -1426,10 +1426,9 @@ var WarpEvmOutput = class {
1426
1426
  const providerConfig = (0, import_warps18.getProviderConfig)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
1427
1427
  const network = new import_ethers5.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
1428
1428
  this.provider = new import_ethers5.ethers.JsonRpcProvider(providerConfig.url, network);
1429
- this.cache = new import_warps18.WarpCache(config.env, config.cache);
1430
1429
  }
1431
- async getActionExecution(warp, actionIndex, tx) {
1432
- const inputs = await this.cache.get(import_warps18.WarpCacheKey.WarpExecutable(this.config.env, warp.meta?.hash || "", actionIndex)) ?? [];
1430
+ async getActionExecution(warp, actionIndex, tx, injectedInputs) {
1431
+ const inputs = injectedInputs ?? [];
1433
1432
  const resolvedInputs = (0, import_warps18.extractResolvedInputValues)(inputs);
1434
1433
  if (!tx) {
1435
1434
  return this.createFailedExecution(warp, actionIndex, resolvedInputs);
@@ -1969,10 +1968,7 @@ var WarpEvmExplorer = class {
1969
1968
 
1970
1969
  // src/WarpEvmWallet.ts
1971
1970
  var import_warps20 = require("@joai/warps");
1972
- var import_evm = require("@x402/evm");
1973
- var import_client = require("@x402/evm/exact/client");
1974
1971
  var import_ethers7 = require("ethers");
1975
- var import_viem = require("viem");
1976
1972
  var import_accounts = require("viem/accounts");
1977
1973
  var WarpEvmWallet = class {
1978
1974
  constructor(config, chain) {
@@ -2079,26 +2075,14 @@ var WarpEvmWallet = class {
2079
2075
  getPublicKey() {
2080
2076
  return this.cachedPublicKey;
2081
2077
  }
2082
- async registerX402Handlers(client) {
2078
+ async getMppAccount() {
2083
2079
  if (!this.walletProvider) throw new Error("No wallet provider available");
2084
2080
  const provider = this.walletProvider;
2085
2081
  const getInstance = provider.getWalletInstance;
2086
- if (typeof getInstance !== "function") throw new Error("Wallet provider does not have getWalletInstance method");
2082
+ if (typeof getInstance !== "function") throw new Error("Wallet provider does not support getMppAccount");
2087
2083
  const wallet = getInstance();
2088
- if (!wallet || !wallet.privateKey) throw new Error("Wallet instance does not have private key");
2089
- const signer = (0, import_evm.toClientEvmSigner)(
2090
- (0, import_accounts.privateKeyToAccount)(wallet.privateKey),
2091
- (0, import_viem.createPublicClient)({
2092
- transport: (0, import_viem.http)((0, import_warps20.getProviderConfig)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl).url)
2093
- })
2094
- );
2095
- const handlers = {};
2096
- for (const chainId of SupportedEvmChainIds) {
2097
- handlers[`eip155:${chainId}`] = () => {
2098
- (0, import_client.registerExactEvmScheme)(client, { signer });
2099
- };
2100
- }
2101
- return handlers;
2084
+ if (!wallet?.privateKey) throw new Error("Wallet instance does not have a private key");
2085
+ return (0, import_accounts.privateKeyToAccount)(wallet.privateKey);
2102
2086
  }
2103
2087
  createProvider() {
2104
2088
  const wallet = this.config.user?.wallets?.[this.chain.name];
@@ -2319,7 +2303,7 @@ var NativeTokenEth = {
2319
2303
  var EthereumAdapter = createEvmAdapter(import_warps24.WarpChainName.Ethereum, {
2320
2304
  mainnet: {
2321
2305
  name: import_warps24.WarpChainName.Ethereum,
2322
- displayName: "Ethereum Mainnet",
2306
+ displayName: "Ethereum",
2323
2307
  chainId: "1",
2324
2308
  blockTime: 12e3,
2325
2309
  addressHrp: "0x",
@@ -2434,7 +2418,7 @@ var NativeTokenStt = {
2434
2418
  var SomniaAdapter = createEvmAdapter(import_warps26.WarpChainName.Somnia, {
2435
2419
  mainnet: {
2436
2420
  name: import_warps26.WarpChainName.Somnia,
2437
- displayName: "Somnia Mainnet",
2421
+ displayName: "Somnia",
2438
2422
  chainId: "5031",
2439
2423
  blockTime: 100,
2440
2424
  addressHrp: "0x",