@ethersphere/bee-js 9.4.0 → 9.5.0
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/dist/cjs/bee.js +71 -11
- package/dist/cjs/modules/debug/stake.js +37 -3
- package/dist/cjs/modules/debug/states.js +24 -1
- package/dist/cjs/utils/http.js +3 -0
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +72 -12
- package/dist/mjs/modules/debug/stake.js +45 -2
- package/dist/mjs/modules/debug/states.js +35 -0
- package/dist/mjs/utils/http.js +3 -0
- package/dist/types/bee.d.ts +54 -12
- package/dist/types/modules/debug/stake.d.ts +9 -2
- package/dist/types/modules/debug/states.d.ts +4 -0
- package/package.json +1 -1
package/dist/mjs/bee.js
CHANGED
|
@@ -35,7 +35,7 @@ import { BeeArgumentError, BeeError } from "./utils/error.js";
|
|
|
35
35
|
import { fileArrayBuffer, isFile } from "./utils/file.js";
|
|
36
36
|
import { ResourceLocator } from "./utils/resource-locator.js";
|
|
37
37
|
import { getAmountForDuration, getDepthForSize, getStampCost } from "./utils/stamps.js";
|
|
38
|
-
import { BZZ } from "./utils/tokens.js";
|
|
38
|
+
import { BZZ, DAI } from "./utils/tokens.js";
|
|
39
39
|
import { asNumberString, assertData, assertFileData, makeTagUid, prepareAllTagsOptions, prepareBeeRequestOptions, prepareCollectionUploadOptions, prepareDownloadOptions, prepareFileUploadOptions, prepareGsocMessageHandler, preparePostageBatchOptions, preparePssMessageHandler, prepareRedundantUploadOptions, prepareTransactionOptions, prepareUploadOptions } from "./utils/type.js";
|
|
40
40
|
import { BatchId, EthAddress, Identifier, PeerAddress, PrivateKey, PublicKey, Reference, Span, Topic, TransactionId } from "./utils/typed-bytes.js";
|
|
41
41
|
import { assertBeeUrl, stripLastSlash } from "./utils/url.js";
|
|
@@ -982,13 +982,24 @@ export class Bee {
|
|
|
982
982
|
return chequebook.cashoutLastCheque(this.getRequestOptionsForCall(requestOptions), address, options);
|
|
983
983
|
}
|
|
984
984
|
/**
|
|
985
|
-
* Deposit tokens from
|
|
985
|
+
* Deposit tokens from node wallet into chequebook
|
|
986
986
|
*
|
|
987
987
|
* @param amount Amount of tokens to deposit (must be positive integer)
|
|
988
988
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
989
989
|
* @return string Hash of the transaction
|
|
990
|
+
* @deprecated Use `depositBZZToChequebook` instead.
|
|
990
991
|
*/
|
|
991
992
|
async depositTokens(amount, gasPrice, options) {
|
|
993
|
+
return this.depositBZZToChequebook(amount, gasPrice, options);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Deposit tokens from node wallet into chequebook
|
|
997
|
+
*
|
|
998
|
+
* @param amount Amount of tokens to deposit (must be positive integer)
|
|
999
|
+
* @param gasPrice Gas Price in WEI for the transaction call
|
|
1000
|
+
* @return string Hash of the transaction
|
|
1001
|
+
*/
|
|
1002
|
+
async depositBZZToChequebook(amount, gasPrice, options) {
|
|
992
1003
|
const amountString = amount instanceof BZZ ? amount.toPLURString() : asNumberString(amount, {
|
|
993
1004
|
min: 1n,
|
|
994
1005
|
name: 'amount'
|
|
@@ -1003,13 +1014,24 @@ export class Bee {
|
|
|
1003
1014
|
return chequebook.depositTokens(this.getRequestOptionsForCall(options), amountString, gasPriceString);
|
|
1004
1015
|
}
|
|
1005
1016
|
/**
|
|
1006
|
-
* Withdraw tokens from the chequebook to the
|
|
1017
|
+
* Withdraw tokens from the chequebook to the node wallet
|
|
1007
1018
|
*
|
|
1008
1019
|
* @param amount Amount of tokens to withdraw (must be positive integer)
|
|
1009
1020
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
1010
1021
|
* @return string Hash of the transaction
|
|
1022
|
+
* @deprecated Use `withdrawBZZFromChequebook` instead.
|
|
1011
1023
|
*/
|
|
1012
1024
|
async withdrawTokens(amount, gasPrice, options) {
|
|
1025
|
+
return this.withdrawBZZFromChequebook(amount, gasPrice, options);
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Withdraw tokens from the chequebook to the node wallet
|
|
1029
|
+
*
|
|
1030
|
+
* @param amount Amount of tokens to withdraw (must be positive integer)
|
|
1031
|
+
* @param gasPrice Gas Price in WEI for the transaction call
|
|
1032
|
+
* @return string Hash of the transaction
|
|
1033
|
+
*/
|
|
1034
|
+
async withdrawBZZFromChequebook(amount, gasPrice, options) {
|
|
1013
1035
|
// TODO: check BZZ in tests
|
|
1014
1036
|
const amountString = amount instanceof BZZ ? amount.toPLURString() : asNumberString(amount, {
|
|
1015
1037
|
min: 1n,
|
|
@@ -1024,6 +1046,16 @@ export class Bee {
|
|
|
1024
1046
|
}
|
|
1025
1047
|
return chequebook.withdrawTokens(this.getRequestOptionsForCall(options), amountString, gasPriceString);
|
|
1026
1048
|
}
|
|
1049
|
+
async withdrawBZZToExternalWallet(amount, address, options) {
|
|
1050
|
+
amount = amount instanceof BZZ ? amount : BZZ.fromPLUR(amount);
|
|
1051
|
+
address = new EthAddress(address);
|
|
1052
|
+
return states.withdrawBZZ(this.getRequestOptionsForCall(options), amount, address);
|
|
1053
|
+
}
|
|
1054
|
+
async withdrawDAIToExternalWallet(amount, address, options) {
|
|
1055
|
+
amount = amount instanceof DAI ? amount : DAI.fromWei(amount);
|
|
1056
|
+
address = new EthAddress(address);
|
|
1057
|
+
return states.withdrawDAI(this.getRequestOptionsForCall(options), amount, address);
|
|
1058
|
+
}
|
|
1027
1059
|
/*
|
|
1028
1060
|
* Settlements endpoint
|
|
1029
1061
|
*/
|
|
@@ -1107,7 +1139,7 @@ export class Bee {
|
|
|
1107
1139
|
return states.getChainState(this.getRequestOptionsForCall(options));
|
|
1108
1140
|
}
|
|
1109
1141
|
/**
|
|
1110
|
-
* Get wallet balances for
|
|
1142
|
+
* Get wallet balances for DAI and BZZ of the Bee node
|
|
1111
1143
|
*
|
|
1112
1144
|
* @param options
|
|
1113
1145
|
*/
|
|
@@ -1335,7 +1367,7 @@ export class Bee {
|
|
|
1335
1367
|
return transactions.rebroadcastTransaction(this.getRequestOptionsForCall(options), transactionHash);
|
|
1336
1368
|
}
|
|
1337
1369
|
/**
|
|
1338
|
-
*
|
|
1370
|
+
* Cancels a currently pending transaction
|
|
1339
1371
|
* @param transactionHash
|
|
1340
1372
|
* @param gasPrice
|
|
1341
1373
|
*/
|
|
@@ -1351,20 +1383,48 @@ export class Bee {
|
|
|
1351
1383
|
return transactions.cancelTransaction(this.getRequestOptionsForCall(options), transactionHash, gasPriceString);
|
|
1352
1384
|
}
|
|
1353
1385
|
/**
|
|
1354
|
-
* Gets the
|
|
1386
|
+
* Gets the amount of staked BZZ
|
|
1355
1387
|
*
|
|
1356
|
-
* @param options
|
|
1388
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1357
1389
|
*/
|
|
1358
1390
|
async getStake(options) {
|
|
1359
1391
|
return stake.getStake(this.getRequestOptionsForCall(options));
|
|
1360
1392
|
}
|
|
1361
1393
|
/**
|
|
1362
|
-
*
|
|
1394
|
+
* Gets the amount of withdrawable staked BZZ.
|
|
1395
|
+
*
|
|
1396
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1397
|
+
*/
|
|
1398
|
+
async getWithdrawableStake(options) {
|
|
1399
|
+
return stake.getWithdrawableStake(this.getRequestOptionsForCall(options));
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Withdraws ALL surplus staked BZZ to the node wallet.
|
|
1403
|
+
*
|
|
1404
|
+
* Use the `getWithdrawableStake` method to check how much surplus stake is available.
|
|
1405
|
+
*
|
|
1406
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1407
|
+
*/
|
|
1408
|
+
async withdrawSurplusStake(options) {
|
|
1409
|
+
return stake.withdrawSurplusStake(this.getRequestOptionsForCall(options));
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Withdraws all staked BZZ to the node wallet.
|
|
1413
|
+
*
|
|
1414
|
+
* **Only available when the staking contract is paused and is in the process of being migrated to a new contract!**
|
|
1415
|
+
*
|
|
1416
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1417
|
+
*/
|
|
1418
|
+
async migrateStake(options) {
|
|
1419
|
+
return stake.migrateStake(this.getRequestOptionsForCall(options));
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Stakes the given amount of BZZ. Initial deposit must be at least 10 BZZ.
|
|
1363
1423
|
*
|
|
1364
1424
|
* Be aware that staked BZZ tokens can **not** be withdrawn.
|
|
1365
1425
|
*
|
|
1366
|
-
* @param amount Amount of BZZ
|
|
1367
|
-
* @param options
|
|
1426
|
+
* @param amount Amount of BZZ tokens to be staked. If not providing a `BZZ` instance, the amount is denoted in PLUR.
|
|
1427
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1368
1428
|
*/
|
|
1369
1429
|
async depositStake(amount, options, requestOptions) {
|
|
1370
1430
|
const amountString = amount instanceof BZZ ? amount.toPLURString() : asNumberString(amount, {
|
|
@@ -1377,9 +1437,9 @@ export class Bee {
|
|
|
1377
1437
|
return stake.stake(this.getRequestOptionsForCall(requestOptions), amountString, options);
|
|
1378
1438
|
}
|
|
1379
1439
|
/**
|
|
1380
|
-
*
|
|
1440
|
+
* Gets current status of node in redistribution game
|
|
1381
1441
|
*
|
|
1382
|
-
* @param options
|
|
1442
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1383
1443
|
*/
|
|
1384
1444
|
async getRedistributionState(options) {
|
|
1385
1445
|
return stake.getRedistributionState(this.getRequestOptionsForCall(options));
|
|
@@ -7,7 +7,7 @@ import { TransactionId } from "../../utils/typed-bytes.js";
|
|
|
7
7
|
const STAKE_ENDPOINT = 'stake';
|
|
8
8
|
const REDISTRIBUTION_ENDPOINT = 'redistributionstate';
|
|
9
9
|
/**
|
|
10
|
-
* Gets the staked
|
|
10
|
+
* Gets the amount of staked BZZ
|
|
11
11
|
*
|
|
12
12
|
* @param requestOptions Options for making requests
|
|
13
13
|
*/
|
|
@@ -24,12 +24,55 @@ export async function getStake(requestOptions) {
|
|
|
24
24
|
name: 'stakedAmount'
|
|
25
25
|
}));
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the amount of withdrawable staked BZZ
|
|
29
|
+
*
|
|
30
|
+
* @param requestOptions Options for making requests
|
|
31
|
+
*/
|
|
32
|
+
export async function getWithdrawableStake(requestOptions) {
|
|
33
|
+
const response = await http(requestOptions, {
|
|
34
|
+
method: 'get',
|
|
35
|
+
responseType: 'json',
|
|
36
|
+
url: `${STAKE_ENDPOINT}/withdrawable`
|
|
37
|
+
});
|
|
38
|
+
const body = Types.asObject(response.data, {
|
|
39
|
+
name: 'response.data'
|
|
40
|
+
});
|
|
41
|
+
return BZZ.fromPLUR(asNumberString(body.withdrawableAmount, {
|
|
42
|
+
name: 'withdrawableAmount'
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
export async function withdrawSurplusStake(requestOptions) {
|
|
46
|
+
const response = await http(requestOptions, {
|
|
47
|
+
method: 'delete',
|
|
48
|
+
responseType: 'json',
|
|
49
|
+
url: `${STAKE_ENDPOINT}/withdrawable`
|
|
50
|
+
});
|
|
51
|
+
const body = Types.asObject(response.data, {
|
|
52
|
+
name: 'response.data'
|
|
53
|
+
});
|
|
54
|
+
return new TransactionId(Types.asHexString(body.txHash, {
|
|
55
|
+
name: 'txHash'
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
export async function migrateStake(requestOptions) {
|
|
59
|
+
const response = await http(requestOptions, {
|
|
60
|
+
method: 'delete',
|
|
61
|
+
responseType: 'json',
|
|
62
|
+
url: STAKE_ENDPOINT
|
|
63
|
+
});
|
|
64
|
+
const body = Types.asObject(response.data, {
|
|
65
|
+
name: 'response.data'
|
|
66
|
+
});
|
|
67
|
+
return new TransactionId(Types.asHexString(body.txHash, {
|
|
68
|
+
name: 'txHash'
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
27
71
|
/**
|
|
28
72
|
* Stake given amount of tokens.
|
|
29
73
|
*
|
|
30
74
|
* @param requestOptions Options for making requests
|
|
31
75
|
* @param amount
|
|
32
|
-
* @param options
|
|
33
76
|
*/
|
|
34
77
|
export async function stake(requestOptions, amount, options) {
|
|
35
78
|
const repsonse = await http(requestOptions, {
|
|
@@ -2,6 +2,7 @@ import { Types } from 'cafe-utility';
|
|
|
2
2
|
import { http } from "../../utils/http.js";
|
|
3
3
|
import { BZZ, DAI } from "../../utils/tokens.js";
|
|
4
4
|
import { asNumberString } from "../../utils/type.js";
|
|
5
|
+
import { TransactionId } from "../../utils/typed-bytes.js";
|
|
5
6
|
import { normalizeCurrentPrice } from "../../utils/workaround.js";
|
|
6
7
|
const RESERVE_STATE_ENDPOINT = 'reservestate';
|
|
7
8
|
const WALLET_ENDPOINT = 'wallet';
|
|
@@ -92,4 +93,38 @@ export async function getWalletBalance(requestOptions) {
|
|
|
92
93
|
name: 'walletAddress'
|
|
93
94
|
})
|
|
94
95
|
};
|
|
96
|
+
}
|
|
97
|
+
export async function withdrawBZZ(requestOptions, amount, address) {
|
|
98
|
+
const response = await http(requestOptions, {
|
|
99
|
+
method: 'post',
|
|
100
|
+
url: `${WALLET_ENDPOINT}/withdraw/bzz`,
|
|
101
|
+
responseType: 'json',
|
|
102
|
+
params: {
|
|
103
|
+
amount: amount.toPLURString(),
|
|
104
|
+
address: address.toHex()
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const body = Types.asObject(response.data, {
|
|
108
|
+
name: 'response.data'
|
|
109
|
+
});
|
|
110
|
+
return new TransactionId(Types.asString(body.transactionHash, {
|
|
111
|
+
name: 'transactionHash'
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
export async function withdrawDAI(requestOptions, amount, address) {
|
|
115
|
+
const response = await http(requestOptions, {
|
|
116
|
+
method: 'post',
|
|
117
|
+
url: `${WALLET_ENDPOINT}/withdraw/nativetoken`,
|
|
118
|
+
responseType: 'json',
|
|
119
|
+
params: {
|
|
120
|
+
amount: amount.toWeiString(),
|
|
121
|
+
address: address.toHex()
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const body = Types.asObject(response.data, {
|
|
125
|
+
name: 'response.data'
|
|
126
|
+
});
|
|
127
|
+
return new TransactionId(Types.asString(body.transactionHash, {
|
|
128
|
+
name: 'transactionHash'
|
|
129
|
+
}));
|
|
95
130
|
}
|
package/dist/mjs/utils/http.js
CHANGED
|
@@ -22,6 +22,9 @@ export const DEFAULT_HTTP_CONFIG = {
|
|
|
22
22
|
*/
|
|
23
23
|
export async function http(options, config) {
|
|
24
24
|
const requestConfig = Objects.deepMerge3(DEFAULT_HTTP_CONFIG, config, options);
|
|
25
|
+
if (requestConfig.data && typeof Buffer !== 'undefined' && Buffer.isBuffer(requestConfig.data)) {
|
|
26
|
+
requestConfig.data = requestConfig.data.buffer.slice(requestConfig.data.byteOffset, requestConfig.data.byteOffset + requestConfig.data.byteLength);
|
|
27
|
+
}
|
|
25
28
|
if (requestConfig.params) {
|
|
26
29
|
const keys = Object.keys(requestConfig.params);
|
|
27
30
|
for (const key of keys) {
|
package/dist/types/bee.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { AllTagsOptions, Collection, PostageBatchOptions, TransactionOptions, Up
|
|
|
7
7
|
import { Bytes } from './utils/bytes';
|
|
8
8
|
import { Duration } from './utils/duration';
|
|
9
9
|
import { Size } from './utils/size';
|
|
10
|
-
import { BZZ } from './utils/tokens';
|
|
10
|
+
import { BZZ, DAI } from './utils/tokens';
|
|
11
11
|
import { BatchId, EthAddress, FeedIndex, Identifier, PeerAddress, PrivateKey, PublicKey, Reference, Topic, TransactionId } from './utils/typed-bytes';
|
|
12
12
|
import { UploadProgress } from './utils/upload-progress';
|
|
13
13
|
/**
|
|
@@ -563,21 +563,41 @@ export declare class Bee {
|
|
|
563
563
|
*/
|
|
564
564
|
cashoutLastCheque(address: PeerAddress | string, options?: TransactionOptions, requestOptions?: BeeRequestOptions): Promise<TransactionId>;
|
|
565
565
|
/**
|
|
566
|
-
* Deposit tokens from
|
|
566
|
+
* Deposit tokens from node wallet into chequebook
|
|
567
567
|
*
|
|
568
568
|
* @param amount Amount of tokens to deposit (must be positive integer)
|
|
569
569
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
570
570
|
* @return string Hash of the transaction
|
|
571
|
+
* @deprecated Use `depositBZZToChequebook` instead.
|
|
571
572
|
*/
|
|
572
573
|
depositTokens(amount: BZZ | NumberString | string | bigint, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
573
574
|
/**
|
|
574
|
-
*
|
|
575
|
+
* Deposit tokens from node wallet into chequebook
|
|
576
|
+
*
|
|
577
|
+
* @param amount Amount of tokens to deposit (must be positive integer)
|
|
578
|
+
* @param gasPrice Gas Price in WEI for the transaction call
|
|
579
|
+
* @return string Hash of the transaction
|
|
580
|
+
*/
|
|
581
|
+
depositBZZToChequebook(amount: BZZ | NumberString | string | bigint, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
582
|
+
/**
|
|
583
|
+
* Withdraw tokens from the chequebook to the node wallet
|
|
575
584
|
*
|
|
576
585
|
* @param amount Amount of tokens to withdraw (must be positive integer)
|
|
577
586
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
578
587
|
* @return string Hash of the transaction
|
|
588
|
+
* @deprecated Use `withdrawBZZFromChequebook` instead.
|
|
579
589
|
*/
|
|
580
590
|
withdrawTokens(amount: BZZ | NumberString | string | bigint, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
591
|
+
/**
|
|
592
|
+
* Withdraw tokens from the chequebook to the node wallet
|
|
593
|
+
*
|
|
594
|
+
* @param amount Amount of tokens to withdraw (must be positive integer)
|
|
595
|
+
* @param gasPrice Gas Price in WEI for the transaction call
|
|
596
|
+
* @return string Hash of the transaction
|
|
597
|
+
*/
|
|
598
|
+
withdrawBZZFromChequebook(amount: BZZ | NumberString | string | bigint, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
599
|
+
withdrawBZZToExternalWallet(amount: BZZ | NumberString | string | bigint, address: EthAddress | Uint8Array | string, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
600
|
+
withdrawDAIToExternalWallet(amount: DAI | NumberString | string | bigint, address: EthAddress | Uint8Array | string, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
581
601
|
/**
|
|
582
602
|
* Get amount of sent and received from settlements with a peer
|
|
583
603
|
*
|
|
@@ -635,7 +655,7 @@ export declare class Bee {
|
|
|
635
655
|
*/
|
|
636
656
|
getChainState(options?: BeeRequestOptions): Promise<ChainState>;
|
|
637
657
|
/**
|
|
638
|
-
* Get wallet balances for
|
|
658
|
+
* Get wallet balances for DAI and BZZ of the Bee node
|
|
639
659
|
*
|
|
640
660
|
* @param options
|
|
641
661
|
*/
|
|
@@ -753,30 +773,52 @@ export declare class Bee {
|
|
|
753
773
|
*/
|
|
754
774
|
rebroadcastPendingTransaction(transactionHash: TransactionId | Uint8Array | string, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
755
775
|
/**
|
|
756
|
-
*
|
|
776
|
+
* Cancels a currently pending transaction
|
|
757
777
|
* @param transactionHash
|
|
758
778
|
* @param gasPrice
|
|
759
779
|
*/
|
|
760
780
|
cancelPendingTransaction(transactionHash: TransactionId | Uint8Array | string, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
761
781
|
/**
|
|
762
|
-
* Gets the
|
|
782
|
+
* Gets the amount of staked BZZ
|
|
763
783
|
*
|
|
764
|
-
* @param options
|
|
784
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
765
785
|
*/
|
|
766
786
|
getStake(options?: BeeRequestOptions): Promise<BZZ>;
|
|
767
787
|
/**
|
|
768
|
-
*
|
|
788
|
+
* Gets the amount of withdrawable staked BZZ.
|
|
789
|
+
*
|
|
790
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
791
|
+
*/
|
|
792
|
+
getWithdrawableStake(options?: BeeRequestOptions): Promise<BZZ>;
|
|
793
|
+
/**
|
|
794
|
+
* Withdraws ALL surplus staked BZZ to the node wallet.
|
|
795
|
+
*
|
|
796
|
+
* Use the `getWithdrawableStake` method to check how much surplus stake is available.
|
|
797
|
+
*
|
|
798
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
799
|
+
*/
|
|
800
|
+
withdrawSurplusStake(options?: BeeRequestOptions): Promise<TransactionId>;
|
|
801
|
+
/**
|
|
802
|
+
* Withdraws all staked BZZ to the node wallet.
|
|
803
|
+
*
|
|
804
|
+
* **Only available when the staking contract is paused and is in the process of being migrated to a new contract!**
|
|
805
|
+
*
|
|
806
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
807
|
+
*/
|
|
808
|
+
migrateStake(options?: BeeRequestOptions): Promise<TransactionId>;
|
|
809
|
+
/**
|
|
810
|
+
* Stakes the given amount of BZZ. Initial deposit must be at least 10 BZZ.
|
|
769
811
|
*
|
|
770
812
|
* Be aware that staked BZZ tokens can **not** be withdrawn.
|
|
771
813
|
*
|
|
772
|
-
* @param amount Amount of BZZ
|
|
773
|
-
* @param options
|
|
814
|
+
* @param amount Amount of BZZ tokens to be staked. If not providing a `BZZ` instance, the amount is denoted in PLUR.
|
|
815
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
774
816
|
*/
|
|
775
817
|
depositStake(amount: BZZ | NumberString | string | bigint, options?: TransactionOptions, requestOptions?: BeeRequestOptions): Promise<TransactionId>;
|
|
776
818
|
/**
|
|
777
|
-
*
|
|
819
|
+
* Gets current status of node in redistribution game
|
|
778
820
|
*
|
|
779
|
-
* @param options
|
|
821
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
780
822
|
*/
|
|
781
823
|
getRedistributionState(options?: BeeRequestOptions): Promise<RedistributionState>;
|
|
782
824
|
private waitForUsablePostageStamp;
|
|
@@ -2,17 +2,24 @@ import { BeeRequestOptions, NumberString, RedistributionState, TransactionOption
|
|
|
2
2
|
import { BZZ } from '../../utils/tokens';
|
|
3
3
|
import { TransactionId } from '../../utils/typed-bytes';
|
|
4
4
|
/**
|
|
5
|
-
* Gets the staked
|
|
5
|
+
* Gets the amount of staked BZZ
|
|
6
6
|
*
|
|
7
7
|
* @param requestOptions Options for making requests
|
|
8
8
|
*/
|
|
9
9
|
export declare function getStake(requestOptions: BeeRequestOptions): Promise<BZZ>;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the amount of withdrawable staked BZZ
|
|
12
|
+
*
|
|
13
|
+
* @param requestOptions Options for making requests
|
|
14
|
+
*/
|
|
15
|
+
export declare function getWithdrawableStake(requestOptions: BeeRequestOptions): Promise<BZZ>;
|
|
16
|
+
export declare function withdrawSurplusStake(requestOptions: BeeRequestOptions): Promise<TransactionId>;
|
|
17
|
+
export declare function migrateStake(requestOptions: BeeRequestOptions): Promise<TransactionId>;
|
|
10
18
|
/**
|
|
11
19
|
* Stake given amount of tokens.
|
|
12
20
|
*
|
|
13
21
|
* @param requestOptions Options for making requests
|
|
14
22
|
* @param amount
|
|
15
|
-
* @param options
|
|
16
23
|
*/
|
|
17
24
|
export declare function stake(requestOptions: BeeRequestOptions, amount: NumberString | string | bigint, options?: TransactionOptions): Promise<TransactionId>;
|
|
18
25
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BeeRequestOptions, ChainState, ReserveState, WalletBalance } from '../../types';
|
|
2
|
+
import { BZZ, DAI } from '../../utils/tokens';
|
|
3
|
+
import { EthAddress, TransactionId } from '../../utils/typed-bytes';
|
|
2
4
|
/**
|
|
3
5
|
* Get state of reserve
|
|
4
6
|
*
|
|
@@ -17,3 +19,5 @@ export declare function getChainState(requestOptions: BeeRequestOptions): Promis
|
|
|
17
19
|
* @param requestOptions Options for making requests
|
|
18
20
|
*/
|
|
19
21
|
export declare function getWalletBalance(requestOptions: BeeRequestOptions): Promise<WalletBalance>;
|
|
22
|
+
export declare function withdrawBZZ(requestOptions: BeeRequestOptions, amount: BZZ, address: EthAddress): Promise<TransactionId>;
|
|
23
|
+
export declare function withdrawDAI(requestOptions: BeeRequestOptions, amount: DAI, address: EthAddress): Promise<TransactionId>;
|