Skip to content

Commit

Permalink
Fix api from address
Browse files Browse the repository at this point in the history
  • Loading branch information
axtezy committed Sep 13, 2024
1 parent 0370126 commit c6d6f36
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rubic-sdk",
"version": "5.36.6",
"version": "5.36.7",
"description": "Simplify dApp creation",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export abstract class CrossChainTrade<T = unknown> {
}

protected get walletAddress(): string {
return this.web3Private.address;
return this._apiFromAddress ?? this.web3Private.address;
}

protected abstract get methodName(): string;
Expand Down Expand Up @@ -139,6 +139,12 @@ export abstract class CrossChainTrade<T = unknown> {
}
}

private _apiFromAddress: string | null = null;

public set apiFromAddress(value: string | null) {
this._apiFromAddress = value;
}

protected constructor(
protected readonly providerAddress: string,
protected readonly routePath: RubicStep[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export abstract class EvmCrossChainTrade extends CrossChainTrade<EvmEncodeConfig
fromAddress: string,
options: SwapTransactionOptions = {}
): Promise<EvmTransactionOptions | never> {
this.apiFromAddress = fromAddress;
if (!options?.testMode) {
await this.checkTradeErrors();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export abstract class EvmOnChainTrade extends OnChainTrade {
fromAddress: string,
options: SwapTransactionOptions = {}
): Promise<EvmTransactionOptions | never> {
this.apiFromAddress = fromAddress;
if (!options?.testMode) {
await this.checkWalletState(options?.testMode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export abstract class OnChainTrade {

public abstract readonly feeInfo: FeeInfo;

private _apiFromAddress: string | null = null;

public set apiFromAddress(value: string | null) {
this._apiFromAddress = value;
}

/**
* Type of instant trade provider.
*/
Expand All @@ -66,7 +72,7 @@ export abstract class OnChainTrade {
}

protected get walletAddress(): string {
return this.web3Private.address;
return this._apiFromAddress ?? this.web3Private.address;
}

protected get httpClient(): HttpClient {
Expand Down

0 comments on commit c6d6f36

Please sign in to comment.