diff --git a/btcjson/wormholecmds.go b/btcjson/wormholecmds.go index f1bd68b..ac23b19 100644 --- a/btcjson/wormholecmds.go +++ b/btcjson/wormholecmds.go @@ -827,6 +827,216 @@ func NewWhcGetFrozenBalanceForAddressCmd(address string) *WhcGetFrozenBalanceFor } } +//whc_getERC721PropertyNews +type WhcGetERC721PropertyNewsCmd struct { + PropertyId string +} + +func NewWhcGetERC721PropertyNewsCmd(propertyId string) *WhcGetERC721PropertyNewsCmd{ + return &WhcGetERC721PropertyNewsCmd{ + PropertyId:propertyId, + } +} + +//whc_getERC721PropertyDestroyTokens +type WhcGetERC721PropertyDestoryTokensCmd struct { + PropertyId string +} + +func NewWhcGetERC721PropertyDestoryTokensCmd(propertyId string) *WhcGetERC721PropertyDestoryTokensCmd{ + return &WhcGetERC721PropertyDestoryTokensCmd{ + PropertyId:propertyId, + } +} + +//whc_getERC721TokenNews +type WhcGetERC721TokenNewsCmd struct { + PropertyId string + TokenId string +} + +func NewWhcGetERC721TokenNewsCmd(propertyId, tokenId string) *WhcGetERC721TokenNewsCmd{ + return &WhcGetERC721TokenNewsCmd{ + PropertyId:propertyId, + TokenId:tokenId, + } +} + +//whc_getERC721AddressTokens +type WhcGetERC721AddressTokensCmd struct { + Address string + PropertyId string +} +func NewWhcGetERC721AddressTokensCmd(address string, id string) *WhcGetERC721AddressTokensCmd{ + return &WhcGetERC721AddressTokensCmd{ + Address:address, + PropertyId:id, + } +} + +//whc_ownerOfERC721Token +type WhcOwnerOfERC721TokenCmd struct { + PropertyId string + TokenId string + Address string +} + +func NewWhcOwnerOfERC721TokenCmd ( propertyId,tokenId string,address string,) *WhcOwnerOfERC721TokenCmd{ + return &WhcOwnerOfERC721TokenCmd{ + PropertyId:propertyId, + TokenId:tokenId, + Address:address, + } + +} + +//whc_listERC721PropertyTokens +type WhcListERC721PropertyTokensCmd struct { + Propertyid string +} + +func NewWhcListERC721PropertyTokensCmd (propertyId string) *WhcListERC721PropertyTokensCmd { + return &WhcListERC721PropertyTokensCmd{ + Propertyid:propertyId, + } +} + +//whc_issuanceERC721property +type WhcIssuanceERC721PropertyCmd struct { + IssueAddress string + Name string + Symbol string + Data string + Url string + TotalNumber string +} + +func NewWhcIssuanceERC721PropertyCmd(issueAddress, name, symbol, data, url,totalNumber string) *WhcIssuanceERC721PropertyCmd{ + return &WhcIssuanceERC721PropertyCmd{ + IssueAddress:issueAddress, + Name:name, + Symbol:symbol, + Data:data, + Url:url, + TotalNumber:totalNumber, + } +} + +//whc_transferERC721Token +type WhcTransferERC721TokenCmd struct { + OwnerAddress string + ReceiveAddress string + PropertyID string + TokenID string +} + +func NewWhcTransferERC721TokenCmd(ownerAddress, receiveAddress string, propertyId, tokenId string) *WhcTransferERC721TokenCmd{ + return &WhcTransferERC721TokenCmd{ + OwnerAddress:ownerAddress, + ReceiveAddress:receiveAddress, + PropertyID:propertyId, + TokenID:tokenId, + } +} + +//whc_destroyERC721Token +type WhcDestoryERC721TokenCmd struct { + OwnerAddress string + PropertyID string + TokenID string +} + +func NewWhcDestoryERC721TokenCmd(ownerAddress string, propertyId,tokenId string) *WhcDestoryERC721TokenCmd{ + return &WhcDestoryERC721TokenCmd{ + OwnerAddress:ownerAddress, + PropertyID:propertyId, + TokenID:tokenId, + } +} + +//whc_issuanceERC721Token +type WhcIssuanceERC721TokenCmd struct { + IssueAddress string + ReceiveAddress string + PropertyID string + TokenID string + TokenAttributes string + TokenUrl string +} +func NewWhcIssuanceERC721TokenCmd (issueAddress, receiveAddress, propertyId, tokenId, tokenAttributes, tokenUrl string) *WhcIssuanceERC721TokenCmd{ + return &WhcIssuanceERC721TokenCmd{ + IssueAddress:issueAddress, + ReceiveAddress:receiveAddress, + PropertyID:propertyId, + TokenID:tokenId, + TokenAttributes:tokenAttributes, + TokenUrl:tokenUrl, + } +} + +//whc_createpayload_issueERC721property +type WhcCreatePayloadIssueERC721PropertyCmd struct { + Name string + Symbol string + Data string + Url string + TotalNumber string +} + +func NewWhcCreatePayloadIssueERC721PropertyCmd(name, symbol, data, url, total string) *WhcCreatePayloadIssueERC721PropertyCmd { + return &WhcCreatePayloadIssueERC721PropertyCmd{ + Name: name, + Symbol:symbol, + Data:data, + Url: url, + TotalNumber:total, + } +} + +//whc_createpayload_issueERC721token +type WhcCreatePayloadIssueERC721TokenCmd struct{ + PropertyId string + TokenId string + TokenAttributes string + TokenUrl string +} + +func NewWhcCreatePayloadIssueERC721TokenCmd(propertyId, tokenId string, tokenAttributes, tokenUrl string) *WhcCreatePayloadIssueERC721TokenCmd{ + return &WhcCreatePayloadIssueERC721TokenCmd{ + PropertyId:propertyId, + TokenId:tokenId, + TokenAttributes:tokenAttributes, + TokenUrl:tokenUrl, + } +} + +//whc_createpayload_transferERC721token +type WhcCreatePayloadTransferERC721TokenCmd struct { + PropertyId string + TokenId string +} + +func NewWhcCreatePayloadTransferERC721TokenCmd(propertyId, tokenId string) *WhcCreatePayloadTransferERC721TokenCmd{ + return &WhcCreatePayloadTransferERC721TokenCmd{ + PropertyId:propertyId, + TokenId:tokenId, + } +} + +//whc_createpayload_destroyERC721token +type WhcCreatePayloadDestoryERC721TokenCmd struct { + PropertyId string + TokenId string +} + +func NewWhcCreatePayloadDestoryERC721TokenCmd(propertyId, tokenId string) *WhcCreatePayloadDestoryERC721TokenCmd{ + return &WhcCreatePayloadDestoryERC721TokenCmd{ + PropertyId:propertyId, + TokenId:tokenId, + } +} + + func init() { // No special flags for commands in this file. flags := UsageFlag(0) @@ -887,4 +1097,21 @@ func init() { MustRegisterCmd("whc_getfrozenbalance", (*GetFrozenBalanceCmd)(nil), flags) MustRegisterCmd("whc_getfrozenbalanceforid", (*WhcGetFrozenBalanceForIdCmd)(nil), flags) MustRegisterCmd("whc_getfrozenbalanceforaddress", (*WhcGetFrozenBalanceForAddressCmd)(nil), flags) + MustRegisterCmd("whc_getERC721AddressTokens", (*WhcGetERC721AddressTokensCmd)(nil), flags) + MustRegisterCmd("whc_getERC721PropertyDestroyTokens", (*WhcGetERC721PropertyDestoryTokensCmd)(nil), flags) + MustRegisterCmd("whc_ownerOfERC721Token", (*WhcOwnerOfERC721TokenCmd)(nil), flags) + MustRegisterCmd("whc_listERC721PropertyTokens", (*WhcListERC721PropertyTokensCmd)(nil), flags) + MustRegisterCmd("whc_getERC721PropertyNews", (*WhcGetERC721PropertyNewsCmd)(nil), flags) + MustRegisterCmd("whc_getERC721TokenNews", (*WhcGetERC721TokenNewsCmd)(nil), flags) + MustRegisterCmd("whc_issuanceERC721property", (*WhcIssuanceERC721PropertyCmd)(nil), flags) + MustRegisterCmd("whc_transferERC721Token", (*WhcTransferERC721TokenCmd)(nil), flags) + MustRegisterCmd("whc_destroyERC721Token", (*WhcDestoryERC721TokenCmd)(nil), flags) + MustRegisterCmd("whc_issuanceERC721Token", (*WhcIssuanceERC721TokenCmd)(nil), flags) + MustRegisterCmd("whc_createpayload_issueERC721property", (*WhcCreatePayloadIssueERC721PropertyCmd)(nil), flags) + MustRegisterCmd("whc_createpayload_issueERC721token", (*WhcCreatePayloadIssueERC721TokenCmd)(nil), flags) + MustRegisterCmd("whc_createpayload_transferERC721token", (*WhcCreatePayloadTransferERC721TokenCmd)(nil), flags) + MustRegisterCmd("whc_createpayload_destroyERC721token", (*WhcCreatePayloadDestoryERC721TokenCmd)(nil), flags) + + + } diff --git a/btcjson/wormholeresults.go b/btcjson/wormholeresults.go index e576aa3..2f66ea7 100644 --- a/btcjson/wormholeresults.go +++ b/btcjson/wormholeresults.go @@ -275,3 +275,52 @@ type FrozenBalanceResult struct { Address *string `json:"address"` PropertyID *int64 `json:"propertyid,omitempty"` } + +type ERC721AddressTokensResult struct { + TokenId string `json:"tokenid"` + Attribute string `json:"attribute"` + TokenUrl string `json:"tokenurl"` + Txid string `json:"creationtxid"` +} + +type OwnerOfERC721TokenResult struct { + Own bool `json:"own"` +} + +type WhcListERC721PropertyTokensResult struct { + TokenId string `json:"tokenid"` + Owner string `json:"owner"` +} + +type WhcGetERC721PropertyNewsResult struct { + PropertyId string `json:"propertyid"` + Owner string `json:"owner"` + CreationTxid string `json:"creationtxid"` + CreationBlock string `json:"creationblock"` + Attribute string `json:"attribute"` + TokenUrl string `json:"tokenurl"` + Name string `json:"name"` + Symbol string `json:"symbol"` + Data string `json:"data"` + PropertyUrl string `json:"propertyurl"` + TotalTokenNumber int `json:"totalTokenNumber"` + HaveIssuedNumber int `json:"haveIssuedNumber"` + CurrentValidIssuedNumer int `json:"currentValidIssuedNumer"` +} + +type WhcGetERC721TokenNewsResult struct { + PropertyId string `json:"propertyid"` + TokenId string `json:"tokenid"` + Owner string `json:"owner"` + CreationTxid string `json:"creationtxid"` + CreationBlock string `json:"creationblock"` + Attribute string `json:"attribute"` + TokenUrl string `json:"tokenurl"` +} + +type WhcGetERC721PropertyDestoryTokensResult struct { + TokenId int64 `json:"tokenid"` + Attribute string `json:"attribute"` + TokenUrl string `json:"tokenurl"` + CreationTxid string `json:"creationtxid"` +} \ No newline at end of file diff --git a/doc/create-transaction-payload.md b/doc/create-transaction-payload.md index 4f87f04..e17e6b3 100644 --- a/doc/create-transaction-payload.md +++ b/doc/create-transaction-payload.md @@ -351,3 +351,100 @@ client. WhcCreatePayloadUnFreeze("bchreg:qzrck6dmz5lgs7v87dr5lp4g56aldg9knucnuqy // result: 0000004600000022 ``` +##### `whc_createpayload_destroyERC721token` + +Creates the payload to destroy ERC721 token + +**Arguments** + +- propertyId `string`The token within the property that will be destroy +- tokenId`string`The tokenid that will be destroy + +**Result** + +- `hash`the hex-encoded transaction hash + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcGetERC721PropertyDestoryTokens("9") + +//result +000000090407000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000 +``` + +##### `whc_createpayload_issueERC721property` + +Creates the payload to issue ERC721 property. + +**Argument** + +- name `string` required:the name of created property +- symbol`string`required:the symbol of created property +- data`string`required:the Data of created property +- url`string`required:the URL of created property +- totalNumber`string`required:the number of token that created property will issued in the future + +**Result** + +- `payload`the hex-encoded payload + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcCreatePayloadIssueERC721Property("payload1","pp","data","url","5") +//result +00000009017061796c6f61643100707000646174610075726c000000000000000005 +``` + +##### `whc_createpayload_issueERC721token` + +Creates the payload to issue ERC721 token. + +**Argument** + +- propertyId `string` required:The ID of the special property that will be issued token +- tokenId`string`required:The tokenID that will be issued +- tokenAttributes`string`required:The Attributes of the new created token +- tokenURL`string`required:The URL of the new created token + +**Result** + +- `payload` the hex-encoded payload + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcCreatePayloadIssueERC721Token("6","6","0000E","SDF") + +//result +0000000902060000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000053444600 +``` + +##### `whc_createpayload_transferERC721token` + +Creates the payload to transfer ERC721 token. + +**Arguments** + +- propertyId `string`required:The propertyid within the token that will be transfer +- tokenId`string`required:The tokenid that will be transfer + +**Result** + +- `hash`the hex-encoded transaction hash + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcCreatePayloadTransferERC721Token("7","1") + +//result +000000090307000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000 +``` + +##### \ No newline at end of file diff --git a/doc/data-retrieval.md b/doc/data-retrieval.md index dea8a7a..0f0628a 100644 --- a/doc/data-retrieval.md +++ b/doc/data-retrieval.md @@ -561,4 +561,303 @@ rpc.NewRPCInstance().WhcGetFrozenBalanceForAddress("bchtest:qqu9lh4jpc05p59pfhu9 ] ``` -##### \ No newline at end of file +##### + +##### `whc_getERC721AddressTokens` + +Returns details for about the tokens or smart property to lookup. + +**Arguments** + +- address `string` required:the address of the query. +- propertyid`string`required:the identifier of the ERC721 property + +**Result** + +- `tokenid`the identifier of the token +- `attribute`the name of the tokens +- `tokenurl`the url of the tokens +- `creationtxid`the hex-encoded creation transaction hash + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcGetERC721AddressTokens("qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt","6") + +//result +[{"tokenid": "1","attribute": "0000000000000000000000000000000000000000000000000000000000edabef", "tokenurl": "http://lll","creationtxid": "b4437159f1443793f2fc3a4a98951a945c2e6d6fcf4839e1c2d39626821b911b"} +] +``` + +##### `whc_getERC721PropertyDestroyTokens` + +Returns details for about the destroy tokens to lookup. + +**Arguments** + +- propertyid `string`required:the identifier of the ERC721 property + +**Result** + +- `tokenid`the identifier of the token +- `attribute`the name of the tokens +- `tokenurl` the url of the tokens +- `creationtxid`the hex-encoded creation transaction hash + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcGetERC721PropertyDestoryTokens("9") +//result +[{ "tokenid": "1", + "attribute": "0000000000000000000000000000000000000000000000000000000000edabef", + "tokenurl": "http://lll", + "creationtxid": "d6c220d2b4ca898f92de9975a32585b285a0c71a401a56b7e6c6cd50b8cfe2c3" + } +] +``` + +##### `whc_getERC721PropertyNews` + +Returns details for about the tokens or smart property to lookup + +**Arguments** + +- propertyid`string`required: the identifier of the ERC721 property + +**Result** + +- `propertyid`the identifier of the property +- `owner`the owner address of the ERC721 Property +- `creationtxid`the hex-encoded creation transaction hash +- `creationblock`the hex-encoded creation block hash +- `name`the name of the property +- `symbol`property symbol +- `data`remark +- `propertyurl`the url of the property +- `totalTokenNumber`the amount of tokens that will be issued +- `haveIssuedNumber`the amount of tokens that have issued +- `currentValidIssuedNumer`the amount of tokens that still available + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcGetERC721PropertyNews("7") +//result +{ + "propertyid": "7", + "owner": "bchtest:qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt", + "creationtxid": "e930f27993881bd74d89572ca8c2273538ea62dec5980190f7c191cb56f02db1", + "creationblock": "00000000000000e204e8ac7c0bdf2914067e75f9f7b109a87bda9762afc339c1", + "name": "property test", + "symbol": "a", + "data": "ttt", + "propertyurl": "http://test", + "totalTokenNumber": 88, + "haveIssuedNumber": 1, + "currentValidIssuedNumer": 1 +} +``` + +##### `whc_getERC721TokenNews` + +Returns details for about the tokens or smart property to lookup. + +**Arguments** + +- propertyid `string`required:the identifier of the ERC721 property +- tokenid`string` required:the identifier of the ERC721 token + +**Result** + +- `propertyid`the identifier of the property +- `tokenid`the identifier of the token +- `owner`the owner address of token +- `creationtxid`the hex-encoded creation transaction hash +- `creationblock`the hex-encoded creation block hash +- `attribute`the name of the tokens +- `tokenurl`the url of the tokens + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcGetERC721TokenNews("7","1") + +//result +{ + "propertyid": "6", + "tokenid": "1", + "owner": "bchtest:qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt", + "creationtxid": "7e88e4fdd9938f37fb94c7fa587287d57f800af6cf5f9cb8f15dca5edbad1f73", + "creationblock": "000000000001481bc37330297e0053f0051125574364aa40e72a965da13d1e3e", + "attribute": "000000000000000000000000000000000000000000000000000000000000000e", + "tokenurl": "http://lll" +} +``` + +##### `whc_listERC721PropertyTokens` + +List all tokens information for the specified ERC721Property. + +**Arguments** + +- propertyid`string` required:the identifier of the ERC721 property + +**Result** + +- `tokenid`the identifier of the token +- `owner`the owner address of the token + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcListERC721PropertyTokens("9") + +//result +[{ + "tokenid": "1", + "owner": "bchtest:qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt" + }, + { + "tokenid": "2", + "owner": "bchtest:qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt" + } +] + +``` + +##### `whc_ownerOfERC721Token` + +Query whether the Token's owner is the specified address. + +**Arguments** + +- propertyid `string`required:the identifier of the ERC721 property +- tokenid`string`required:the identifier of the ERC721 token +- address`string` query address for the specified ERC721 Token + +**Result** + +- `ownwhether the query address owner the specified ERC721 Token` + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcOwnerOfERC721Token("7","1","qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt") + +//result +{ + "own": true +} +``` + +##### +##### `whc_destroyERC721Token` + +Destroy ERC721 Token. + +**Arguments** + +- senderAddress`string`required:The bitcoincash address of the token owner +- propertyId`string`required:The propertyid within the token that will be destory +- tokenId`string`required:The tokenid that will be destory + +**Result** + +- `hash`the hex-encoded transaction hash + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcDestoryERC721Token("qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt","9","1") + +//result +2c82940e9f9d637fc456a4c651fef7b9dabeb3187571b562088a43aacbb9d80e +``` + +##### `whc_issuanceERC721Token` + +Issue ERC721 Token. + +**Arguments** + +- issueAddress`string`required:The BitcoinCash address will issue a token in special property +- receiveaddress`string`required:The address of receiver will be received new created token +- propertyID`string`required:The ID of the special property that will be issued token +- tokenID`string`required:The tokenID that will be issued +- tokenAttributes`string`The Attributes of the new created token +- tokenURL`string`The URL of the new created token + +**Result** + +- `hash`the hex-encoded transaction hash + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcIssuanceERC721Token("qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt","qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt","9","1","00000000000000000000000000EDABEF","http://lll") + +//result +b4437159f1443793f2fc3a4a98951a945c2e6d6fcf4839e1c2d39626821b911b +``` + +##### `whc_issuanceERC721property` + +Issue ERC721 property + +**Arguments** + +- issueAddress`string`required:The BitcoinCash address will issue ERC721 property +- name`string`required:the name of created property +- symbol`string`required:the symbol of created property +- data`string`required:the Data of created property +- url`string`required:the URL of created property +- totalNumber`string`required: the number of token that created property will issued in the future + +**Result** + +- `hash`the hex-encoded transaction hash + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcIssuanceERC721Property("qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt","property test4","a","ttt","http://test","8") + +//result +e5efb94c13d9fbbdbe3decfeb88300d61cf259447d225b641f00251df0bc6db6 +``` + +##### `whc_transferERC721Token` + +Transfer ERC721 Token. + +**Arguments** + +- ownerAddress`string`The bitcoincash address of the token owner +- receiveaddress`string`The redeem bitcoin address of the token receiver +- propertyId`string`The propertyid within the token that will be transfer +- tokenId`string`The tokenid that will be transfer + +**Result** + +- `hash`the hex-encoded transaction hash + +**Examples** + +```go +//request +rpc.NewRPCInstance().WhcTransferERC721Token("qrqfsslh4l27kwgxfq959gq9tpqn6j739ydn527mlt","qpd485y7slsn9mnudjm6n477m4yxdx9u5yf0ff3z55","8","1") + +//result +025c1382cc049e6db911969313f42ec34b338c4ed21e0d83c25e1dc066db27d5 +``` + diff --git a/examples/fozen_token.go b/examples/fozen_token.go index f9bdc2b..a98995f 100644 --- a/examples/fozen_token.go +++ b/examples/fozen_token.go @@ -27,19 +27,21 @@ func getClient() *rpcclient.Client { func main() { c := getClient() - res, err := c.WhcSendUnFreeze("bchreg:qzrck6dmz5lgs7v87dr5lp4g56aldg9knucnuqyl2g", 5, "1", "bchreg:qzuy3es55tygnmmeydh5uqc39sfkke6hlqf2dv26h0") - fmt.Println(res) - fmt.Println(err) - - balance, err := c.WhcGetFrozenBalance("qzuy3es55tygnmmeydh5uqc39sfkke6hlqf2dv26h0", 5) - fmt.Println(err) - fmt.Println(balance) - - balances ,err :=c.WhcGetFrozenBalanceForId(5) - fmt.Println(err) - fmt.Println(balances) - + //res, err := c.WhcSendUnFreeze("bchreg:qzrck6dmz5lgs7v87dr5lp4g56aldg9knucnuqyl2g", 5, "1", "bchreg:qzuy3es55tygnmmeydh5uqc39sfkke6hlqf2dv26h0") + //fmt.Println(res) + //fmt.Println(err) + // + //balance, err := c.WhcGetFrozenBalance("qzuy3es55tygnmmeydh5uqc39sfkke6hlqf2dv26h0", 5) + //fmt.Println(err) + //fmt.Println(balance) + // + //balances ,err :=c.WhcGetFrozenBalanceForId(5) + //fmt.Println(err) + //fmt.Println(balances) + // list,err :=c.WhcGetFrozenBalanceForAddress("qzuy3es55tygnmmeydh5uqc39sfkke6hlqf2dv26h0") fmt.Println(err) fmt.Println(list) + + } diff --git a/rpcclient/wormhole.go b/rpcclient/wormhole.go index e8ed5b7..2406cf6 100644 --- a/rpcclient/wormhole.go +++ b/rpcclient/wormhole.go @@ -6,7 +6,6 @@ package rpcclient import ( "encoding/json" - "github.com/copernet/whc.go/btcjson" ) @@ -1537,3 +1536,388 @@ func (c *Client) WhcSendUnFreezeAsync(fromAddress string, id int64, amount strin cmd := btcjson.NewWhcSendUnFreezeCmd(fromAddress, id, amount, frozenAddress) return c.sendCmd(cmd) } + +//whc_getERC721AddressTokens +type FutureWhcGetERC721AddressTokensResult chan *response + +func (r FutureWhcGetERC721AddressTokensResult) Receive() (*[]btcjson.ERC721AddressTokensResult, error){ + res, err := receiveFuture(r) + if err != nil { + return nil, err + } + + var result []btcjson.ERC721AddressTokensResult + err = json.Unmarshal(res, &result) + if err != nil { + return nil, err + } + + return &result, nil +} + +func (c *Client) WhcGetERC721AddressTokensAsync(address string,id string) FutureWhcGetERC721AddressTokensResult { + cmd := btcjson.NewWhcGetERC721AddressTokensCmd(address,id) + return c.sendCmd(cmd) +} + +func (c *Client) WhcGetERC721AddressTokens(address string,id string) (*[]btcjson.ERC721AddressTokensResult, error) { + return c.WhcGetERC721AddressTokensAsync(address,id).Receive() +} + +//whc_ownerOfERC721Token +type FutureWhcOwnerOfERC721TokenResult chan *response + +func (r FutureWhcOwnerOfERC721TokenResult) Receive() (*btcjson.OwnerOfERC721TokenResult, error){ + res, err := receiveFuture(r) + if err != nil { + return nil, err + } + + var result btcjson.OwnerOfERC721TokenResult + err = json.Unmarshal(res, &result) + if err != nil { + return nil, err + } + + return &result, nil +} + +func (c *Client) WhcOwnerOfERC721TokenAsync(propertyId, tokenId string,address string) FutureWhcOwnerOfERC721TokenResult { + cmd := btcjson.NewWhcOwnerOfERC721TokenCmd(propertyId, tokenId,address) + return c.sendCmd(cmd) +} + +func (c * Client) WhcOwnerOfERC721Token( propertyId, tokenId string,address string) (*btcjson.OwnerOfERC721TokenResult, error) { + return c.WhcOwnerOfERC721TokenAsync(propertyId,tokenId,address,).Receive() +} + + +//whc_listERC721PropertyTokens +type FutureWhcListERC721PropertyTokensResult chan *response + +func (r FutureWhcListERC721PropertyTokensResult) Receive() ( * []btcjson.WhcListERC721PropertyTokensResult, error) { + res, err := receiveFuture(r) + if err != nil { + return nil, err + } + + var result []btcjson.WhcListERC721PropertyTokensResult + err = json.Unmarshal(res, &result) + if err != nil { + return nil, err + } + + return &result, nil +} + +func (c *Client) WhcListERC721PropertyTokensAnsyc(propertyID string) FutureWhcListERC721PropertyTokensResult{ + cmd := btcjson.NewWhcListERC721PropertyTokensCmd(propertyID) + return c.sendCmd(cmd) +} + +func (c *Client) WhcListERC721PropertyTokens (propertyId string) (*[]btcjson.WhcListERC721PropertyTokensResult, error){ + return c.WhcListERC721PropertyTokensAnsyc(propertyId).Receive() +} + +//whc_getERC721PropertyNews + +type FutureWhcGetERC721PropertyNewsResult chan *response + +func (r FutureWhcGetERC721PropertyNewsResult) Receive() (*btcjson.WhcGetERC721PropertyNewsResult,error) { + res, err := receiveFuture(r) + if err != nil { + return nil, err + } + + var result btcjson.WhcGetERC721PropertyNewsResult + err = json.Unmarshal(res, &result) + if err != nil { + return nil, err + } + + return &result, nil + +} + +func (c *Client) WhcGetERC721PropertyNewsAnsyc(propertyId string) FutureWhcGetERC721PropertyNewsResult{ + cmd :=btcjson.NewWhcGetERC721PropertyNewsCmd(propertyId) + return c.sendCmd(cmd) +} + +func (c *Client) WhcGetERC721PropertyNews(propertyId string) (*btcjson.WhcGetERC721PropertyNewsResult, error){ + return c.WhcGetERC721PropertyNewsAnsyc(propertyId).Receive() +} + +//whc_getERC721TokenNews +type FetureWhcGetERC721TokenNewsResult chan *response + +func (r FetureWhcGetERC721TokenNewsResult) Receive() (* btcjson.WhcGetERC721TokenNewsResult, error){ + res, err := receiveFuture(r) + if err != nil { + return nil, err + } + + var result btcjson.WhcGetERC721TokenNewsResult + err = json.Unmarshal(res, &result) + + if err != nil{ + return nil, err + } + + return &result, nil +} + +func (c *Client) WhcGetERC721TokenNewsAsync(propertyId, tokenId string) FetureWhcGetERC721TokenNewsResult{ + cmd := btcjson.NewWhcGetERC721TokenNewsCmd(propertyId,tokenId) + return c.sendCmd(cmd) +} + +func (c * Client) WhcGetERC721TokenNews(propertyId, tokenId string) (* btcjson.WhcGetERC721TokenNewsResult, error){ + return c.WhcGetERC721TokenNewsAsync(propertyId, tokenId).Receive() +} +//whc_issuanceERC721property +type FetureWhcIssuanceERC721PropertyResult chan* response + +func (r FetureWhcIssuanceERC721PropertyResult) Receive() (string, error) { + res, err := receiveFuture(r) + if err != nil { + return "", err + } + var result string + err = json.Unmarshal(res,&result) + if err != nil { + return "",err + } + + return result, nil +} + +func (c *Client) WhcIssuanceERC721PropertyAsync(issueAddress, name, symbol, data, url, totalNumber string) FetureWhcIssuanceERC721PropertyResult{ + cmd := btcjson.NewWhcIssuanceERC721PropertyCmd(issueAddress, name, symbol, data,url,totalNumber) + return c.sendCmd(cmd) +} + +func (c *Client) WhcIssuanceERC721Property (issueAddress, name, symbol, data, url,totalNumber string) (string, error){ + return c.WhcIssuanceERC721PropertyAsync(issueAddress, name, symbol, data, url,totalNumber).Receive() +} + +//whc_transferERC721Token +type FetureWhcTransferERC721TokenResult chan *response + +func (r FetureWhcTransferERC721TokenResult)Receive() (string, error){ + res, err := receiveFuture(r) + if err != nil { + return "", err + } + + var result string + err = json.Unmarshal(res, &result) + if err != nil { + return "", err + } + + return result, nil +} + + +func (c *Client) WhcTransferERC721TokenAsync (ownerAddress, receiveAddress string, propertyId, tokenId string) FetureWhcTransferERC721TokenResult{ + cmd := btcjson.NewWhcTransferERC721TokenCmd(ownerAddress, receiveAddress, propertyId, tokenId) + return c.sendCmd(cmd) +} + +func (c *Client) WhcTransferERC721Token (ownerAddress, receiveAddress string, propertyId, tokenId string) (string, error) { + return c.WhcTransferERC721TokenAsync(ownerAddress, receiveAddress, propertyId, tokenId).Receive() +} + + +//whc_destroyERC721Token +type FetureWhcDestoryERC721TokenResult chan *response + +func (r FetureWhcDestoryERC721TokenResult) Receive() (string, error){ + res, err := receiveFuture(r) + if err != nil { + return "", err + } + + var result string + err = json.Unmarshal(res, &result) + if err != nil{ + return "", err + } + + return result, nil +} + +func (c *Client) WhcDestoryERC721TokenAsync(ownerAddress string, propertyId,tokenId string) FetureWhcDestoryERC721TokenResult{ + cmd := btcjson.NewWhcDestoryERC721TokenCmd(ownerAddress, propertyId, tokenId) + return c.sendCmd(cmd) +} + +func (c *Client) WhcDestoryERC721Token(ownerAddress string, propertyId,tokenId string) (string, error) { + return c.WhcDestoryERC721TokenAsync(ownerAddress, propertyId, tokenId).Receive() +} + +//whc_createpayload_issueERC721property +type FetureWhcCreatePayloadIssueERC721PropertyResult chan *response + +func (r FetureWhcCreatePayloadIssueERC721PropertyResult)Receive() (string, error) { + res, err := receiveFuture(r) + if err != nil { + return "", err + } + + var result string + err = json.Unmarshal(res,&result) + if err != nil { + return "", err + } + + return result, nil +} + +func (c *Client) WhcCreatePayloadIssueERC721PropertyAsync(name, symbol, data, url ,total string) FetureWhcCreatePayloadIssueERC721PropertyResult{ + cmd := btcjson.NewWhcCreatePayloadIssueERC721PropertyCmd(name, symbol, data, url,total) + return c.sendCmd(cmd) +} + +func (c *Client) WhcCreatePayloadIssueERC721Property(name, symbol, data, url ,total string) (string, error){ + return c.WhcCreatePayloadIssueERC721PropertyAsync(name, symbol, data, url, total).Receive() +} + +//whc_createpayload_issueERC721token +type FetureWhcCreatePayloadIssueERC721TokenResult chan *response + +func (r FetureWhcCreatePayloadIssueERC721TokenResult) Receive() (string, error) { + res, err := receiveFuture(r) + if err != nil { + return "", err + } + + var result string + err = json.Unmarshal(res,&result) + if err != nil { + return "", err + } + + return result, nil +} + +func (c *Client) WhcCreatePayloadIssueERC721TokenAsync (propertyId, tokenId string, tokenAttributes, tokenUrl string) FetureWhcCreatePayloadIssueERC721TokenResult{ + cmd := btcjson.NewWhcCreatePayloadIssueERC721TokenCmd(propertyId,tokenId,tokenAttributes,tokenUrl) + return c.sendCmd(cmd) +} + +func (c *Client) WhcCreatePayloadIssueERC721Token(propertyId, tokenId string, tokenAttributes, tokenUrl string) (string, error){ + return c.WhcCreatePayloadIssueERC721TokenAsync(propertyId,tokenId,tokenAttributes,tokenUrl).Receive() +} + +//whc_createpayload_transferERC721token +type FetureWhcCreatePayloadTransferERC721TokenResult chan *response + +func (r FetureWhcCreatePayloadTransferERC721TokenResult) Receive() (string, error) { + res, err := receiveFuture(r) + if err != nil { + return "" , err + } + + var result string + err = json.Unmarshal(res, &result) + if err != nil { + return "", err + } + + return result, nil +} + +func (c *Client) WhcCreatePayloadTransferERC721TokenAsync (propertyId, tokenId string)FetureWhcCreatePayloadTransferERC721TokenResult{ + cmd := btcjson.NewWhcCreatePayloadTransferERC721TokenCmd(propertyId, tokenId) + return c.sendCmd(cmd) +} + +func (c *Client) WhcCreatePayloadTransferERC721Token(propertyId, tokenId string) (string, error){ + return c.WhcCreatePayloadTransferERC721TokenAsync(propertyId, tokenId).Receive() +} + +//whc_createpayload_destroyERC721token +type FetureWhcCreatePayloadDestoryERC721TokenResult chan *response + +func (r FetureWhcCreatePayloadDestoryERC721TokenResult) Receive() (string,error) { + res, err := receiveFuture(r) + if err != nil { + return "" , err + } + + var result string + err = json.Unmarshal(res, &result) + if err != nil { + return "", err + } + + return result, nil +} + + +func (c * Client) WhcCreatePayloadDestoryERC721TokenAsync(propertyId, tokenId string)FetureWhcCreatePayloadDestoryERC721TokenResult { + cmd := btcjson.NewWhcCreatePayloadDestoryERC721TokenCmd(propertyId, tokenId) + return c.sendCmd(cmd) +} + +func (c * Client)WhcCreatePayloadDestoryERC721Token(propertyId, tokenId string) (string, error) { + return c.WhcCreatePayloadDestoryERC721TokenAsync(propertyId, tokenId).Receive() +} + +////whc_getERC721PropertyDestroyTokens +type FetureWhcGetERC721PropertyDestoryTokensResult chan *response + +func (r FetureWhcGetERC721PropertyDestoryTokensResult) Receive() (*[]btcjson.WhcGetERC721PropertyDestoryTokensCmd, error){ + res, err := receiveFuture(r) + if err != nil { + return nil , err + } + + var result []btcjson.WhcGetERC721PropertyDestoryTokensCmd + err = json.Unmarshal(res, &result) + if err != nil { + return nil, err + } + + return &result, nil +} + +func (c * Client) WhcGetERC721PropertyDestoryTokensAsync(propertyId string) FetureWhcGetERC721PropertyDestoryTokensResult { + cmd := btcjson.NewWhcGetERC721PropertyDestoryTokensCmd(propertyId) + return c.sendCmd(cmd) +} + +func (c *Client) WhcGetERC721PropertyDestoryTokens(propertyId string) (*[]btcjson.WhcGetERC721PropertyDestoryTokensCmd, error){ + return c.WhcGetERC721PropertyDestoryTokensAsync(propertyId).Receive() +} + +//whc_issuanceERC721Token +type FetureWhcIssuanceERC721TokenResult chan *response + +func (r FetureWhcIssuanceERC721TokenResult) Receive() (string, error){ + res, err := receiveFuture(r) + if err != nil { + return "" , err + } + + var result string + err = json.Unmarshal(res, &result) + if err != nil { + return "", err + } + + return result, nil +} + +func (c *Client) WhcIssuanceERC721TokenAsync (issueAddress, receiveAddress, propertyId, tokenId, tokenAttributes, tokenUrl string) FetureWhcIssuanceERC721TokenResult{ + cmd := btcjson.NewWhcIssuanceERC721TokenCmd(issueAddress,receiveAddress, propertyId,tokenId, tokenAttributes, tokenUrl) + return c.sendCmd(cmd) +} + +func (c *Client) WhcIssuanceERC721Token (issueAddress, receiveAddress, propertyId, tokenId, tokenAttributes, tokenUrl string) (string, error) { + return c.WhcIssuanceERC721TokenAsync(issueAddress,receiveAddress, propertyId,tokenId, tokenAttributes, tokenUrl).Receive() +} + +