If blocto provider injected properly isBlocto
will be true
window.solana.isBlocto
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
pod 'BloctoSolanaWeb3Provider', '0.1.0', :git => 'https://github.com/portto/blocto-solana-web3-provider'
end
We have to inject the following code just like Ethereum:
(function() {
var config = {
address: "\(address)",
network: "\(network)"
};
const bloctoProvider = new window.BloctoSolana(config);
window.\(windowProperty) = bloctoProvider;
window.bloctoProvider = bloctoProvider;
})();
The network is "mainnet-beta" or "devnet".
{
"id": <int>,
"method": <string>,
...
}
Please call sendResponse
func with json string.
- If no
id
,sendResponse({ "id": 0, "error": "invalidRequest" })
- If no
method
,sendResponse({ "id": id, "error": "invalidRequest" })
{
"id": <int>,
...
}
{
"id": <int>,
"error": <string>
}
- Request
{
"id": <int>,
"method": "connect"
}
- Response
{
"id": <int>,
"params": {
"publicKey": <string>
}
}
- Error
- If no accounts (not enabled),
sendResponse( "id": id, "error": "noAccounts")
// app presents wallet enable panel - If user click close/cancel button,
sendResponse( "id": id, "error": "cancelled")
- other unexpected behavior
sendResponse({ "id": id, "error": "internal"})
- Request
{
"id": <int>
}
- Response
{
"id": <int>
}
- Error no error. please remember send response with id.
- Request
{
"id": <int>,
"params": {
"message": <hex-string>
}
}
- Response
{
"id": <int>,
"result": <hex-string> // raw-transaction-message
}
- Error
- If no
message
,sendResponse({ "id": id, "error": "invalidRequest" })
- If no network connection,
sendResponse({ "id": id, "error": "noNetworkConnection" })
- other unexpected behavior
sendResponse({ "id": id, "error": "internal" })
- Request
{
"id": <int>,
"params": {
"message": <hex-string>,
"publicKeySignaturePairs": { // In most cases, it should be empty.
<base-58>: <hex-string> // public key: signature
},
"isInvokeWrapped": <bool> // check if calling createTransaction or not.
}
}
- Response
{
"id": <int>,
"result": <hex-string> // tx hash
}
- Error
- If no
message
orisInvokeWrapped
,sendResponse({ "id": id, "error": "invalidRequest" })
- If no network connection,
sendResponse({ "id": id, "error": "noNetworkConnection" })
- If user click close/cancel button,
sendResponse({ "id": id, "error": "cancelled" })
- other unexpected behavior
sendResponse({ "id": id, "error": "internal" })
- Request
{
"id": <int>,
"params": {
"appId": <uuid>,
}
}
- Response
{
"id": <int>,
"result": <hex-string> // encrypted jwt token
}
- Error
- If no
appId
param,sendResponse({ "id": id, "error": "invalidRequest" })
- If app id not exists (by checking BE api error),
sendResponse({ "id": id, "error": "appIdNotExist" })
- If no network connection,
sendResponse({ "id": id, "error": "noNetworkConnection" })
- If user block this website,
sendError(id, "blocked")
- If user click close/cancel button or tap background to cancel,
sendResponse({ "id": id, "error": "cancelled" })
- other unexpected behavior
sendResponse({ "id": id, "error": "internal" })