Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
arg(data, exports) {
ensure(typeof data === "string", "Can only use `Uint8Array` as `&[u8]`");
// @ts-ignore -- yes accessing these exports works
const { alloc, memory } = exports;
ensure(alloc, "You need to export an `alloc` function to get strings from WASM");
ensure(memory, "You need to export the main memory to get strings from WASM");
const utf8Encoder = new TextEncoder("UTF-8");
const stringBuffer = utf8Encoder.encode(data);
return newSlice(memory, alloc, stringBuffer);
},
/**
import base64 from 'base64-js';
import {TextEncoder} from 'text-encoding';
import spinnerPageHtml from '../templates/github-export.html';
export const spinnerPage = base64.fromByteArray(
new TextEncoder('utf-8').encode(spinnerPageHtml),
);
function convertObjectToJsonChunk(json) {
const jsonChunkString = JSON.stringify(json);
const textEncoder = new TextEncoder('utf8');
return textEncoder.encode(jsonChunkString);
}
function t2a (text) {
return new TextEncoder("utf-8").encode(text)
}
function t2a (text) {
return new TextEncoder("utf-8").encode(text)
}
const api = (rpcRef: typeof JsonRpc, signatureProvider: typeof JsSignatureProvider) =>
new Api({
rpc: rpcRef,
signatureProvider,
textDecoder: new TextDecoder(),
textEncoder: new TextEncoder(),
});
module.exports = fp((fastify, options, next) => {
const rpc = new JsonRpc(options.eos.endpoint, {fetch});
const api = new Api({
rpc,
signatureProvider: null,
chainId: options.chainId,
textDecoder: new TextDecoder(),
textEncoder: new TextEncoder(),
});
fastify.decorate('eos', {api, rpc});
next();
}, {
fastify: '>=1.0.0',
constructor() {
this.config = loadConfig();
const rpc = new JsonRpc(this.config.eos.endpoint, {fetch});
this.api = new Api({
rpc,
signatureProvider: null,
chainId: this.config.chainId,
textDecoder: new TextDecoder(),
textEncoder: new TextEncoder(),
});
this.logger = require('./connections/logger')('eosdac-processor', this.config.logger);
}
constructor() {
this.config = loadConfig();
this.db = connectMongo(this.config);
const rpc = new JsonRpc(this.config.eos.endpoint, {fetch});
this.api = new Api({
rpc,
signatureProvider: null,
chainId: this.config.chainId,
textDecoder: new TextDecoder(),
textEncoder: new TextEncoder(),
});
this.logger = require('../connections/logger')('watcher-proposals', this.config.logger);
}