@ethersphere/bee-js 9.4.1 → 9.6.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 +82 -11
- package/dist/cjs/modules/debug/stake.js +37 -3
- package/dist/cjs/modules/debug/states.js +24 -1
- package/dist/cjs/modules/status.js +15 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +83 -12
- package/dist/mjs/modules/debug/stake.js +45 -2
- package/dist/mjs/modules/debug/states.js +35 -0
- package/dist/mjs/modules/status.js +12 -0
- package/dist/types/bee.d.ts +63 -12
- package/dist/types/modules/debug/stake.d.ts +9 -2
- package/dist/types/modules/debug/states.d.ts +4 -0
- package/dist/types/modules/status.d.ts +1 -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";
|
|
@@ -867,6 +867,17 @@ export class Bee {
|
|
|
867
867
|
}
|
|
868
868
|
return true;
|
|
869
869
|
}
|
|
870
|
+
/**
|
|
871
|
+
* Checks the `/gateway` endpoint to see if the remote API is a gateway.
|
|
872
|
+
*
|
|
873
|
+
* Do note that this is not a standard way to check for gateway nodes,
|
|
874
|
+
* but some of the gateway tooling expose this endpoint.
|
|
875
|
+
*
|
|
876
|
+
* @param options
|
|
877
|
+
*/
|
|
878
|
+
async isGateway(options) {
|
|
879
|
+
return status.isGateway(this.getRequestOptionsForCall(options));
|
|
880
|
+
}
|
|
870
881
|
// Legacy debug API
|
|
871
882
|
async getNodeAddresses(options) {
|
|
872
883
|
return connectivity.getNodeAddresses(this.getRequestOptionsForCall(options));
|
|
@@ -982,13 +993,24 @@ export class Bee {
|
|
|
982
993
|
return chequebook.cashoutLastCheque(this.getRequestOptionsForCall(requestOptions), address, options);
|
|
983
994
|
}
|
|
984
995
|
/**
|
|
985
|
-
* Deposit tokens from
|
|
996
|
+
* Deposit tokens from node wallet into chequebook
|
|
986
997
|
*
|
|
987
998
|
* @param amount Amount of tokens to deposit (must be positive integer)
|
|
988
999
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
989
1000
|
* @return string Hash of the transaction
|
|
1001
|
+
* @deprecated Use `depositBZZToChequebook` instead.
|
|
990
1002
|
*/
|
|
991
1003
|
async depositTokens(amount, gasPrice, options) {
|
|
1004
|
+
return this.depositBZZToChequebook(amount, gasPrice, options);
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Deposit tokens from node wallet into chequebook
|
|
1008
|
+
*
|
|
1009
|
+
* @param amount Amount of tokens to deposit (must be positive integer)
|
|
1010
|
+
* @param gasPrice Gas Price in WEI for the transaction call
|
|
1011
|
+
* @return string Hash of the transaction
|
|
1012
|
+
*/
|
|
1013
|
+
async depositBZZToChequebook(amount, gasPrice, options) {
|
|
992
1014
|
const amountString = amount instanceof BZZ ? amount.toPLURString() : asNumberString(amount, {
|
|
993
1015
|
min: 1n,
|
|
994
1016
|
name: 'amount'
|
|
@@ -1003,13 +1025,24 @@ export class Bee {
|
|
|
1003
1025
|
return chequebook.depositTokens(this.getRequestOptionsForCall(options), amountString, gasPriceString);
|
|
1004
1026
|
}
|
|
1005
1027
|
/**
|
|
1006
|
-
* Withdraw tokens from the chequebook to the
|
|
1028
|
+
* Withdraw tokens from the chequebook to the node wallet
|
|
1007
1029
|
*
|
|
1008
1030
|
* @param amount Amount of tokens to withdraw (must be positive integer)
|
|
1009
1031
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
1010
1032
|
* @return string Hash of the transaction
|
|
1033
|
+
* @deprecated Use `withdrawBZZFromChequebook` instead.
|
|
1011
1034
|
*/
|
|
1012
1035
|
async withdrawTokens(amount, gasPrice, options) {
|
|
1036
|
+
return this.withdrawBZZFromChequebook(amount, gasPrice, options);
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Withdraw tokens from the chequebook to the node wallet
|
|
1040
|
+
*
|
|
1041
|
+
* @param amount Amount of tokens to withdraw (must be positive integer)
|
|
1042
|
+
* @param gasPrice Gas Price in WEI for the transaction call
|
|
1043
|
+
* @return string Hash of the transaction
|
|
1044
|
+
*/
|
|
1045
|
+
async withdrawBZZFromChequebook(amount, gasPrice, options) {
|
|
1013
1046
|
// TODO: check BZZ in tests
|
|
1014
1047
|
const amountString = amount instanceof BZZ ? amount.toPLURString() : asNumberString(amount, {
|
|
1015
1048
|
min: 1n,
|
|
@@ -1024,6 +1057,16 @@ export class Bee {
|
|
|
1024
1057
|
}
|
|
1025
1058
|
return chequebook.withdrawTokens(this.getRequestOptionsForCall(options), amountString, gasPriceString);
|
|
1026
1059
|
}
|
|
1060
|
+
async withdrawBZZToExternalWallet(amount, address, options) {
|
|
1061
|
+
amount = amount instanceof BZZ ? amount : BZZ.fromPLUR(amount);
|
|
1062
|
+
address = new EthAddress(address);
|
|
1063
|
+
return states.withdrawBZZ(this.getRequestOptionsForCall(options), amount, address);
|
|
1064
|
+
}
|
|
1065
|
+
async withdrawDAIToExternalWallet(amount, address, options) {
|
|
1066
|
+
amount = amount instanceof DAI ? amount : DAI.fromWei(amount);
|
|
1067
|
+
address = new EthAddress(address);
|
|
1068
|
+
return states.withdrawDAI(this.getRequestOptionsForCall(options), amount, address);
|
|
1069
|
+
}
|
|
1027
1070
|
/*
|
|
1028
1071
|
* Settlements endpoint
|
|
1029
1072
|
*/
|
|
@@ -1107,7 +1150,7 @@ export class Bee {
|
|
|
1107
1150
|
return states.getChainState(this.getRequestOptionsForCall(options));
|
|
1108
1151
|
}
|
|
1109
1152
|
/**
|
|
1110
|
-
* Get wallet balances for
|
|
1153
|
+
* Get wallet balances for DAI and BZZ of the Bee node
|
|
1111
1154
|
*
|
|
1112
1155
|
* @param options
|
|
1113
1156
|
*/
|
|
@@ -1335,7 +1378,7 @@ export class Bee {
|
|
|
1335
1378
|
return transactions.rebroadcastTransaction(this.getRequestOptionsForCall(options), transactionHash);
|
|
1336
1379
|
}
|
|
1337
1380
|
/**
|
|
1338
|
-
*
|
|
1381
|
+
* Cancels a currently pending transaction
|
|
1339
1382
|
* @param transactionHash
|
|
1340
1383
|
* @param gasPrice
|
|
1341
1384
|
*/
|
|
@@ -1351,20 +1394,48 @@ export class Bee {
|
|
|
1351
1394
|
return transactions.cancelTransaction(this.getRequestOptionsForCall(options), transactionHash, gasPriceString);
|
|
1352
1395
|
}
|
|
1353
1396
|
/**
|
|
1354
|
-
* Gets the
|
|
1397
|
+
* Gets the amount of staked BZZ
|
|
1355
1398
|
*
|
|
1356
|
-
* @param options
|
|
1399
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1357
1400
|
*/
|
|
1358
1401
|
async getStake(options) {
|
|
1359
1402
|
return stake.getStake(this.getRequestOptionsForCall(options));
|
|
1360
1403
|
}
|
|
1361
1404
|
/**
|
|
1362
|
-
*
|
|
1405
|
+
* Gets the amount of withdrawable staked BZZ.
|
|
1406
|
+
*
|
|
1407
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1408
|
+
*/
|
|
1409
|
+
async getWithdrawableStake(options) {
|
|
1410
|
+
return stake.getWithdrawableStake(this.getRequestOptionsForCall(options));
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Withdraws ALL surplus staked BZZ to the node wallet.
|
|
1414
|
+
*
|
|
1415
|
+
* Use the `getWithdrawableStake` method to check how much surplus stake is available.
|
|
1416
|
+
*
|
|
1417
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1418
|
+
*/
|
|
1419
|
+
async withdrawSurplusStake(options) {
|
|
1420
|
+
return stake.withdrawSurplusStake(this.getRequestOptionsForCall(options));
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Withdraws all staked BZZ to the node wallet.
|
|
1424
|
+
*
|
|
1425
|
+
* **Only available when the staking contract is paused and is in the process of being migrated to a new contract!**
|
|
1426
|
+
*
|
|
1427
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1428
|
+
*/
|
|
1429
|
+
async migrateStake(options) {
|
|
1430
|
+
return stake.migrateStake(this.getRequestOptionsForCall(options));
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Stakes the given amount of BZZ. Initial deposit must be at least 10 BZZ.
|
|
1363
1434
|
*
|
|
1364
1435
|
* Be aware that staked BZZ tokens can **not** be withdrawn.
|
|
1365
1436
|
*
|
|
1366
|
-
* @param amount Amount of BZZ
|
|
1367
|
-
* @param options
|
|
1437
|
+
* @param amount Amount of BZZ tokens to be staked. If not providing a `BZZ` instance, the amount is denoted in PLUR.
|
|
1438
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1368
1439
|
*/
|
|
1369
1440
|
async depositStake(amount, options, requestOptions) {
|
|
1370
1441
|
const amountString = amount instanceof BZZ ? amount.toPLURString() : asNumberString(amount, {
|
|
@@ -1377,9 +1448,9 @@ export class Bee {
|
|
|
1377
1448
|
return stake.stake(this.getRequestOptionsForCall(requestOptions), amountString, options);
|
|
1378
1449
|
}
|
|
1379
1450
|
/**
|
|
1380
|
-
*
|
|
1451
|
+
* Gets current status of node in redistribution game
|
|
1381
1452
|
*
|
|
1382
|
-
* @param options
|
|
1453
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
1383
1454
|
*/
|
|
1384
1455
|
async getRedistributionState(options) {
|
|
1385
1456
|
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
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Types } from 'cafe-utility';
|
|
1
2
|
import { http } from "../utils/http.js";
|
|
2
3
|
/**
|
|
3
4
|
* Ping the base bee URL. If connection was not successful throw error
|
|
@@ -8,4 +9,15 @@ export async function checkConnection(requestOptions) {
|
|
|
8
9
|
await http(requestOptions, {
|
|
9
10
|
url: ''
|
|
10
11
|
});
|
|
12
|
+
}
|
|
13
|
+
export async function isGateway(requestOptions) {
|
|
14
|
+
try {
|
|
15
|
+
const response = await http(requestOptions, {
|
|
16
|
+
url: '/gateway'
|
|
17
|
+
});
|
|
18
|
+
const data = Types.asObject(response.data);
|
|
19
|
+
return Types.asBoolean(data.gateway);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
11
23
|
}
|
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
|
/**
|
|
@@ -497,6 +497,15 @@ export declare class Bee {
|
|
|
497
497
|
* @returns true if successful, false on error
|
|
498
498
|
*/
|
|
499
499
|
isConnected(options?: BeeRequestOptions): Promise<boolean>;
|
|
500
|
+
/**
|
|
501
|
+
* Checks the `/gateway` endpoint to see if the remote API is a gateway.
|
|
502
|
+
*
|
|
503
|
+
* Do note that this is not a standard way to check for gateway nodes,
|
|
504
|
+
* but some of the gateway tooling expose this endpoint.
|
|
505
|
+
*
|
|
506
|
+
* @param options
|
|
507
|
+
*/
|
|
508
|
+
isGateway(options?: BeeRequestOptions): Promise<boolean>;
|
|
500
509
|
getNodeAddresses(options?: BeeRequestOptions): Promise<NodeAddresses>;
|
|
501
510
|
getBlocklist(options?: BeeRequestOptions): Promise<Peer[]>;
|
|
502
511
|
/**
|
|
@@ -563,21 +572,41 @@ export declare class Bee {
|
|
|
563
572
|
*/
|
|
564
573
|
cashoutLastCheque(address: PeerAddress | string, options?: TransactionOptions, requestOptions?: BeeRequestOptions): Promise<TransactionId>;
|
|
565
574
|
/**
|
|
566
|
-
* Deposit tokens from
|
|
575
|
+
* Deposit tokens from node wallet into chequebook
|
|
567
576
|
*
|
|
568
577
|
* @param amount Amount of tokens to deposit (must be positive integer)
|
|
569
578
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
570
579
|
* @return string Hash of the transaction
|
|
580
|
+
* @deprecated Use `depositBZZToChequebook` instead.
|
|
571
581
|
*/
|
|
572
582
|
depositTokens(amount: BZZ | NumberString | string | bigint, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
573
583
|
/**
|
|
574
|
-
*
|
|
584
|
+
* Deposit tokens from node wallet into chequebook
|
|
585
|
+
*
|
|
586
|
+
* @param amount Amount of tokens to deposit (must be positive integer)
|
|
587
|
+
* @param gasPrice Gas Price in WEI for the transaction call
|
|
588
|
+
* @return string Hash of the transaction
|
|
589
|
+
*/
|
|
590
|
+
depositBZZToChequebook(amount: BZZ | NumberString | string | bigint, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
591
|
+
/**
|
|
592
|
+
* Withdraw tokens from the chequebook to the node wallet
|
|
575
593
|
*
|
|
576
594
|
* @param amount Amount of tokens to withdraw (must be positive integer)
|
|
577
595
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
578
596
|
* @return string Hash of the transaction
|
|
597
|
+
* @deprecated Use `withdrawBZZFromChequebook` instead.
|
|
579
598
|
*/
|
|
580
599
|
withdrawTokens(amount: BZZ | NumberString | string | bigint, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
600
|
+
/**
|
|
601
|
+
* Withdraw tokens from the chequebook to the node wallet
|
|
602
|
+
*
|
|
603
|
+
* @param amount Amount of tokens to withdraw (must be positive integer)
|
|
604
|
+
* @param gasPrice Gas Price in WEI for the transaction call
|
|
605
|
+
* @return string Hash of the transaction
|
|
606
|
+
*/
|
|
607
|
+
withdrawBZZFromChequebook(amount: BZZ | NumberString | string | bigint, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
608
|
+
withdrawBZZToExternalWallet(amount: BZZ | NumberString | string | bigint, address: EthAddress | Uint8Array | string, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
609
|
+
withdrawDAIToExternalWallet(amount: DAI | NumberString | string | bigint, address: EthAddress | Uint8Array | string, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
581
610
|
/**
|
|
582
611
|
* Get amount of sent and received from settlements with a peer
|
|
583
612
|
*
|
|
@@ -635,7 +664,7 @@ export declare class Bee {
|
|
|
635
664
|
*/
|
|
636
665
|
getChainState(options?: BeeRequestOptions): Promise<ChainState>;
|
|
637
666
|
/**
|
|
638
|
-
* Get wallet balances for
|
|
667
|
+
* Get wallet balances for DAI and BZZ of the Bee node
|
|
639
668
|
*
|
|
640
669
|
* @param options
|
|
641
670
|
*/
|
|
@@ -753,30 +782,52 @@ export declare class Bee {
|
|
|
753
782
|
*/
|
|
754
783
|
rebroadcastPendingTransaction(transactionHash: TransactionId | Uint8Array | string, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
755
784
|
/**
|
|
756
|
-
*
|
|
785
|
+
* Cancels a currently pending transaction
|
|
757
786
|
* @param transactionHash
|
|
758
787
|
* @param gasPrice
|
|
759
788
|
*/
|
|
760
789
|
cancelPendingTransaction(transactionHash: TransactionId | Uint8Array | string, gasPrice?: NumberString | string | bigint, options?: BeeRequestOptions): Promise<TransactionId>;
|
|
761
790
|
/**
|
|
762
|
-
* Gets the
|
|
791
|
+
* Gets the amount of staked BZZ
|
|
763
792
|
*
|
|
764
|
-
* @param options
|
|
793
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
765
794
|
*/
|
|
766
795
|
getStake(options?: BeeRequestOptions): Promise<BZZ>;
|
|
767
796
|
/**
|
|
768
|
-
*
|
|
797
|
+
* Gets the amount of withdrawable staked BZZ.
|
|
798
|
+
*
|
|
799
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
800
|
+
*/
|
|
801
|
+
getWithdrawableStake(options?: BeeRequestOptions): Promise<BZZ>;
|
|
802
|
+
/**
|
|
803
|
+
* Withdraws ALL surplus staked BZZ to the node wallet.
|
|
804
|
+
*
|
|
805
|
+
* Use the `getWithdrawableStake` method to check how much surplus stake is available.
|
|
806
|
+
*
|
|
807
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
808
|
+
*/
|
|
809
|
+
withdrawSurplusStake(options?: BeeRequestOptions): Promise<TransactionId>;
|
|
810
|
+
/**
|
|
811
|
+
* Withdraws all staked BZZ to the node wallet.
|
|
812
|
+
*
|
|
813
|
+
* **Only available when the staking contract is paused and is in the process of being migrated to a new contract!**
|
|
814
|
+
*
|
|
815
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
816
|
+
*/
|
|
817
|
+
migrateStake(options?: BeeRequestOptions): Promise<TransactionId>;
|
|
818
|
+
/**
|
|
819
|
+
* Stakes the given amount of BZZ. Initial deposit must be at least 10 BZZ.
|
|
769
820
|
*
|
|
770
821
|
* Be aware that staked BZZ tokens can **not** be withdrawn.
|
|
771
822
|
*
|
|
772
|
-
* @param amount Amount of BZZ
|
|
773
|
-
* @param options
|
|
823
|
+
* @param amount Amount of BZZ tokens to be staked. If not providing a `BZZ` instance, the amount is denoted in PLUR.
|
|
824
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
774
825
|
*/
|
|
775
826
|
depositStake(amount: BZZ | NumberString | string | bigint, options?: TransactionOptions, requestOptions?: BeeRequestOptions): Promise<TransactionId>;
|
|
776
827
|
/**
|
|
777
|
-
*
|
|
828
|
+
* Gets current status of node in redistribution game
|
|
778
829
|
*
|
|
779
|
-
* @param options
|
|
830
|
+
* @param options HTTP request options, such as `headers` or `timeout`
|
|
780
831
|
*/
|
|
781
832
|
getRedistributionState(options?: BeeRequestOptions): Promise<RedistributionState>;
|
|
782
833
|
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>;
|
|
@@ -5,3 +5,4 @@ import { BeeRequestOptions } from '../index';
|
|
|
5
5
|
* @param requestOptions Options for making requests
|
|
6
6
|
*/
|
|
7
7
|
export declare function checkConnection(requestOptions: BeeRequestOptions): Promise<void> | never;
|
|
8
|
+
export declare function isGateway(requestOptions: BeeRequestOptions): Promise<boolean>;
|