@upcoming/bee-js 0.7.0 → 0.8.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/manifest/manifest.js +3 -0
- package/dist/cjs/utils/tokens.js +8 -2
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/manifest/manifest.js +3 -0
- package/dist/mjs/utils/tokens.js +8 -2
- package/dist/types/utils/tokens.d.ts +2 -0
- package/package.json +2 -2
|
@@ -140,6 +140,9 @@ export class MantarayNode {
|
|
|
140
140
|
}
|
|
141
141
|
const owner = node.metadata['swarm-feed-owner'];
|
|
142
142
|
const topic = node.metadata['swarm-feed-topic'];
|
|
143
|
+
if (!owner || !topic) {
|
|
144
|
+
return Optional.empty();
|
|
145
|
+
}
|
|
143
146
|
return Optional.of(await bee.fetchLatestFeedUpdate(topic, owner, requestOptions));
|
|
144
147
|
}
|
|
145
148
|
/**
|
package/dist/mjs/utils/tokens.js
CHANGED
|
@@ -46,7 +46,7 @@ export class BZZ {
|
|
|
46
46
|
* @returns New BZZ instance
|
|
47
47
|
*/
|
|
48
48
|
divide(other) {
|
|
49
|
-
return new BZZ(this.state.
|
|
49
|
+
return new BZZ(this.state.divmod(other)[0]);
|
|
50
50
|
}
|
|
51
51
|
gt(other) {
|
|
52
52
|
return this.state.compare(other.state) === 1;
|
|
@@ -63,6 +63,9 @@ export class BZZ {
|
|
|
63
63
|
eq(other) {
|
|
64
64
|
return this.state.compare(other.state) === 0;
|
|
65
65
|
}
|
|
66
|
+
exchangeToDAI(daiPerBzz) {
|
|
67
|
+
return DAI.fromWei(this.state.exchange('*', new FixedPointNumber(daiPerBzz.toWeiBigInt(), DAI.DIGITS), DAI.DIGITS).value);
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
BZZ.DIGITS = 16;
|
|
68
71
|
export class DAI {
|
|
@@ -112,7 +115,7 @@ export class DAI {
|
|
|
112
115
|
* @returns New DAI instance
|
|
113
116
|
*/
|
|
114
117
|
divide(other) {
|
|
115
|
-
return new DAI(this.state.
|
|
118
|
+
return new DAI(this.state.divmod(other)[0]);
|
|
116
119
|
}
|
|
117
120
|
gt(other) {
|
|
118
121
|
return this.state.compare(other.state) === 1;
|
|
@@ -129,5 +132,8 @@ export class DAI {
|
|
|
129
132
|
eq(other) {
|
|
130
133
|
return this.state.compare(other.state) === 0;
|
|
131
134
|
}
|
|
135
|
+
exchangeToBZZ(daiPerBzz) {
|
|
136
|
+
return BZZ.fromPLUR(this.state.exchange('/', new FixedPointNumber(daiPerBzz.toWeiBigInt(), DAI.DIGITS), BZZ.DIGITS).value);
|
|
137
|
+
}
|
|
132
138
|
}
|
|
133
139
|
DAI.DIGITS = 18;
|
|
@@ -35,6 +35,7 @@ export declare class BZZ {
|
|
|
35
35
|
lt(other: BZZ): boolean;
|
|
36
36
|
lte(other: BZZ): boolean;
|
|
37
37
|
eq(other: BZZ): boolean;
|
|
38
|
+
exchangeToDAI(daiPerBzz: DAI): DAI;
|
|
38
39
|
}
|
|
39
40
|
export declare class DAI {
|
|
40
41
|
static readonly DIGITS = 18;
|
|
@@ -72,4 +73,5 @@ export declare class DAI {
|
|
|
72
73
|
lt(other: DAI): boolean;
|
|
73
74
|
lte(other: DAI): boolean;
|
|
74
75
|
eq(other: DAI): boolean;
|
|
76
|
+
exchangeToBZZ(daiPerBzz: DAI): BZZ;
|
|
75
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upcoming/bee-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"axios": "^0.28.1",
|
|
66
|
-
"cafe-utility": "^27.
|
|
66
|
+
"cafe-utility": "^27.12.0",
|
|
67
67
|
"isomorphic-ws": "^4.0.1",
|
|
68
68
|
"semver": "^7.3.5",
|
|
69
69
|
"ws": "^8.7.0"
|