@cryptorubic/web3 1.1.0-alpha-stellar.31 → 1.1.0-alpha-stellar.33
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/package.json +1 -1
- package/src/lib/adapter/adapters/adapter-stellar/models/stellar-rpc-provider.d.ts +4 -0
- package/src/lib/adapter/adapters/adapter-stellar/models/stellar-rpc-provider.js +2 -0
- package/src/lib/adapter/adapters/adapter-stellar/stellar-adapter.d.ts +4 -2
- package/src/lib/adapter/adapters/adapter-stellar/stellar-adapter.js +14 -3
- package/src/lib/adapter/models/create-factory-params.d.ts +2 -1
package/package.json
CHANGED
|
@@ -11,10 +11,12 @@ import { Abi } from 'viem';
|
|
|
11
11
|
import { MethodData } from '../models/web3-public-models/method-data';
|
|
12
12
|
import { ContractMulticallResponse } from '../models/web3-public-models/contract-multicall-response';
|
|
13
13
|
import { StellarTransactionConfig } from '../../../utils/models/stellar-transaction-config';
|
|
14
|
+
import { StellarRpcProvider } from './models/stellar-rpc-provider';
|
|
14
15
|
export declare class StellarAdapter extends AbstractAdapter<StellarClient, StellarWallet, StellarBlockchainName> {
|
|
15
|
-
private readonly
|
|
16
|
+
private readonly rpc;
|
|
16
17
|
readonly signer: StellarAdapterSigner;
|
|
17
|
-
|
|
18
|
+
private readonly horizonClient;
|
|
19
|
+
constructor(rpc: StellarRpcProvider[], httpClient: HttpClient, logger?: ICustomLogger, clientParams?: ClientAdaptersFactoryParams);
|
|
18
20
|
initWeb3Client(): void;
|
|
19
21
|
getBlockNumber(): Promise<number | {
|
|
20
22
|
blockNumber: number;
|
|
@@ -11,13 +11,17 @@ const bignumber_js_1 = require("bignumber.js");
|
|
|
11
11
|
const web3_pure_1 = require("../../../utils/web3-pure");
|
|
12
12
|
const fake_stellar_wallet_1 = require("./constants/fake-stellar-wallet");
|
|
13
13
|
class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
14
|
-
constructor(
|
|
14
|
+
constructor(rpc, httpClient, logger, clientParams) {
|
|
15
15
|
super(core_1.BLOCKCHAIN_NAME.STELLAR, logger);
|
|
16
|
-
this.
|
|
16
|
+
this.rpc = rpc;
|
|
17
17
|
this.signer = new stellar_adapter_signer_1.StellarAdapterSigner(this.publicRef, httpClient, logger, clientParams);
|
|
18
|
+
this.horizonClient = new stellar_sdk_1.Horizon.Server(rpc[0].horizon, {
|
|
19
|
+
allowHttp: true,
|
|
20
|
+
appName: 'rubic.exchange'
|
|
21
|
+
});
|
|
18
22
|
}
|
|
19
23
|
initWeb3Client() {
|
|
20
|
-
this.public = new stellar_sdk_2.rpc.Server(this.
|
|
24
|
+
this.public = new stellar_sdk_2.rpc.Server(this.rpc[0].soroban, {
|
|
21
25
|
allowHttp: true,
|
|
22
26
|
timeout: 5000
|
|
23
27
|
});
|
|
@@ -27,6 +31,13 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
27
31
|
return sequence;
|
|
28
32
|
}
|
|
29
33
|
async getTokensBalances(userAddress, tokensAddresses) {
|
|
34
|
+
try {
|
|
35
|
+
const resp = await this.horizonClient.loadAccount(userAddress);
|
|
36
|
+
console.log(resp.balances);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
console.error(err);
|
|
40
|
+
}
|
|
30
41
|
return Promise.all(tokensAddresses.map((address) => this.getBalance(userAddress, address)));
|
|
31
42
|
}
|
|
32
43
|
async getBalance(userAddress, tokenAddress) {
|
|
@@ -3,7 +3,8 @@ import { EnvType } from '../constants/models/env-type';
|
|
|
3
3
|
import { TronWebProvider } from '../adapters/adapter-tron/models/tron-web-provider';
|
|
4
4
|
import { TonAdapterConfig } from '../adapters/models/ton-adapter-config';
|
|
5
5
|
import { FallbackTransportConfig, HttpTransportConfig } from 'viem';
|
|
6
|
-
|
|
6
|
+
import { StellarRpcProvider } from '../adapters/adapter-stellar/models/stellar-rpc-provider';
|
|
7
|
+
export type RpcListType = Record<EvmBlockchainName, string[]> & Record<TronBlockchainName, TronWebProvider[]> & Record<SolanaBlockchainName, string[]> & Record<SuiBlockchainName, string[]> & Record<StellarBlockchainName, StellarRpcProvider[]>;
|
|
7
8
|
export interface AdapterFactoryParams {
|
|
8
9
|
rpcList: RpcListType;
|
|
9
10
|
httpClient?: HttpClient;
|