-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20f40e3
commit 1fd73ce
Showing
30 changed files
with
2,565 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package client | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/rubixchain/rubixgoplatform/core/model" | ||
"github.com/rubixchain/rubixgoplatform/setup" | ||
) | ||
|
||
func (c *Client) CreateFT(did string, ftName string, ftCount int, wholeToken float64) (*model.BasicResponse, error) { | ||
createFTReq := model.CreateFTReq{ | ||
DID: did, | ||
FTName: ftName, | ||
FTCount: ftCount, | ||
TokenCount: wholeToken, | ||
} | ||
var basicresponse model.BasicResponse | ||
err := c.sendJSONRequest("POST", setup.APICreateFT, nil, &createFTReq, &basicresponse) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &basicresponse, nil | ||
} | ||
|
||
func (c *Client) TransferFT(rt *model.TransferFTReq) (*model.BasicResponse, error) { | ||
var br model.BasicResponse | ||
err := c.sendJSONRequest("POST", setup.APIInitiateFTTransfer, nil, rt, &br, time.Minute*2) | ||
if err != nil { | ||
c.log.Error("Failed FT Transfer", "err", err) | ||
return nil, err | ||
} | ||
return &br, nil | ||
} | ||
|
||
func (c *Client) GetFTInfo(didStr string) (*model.GetFTInfo, error) { | ||
m := make(map[string]string) | ||
m["did"] = didStr | ||
var info model.GetFTInfo | ||
err := c.sendJSONRequest("GET", setup.APIGetFTInfo, m, nil, &info) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &info, nil | ||
} |
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
Oops, something went wrong.