Skip to content

priv_api

Richard edited this page Mar 15, 2022 · 1 revision

1. Wan-API Manual for Wanchain

Wan-api is the Wan-related API interface that can be called after the user links to the gwan node through IPC or RPC.

This manual enumerates and explains all Wan-APIs.

2. Content

3. Wan-API

3.1. Basic information query

3.1.1. getWanAddress

Get the Wan address of an account

> wan.getWanAddress("0x0e6c6ce800855d5388b72391b6f3f635a57818a4")
"0x030f868943c44165a95f32a15690913716378c874720d55cb1cad8f855305ab8d402b88480fd1980737c230140afd5a6403c13fa23d2f7405ca9e581702c4498b189"
> 

3.1.2. getSupportWanCoinOTABalances

Get the balance value which wan coin private transaction supported.

> wan.getSupportWanCoinOTABalances()
[10000000000000000000, 20000000000000000000, 50000000000000000000, 100000000000000000000, 200000000000000000000, 500000000000000000000, 1e+21, 5e+21, 5e+22]
> 

3.1.3. getSupportStampOTABalances

Get the balance value which wan stamp private transaction supported

> wan.getSupportStampOTABalances()
[90000000000000000, 200000000000000000, 500000000000000000]
> 

3.1.4. getOTAMixSet

According to the specified number to get the set of OTA wan.getOTAMixSet(otaAddress, number) parameters: otaAddress: specify one of ota address. number: specify how many ota you want to fetch.

> wan.getOTAMixSet("0x02212f1d71e659bdb088a5066c2b8b339c70c0e63a1d0abedb6696053741ed4d6002113a04f3067f701ebe686bc35e6be7b692995f407d234f2b04b08c9a49797df1",8)
["0x02796e612dd0ba332fcf16cb23d249c0b42d64f31501009736c87c83dfb849a20203356fb401c473c007ca07336f4b8842f471071dc27ff1e11baebbf962ac180f4a", "0x029ec90af30ed2f59768c6c07e69a889582e1e0b2e81592958de98c41d6e346662020b3a34372314c9180b221f19590e8d26b0c0502f34529e48fae55c0838d561c0", "0x03de8de77341ca7a861b5b705d281b10e56482a4a1f6fc3619ae814cbaefa23d6c021da8382a12a4ccaa43890ff951fde267475ef928e71142b199d493f2225dc909", "0x0217955aec825def8c8a5dd5cd60d7351a348913439260148f23f210c668997c7f021cd1f4c1786c0089d27494337619d929f6c3f2656f2f9cfb017bbb51bcd284ec", "0x027707bab687b77529561c8bfeb433ede034b907d3889db7df9d0625f97304394502ceb04d47a4d99f43296580c7658f0b35d3a4163171dfe08d1390e79ce2779dd9", "0x020e4eeebf1c136351626a1840421971420a85ab6f7cf1472f3c84ffb41bdbf08e03bd50809da436ca5c38c39b3c7cb8f5ed511fa43718c353e7f0e946631e154d67", "0x03c63de7511d30d7c103a4180e069a3974f5fa384ff6b99b0062616102b2710a9a032e253aa13dea2bfe70586310cc4857e72715254138fbc4cb9f1c1cb3df533971", "0x0244f4b9d6294ce76d4b00307315d43f76b2d6ae5192e11fcf8a5ed1213729b1bf02f57e05984a07254bdb3d8d52f05238a79e5697f7fc6daaa1ba9a2f9c37d2d206"]
>

3.1.5. getOTABalance

Get the specified ota balance.

> wan.getOTABalance("0x02212f1d71e659bdb088a5066c2b8b339c70c0e63a1d0abedb6696053741ed4d6002113a04f3067f701ebe686bc35e6be7b692995f407d234f2b04b08c9a49797df1")
10000000000000000000
>

3.1.6. checkOTAUsed

Check if the OTA has been used

> wan.checkOTAUsed("0x02212f1d71e659bdb088a5066c2b8b339c70c0e63a1d0abedb6696053741ed4d6002113a04f3067f701ebe686bc35e6be7b692995f407d234f2b04b08c9a49797df1")
false
>

3.1.7. generateOneTimeAddress

Generate a OTA address according to the given wan address.

> wan.generateOneTimeAddress("0x02212f1d71e659bdb088a5066c2b8b339c70c0e63a1d0abedb6696053741ed4d6002113a04f3067f701ebe686bc35e6be7b692995f407d234f2b04b08c9a49797df1")
"0x02643ea2c12b240d47dc8cd100b36891fb72032417931c8e6336372a117075096402636e4fe815aef476f04679337c9343934b619dc9ab550dc1a6fe606cfdb720b0"
>

3.1.8. computeOTAPPKeys

compute ota private key, public key and short address

> wan.computeOTAPPKeys("0x0e6c6ce800855d5388b72391b6f3f635a57818a4","0x02212f1d71e659bdb088a5066c2b8b339c70c0e63a1d0abedb6696053741ed4d6002113a04f3067f701ebe686bc35e6be7b692995f407d234f2b04b08c9a49797df1")
"0x5ff483982105f111597d6192d8c37e2701e1cd0dfb8c059400b9314baca57ca5+0x212f1d71e659bdb088a5066c2b8b339c70c0e63a1d0abedb6696053741ed4d600bcfbd211adcb8ca9243491e468aba969a32b74bbd3ad6fb984bea695f5917ca+0x9d1217f48cb9f27a0c08f7e4b74f061c4f7a536c"
> 
Clone this wiki locally