@tomo-inc/chains-service 0.0.24 → 0.0.26

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.cjs CHANGED
@@ -3903,15 +3903,19 @@ function tomoPublicApiService(publicApiBase, tomoAppInfo) {
3903
3903
  walletAPIs: WalletAPIs.getInstance(publicApiBase, tomoAppInfo)
3904
3904
  };
3905
3905
  }
3906
+ var TX_DOMAIN_OVERRIDES = {
3907
+ "prod-dogeos": "https://wallet.tomo.inc"
3908
+ };
3906
3909
  function getConfig(tomoStage) {
3907
3910
  const domain = walletUtils.TomoApiDomains[tomoStage];
3908
3911
  if (!domain) {
3909
3912
  throw new Error("Invalid tomo stage");
3910
3913
  }
3914
+ const txDomain = TX_DOMAIN_OVERRIDES[tomoStage] ?? domain;
3911
3915
  return {
3912
3916
  rpcBaseUrl: `${domain}`,
3913
3917
  walletBaseUrl: `${domain}/wallet`,
3914
- txBaseUrl: `${domain}/quote`,
3918
+ txBaseUrl: `${txDomain}/quote`,
3915
3919
  tokenBaseUrl: `${domain}/token`,
3916
3920
  userBaseUrl: `${domain}/user/api`
3917
3921
  };
@@ -3919,7 +3923,8 @@ function getConfig(tomoStage) {
3919
3923
  var CONFIG = {
3920
3924
  prod: getConfig("prod"),
3921
3925
  pre: getConfig("pre"),
3922
- dev: getConfig("dev")
3926
+ dev: getConfig("dev"),
3927
+ "prod-dogeos": getConfig("prod-dogeos")
3923
3928
  };
3924
3929
 
3925
3930
  // src/base/service.ts
@@ -4951,6 +4956,16 @@ var EvmService = class _EvmService extends BaseService {
4951
4956
  }
4952
4957
  };
4953
4958
  }
