@cryptorubic/web3 1.0.0-alpha.no-sdk.24 → 1.0.0-alpha.no-sdk.25
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
CHANGED
|
@@ -69,7 +69,7 @@ export declare class EvmAdapter extends AbstractAdapter<PublicActions & PublicCl
|
|
|
69
69
|
* @param [options] Additional options.
|
|
70
70
|
* @returns Approval transaction hash.
|
|
71
71
|
*/
|
|
72
|
-
approveTokens(
|
|
72
|
+
approveTokens(tokenAddress: string, spenderAddress: string, amount?: BigNumber | 'infinity', options?: EvmTransactionOptions): Promise<string>;
|
|
73
73
|
/**
|
|
74
74
|
* Build encoded approve transaction config.
|
|
75
75
|
* @param tokenAddress Address of the smart-contract corresponding to the token.
|
|
@@ -320,12 +320,12 @@ class EvmAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
320
320
|
* @param [options] Additional options.
|
|
321
321
|
* @returns Approval transaction hash.
|
|
322
322
|
*/
|
|
323
|
-
async approveTokens(
|
|
323
|
+
async approveTokens(tokenAddress, spenderAddress, amount = 'infinity', options = {}) {
|
|
324
324
|
try {
|
|
325
325
|
const rawValue = amount === 'infinity' ? new bignumber_js_1.default(2).pow(256).minus(1) : amount;
|
|
326
326
|
const encodedApprove = this.encodeApprove(tokenAddress, spenderAddress, rawValue.toFixed(0));
|
|
327
327
|
const gaslessParams = {
|
|
328
|
-
account: walletAddress,
|
|
328
|
+
account: this.signer.walletAddress,
|
|
329
329
|
to: tokenAddress,
|
|
330
330
|
value: BigInt('0'),
|
|
331
331
|
data: encodedApprove.data
|
|
@@ -12,7 +12,8 @@ import { ClientAdaptersFactoryParams } from '../../models/create-factory-params'
|
|
|
12
12
|
import { TronAdapterSigner } from './signer/tron-adapter-signer';
|
|
13
13
|
import { TronTransactionOptions } from './models/tron-send-tx-params';
|
|
14
14
|
import { AllowanceInfo } from '../models/common-types';
|
|
15
|
-
|
|
15
|
+
import { ApprovableAdapter } from '../models/approve-adapter';
|
|
16
|
+
export declare class TronAdapter extends AbstractAdapter<TronWeb, TronWeb, TronBlockchainName> implements ApprovableAdapter<TronTransactionConfig> {
|
|
16
17
|
readonly signer: TronAdapterSigner;
|
|
17
18
|
private readonly multicallAddress;
|
|
18
19
|
needPreswapAction(): Promise<boolean>;
|
|
@@ -30,13 +30,12 @@ export interface ApprovableAdapter<T> extends AbstractAdapter<any, any, Blockcha
|
|
|
30
30
|
needApprove(token: TokenAmount, contractAddress: string, walletAddress: string, amount: string): Promise<boolean>;
|
|
31
31
|
/**
|
|
32
32
|
* Executes approve method in ERC-20 token contract.
|
|
33
|
-
* @param walletAddress Address of user wallet.
|
|
34
33
|
* @param tokenAddress Address of the smart-contract corresponding to the token.
|
|
35
34
|
* @param spenderAddress Wallet or contract address to approve.
|
|
36
35
|
* @param amount Token amount to approve in wei.
|
|
37
36
|
* @param [options] Additional options.
|
|
38
37
|
* @returns Approval transaction receipt.
|
|
39
38
|
*/
|
|
40
|
-
approveTokens(
|
|
39
|
+
approveTokens(tokenAddress: string, spenderAddress: string, amount: BigNumber | 'infinity', options: BasicSendTransactionOptions): Promise<string>;
|
|
41
40
|
}
|
|
42
41
|
export declare function isApprovableAdapter(adapter: AbstractAdapter<any, any, BlockchainName, {}>): adapter is ApprovableAdapter<EvmTransactionConfig | TronTransactionConfig>;
|