UNPKG

@robincore/flutter-dapp-provider

Version:

a javascript ethereum provider injector used as an interface between wallet and dApps. [for flutter]

42 lines 1.69 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("../index"); const RPCall_1 = __importDefault(require("../rpc/RPCall")); describe('CoreDappBridge', () => { describe('coreDappBridge chain change', () => { const iSetup = { currentProvider: 'ethereum', currentAddress: '0x0000000', chainId: '0x1', }; const coreDappBridge = new index_1.CoreDappBridge(iSetup); it('emits chain change event', () => { // add listener on chain changed coreDappBridge.on('chainChanged', chainId => { expect(chainId).not.toBe(iSetup.chainId); }); // change the chain coreDappBridge.handleChainChange('0x2'); expect(coreDappBridge.chainId).toBe('0x2'); expect(coreDappBridge.isCoreDapp).toBe(true); }); it("runs without any error", async () => { const rpc = new RPCall_1.default("https://data-seed-prebsc-2-s3.binance.org:8545"); const payload = { method: "eth_gasPrice", params: [], jsonrpc: "2.0", id: 21992 }; const req = await rpc.call(payload); console.log(req); }); it('should sign message given', async function () { coreDappBridge.eth_sign(["0x9392", "0x1"]); }); }); }); //# sourceMappingURL=CoreDappBridge.test.js.map