-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from kaiachain/feat/update-rpc-docs-21-8-24
feat: update api changes
- Loading branch information
Showing
27 changed files
with
686 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
web3rpc/rpc-specs/code-samples/curl/kaia/configuration/getParams.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
curl -X 'POST' \ | ||
'https://api.baobab.klaytn.net:8651' \ | ||
-H 'accept: application/json' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"method": "kaia_getParams", | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"params": [89] | ||
}' |
9 changes: 9 additions & 0 deletions
9
web3rpc/rpc-specs/code-samples/curl/kaia/miscellaneous/getTotalSupply.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
curl -X POST \ | ||
-H "Content-Type: application/json" \ | ||
--data '{ | ||
"jsonrpc": "2.0", | ||
"method": "kaia_getTotalSupply", | ||
"params": ["latest"], | ||
"id": 1 | ||
}' \ | ||
https://api.baobab.klaytn.net:8651 |
10 changes: 10 additions & 0 deletions
10
web3rpc/rpc-specs/code-samples/curl/klay/configuration/getParams.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
curl -X 'POST' \ | ||
'https://api.baobab.klaytn.net:8651' \ | ||
-H 'accept: application/json' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"method": "klay_getParams", | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"params": [89] | ||
}' |
14 changes: 14 additions & 0 deletions
14
...-samples/java/src/main/java/opensdk/sdk/apis/kaia/configuration/KaiaGetParamsExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import org.web3j.protocol.http.HttpService; | ||
import org.web3j.protocol.kaia.Web3j; | ||
import org.web3j.protocol.kaia.core.method.response.KaiaGetParamsResponse; | ||
|
||
import java.io.IOException; | ||
|
||
public class KaiaGetParamsExample { | ||
private Web3j w3 = Web3j.build(new HttpService("https://public-en-baobab.klaytn.net")); | ||
void kaiaGetParamsExample() throws IOException { | ||
int blockTag = 0; | ||
KaiaGetParamsResponse response = w3.kaiaGetParams(blockTag).send(); | ||
response.getResult(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...les/java/src/main/java/opensdk/sdk/apis/kaia/miscellaneous/KaiaGetTotalSupplyExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import org.web3j.protocol.http.HttpService; | ||
import org.web3j.protocol.kaia.Web3j; | ||
import org.web3j.protocol.kaia.core.method.response.KaiaGetTotalSupplyResponse; | ||
|
||
import java.io.IOException; | ||
|
||
public class KaiaGetTotalSupplyExample { | ||
private Web3j w3 = Web3j.build(new HttpService("https://public-en-baobab.klaytn.net")); | ||
|
||
void KaiaGetTotalSupply() throws IOException { | ||
String blockNumber = "latest"; | ||
KaiaGetTotalSupplyResponse response = w3.kaiaGetTotalSupply(blockNumber).send(); | ||
response.getResult(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...-samples/java/src/main/java/opensdk/sdk/apis/klay/configuration/KlayGetParamsExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import org.web3j.protocol.http.HttpService; | ||
import org.web3j.protocol.kaia.Web3j; | ||
import org.web3j.protocol.kaia.core.method.response.KlayGetParamsResponse; | ||
|
||
import java.io.IOException; | ||
|
||
public class KlayGetParamsExample { | ||
private Web3j w3 = Web3j.build(new HttpService("https://public-en-baobab.klaytn.net")); | ||
void klayGetParamsExample() throws IOException { | ||
int blockTag = 0; | ||
KlayGetParamsResponse response = w3.klayGetParams(blockTag).send(); | ||
response.getResult(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
web3rpc/rpc-specs/code-samples/javascript/kaia/configuration/getParams.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { JsonRpcProvider } = require("@kaiachain/ethers-ext"); | ||
(() => { | ||
const provider = new JsonRpcProvider("https://public-en-baobab.klaytn.net"); | ||
const blockNumber = 89; | ||
|
||
provider.kaia | ||
.getParams(blockNumber, {}, (err, data, response) => {}) | ||
.then((data) => { | ||
console.log(data); | ||
}); | ||
})(); |
11 changes: 11 additions & 0 deletions
11
web3rpc/rpc-specs/code-samples/javascript/kaia/miscellaneous/getTotalSupply.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { JsonRpcProvider } = require("@kaiachain/ethers-ext"); | ||
(() => { | ||
const provider = new JsonRpcProvider("https://public-en-baobab.klaytn.net"); | ||
const blockNumber = "latest"; | ||
|
||
provider.kaia | ||
.getTotalSupply(blockNumber, {}, (err, data, response) => {}) | ||
.then((data) => { | ||
console.log(data); | ||
}); | ||
})(); |
11 changes: 11 additions & 0 deletions
11
web3rpc/rpc-specs/code-samples/javascript/klay/configuration/getParams.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { JsonRpcProvider } = require("@kaiachain/ethers-ext"); | ||
(() => { | ||
const provider = new JsonRpcProvider("https://public-en-baobab.klaytn.net"); | ||
const blockNumber = 89; | ||
|
||
provider.klay | ||
.getParams(blockNumber, {}, (err, data, response) => {}) | ||
.then((data) => { | ||
console.log(data); | ||
}); | ||
})(); |
11 changes: 11 additions & 0 deletions
11
web3rpc/rpc-specs/code-samples/python/kaia/configuration/getParams.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from web3 import Web3 | ||
from web3py_ext import extend | ||
|
||
host = "https://api.baobab.klaytn.net:8651" | ||
|
||
blockNumber = 89 | ||
|
||
w3 = Web3(Web3.HTTPProvider(host)) | ||
kaia_response = w3.kaia.get_params(blockNumber) | ||
|
||
print(kaia_response) |
11 changes: 11 additions & 0 deletions
11
web3rpc/rpc-specs/code-samples/python/kaia/miscellaneous/getTotalSupply.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from web3 import Web3 | ||
from web3py_ext import extend | ||
|
||
host = "https://api.baobab.klaytn.net:8651" | ||
|
||
blockNumber = 'latest' | ||
|
||
w3 = Web3(Web3.HTTPProvider(host)) | ||
kaia_response = w3.kaia.get_total_supply(blockNumber) | ||
|
||
print(kaia_response) |
Oops, something went wrong.