@hinkal/common 0.2.30 → 0.2.31

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.
@@ -31,7 +31,7 @@ export declare const checkEOAWithDelegation: (chainId: number, eoaAddress: strin
31
31
  } | {
32
32
  delegated: boolean;
33
33
  implementation: string;
34
- nonce: any;
34
+ nonce: number;
35
35
  }>;
36
36
  export declare const getAuthorizationDataIfNeeded: (chainId: number, privateKey: string | undefined) => Promise<AuthorizationData | undefined>;
37
37
  export declare const recoverAuthorizationData: (authorizationData: AuthorizationData | undefined) => ethers.Authorization | undefined;
@@ -1 +1 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../providers/CustomSolanaConnection.cjs`);let n=require(`ethers`);var r=e=>new n.ethers.JsonRpcProvider(e),i=t=>{let{fetchRpcUrl:r}=e.networkRegistry[t];if(!r)throw Error(`RPC URL not found for the specified chain ID`);return new n.JsonRpcProvider(r,t,{staticNetwork:!0})},a=(e,n=`confirmed`)=>new t.CustomSolanaConnection(e,n);exports.createCustomRpcProvider=i,exports.createCustomSolanaConnection=a,exports.createProvider=r;
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../providers/CustomSolanaConnection.cjs`),n=require(`../../providers/CustomEthersProvider.cjs`);let r=require(`ethers`);var i=e=>new r.ethers.JsonRpcProvider(e),a=t=>{let{fetchRpcUrl:i}=e.networkRegistry[t];if(!i)throw Error(`RPC URL not found for the specified chain ID`);let a=new n.CustomEthersProvider(i);return new r.ethers.BrowserProvider(a)},o=(e,n=`confirmed`)=>new t.CustomSolanaConnection(e,n);exports.createCustomRpcProvider=a,exports.createCustomSolanaConnection=o,exports.createProvider=i;
@@ -2,5 +2,5 @@ import { CustomSolanaConnection } from '../../providers/CustomSolanaConnection';
2
2
  import { Commitment, ConnectionConfig } from '@solana/web3.js';
3
3
  import { ethers } from 'ethers';
4
4
  export declare const createProvider: (rpcUrl: string) => ethers.JsonRpcProvider;
5
- export declare const createCustomRpcProvider: (chainId: number) => any;
5
+ export declare const createCustomRpcProvider: (chainId: number) => ethers.BrowserProvider;
6
6
  export declare const createCustomSolanaConnection: (endpoint: string, commitmentOrConfig?: Commitment | ConnectionConfig) => CustomSolanaConnection;
@@ -1,11 +1,13 @@
1
1
  import { networkRegistry as e } from "../../constants/chains.constants.mjs";
2
2
  import { CustomSolanaConnection as t } from "../../providers/CustomSolanaConnection.mjs";
3
- import { JsonRpcProvider as n, ethers as r } from "ethers";
3
+ import { CustomEthersProvider as n } from "../../providers/CustomEthersProvider.mjs";
4
+ import { ethers as r } from "ethers";
4
5
  //#region libs/shared/common/src/functions/utils/create-provider.ts
5
6
  var i = (e) => new r.JsonRpcProvider(e), a = (t) => {
6
- let { fetchRpcUrl: r } = e[t];
7
- if (!r) throw Error("RPC URL not found for the specified chain ID");
8
- return new n(r, t, { staticNetwork: !0 });
7
+ let { fetchRpcUrl: i } = e[t];
8
+ if (!i) throw Error("RPC URL not found for the specified chain ID");
9
+ let a = new n(i);
10
+ return new r.BrowserProvider(a);
9
11
  }, o = (e, n = "confirmed") => new t(e, n);
10
12
  //#endregion
11
13
  export { a as createCustomRpcProvider, o as createCustomSolanaConnection, i as createProvider };
@@ -4,7 +4,7 @@ type TxConfirmationOptions = {
4
4
  evmTimeoutMs?: number;
5
5
  solanaCommitment?: Commitment;
6
6
  };
7
- export declare const waitForEthereumTransactionConfirmation: (chainId: number, txHash: string, opts?: TxConfirmationOptions) => Promise<any>;
7
+ export declare const waitForEthereumTransactionConfirmation: (chainId: number, txHash: string, opts?: TxConfirmationOptions) => Promise<import('ethers').TransactionReceipt>;
8
8
  export declare const waitForSolanaTransactionConfirmation: (chainId: number, txHash: string, opts?: TxConfirmationOptions) => Promise<import('@solana/web3.js').RpcResponseAndContext<import('@solana/web3.js').SignatureResult>>;
9
9
  export declare const waitForTransactionConfirmation: (chainId: number, txHash: string, opts?: TxConfirmationOptions) => Promise<void>;
10
10
  export {};
@@ -1,10 +1,13 @@
1
1
  import { ethers } from 'ethers';
2
2
  type ABIType = ConstructorParameters<typeof ethers.Interface>[0];
3
3
  export declare function getTransactionLogEvents(chainId: number, txHash: string, contractAddress: string, contractABI: ABIType): Promise<{
4
- transactionHash: any;
5
- from: any;
6
- to: any;
7
- blockNumber: any;
8
- events: any;
4
+ transactionHash: string;
5
+ from: string;
6
+ to: string | null;
7
+ blockNumber: number;
8
+ events: {
9
+ name: string;
10
+ args: ethers.Result;
11
+ }[];
9
12
  }>;
10
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hinkal/common",
3
- "version": "0.2.30",
3
+ "version": "0.2.31",
4
4
  "homepage": "hinkal.io",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
@@ -0,0 +1 @@
1
+ const e=require(`../data-structures/http/HttpClient.cjs`),t=require(`../error-handling/logger.cjs`);var n=class{rpcUrl;nextId=1;constructor(e){this.rpcUrl=e}async request(n){let r={jsonrpc:`2.0`,id:this.nextId,method:n.method,params:n.params||[]};this.nextId+=1;try{let t=await e.httpClient.post(this.rpcUrl,r);if(t.error)throw Error(t.error.message||`RPC Error`);return t.result}catch(e){throw t.Logger.error(`CustomEthersProvider RPC error:`,e),e}}};exports.CustomEthersProvider=n;
@@ -0,0 +1,28 @@
1
+ import { httpClient as e } from "../data-structures/http/HttpClient.mjs";
2
+ import { Logger as t } from "../error-handling/logger.mjs";
3
+ //#region libs/shared/common/src/providers/CustomEthersProvider.ts
4
+ var n = class {
5
+ rpcUrl;
6
+ nextId = 1;
7
+ constructor(e) {
8
+ this.rpcUrl = e;
9
+ }
10
+ async request(n) {
11
+ let r = {
12
+ jsonrpc: "2.0",
13
+ id: this.nextId,
14
+ method: n.method,
15
+ params: n.params || []
16
+ };
17
+ this.nextId += 1;
18
+ try {
19
+ let t = await e.post(this.rpcUrl, r);
20
+ if (t.error) throw Error(t.error.message || "RPC Error");
21
+ return t.result;
22
+ } catch (e) {
23
+ throw t.error("CustomEthersProvider RPC error:", e), e;
24
+ }
25
+ }
26
+ };
27
+ //#endregion
28
+ export { n as CustomEthersProvider };