Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot/wasm-bridge

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/wasm-bridge - npm Package Compare versions

Comparing version 6.3.1 to 6.4.1

66

bridge.js
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// A number of functions are "unsafe" and purposefully so - it is

@@ -7,6 +8,7 @@ // assumed that where the bridge is used, it is correctly wrapped

// then ensures that the internal wasm instance here is available
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { stringToU8a, u8aToString } from '@polkadot/util';
import { Wbg } from "./wbg.js";
/**

@@ -21,3 +23,2 @@ * @name Bridge

*/
export class Bridge {

@@ -34,3 +35,2 @@ #cachegetInt32;

#type;
constructor(createWasm) {

@@ -46,26 +46,23 @@ this.#createWasm = createWasm;

this.#wasmPromise = null;
this.#wbg = { ...new Wbg(this)
this.#wbg = {
...new Wbg(this)
};
}
/** @description Returns the init error */
get error() {
return this.#wasmError;
}
/** @description Returns the init type */
get type() {
return this.#type;
}
/** @description Returns the created wasm interface */
get wasm() {
return this.#wasm;
}
/** @description Performs the wasm initialization */
async init(createWasm) {

@@ -75,3 +72,2 @@ if (!this.#wasmPromise || createWasm) {

}
const {

@@ -87,2 +83,3 @@ error,

}
/**

@@ -92,7 +89,6 @@ * @internal

*/
getObject(idx) {
return this.#heap[idx];
}
/**

@@ -102,4 +98,2 @@ * @internal

*/
dropObject(idx) {

@@ -109,6 +103,6 @@ if (idx < 36) {

}
this.#heap[idx] = this.#heapNext;
this.#heapNext = idx;
}
/**

@@ -118,4 +112,2 @@ * @internal

*/
takeObject(idx) {

@@ -126,2 +118,3 @@ const ret = this.getObject(idx);

}
/**

@@ -131,4 +124,2 @@ * @internal

*/
addObject(obj) {

@@ -138,3 +129,2 @@ if (this.#heapNext === this.#heap.length) {

}
const idx = this.#heapNext;

@@ -145,2 +135,3 @@ this.#heapNext = this.#heap[idx];

}
/**

@@ -150,4 +141,2 @@ * @internal

*/
getInt32() {

@@ -157,5 +146,5 @@ if (this.#cachegetInt32 === null || this.#cachegetInt32.buffer !== this.#wasm.memory.buffer) {

}
return this.#cachegetInt32;
}
/**

@@ -165,4 +154,2 @@ * @internal

*/
getUint8() {

@@ -172,5 +159,5 @@ if (this.#cachegetUint8 === null || this.#cachegetUint8.buffer !== this.#wasm.memory.buffer) {

}
return this.#cachegetUint8;
}
/**

@@ -180,7 +167,6 @@ * @internal

*/
getU8a(ptr, len) {
return this.getUint8().subarray(ptr / 1, ptr / 1 + len);
}
/**

@@ -190,7 +176,6 @@ * @internal

*/
getString(ptr, len) {
return u8aToString(this.getU8a(ptr, len));
}
/**

@@ -200,10 +185,8 @@ * @internal

*/
allocU8a(arg) {
const ptr = this.#wasm.__wbindgen_malloc(arg.length * 1);
this.getUint8().set(arg, ptr / 1);
return [ptr, arg.length];
}
/**

@@ -213,7 +196,6 @@ * @internal

*/
allocString(arg) {
return this.allocU8a(stringToU8a(arg));
}
/**

@@ -223,4 +205,2 @@ * @internal

*/
resultU8a() {

@@ -230,7 +210,6 @@ const r0 = this.getInt32()[8 / 4 + 0];

const ret = this.getU8a(r0, r1).slice();
this.#wasm.__wbindgen_free(r0, r1 * 1);
return ret;
}
/**

@@ -240,8 +219,5 @@ * @internal

*/
resultString() {
return u8aToString(this.resultU8a());
}
}
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from "./bridge.js";
export * from "./init.js";

