WaykiBridge

1. Introduction

WaykiBridge is the DAPP development interface tool launched by the WiykiChain develop team. Developers can integrate the WaykiBridge interface when developing DAPP, that is, you only need a set of code(H5) to call the WaykiMax and WaykiTimes APP wallet for signing and broadcasting WaykiChain transactions so that users can be in Browser and WaykiTimes APP DAPP is used in the Application Center.

2. Tools Download

2.1. Web Wallet Extension WaykiMax Download

2.2. WaykiTimes (Testnet) Download

IOS: https://www.pgyer.com/mHDN

Android: https://wicc-dev-mix.oss-cn-shenzhen.aliyuncs.com/android/2test/waykitime/WaykiTimes_2.0.0_production_release.apk

2.3. WaykiTimes (Mainnet) Download

Please use mobile browser to scan the QR Code for download

1、【Open WaykiTimes】-> 【My】->【Settings】->【Developer Mode】

2、【Open WaykiTimes】-> 【Dapps】->【Operations as shown below】

3. WaykiBridge calling example

Example Application: https://waykibridge-testpage.wiccdev.org/

Opensource Code: https://gitlab.com/waykichain-public/wicc-dapps/wicc-appcenter-test/tree/master

4. WaykiBridge API Description

4.1. Prerequisite work

Import the javascript code

  <script src="https://sw91.net/devops/js/waykiBridge.js"></script>

Note: Please do the delay processing if you need to call the interface when the page loads after import the file:

(setTimeout(() => this.getAddressInfo(), 100);)


4.2. Calling format

waykiBridge.walletPlugin(method,param,callback when succeed,callback when failed)

waykiBridge.walletPlugin(name,query,function(res){},function(err){})

Note: All the param of query is string or array


4.3. API errorCode Description

errorCode (Int) errorMsg (String) Description
0 \ success
1000 Please install WaykiMax first. Wallet don't exist.
2000 Please create or import wallet first. Account don't be created or import.
7000 User denied transaction signature. User denied transaction signature.

Note: Developers only need to make status judgments based on errorCode', anderrorMsg'is only used for status information prompts.


4.4. getAddressInfo

param

{} // There is no param, but please transfer {}

example

    waykiBridge.walletPlugin(
        "getAddressInfo",
        {},
        function(res) {
            console.log(res)
        },
        function(err) {
            console.log(err)
        }
    );

callback when succeed

{ 
    "result": { 
        "account": { 
            "address": "WPqY8RJHN1u4Kzrnj2mHG9V8igJJVVcveb", 
            "id": "bd2356fa-6137-448e-806f-d6ab09785749", "testnetAddress": "wLnwB9n9PCdP2sWAF3R3KvMujxGnVsE6aa" 
            }, 
        "network": "testnet", 
        "address": "wLnwB9n9PCdP2sWAF3R3KvMujxGnVsE6aa" 
    }, 
    "errorCode": 0 
}

4.5. call smart contract

query param:

{
    "regId":"",     // contract regid
    "contractField", "", // contract field
    "inputAmount":"",   // imput money
    "remark" :""  // optional
}

example:

    waykiBridge.walletPlugin(
        "walletPluginContractInvoke",
        {
          regId: "13103-1",
          contractField: "f0",
          inputAmount: "1",
          remark : ""

        },
        function(res) {
            console.log(res)
        },
        function(err) {
            console.log(err)
        }
    );

callback when succeed

{ 
    "result": { 
        "amount": 100000000,
        "fee": 1000000, 
        "contract": "f0",
        "txid":"029c86a648030e2b28ccc64c5ed60c96a0c61de95a30cab82159a476ceeeaf3d", 
        "regId": "91647-1", 
        "txType": null,
        "toAddress": "wNTJYM3gyXJH9dPQe96ofyHotf5eq3EP14", 
        "sendAddress": "wLnwB9n9PCdP2sWAF3R3KvMujxGnVsE6aa" 
      }, 
    "errorCode": 0 
}

4.6. Contract Publish

query param

{
    "contractContent": "", // Contract content
    "contractDesc": ""     // Contract Description
}

example

    waykiBridge.walletPlugin(
        "walletPluginContractInvoke",
        {
          contractContent: 'mylib = require "mylib"',
          contractDesc: "Description",
        },
        function(res) {
            console.log(res)
        },
        function(err) {
            console.log(err)
        }
    );

callback when succeed

{
    "result": { 
         "amount": 0, 
         "fee": 110000000, 
         "contract": null, 
         "txid": "4bbbee4320843d19d4a008bfc7dc1a26fdf5ed9c1a96415db033d4f83c6e9fa0", 
         "regId": "91647-1", 
         "txType": null,
         "toAddress": null,
         "sendAddress": "wLnwB9n9PCdP2sWAF3R3KvMujxGnVsE6aa"
    }, 
    "errorCode": 0 
}

4.7. walletPluginTransfer

param

{
    "amount",""   //transfer amount 
    "collectionAddress", "" // oject address
    "remark": "" // comment
}

example:

    waykiBridge.walletPlugin(
        "walletPluginTransfer",
        {
          amount: "100000000", 
          collectionAddress: "Wi2H3XAhMtdLPkjQVSkYXhF3GRNTwAhtqA",
          remark: "comment"
        },
        function(res) {
          _this.transferRes = res;
        },
        function(err) {
          _this.transferRes = err;
        }
    );

callback when succeed

{ 
    "result": { 
        "amount": 10000000, 
        "fee": 10000, 
        "contract": "", 
        "txid": "64244292b9abb2e5b8d55a3f37584781e0151e0358a440b0e910100f9970957b",
        "regId": "91647-1", 
        "txType": null, 
        "toAddress": "weyg6FeZP5Mf6dNn1TQJbU7pHhLx1QMkZ8", 
        "sendAddress": "wLnwB9n9PCdP2sWAF3R3KvMujxGnVsE6aa" 
    }, 
    "errorCode": 0 
}

results matching ""

    No results matching ""