JS Extensions

JSBridge is injected javascript code in MYKEY dapp browser enviroment by default, which support Scatter protocol, and web3js protocol.

In order to control the MYKEY application conveniently, MYKEY adds the following methods:

Check whether the current wallet is MYKEY

window.ethereum.isMYKEY

Close App window

Close App window and return to MYKEY.

window.MyKey.Browser.closeWindow

Open full screen

Open full screen

window.MyKey.Browser.openFullScreen

Params

Close full screen

Close full screen.

window.MyKey.Browser.closeFullScreen

Disable physical back button

Disable physical back button, only for Android

window.MyKey.Browser.forbidPhysicalBack

Allow physical back button

Allow physical back button, only for Android

window.MyKey.Browser.allowPhysicalBack

Get MYKEY Account Information

Get MYKEY Account Information

window.MyKey.Browser.getAccountInfo

Params

Return

Return format: Promise
{
	"data": {
		"accountName": "",     //Nickname in MYKEY
		"chainInfoList": ["account": "", "chain": ""],
		"id": "",    //unique id in MYKEY
		"operationKeys": ["","",""],   //public keys of three operation keys
		"xpubOperationKeys": ["","",""]  //public keys of three operation keys in Xpub format
	},
	"errorCode": 0
}

Get client configuration

Get client configuration

window.MyKey.Browser.getClientConfig

Return

Return format: Promise
{
	"data": {
		"currency": "CNY",
		"locale": "zh-CN",
		"maxKycBindAccount": 1,
		"regioin": "CN",
		"userAgent": "",       //include field channel:MYKEY
		"recaptchaUserKey":""  //only use for MYKEY redpackage
	},
	"errorCode": 0
}

Send transaction

Send transaction

window.MyKey.Browser.sendTransaction(transaction) => Promise

Params

Return

Return format: Promise
result: {
	"errorCode": 0,
	"errorMsg": "",
	"data": {
		"transactionId": "",
		"signature": ""
	}
}

Example:

Buy ram on EOS.

window.MyKey.Browser.sendTransaction('{"actions":[{"account":"eosio","name":"buyram","data":{"payer":"","receiver":"","quant":"1.0000 EOS"}}],"chain":"EOS"},"extra":{"key":"value"}}')

New field extra will be effected from Android:2.5.0,IOS:2.5.0

Sign

Apply MYKEY sign transactions

window.MyKey.Browser.sign(message) => Promise

Params

Return

Return format: Promise
result: {
	"errorCode": 0,
	"errorMsg": "",
	"data": {
		"signature": ""
	}
}

Get Transaction Progress

window.MyKey.Browser.getTransactionProgress

Params

Return

Return format: Promise
result: {
	"errorCode": 0,
	"errorMsg": "",
	"data": {
		"percent": ,   //[0 - 100]
		"blockNum":    //[blockNum]
	}
}

Effective from: Android:2.5.0,iOS:2.5.0

Set application title

Set application title

window.MyKey.Browser.setTitle(title)

Params

Show loading animation

Show loading animation

window.MyKey.Browser.showLoading

Hidden loading animation

hidden loading animation

window.MyKey.Browser.hiddenLoading

serialize specified function call

serialize specified function call

window.MyKey.Browser.encodeFunctionCall(abi, method, param) => Promise

Return

result:{"errorCode":0,"errorMsg":"","data":"[serialized data]"}

Params

Last updated