@@ -7,9 +7,7 @@ "use strict";

exports.Bridge = void 0;
var _util = require("@polkadot/util");
var _wbg = require("./wbg");
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// A number of functions are "unsafe" and purposefully so - it is

@@ -19,3 +17,2 @@ // assumed that where the bridge is used, it is correctly wrapped

// then ensures that the internal wasm instance here is available
/* eslint-disable @typescript-eslint/no-non-null-assertion */

@@ -43,3 +40,2 @@

#type;
constructor(createWasm) {

@@ -55,26 +51,23 @@ this.#createWasm = createWasm;

this.#wasmPromise = null;
this.#wbg = { ...new _wbg.Wbg(this)
this.#wbg = {
...new _wbg.Wbg(this)
};
}
/** @description Returns the init error */
get error() {
return this.#wasmError;
}
/** @description Returns the init type */
get type() {
return this.#type;
}
/** @description Returns the created wasm interface */
get wasm() {
return this.#wasm;
}
/** @description Performs the wasm initialization */
async init(createWasm) {

@@ -84,3 +77,2 @@ if (!this.#wasmPromise || createWasm) {

}
const {

@@ -96,2 +88,3 @@ error,

}
/**

@@ -101,7 +94,6 @@ * @internal

*/
getObject(idx) {
return this.#heap[idx];
}
/**

@@ -111,4 +103,2 @@ * @internal

*/
dropObject(idx) {

@@ -118,6 +108,6 @@ if (idx < 36) {

}
this.#heap[idx] = this.#heapNext;
this.#heapNext = idx;
}
/**

@@ -127,4 +117,2 @@ * @internal

*/
takeObject(idx) {

@@ -135,2 +123,3 @@ const ret = this.getObject(idx);

}
/**

@@ -140,4 +129,2 @@ * @internal

*/
addObject(obj) {

@@ -147,3 +134,2 @@ if (this.#heapNext === this.#heap.length) {

}
const idx = this.#heapNext;

@@ -154,2 +140,3 @@ this.#heapNext = this.#heap[idx];

}
/**

@@ -159,4 +146,2 @@ * @internal

*/
getInt32() {

@@ -166,5 +151,5 @@ if (this.#cachegetInt32 === null || this.#cachegetInt32.buffer !== this.#wasm.memory.buffer) {

}
return this.#cachegetInt32;
}
/**

@@ -174,4 +159,2 @@ * @internal

*/
getUint8() {

@@ -181,5 +164,5 @@ if (this.#cachegetUint8 === null || this.#cachegetUint8.buffer !== this.#wasm.memory.buffer) {

}
return this.#cachegetUint8;
}
/**

@@ -189,7 +172,6 @@ * @internal

*/
getU8a(ptr, len) {
return this.getUint8().subarray(ptr / 1, ptr / 1 + len);
}
/**

@@ -199,7 +181,6 @@ * @internal

*/
getString(ptr, len) {
return (0, _util.u8aToString)(this.getU8a(ptr, len));
}
/**

@@ -209,10 +190,8 @@ * @internal

*/
allocU8a(arg) {
const ptr = this.#wasm.__wbindgen_malloc(arg.length * 1);
this.getUint8().set(arg, ptr / 1);
return [ptr, arg.length];
}
/**

@@ -222,7 +201,6 @@ * @internal

*/
allocString(arg) {
return this.allocU8a((0, _util.stringToU8a)(arg));
}
/**

@@ -232,4 +210,2 @@ * @internal

*/
resultU8a() {

@@ -239,7 +215,6 @@ const r0 = this.getInt32()[8 / 4 + 0];

const ret = this.getU8a(r0, r1).slice();
this.#wasm.__wbindgen_free(r0, r1 * 1);
return ret;
}
/**

@@ -249,10 +224,6 @@ * @internal

*/
resultString() {
return (0, _util.u8aToString)(this.resultU8a());
}
}
exports.Bridge = Bridge;