4959
+ async request(method, params) {
4960
+ try {
4961
+ const rpcClient = await this.createPublicClient({});
4962
+ const res = await rpcClient.request(method, params);
4963
+ return res;
4964
+ } catch (error) {
4965
+ console.error("Failed to request:", error);
4966
+ throw error;
4967
+ }
4968
+ }
4954
4969
  async createPublicClient({ chainId, rpcUrl }) {
4955
4970
  if (rpcUrl) {
4956
4971
  return viem.createPublicClient({
package/dist/index.d.cts CHANGED
@@ -601,6 +601,7 @@ declare class EvmService extends BaseService {
601
601
  eth_signTypedData_v4([address, typedData]: [`0x${string}`, ITypedData]): Promise<`0x${string}`>;
602
602
  eth_getBalance([address, type]: [`0x${string}`, "latest"]): Promise<string>;
603
603
  _queryGasInfo(txData: TransactionParams$1): Promise<QueryGasResponse>;
604
+ request(method: string, params: any): Promise<any>;
604
605
  private createPublicClient;
605
606
  eth_estimateGas(txs: Transaction$1[]): Promise<`0x${string}`>;
606
607
  eth_getTransactionCount([address, type]: [`0x${string}`, "latest" | "pending"]): Promise<number>;
package/dist/index.d.ts CHANGED
@@ -601,6 +601,7 @@ declare class EvmService extends BaseService {
601
601
  eth_signTypedData_v4([address, typedData]: [`0x${string}`, ITypedData]): Promise<`0x${string}`>;
602
602
  eth_getBalance([address, type]: [`0x${string}`, "latest"]): Promise<string>;
603
603
  _queryGasInfo(txData: TransactionParams$1): Promise<QueryGasResponse>;
604
+ request(method: string, params: any): Promise<any>;
604
605
  private createPublicClient;
605
606
  eth_estimateGas(txs: Transaction$1[]): Promise<`0x${string}`>;
606
607
  eth_getTransactionCount([address, type]: [`0x${string}`, "latest" | "pending"]): Promise<number>;
package/dist/index.js CHANGED
@@ -3895,15 +3895,19 @@ function tomoPublicApiService(publicApiBase, tomoAppInfo) {
3895
3895
  walletAPIs: WalletAPIs.getInstance(publicApiBase, tomoAppInfo)
3896
3896
  };
3897
3897
  }
3898
+ var TX_DOMAIN_OVERRIDES = {
3899
+ "prod-dogeos": "https://wallet.tomo.inc"
3900
+ };
3898
3901
  function getConfig(tomoStage) {
3899
3902
  const domain = TomoApiDomains[tomoStage];
3900
3903
  if (!domain) {
3901
3904
  throw new Error("Invalid tomo stage");
3902
3905
  }
3906
+ const txDomain = TX_DOMAIN_OVERRIDES[tomoStage] ?? domain;
3903
3907
  return {
3904
3908
  rpcBaseUrl: `${domain}`,
3905
3909
  walletBaseUrl: `${domain}/wallet`,
3906
- txBaseUrl: `${domain}/quote`,
3910
+ txBaseUrl: `${txDomain}/quote`,
3907
3911
  tokenBaseUrl: `${domain}/token`,
3908
3912
  userBaseUrl: `${domain}/user/api`
3909
3913
  };
@@ -3911,7 +3915,8 @@ function getConfig(tomoStage) {
3911
3915
  var CONFIG = {
3912
3916
  prod: getConfig("prod"),
3913
3917
  pre: getConfig("pre"),
3914
- dev: getConfig("dev")
3918
+ dev: getConfig("dev"),
3919
+ "prod-dogeos": getConfig("prod-dogeos")
3915
3920
  };
3916
3921
 
3917
3922
  // src/base/service.ts
@@ -4943,6 +4948,16 @@ var EvmService = class _EvmService extends BaseService {
4943
4948
  }
4944
4949
  };
4945
4950
  }
4951
+ async request(method, params) {
4952
+ try {
4953
+ const rpcClient = await this.createPublicClient({});
4954
+ const res = await rpcClient.request(method, params);
4955
+ return res;
4956
+ } catch (error) {
4957
+ console.error("Failed to request:", error);
4958
+ throw error;
4959
+ }
4960
+ }
4946
4961
  async createPublicClient({ chainId, rpcUrl }) {
4947
4962
  if (rpcUrl) {
4948
4963
  return createPublicClient({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomo-inc/chains-service",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "author": "tomo.inc",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -23,7 +23,7 @@
23
23
  "bitcoinjs-lib": "^7.0.0",
24
24
  "crypto-js": "4.2.0",
25
25
  "viem": "2.21.54",
26
- "@tomo-inc/wallet-utils": "0.0.18"
26
+ "@tomo-inc/wallet-utils": "0.0.19"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/supertest": "^2.0.12",
package/src/config.ts CHANGED
@@ -1,14 +1,19 @@
1
1
  import { TomoApiDomains, TomoStage } from "@tomo-inc/wallet-utils";
2
2
 
3
+ const TX_DOMAIN_OVERRIDES: Partial<Record<TomoStage, string>> = {
4
+ "prod-dogeos": "https://wallet.tomo.inc",
5
+ };
6
+
3
7
  export function getConfig(tomoStage: TomoStage) {
4
8
  const domain = TomoApiDomains[tomoStage];
5
9
  if (!domain) {
6
10
  throw new Error("Invalid tomo stage");
7
11
  }
12
+ const txDomain = TX_DOMAIN_OVERRIDES[tomoStage] ?? domain;
8
13
  return {
9
14
  rpcBaseUrl: `${domain}`,
10
15
  walletBaseUrl: `${domain}/wallet`,
11
- txBaseUrl: `${domain}/quote`,
16
+ txBaseUrl: `${txDomain}/quote`,
12
17
  tokenBaseUrl: `${domain}/token`,
13
18
  userBaseUrl: `${domain}/user/api`,
14
19
  };
@@ -18,4 +23,5 @@ export const CONFIG = {
18
23
  prod: getConfig("prod"),
19
24
  pre: getConfig("pre"),
20
25
  dev: getConfig("dev"),
26
+ "prod-dogeos": getConfig("prod-dogeos"),
21
27
  };
@@ -203,6 +203,17 @@ export class EvmService extends BaseService {
203
203
  };
204
204
  }
205
205
 
206
+ public async request(method: string, params: any): Promise<any> {
207
+ try {
208
+ const rpcClient = await this.createPublicClient({});
209
+ const res = await rpcClient.request(method, params);
210
+ return res;
211
+ } catch (error) {
212
+ console.error("Failed to request:", error);
213
+ throw error;
214
+ }
215
+ }
216
+
206
217
  private async createPublicClient({ chainId, rpcUrl }: { chainId?: string; rpcUrl?: string }): Promise<any> {
207
218
  if (rpcUrl) {
208
219
  return createPublicClient({