Crates.io | nc_rsdk |
lib.rs | nc_rsdk |
version | 0.1.0 |
source | src |
created_at | 2023-02-28 16:30:22.816373 |
updated_at | 2023-02-28 16:30:22.816373 |
description | This is a prototype of a Rust SDK providing functionality for interacting with the Newcoin network. |
homepage | |
repository | https://github.com/newcoin-sdk/newcoin-rs-api |
max_upload_size | |
id | 797197 |
size | 106,047 |
This is a prototype of a Rust SDK providing functionality for interacting with the Newcoin network.
The expected api functionality is exampled via the main.rs
file.
//** This command will not yet work as rs_ncdao has not yet been uploaded to crates.io. **//
cargo install nc_rsdk
cargo run
cargo test
let gtr_response = get_table_rows().await;
let data_1 = gtr_response.text().await?;
let gtr_wp_response = get_proposal_by_id(&payload).await;
let data_2 = gtr_wp_response.unwrap_err();
let gtr_wp: Response = get_table_rows_with_payload(&payload).await.unwrap();
@newfound8ion/newcoin-sdk / Exports
Ƭ NCApproveDaoProposal: Struct
Name | Type |
---|---|
approver |
String |
approver_prv_key |
String |
dao_id |
u32 |
dao_owner |
String |
proposal_author |
String |
proposal_id |
u32 |
Ƭ NCBuyRam: Struct
Name | Type |
---|---|
payer |
String |
payer_prv_key |
String |
ram_amt |
u32 |
user |
String |
Ƭ NCChangeFile: Struct
Name | Type |
---|---|
asset_id |
String |
editor |
String |
new_content |
String |
new_image |
String |
new_name |
String |
new_path |
String |
owner |
String |
payer |
String |
payer_prv_key |
String |
Ƭ NCCreateCollection: Struct
Name | Type |
---|---|
allow_notify |
bool |
burnable |
bool |
collection_name |
String |
max_supply |
u32 |
mkt_fee |
u32 |
schema_fields |
Vec<NCNameType> |
schema_name |
String |
template_fields |
Vec<NCNameType> |
template_name |
String |
user |
String |
user_prv_active_key |
String |
xferable |
bool |
Ƭ NCCreateDao: Struct
Name | Type |
---|---|
author |
String |
author_prv_key |
String |
descr |
String |
token |
String |
Ƭ NCCreateDaoProposal: Struct
Name | Type |
---|---|
dao_id |
String |
dao_owner |
String |
pass_rate |
u32 |
proposer |
String |
proposer_prv_key |
String |
summary |
String |
title |
String |
url |
String |
vote_end |
String |
vote_start |
String |
Ƭ NCCreateDaoStakeProposal: Struct
Name | Type |
---|---|
dao_id |
String |
dao_owner |
String |
pass_rate |
u32 |
proposer |
String |
proposer_prv_key |
String |
quantity |
(Struct ) { contract : String , quantity : String } |
quantity.contract |
String |
quantity.quantity |
String |
to |
String |
vote_end |
String |
vote_start |
String |
Ƭ NCCreateDaoUserWhitelistProposal: Struct
Name | Type |
---|---|
dao_id |
String |
dao_owner |
String |
pass_rate |
u32 |
proposer |
String |
proposer_prv_key |
String |
type |
String |
user |
String |
vote_end |
String |
vote_start |
String |
Ƭ NCCreatePermission: Struct
Name | Type |
---|---|
author |
String |
author_prv_active_key |
String |
perm_name |
String |
perm_pub_key |
String |
Ƭ NCCreatePool: Struct
Name | Type |
---|---|
is_deflatable |
bool |
is_inflatable |
bool |
is_treasury |
bool |
owner |
String |
owner_prv_active_key |
String |
ticker |
String |
Ƭ NCCreateUser: Struct
Name | Type |
---|---|
cpu_amount |
String |
net_amount |
String |
newUser |
String |
newacc_pub_active_key |
String |
newacc_pub_owner_key |
String |
payer |
String |
payer_prv_key |
String |
ram_amt |
u32 |
xfer |
bool |
Ƭ NCDaoProposalVote: Struct
Name | Type |
---|---|
dao_id |
String |
dao_owner |
String |
option |
String |
proposal_id |
String |
proposal_type |
String |
quantity |
String |
voter |
String |
voter_prv_key |
String |
Ƭ NCDaoWithdrawVoteDeposit: Struct
Name | Type |
---|---|
vote_id |
String |
voter |
String |
voter_prv_key |
String |
Ƭ NCExecuteDaoProposal: Struct
Name | Type |
---|---|
dao_id |
u32 |
dao_owner |
String |
exec |
String |
exec_prv_key |
String |
proposal_author |
String |
proposal_id |
u32 |
Ƭ NCGetAccInfo: Struct
Name | Type |
---|---|
contract |
String |
owner |
String |
token_name |
String |
Ƭ NCGetDaoProposals: Struct
Name | Type |
---|---|
dao_id |
String |
dao_owner |
String |
limit |
u32 |
lower_bound |
String |
proposal_author |
String |
proposal_id |
String |
reverse |
bool |
upper_bound |
String |
Ƭ NCGetDaoWhiteList: Struct
Name | Type |
---|---|
dao_id |
String |
dao_owner |
String |
limit |
String |
lower_bound |
String |
reverse |
bool |
upper_bound |
String |
Ƭ NCGetPoolInfo: Struct
Name | Type |
---|---|
code |
String |
owner |
String |
Ƭ NCGetVotes: Struct
Name | Type |
---|---|
limit |
String |
lower_bound |
String |
reverse |
bool |
upper_bound |
String |
voter |
String |
Ƭ NCKeyPair: Struct
Name | Type |
---|---|
prv_key |
String |
pub_key |
String |
Ƭ NCKeyValPair: Struct
Name | Type |
---|---|
key |
String |
value |
Vec<String> |
Ƭ NCLinkPerm: Struct
Name | Type |
---|---|
action_owner |
String |
action_to_link |
String |
author |
String |
author_prv_active_key |
String |
perm_to_link |
String |
Ƭ NCMintAsset: Struct
Name | Type |
---|---|
col_name |
String |
creator |
String |
immutable_data |
Vec<NCKeyValPair> |
mutable_data |
Vec<NCKeyValPair> |
payer |
String |
payer_prv_key |
String |
sch_name |
String |
tmpl_id |
u32 |
user_prv_active_key |
String |
Ƭ NCMintFile: Struct
Name | Type |
---|---|
content |
String |
creator |
String |
image |
String |
name |
String |
path |
String |
payer |
String |
payer_prv_key |
String |
user_prv_active_key |
String |
Ƭ NCMintLink: Struct
Name | Type |
---|---|
col_name |
String |
creator |
String |
description |
String |
image |
String |
payer |
String |
payer_prv_key |
String |
subj_name |
String |
subj_type |
String |
Ƭ NCMintProfile: Struct
Name | Type |
---|---|
apple |
String |
aspectRatio |
String |
authority |
String |
bio |
String |
blurHash |
String |
content |
String |
contentType |
String |
contentUrl |
String |
coverContentUrl |
String |
creator |
String |
discord |
String |
displayName |
String |
email |
String |
facebook |
String |
facebookId |
String |
firstName |
String |
fullName |
String |
instagram |
String |
lastName |
String |
medium |
String |
offer |
String |
payer |
String |
payer_prv_key |
String |
phone |
String |
pinterest |
String |
reddit |
String |
signal |
String |
signature |
String |
snapchat |
String |
soundcloud |
String |
source |
String |
spotify |
String |
status |
String |
telegram |
String |
tiktok |
String |
tumblr |
String |
twitter |
String |
user_prv_active_key |
String |
username |
String |
youtube |
String |
youtubeId |
String |
Ƭ NCModifyAsset: Struct
Name | Type |
---|---|
asset_id |
String |
editor |
String |
new_data |
Vec<NCKeyValPair> |
owner |
String |
payer |
String |
payer_prv_key |
String |
Ƭ NCNameType: Struct
Name | Type |
---|---|
name |
String |
type |
String |
Ƭ NCPoolsInfo: Struct
Name | Type |
---|---|
more |
bool |
next_key |
String |
rows |
Vec<NCPoolInfo> |
Ƭ NCReturnInfo: Struct
Name | Type |
---|---|
acc_balances |
Vec<String> |
Ƭ NCReturnTxs: Struct
Name | Type |
---|---|
TxID |
String |
TxID_WithdrawVoteDeposit |
String |
TxID_addToWhiteList |
String |
TxID_approveDaoProposal |
String |
TxID_changeFile |
String |
TxID_createAcc |
String |
TxID_createCol |
String |
TxID_createDao |
String |
TxID_createDaoProposal |
String |
TxID_createPerm |
String |
TxID_createPool |
String |
TxID_createSch |
String |
TxID_createTpl |
String |
TxID_executeDaoProposal |
String |
TxID_linkPerm |
String |
TxID_mintAsset |
String |
TxID_mintFile |
String |
TxID_mintNft |
String |
TxID_mintProfile |
String |
TxID_modifyAsset |
String |
TxID_removeFromWhiteList |
String |
TxID_stakeMainDAO |
String |
TxID_stakePool |
String |
TxID_txNcoBalance |
String |
TxID_unstakeMainDAO |
String |
TxID_unstakePool |
String |
TxID_voteDaoProposal |
String |
TxID_withdrawFromPool |
String |
asset_id |
String |
dao_id |
String |
pool_code |
String |
pool_id |
String |
proposal_id |
u32 |
template_id |
String |
tx |
TransactResult |
Ƭ NCStakeMainDao: Struct
Name | Type |
---|---|
amt |
String |
payer |
String |
payer_prv_key |
String |
Ƭ NCStakePool: Struct
Name | Type |
---|---|
amt |
String |
owner |
String |
payer |
String |
payer_prv_key |
String |
Ƭ NCTxBal: Struct
Name | Type |
---|---|
amt |
String |
memo |
String |
payer |
String |
payer_prv_key |
String |
to |
String |
Ƭ NCTxNcoBal: Struct
Name | Type |
---|---|
amt |
String |
memo |
String |
payer |
String |
payer_prv_key |
String |
to |
String |
Ƭ NCUnstakePool: Struct
Name | Type |
---|---|
amt |
String |
payer |
String |
payer_prv_key |
String |
• Const
default_nft_schema: { name
: String
, nft_schema_type
: String
}
• Const
devnet_services: NCInitServices
• Const
devnet_urls: NCInitUrls
• Const
file_schema: { name
: String
, file_schema_type
: String
}[]
• Const
link_schema: { name
: String
, link_schema_type
: String
}[]
• Const
profile_schema: { name
: String
, profile_schema_type
: String
}[]
//** As of yet, the text below has not been reworked for the application.** //
The REST API to the example app is described below.
GET /thing/
curl -i -H 'Accept: application/json' http://localhost:7000/thing/
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 2
[]
let url_val = NCInitUrlsDev::default().nodeos_url.clone();
let gtr_response: Response = get_table_rows().await;
let data = gtr_response.json().await;
POST /thing/
curl -i -H 'Accept: application/json' -d 'name=Foo&status=new' http://localhost:7000/thing
HTTP/1.1 201 Created
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 201 Created
Connection: close
Content-Type: application/json
Location: /thing/1
Content-Length: 36
{"id":1,"name":"Foo","status":"new"}
GET /thing/id
curl -i -H 'Accept: application/json' http://localhost:7000/thing/1
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 36
{"id":1,"name":"Foo","status":"new"}
GET /thing/id
curl -i -H 'Accept: application/json' http://localhost:7000/thing/9999
HTTP/1.1 404 Not Found
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 404 Not Found
Connection: close
Content-Type: application/json
Content-Length: 35
{"status":404,"reason":"Not found"}
POST /thing/
curl -i -H 'Accept: application/json' -d 'name=Bar&junk=rubbish' http://localhost:7000/thing
HTTP/1.1 201 Created
Date: Thu, 24 Feb 2011 12:36:31 GMT
Status: 201 Created
Connection: close
Content-Type: application/json
Location: /thing/2
Content-Length: 35
{"id":2,"name":"Bar","status":null}
GET /thing/
curl -i -H 'Accept: application/json' http://localhost:7000/thing/
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:31 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 74
[{"id":1,"name":"Foo","status":"new"},{"id":2,"name":"Bar","status":null}]
PUT /thing/:id/status/changed
curl -i -H 'Accept: application/json' -X PUT http://localhost:7000/thing/1/status/changed
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:31 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 40
{"id":1,"name":"Foo","status":"changed"}
GET /thing/id
curl -i -H 'Accept: application/json' http://localhost:7000/thing/1
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:31 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 40
{"id":1,"name":"Foo","status":"changed"}
PUT /thing/:id
curl -i -H 'Accept: application/json' -X PUT -d 'name=Foo&status=changed2' http://localhost:7000/thing/1
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:31 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 41
{"id":1,"name":"Foo","status":"changed2"}
PUT /thing/:id
curl -i -H 'Accept: application/json' -X PUT -d 'status=changed3' http://localhost:7000/thing/1
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:32 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 41
{"id":1,"name":"Foo","status":"changed3"}
PUT /thing/:id
curl -i -H 'Accept: application/json' -X PUT -d 'id=99&status=changed4' http://localhost:7000/thing/1
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:32 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 41
{"id":1,"name":"Foo","status":"changed4"}
POST /thing/:id_method=POST
curl -i -H 'Accept: application/json' -X POST -d 'name=Baz&_method=PUT' http://localhost:7000/thing/1
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:32 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 41
{"id":1,"name":"Baz","status":"changed4"}
POST /thing/:id_method=POST
curl -i -H 'Accept: application/json' -X POST -d 'name=Qux' http://localhost:7000/thing/1_method=PUT
HTTP/1.1 404 Not Found
Date: Thu, 24 Feb 2011 12:36:32 GMT
Status: 404 Not Found
Connection: close
Content-Type: text/html;charset=utf-8
Content-Length: 35
{"status":404,"reason":"Not found"}
DELETE /thing/id
curl -i -H 'Accept: application/json' -X DELETE http://localhost:7000/thing/1/
HTTP/1.1 204 No Content
Date: Thu, 24 Feb 2011 12:36:32 GMT
Status: 204 No Content
Connection: close
DELETE /thing/id
curl -i -H 'Accept: application/json' -X DELETE http://localhost:7000/thing/1/
HTTP/1.1 404 Not Found
Date: Thu, 24 Feb 2011 12:36:32 GMT
Status: 404 Not Found
Connection: close
Content-Type: application/json
Content-Length: 35
{"status":404,"reason":"Not found"}
GET /thing/1
curl -i -H 'Accept: application/json' http://localhost:7000/thing/1
HTTP/1.1 404 Not Found
Date: Thu, 24 Feb 2011 12:36:33 GMT
Status: 404 Not Found
Connection: close
Content-Type: application/json
Content-Length: 35
{"status":404,"reason":"Not found"}
DELETE /thing/id
curl -i -H 'Accept: application/json' -X POST -d'_method=DELETE' http://localhost:7000/thing/2/
HTTP/1.1 204 No Content
Date: Thu, 24 Feb 2011 12:36:33 GMT
Status: 204 No Content
Connection: close