All Projects → xuewuli → Tiny.scatter

xuewuli / Tiny.scatter

Scatter compatible eos injection library

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Tiny.scatter

Cryptokylin Testnet
EOS.io Kylin Testnet by cryptokylin.io
Stars: ✭ 140 (+351.61%)
Mutual labels:  blockchain, eos, eosio
Eos Go
EOS.IO Go API library
Stars: ✭ 531 (+1612.9%)
Mutual labels:  blockchain, eos, eosio
Advanced Eos Examples
EOS Smart Contract Development Examples
Stars: ✭ 146 (+370.97%)
Mutual labels:  blockchain, eos, eosio
Anchor
EOSIO Desktop Wallet and Authenticator
Stars: ✭ 381 (+1129.03%)
Mutual labels:  wallet, eos, eosio
Monstereos
A Tamagotchi and Battle Game for EOS Blockchain :)
Stars: ✭ 174 (+461.29%)
Mutual labels:  blockchain, eos, eosio
Eosc
Cross-platform EOSIO command-line swiss-army-knife (EOS, BOS, Telos, Worbli, etc.)
Stars: ✭ 128 (+312.9%)
Mutual labels:  blockchain, eos, eosio
Awesome Eos
A curated list of EOS Ecosystem by SuperONE.
Stars: ✭ 160 (+416.13%)
Mutual labels:  blockchain, eos, eosio
Scatter
Scatter is an in-browser ( extension ) wallet for EOS which facilitates interaction between users and dapps.
Stars: ✭ 59 (+90.32%)
Mutual labels:  blockchain, eos, eosio
Awesome Blockchain
⚡️Curated list of resources for the development and applications of blockchain.
Stars: ✭ 937 (+2922.58%)
Mutual labels:  blockchain, eos, eosio
Eos Bios
DEPRECATED: use `eosc boot` now. Historically: Orchestrator for a decentralized EOS.IO blockchain network boot
Stars: ✭ 173 (+458.06%)
Mutual labels:  blockchain, eos, eosio
Simpleos
EOSIO Blockchain Interface & Wallet
Stars: ✭ 157 (+406.45%)
Mutual labels:  blockchain, wallet, eos
Blockchainwallet Crypto
比特币、以太坊公私钥生成以及签名,长时间不维护可移步 https://github.com/QuincySx/ChainWallet
Stars: ✭ 183 (+490.32%)
Mutual labels:  blockchain, wallet, eos
Eostracker
🗄EOS Tracker: Real time block explorer for EOS Blockchain
Stars: ✭ 166 (+435.48%)
Mutual labels:  blockchain, eos, eosio
Awesome Eos
A curated list of awesome EOS frameworks, libraries, software and resources.
Stars: ✭ 181 (+483.87%)
Mutual labels:  blockchain, eos, eosio
EOSWallet
🔐EOS Wallet: Manage your EOS accounts with steroids :)
Stars: ✭ 36 (+16.13%)
Mutual labels:  wallet, eos, eosio
Ethereumkit
EthereumKit is a free, open-source Swift framework for easily interacting with the Ethereum.
Stars: ✭ 400 (+1190.32%)
Mutual labels:  blockchain, wallet
Scatterdesktop
Connect to applications on EOS, Ethereum, and Tron. Exchange tokens with ease. Manage your assets safely. All in a simple to use interface.
Stars: ✭ 459 (+1380.65%)
Mutual labels:  blockchain, eos
Token Profile
Blockchain coin and token profile collection
Stars: ✭ 518 (+1570.97%)
Mutual labels:  blockchain, wallet
Eos Smart Contract Security Best Practices
A guide to EOS smart contract security best practices
Stars: ✭ 371 (+1096.77%)
Mutual labels:  blockchain, eosio
Bitshares Ui
Fully featured Graphical User Interface / Reference Wallet for the BitShares Blockchain
Stars: ✭ 505 (+1529.03%)
Mutual labels:  blockchain, wallet

Tiny.Scatter

Scatter compatible eos injection library

Demo

a simple react-native demo in ./demo dir.

(only test on iOS, should work on Android too.) demo screenshot

inject to iOS WKWebView

extension WKWebViewConfiguration {
    static func makeScatterEOSSupport(account: String, publicKey: String, in messageHandler: WKScriptMessageHandler, with config: WKWebViewConfiguration) -> Void {
        var js = ""
        
        if let filepath = Bundle.main.path(forResource: "tiny_scatter", ofType: "js") {
            do {
                js += try String(contentsOfFile: filepath)
            } catch { }
        }
        
        js +=
        """
        // 'value' as string. "SIG_K1_..."
        function onSignEOSMessageSuccessful(id, value) {
            BrigeAPI.sendResponse(id, value)
        }

        // 'value' as string. '{"signatures":["SIG_K1_..."]}'
        function onSignEOSSuccessful(id, value) {
            BrigeAPI.sendResponse(id, JSON.parse(value))
        }
        
        // 'error' as string
        function onSignEOSError(id, error) {
            BrigeAPI.sendError(id, {"type": "signature_rejected", "message": error, "code": 402, "isError": true})
        }

        window.tinyBrige = {
            signEOS: function (param) {
                window.webkit.messageHandlers['signEOS'].postMessage(param)
            },
            signEOSMsg: function (param) {
                window.webkit.messageHandlers['signEOSMsg'].postMessage(param)
            }
        }

        TinyIdentitys.initEOS("\(account)", "\(publicKey)");
        
        const scatter = new TinyScatter();
        scatter.loadPlugin(new TinyEOS());
        
        window.scatter = scatter;
        
        document.dispatchEvent(new CustomEvent('scatterLoaded'));

        """
        let onLoadScript = WKUserScript(source: "document.dispatchEvent(new CustomEvent('scatterLoaded'))", injectionTime: .atDocumentEnd, forMainFrameOnly: false)
        config.userContentController.addUserScript(onLoadScript)
        let userScript = WKUserScript(source: js, injectionTime: .atDocumentStart, forMainFrameOnly: false)
        config.userContentController.add(messageHandler, name: XMethod.signEOS.rawValue)
        config.userContentController.addUserScript(userScript)
    }
}

Additional init.js for Android. you need thirdpart lib such as https://github.com/TrustWallet/Web3View (or roll you own) to accomplish the injection.

// callback when you finish the sign. use webView.evaluateJavascript 

// 'id' as number. it's the param.id when XWebView.signEOS called
// 'value' as string. '{"signatures":["SIG_K1_..."]}'
function onSignEOSSuccessful(id, value) {
    BrigeAPI.sendResponse(id, JSON.parse(value))
}

// value as string "SIG_K1_..."
function onSignEOSMessageSuccessful(id, value) {
    BrigeAPI.sendResponse(id, value)
}

function onSignEOSError(id, error) {
    BrigeAPI.sendError(id, {"type": "signature_rejected", "message": error, "code": 402, "isError": true})
}

window.tinyBrige = {
  signEOS: function (param) {
    //XWebView is export from java @JavascriptInterface, is based on your implement.
    XWebView.signEOS(param.id, param.object.data);
  },
  signEOSMsg: function (param) {
    XWebView.signEOSMsg(param.id, param.object.data);
  }
}

TinyIdentitys.initEOS("%1$s", "%2$s");

const scatter = new TinyScatter();
scatter.loadPlugin(new TinyEOS());

window.scatter = scatter;

setTimeout(function() {document.dispatchEvent(new CustomEvent('scatterLoaded'));}, 1000);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].