@orbi-wallet/sdk 0.0.2 → 0.0.3
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/client.js +24 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -24,10 +24,34 @@
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.OrbiClient = void 0;
|
|
26
26
|
const KEYS_URL = 'https://keys.orbiwallet.xyz';
|
|
27
|
+
function _patchBuffer() {
|
|
28
|
+
if (typeof window === 'undefined')
|
|
29
|
+
return;
|
|
30
|
+
function dv(b) { return new DataView(b.buffer, b.byteOffset, b.byteLength); }
|
|
31
|
+
function def(p, n, fn) {
|
|
32
|
+
if (typeof p[n] !== 'function')
|
|
33
|
+
Object.defineProperty(p, n, { value: fn, writable: true, configurable: true });
|
|
34
|
+
}
|
|
35
|
+
function patch(p) {
|
|
36
|
+
if (!p)
|
|
37
|
+
return;
|
|
38
|
+
def(p, 'readBigInt64BE', function (o = 0) { return dv(this).getBigInt64(o, false); });
|
|
39
|
+
def(p, 'readBigUInt64BE', function (o = 0) { return dv(this).getBigUint64(o, false); });
|
|
40
|
+
def(p, 'readBigInt64LE', function (o = 0) { return dv(this).getBigInt64(o, true); });
|
|
41
|
+
def(p, 'readBigUInt64LE', function (o = 0) { return dv(this).getBigUint64(o, true); });
|
|
42
|
+
def(p, 'writeBigInt64BE', function (v, o = 0) { dv(this).setBigInt64(o, v, false); return o + 8; });
|
|
43
|
+
def(p, 'writeBigUInt64BE', function (v, o = 0) { dv(this).setBigUint64(o, v, false); return o + 8; });
|
|
44
|
+
def(p, 'writeBigInt64LE', function (v, o = 0) { dv(this).setBigInt64(o, v, true); return o + 8; });
|
|
45
|
+
def(p, 'writeBigUInt64LE', function (v, o = 0) { dv(this).setBigUint64(o, v, true); return o + 8; });
|
|
46
|
+
}
|
|
47
|
+
patch(Uint8Array.prototype);
|
|
48
|
+
patch(globalThis.Buffer?.prototype);
|
|
49
|
+
}
|
|
27
50
|
class OrbiClient {
|
|
28
51
|
constructor(config) {
|
|
29
52
|
this.apiUrl = config.apiUrl.replace(/\/$/, '');
|
|
30
53
|
this.apiKey = config.apiKey;
|
|
54
|
+
_patchBuffer();
|
|
31
55
|
}
|
|
32
56
|
authHeaders() {
|
|
33
57
|
return this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {};
|
package/package.json
CHANGED