@@ -99,7 +99,7 @@ import { fileArrayBuffer, isFile } from './utils/file'
9999import { ResourceLocator } from './utils/resource-locator'
100100import { Size } from './utils/size'
101101import { getAmountForDuration , getDepthForSize , getStampCost } from './utils/stamps'
102- import { BZZ } from './utils/tokens'
102+ import { BZZ , DAI } from './utils/tokens'
103103import {
104104 asNumberString ,
105105 assertData ,
@@ -1437,16 +1437,32 @@ export class Bee {
14371437 }
14381438
14391439 /**
1440- * Deposit tokens from overlay address into chequebook
1440+ * Deposit tokens from node wallet into chequebook
14411441 *
14421442 * @param amount Amount of tokens to deposit (must be positive integer)
14431443 * @param gasPrice Gas Price in WEI for the transaction call
14441444 * @return string Hash of the transaction
1445+ * @deprecated Use `depositBZZToChequebook` instead.
14451446 */
14461447 async depositTokens (
14471448 amount : BZZ | NumberString | string | bigint ,
14481449 gasPrice ?: NumberString | string | bigint ,
14491450 options ?: BeeRequestOptions ,
1451+ ) : Promise < TransactionId > {
1452+ return this . depositBZZToChequebook ( amount , gasPrice , options )
1453+ }
1454+
1455+ /**
1456+ * Deposit tokens from node wallet into chequebook
1457+ *
1458+ * @param amount Amount of tokens to deposit (must be positive integer)
1459+ * @param gasPrice Gas Price in WEI for the transaction call
1460+ * @return string Hash of the transaction
1461+ */
1462+ async depositBZZToChequebook (
1463+ amount : BZZ | NumberString | string | bigint ,
1464+ gasPrice ?: NumberString | string | bigint ,
1465+ options ?: BeeRequestOptions ,
14501466 ) : Promise < TransactionId > {
14511467 const amountString =
14521468 amount instanceof BZZ ? amount . toPLURString ( ) : asNumberString ( amount , { min : 1n , name : 'amount' } )
@@ -1461,16 +1477,32 @@ export class Bee {
14611477 }
14621478
14631479 /**
1464- * Withdraw tokens from the chequebook to the overlay address
1480+ * Withdraw tokens from the chequebook to the node wallet
14651481 *
14661482 * @param amount Amount of tokens to withdraw (must be positive integer)
14671483 * @param gasPrice Gas Price in WEI for the transaction call
14681484 * @return string Hash of the transaction
1485+ * @deprecated Use `withdrawBZZFromChequebook` instead.
14691486 */
14701487 async withdrawTokens (
14711488 amount : BZZ | NumberString | string | bigint ,
14721489 gasPrice ?: NumberString | string | bigint ,
14731490 options ?: BeeRequestOptions ,
1491+ ) : Promise < TransactionId > {
1492+ return this . withdrawBZZFromChequebook ( amount , gasPrice , options )
1493+ }
1494+
1495+ /**
1496+ * Withdraw tokens from the chequebook to the node wallet
1497+ *
1498+ * @param amount Amount of tokens to withdraw (must be positive integer)
1499+ * @param gasPrice Gas Price in WEI for the transaction call
1500+ * @return string Hash of the transaction
1501+ */
1502+ async withdrawBZZFromChequebook (
1503+ amount : BZZ | NumberString | string | bigint ,
1504+ gasPrice ?: NumberString | string | bigint ,
1505+ options ?: BeeRequestOptions ,
14741506 ) : Promise < TransactionId > {
14751507 // TODO: check BZZ in tests
14761508 const amountString =
@@ -1485,6 +1517,28 @@ export class Bee {
14851517 return chequebook . withdrawTokens ( this . getRequestOptionsForCall ( options ) , amountString , gasPriceString )
14861518 }
14871519
1520+ async withdrawBZZToExternalWallet (
1521+ amount : BZZ | NumberString | string | bigint ,
1522+ address : EthAddress | Uint8Array | string ,
1523+ options ?: BeeRequestOptions ,
1524+ ) : Promise < TransactionId > {
1525+ amount = amount instanceof BZZ ? amount : BZZ . fromPLUR ( amount )
1526+ address = new EthAddress ( address )
1527+
1528+ return states . withdrawBZZ ( this . getRequestOptionsForCall ( options ) , amount , address )
1529+ }
1530+
1531+ async withdrawDAIToExternalWallet (
1532+ amount : DAI | NumberString | string | bigint ,
1533+ address : EthAddress | Uint8Array | string ,
1534+ options ?: BeeRequestOptions ,
1535+ ) : Promise < TransactionId > {
1536+ amount = amount instanceof DAI ? amount : DAI . fromWei ( amount )
1537+ address = new EthAddress ( address )
1538+
1539+ return states . withdrawDAI ( this . getRequestOptionsForCall ( options ) , amount , address )
1540+ }
1541+
14881542 /*
14891543 * Settlements endpoint
14901544 */
@@ -1581,7 +1635,7 @@ export class Bee {
15811635 }
15821636
15831637 /**
1584- * Get wallet balances for xDai and BZZ of the Bee node
1638+ * Get wallet balances for DAI and BZZ of the Bee node
15851639 *
15861640 * @param options
15871641 */
0 commit comments