@@ -6,5 +6,3 @@ "use strict";

});
var _bridge = require("./bridge");
Object.keys(_bridge).forEach(function (key) {

@@ -20,5 +18,3 @@ if (key === "default" || key === "__esModule") return;

});
var _init = require("./init");
Object.keys(_init).forEach(function (key) {

@@ -25,0 +21,0 @@ if (key === "default" || key === "__esModule") return;

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _util = require("@polkadot/util");
var _detectOther = _interopRequireDefault(require("./detectOther"));
var _packageInfo = require("./packageInfo");
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
(0, _util.detectPackage)(_packageInfo.packageInfo, null, _detectOther.default);

@@ -6,7 +6,4 @@ "use strict";

});
require("./detectPackage");
var _bundle = require("./bundle");
Object.keys(_bundle).forEach(function (key) {

@@ -13,0 +10,0 @@ if (key === "default" || key === "__esModule") return;

@@ -7,3 +7,2 @@ "use strict";

exports.createWasmFn = createWasmFn;
// Copyright 2019-2022 @polkadot/wasm-bundle authors & contributors

@@ -27,3 +26,2 @@ // SPDX-License-Identifier: Apache-2.0

};
try {

@@ -35,3 +33,2 @@ if (!wasmBytes || !wasmBytes.length) {

}
const source = await WebAssembly.instantiate(wasmBytes, {

@@ -52,5 +49,4 @@ wbg

}
return result;
};
}

@@ -9,3 +9,5 @@ "use strict";

// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
const packageInfo = {

@@ -15,4 +17,4 @@ name: '@polkadot/wasm-bridge',

type: 'cjs',
version: '6.3.1'
version: '6.4.1'
};
exports.packageInfo = packageInfo;

@@ -7,7 +7,6 @@ "use strict";

exports.Wbg = void 0;
var _xRandomvalues = require("@polkadot/x-randomvalues");
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
const DEFAULT_CRYPTO = {

@@ -19,2 +18,3 @@ getRandomValues: _xRandomvalues.getRandomValues

};
/**

@@ -31,61 +31,60 @@ * @name Wbg

*/
class Wbg {
#bridge;
constructor(bridge) {
this.#bridge = bridge;
}
/** @internal */
abort = () => {
throw new Error('abort');
};
/** @internal */
__wbindgen_is_undefined = idx => {
return this.#bridge.getObject(idx) === undefined;
};
/** @internal */
__wbindgen_throw = (ptr, len) => {
throw new Error(this.#bridge.getString(ptr, len));
};
/** @internal */
__wbg_self_1b7a39e3a92c949c = () => {
return this.#bridge.addObject(DEFAULT_SELF);
};
/** @internal */
__wbg_require_604837428532a733 = (ptr, len) => {
throw new Error(`Unable to require ${this.#bridge.getString(ptr, len)}`);
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_crypto_968f1772287e2df0 = _idx => {
return this.#bridge.addObject(DEFAULT_CRYPTO);
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_getRandomValues_a3d34b4fee3c2869 = _idx => {
return this.#bridge.addObject(DEFAULT_CRYPTO.getRandomValues);
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_getRandomValues_f5e14ab7ac8e995d = (_arg0, ptr, len) => {
DEFAULT_CRYPTO.getRandomValues(this.#bridge.getU8a(ptr, len));
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_randomFillSync_d5bd2d655fdf256a = (_idx, _ptr, _len) => {
throw new Error('randomFillsync is not available');
__wbg_randomFillSync_d5bd2d655fdf256a = (_idx, _ptr, _len) => {
throw new Error('randomFillsync is not available'); // getObject(idx).randomFillSync(getU8a(ptr, len));
// getObject(idx).randomFillSync(getU8a(ptr, len));
};
/** @internal */
__wbindgen_object_drop_ref = idx => {

@@ -95,3 +94,2 @@ this.#bridge.takeObject(idx);

}
exports.Wbg = Wbg;
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
import { detectPackage } from '@polkadot/util';

@@ -5,0 +7,0 @@ import others from "./detectOther.js";

// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
import "./detectPackage.js";
export * from "./bundle.js";

@@ -19,3 +19,2 @@ // Copyright 2019-2022 @polkadot/wasm-bundle authors & contributors

};
try {

@@ -27,3 +26,2 @@ if (!wasmBytes || !wasmBytes.length) {

}
const source = await WebAssembly.instantiate(wasmBytes, {

@@ -44,5 +42,4 @@ wbg

}
return result;
};
}

@@ -23,3 +23,3 @@ {

"type": "module",
"version": "6.3.1",
"version": "6.4.1",
"main": "./cjs/index.js",

@@ -84,3 +84,3 @@ "module": "./index.js",

"dependencies": {
"@babel/runtime": "^7.18.9"
"@babel/runtime": "^7.20.6"
},

@@ -87,0 +87,0 @@ "peerDependencies": {

// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = {

@@ -8,3 +10,3 @@ name: '@polkadot/wasm-bridge',

type: 'esm',
version: '6.3.1'
version: '6.4.1'
};

@@ -1,3 +0,3 @@

export declare type WasmImports = Record<string, (...args: never[]) => unknown>;
export declare type WasmMemory = {
export type WasmImports = Record<string, (...args: never[]) => unknown>;
export type WasmMemory = {
buffer: ArrayBuffer;

@@ -10,4 +10,4 @@ };

}
export declare type InitPromise<C extends WasmBaseInstance> = Promise<InitResult<C>>;
export declare type InitFn<C extends WasmBaseInstance> = (wbg: WasmImports) => InitPromise<C>;
export type InitPromise<C extends WasmBaseInstance> = Promise<InitResult<C>>;
export type InitFn<C extends WasmBaseInstance> = (wbg: WasmImports) => InitPromise<C>;
export interface BridgeBase<C extends WasmBaseInstance> extends InitResult<C> {

@@ -14,0 +14,0 @@ init(createWasm?: InitFn<C>): Promise<C | null>;

// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { getRandomValues } from '@polkadot/x-randomvalues';

@@ -10,2 +11,3 @@ const DEFAULT_CRYPTO = {

};
/**

@@ -22,61 +24,60 @@ * @name Wbg

*/
export class Wbg {
#bridge;
constructor(bridge) {
this.#bridge = bridge;
}
/** @internal */
abort = () => {
throw new Error('abort');
};
/** @internal */
__wbindgen_is_undefined = idx => {
return this.#bridge.getObject(idx) === undefined;
};
/** @internal */
__wbindgen_throw = (ptr, len) => {
throw new Error(this.#bridge.getString(ptr, len));
};
/** @internal */
__wbg_self_1b7a39e3a92c949c = () => {
return this.#bridge.addObject(DEFAULT_SELF);
};
/** @internal */
__wbg_require_604837428532a733 = (ptr, len) => {
throw new Error(`Unable to require ${this.#bridge.getString(ptr, len)}`);
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_crypto_968f1772287e2df0 = _idx => {
return this.#bridge.addObject(DEFAULT_CRYPTO);
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_getRandomValues_a3d34b4fee3c2869 = _idx => {
return this.#bridge.addObject(DEFAULT_CRYPTO.getRandomValues);
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_getRandomValues_f5e14ab7ac8e995d = (_arg0, ptr, len) => {
DEFAULT_CRYPTO.getRandomValues(this.#bridge.getU8a(ptr, len));
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_randomFillSync_d5bd2d655fdf256a = (_idx, _ptr, _len) => {
throw new Error('randomFillsync is not available');
__wbg_randomFillSync_d5bd2d655fdf256a = (_idx, _ptr, _len) => {
throw new Error('randomFillsync is not available'); // getObject(idx).randomFillSync(getU8a(ptr, len));
// getObject(idx).randomFillSync(getU8a(ptr, len));
};
/** @internal */
__wbindgen_object_drop_ref = idx => {

@@ -83,0 +84,0 @@ this.#bridge.takeObject(idx);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc