{"id":13823260,"url":"https://github.com/hunterlong/shapeshift","last_synced_at":"2025-07-08T17:33:06.766Z","repository":{"id":57517937,"uuid":"85891555","full_name":"hunterlong/shapeshift","owner":"hunterlong","description":"ShapeShift API for Go Language - convert cryptocurrencies with ease using ShapeShift and golang","archived":false,"fork":false,"pushed_at":"2018-08-21T06:51:53.000Z","size":36,"stargazers_count":35,"open_issues_count":0,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-11T20:11:27.578Z","etag":null,"topics":["bitcoin","cryptocurrency","dash","ethereum","golang","shapeshift"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hunterlong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-23T01:02:10.000Z","updated_at":"2022-11-14T16:59:48.000Z","dependencies_parsed_at":"2022-09-26T18:01:34.222Z","dependency_job_id":null,"html_url":"https://github.com/hunterlong/shapeshift","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterlong%2Fshapeshift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterlong%2Fshapeshift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterlong%2Fshapeshift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterlong%2Fshapeshift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunterlong","download_url":"https://codeload.github.com/hunterlong/shapeshift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225453288,"owners_count":17476698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","cryptocurrency","dash","ethereum","golang","shapeshift"],"created_at":"2024-08-04T09:00:26.944Z","updated_at":"2024-11-20T01:30:22.541Z","avatar_url":"https://github.com/hunterlong.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cdn.pbrd.co/images/MK2f4akQc.jpg\" alt=\"shapeshift api golang\"/\u003e\n\u003c/p\u003e\n\n# ShapeShift in Go Language\n[![Build Status](https://travis-ci.org/hunterlong/shapeshift.svg?branch=master)](https://travis-ci.org/hunterlong/shapeshift)  [![Coverage Status](https://coveralls.io/repos/github/hunterlong/shapeshift/badge.svg?branch=master)](https://coveralls.io/github/hunterlong/shapeshift?branch=master) [![GoDoc](https://godoc.org/github.com/hunterlong/shapeshift?status.svg)](https://godoc.org/github.com/hunterlong/shapeshift) [![Go Report Card](https://goreportcard.com/badge/github.com/hunterlong/shapeshift)](https://goreportcard.com/report/github.com/hunterlong/shapeshift)\n\nThis Go Language Package will allow you to use the [ShapeShift API](https://info.shapeshift.io/) and convert your cryptocurrencies in your very own application. It includes most of the ShapeShift API requests listed on their references website. Below you'll find a perfect example of a new ShapeShift transaction.\n\n```go\ngo get -u github.com/hunterlong/shapeshift\n```\n###### get the most up to date version\n```go\nimport \"github.com/hunterlong/shapeshift\"\n```\nOnce you've imported shapeshift into your golang project, you can use any of the requests below. Checkout the Travis CI test logs for responses of each function. See an issue? PR it!\n\n***\n\n# :new: New ShapeShift Transaction\nI want to convert Ethereum to Bitcoin. The 'ToAddress' is my Bitcoin address. Once I run this, I'll get a Ethereum address from ShapeShift.\n```go\nnew := shapeshift.New{\n\tPair: \"eth_btc\",\n\tToAddress: \"16FdfRFVPUwiKAceRSqgEfn1tmB4sVUmLh\",\n\t// FromAddress: \"0xcf2f204aC8D7714990912fA422874371c001217D\",  (Optional Return To Ethereum Address)\n       }\n\nresponse, err := new.Shift()\n\nif err != nil {\n    panic(error)\n}\n\nif response.isOk() {\n\n    sendToAddress := response.SendTo\n    // i will send Ether to this address\n\n    fmt.Println(\"Send To Address: \", sendToAddress)\n    fmt.Println(\"Send Type: \", response.SendType)\n    fmt.Println(\"Receiving at Address: \", response.ReturnTo)\n    fmt.Println(\"Receiving Type: \", response.ReturnType)\n    fmt.Println(\"Send Type: \", response.SendType)\n    fmt.Println(\"API Key: \", response.ApiKey)\n    fmt.Println(\"Public Data: \", response.Public)\n    fmt.Println(\"XrpDestTag: \", response.XrpDestTag)\n\n} else {\n    fmt.Println(response.ErrorMsg())\n}\n```\n***\n\n# :repeat: Get Status of Transaction\nOnce I sent some Ethereum to the given Ethereum address, I want to check the status of my ShapeShift transaction by inserting the Etheruem address 'sendToAddress' that ShapeShift gave me in previous function.\n```go\nvar newTransactionId string\n\nstatus, err := shapeshift.DepositStatus(sendToAddress)\n\nif err != nil {\n    panic(err)\n}\n\nif !response.isOk() {\n    fmt.Println(status.ErrorMsg())\n}\n\nfmt.Println(status.Status)\n// no_deposits\n// received\n// complete\n// failed\n\nif status.Status == \"complete\" {\n\tfmt.Println(\"Incoming Coin: \", status.IncomingCoin)\n\tfmt.Println(\"Incoming Type: \", status.IncomingType)\n\tfmt.Println(\"Outgoing Coin: \", status.OutgoingCoin)\n\tfmt.Println(\"Outgoing Type: \", status.OutgoingType)\n\tfmt.Println(\"Address: \", status.Address)\n\tfmt.Println(\"Transaction ID: \", status.Transaction)\n\tfmt.Println(\"Withdraw: \", status.Withdraw)\n\t\n\tnewTransactionId = status.Transaction\n\t// saving transaction ID so i can send a receipt\n}\n```\n***\n\n# :arrow_double_up: Send an Email Receipt\nWant to send a receipt of this transaction? Just include an email address and the transaction ID affiliated with the ShapeShift transaction. \n```go\nreceipt := shapeshift.Receipt{\n\tEmail:         \"user@myemailer.com\",\n\tTransactionID: newTransactionId,\n     }\n\nresponse, err := receipt.Send()\n\nif err != nil {\n    panic(err)\n}\n\nif response.isOk() {\n    fmt.Println(\"Receipt was sent to user\")\n} else {\n    fmt.Println(status.ErrorMsg())\n}\n\n```\n***\n\n# Additional Functions\nThe other ShapeShift API requests are available for you to use. \n\n### :white_check_mark: Get Rate\nGets the current rate offered by Shapeshift. This is an estimate because the rate can occasionally change rapidly depending on the markets. The rate is also a 'use-able' rate not a direct market rate. Meaning multiplying your input coin amount times the rate should give you a close approximation of what will be sent out. This rate does not include the transaction (miner) fee taken off every transaction.\n```go\npair := shapeshift.Pair{\"eth_btc\"}\n\nrate, err := pair.GetRates()\n\nif err != nil {\n    panic(err)\n}\n\n\nfmt.Println(\"Rate: \", rate)\n```\n***\n\n### :white_check_mark: Deposit Limits\nGets the current deposit limit set by Shapeshift. Amounts deposited over this limit will be sent to the return address if one was entered, otherwise the user will need to contact ShapeShift support to retrieve their coins. This is an estimate because a sudden market swing could move the limit.\n```go\npair := shapeshift.Pair{\"eth_btc\"}\nlimits, err := pair.GetLimits()\n\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(\"Limit: \", limits)\n```\n***\n\n### :white_check_mark: Market Info\nThis gets the market info (pair, rate, limit, minimum limit, miner fee)\n```go\npair := shapeshift.Pair{\"btc_eth\"}\ninfo, err := pair.GetInfo()\n\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(\"Pair: \", info.Pair)\nfmt.Println(\"Min: \", info.Min)\nfmt.Println(\"Miner Fee: \", info.MinerFee)\nfmt.Println(\"Limit: \", info.Limit)\nfmt.Println(\"Rate: \", info.Rate)\n```\n***\n\n### :white_check_mark: Recent Transactions\n```go\nrecent, err := shapeshift.RecentTransactions(\"5\")\n\nif err != nil {\n    panic(err)\n}\n\nfor _, v := range recent {\n    fmt.Println(\"In: \", v.CurIn)\n    fmt.Println(\"Out: \", v.CurOut)\n    fmt.Println(\"Amount: \", v.Amount)\n    fmt.Println(\"Timestamp: \", v.Timestamp)\n    fmt.Println(\"-------------------------------\")\n}\n```\n***\n\n### :white_check_mark: Deposit Address Status\nThis returns the status of the most recent deposit transaction to the address.\n```go\nstatus, err := shapeshift.DepositStatus(\"1JP7QWC9GbpKEHSvefygWk5woFy9xeQHKc\")\n\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(\"Deposit Status: \", status.Status)\nfmt.Println(\"Incoming Coin: \", status.IncomingCoin)\nfmt.Println(\"Incoming Type: \", status.IncomingType)\nfmt.Println(\"Outgoing Coin: \", status.OutgoingCoin)\nfmt.Println(\"Outgoing Type: \", status.OutgoingType)\nfmt.Println(\"Address: \", status.Address)\nfmt.Println(\"Transaction ID: \", status.Transaction)\nfmt.Println(\"Withdraw: \", status.Withdraw)\n```\n***\n\n### :white_check_mark: Time Remaining on Fixed Transaction Amount\nGet a list of the most recent transactions.\n```go\nstatus, err := shapeshift.TimeRemaining(\"16FdfRFVPUwiKAceRSqgEfn1tmB4sVUmLh\")\n\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(status.Status)\n```\n***\n\n### :white_check_mark: Get Available Coins\nAllows anyone to get a list of all the currencies that Shapeshift currently supports at any given time. The list will include the name, symbol, availability status, and an icon link for each.\n```go\ncoins, err := shapeshift.Coins()\n\nif err != nil {\n    panic(err)\n}\n\neth := coins.ETH\nfmt.Println(\"Coin: \", eth.Name)\nfmt.Println(\"Status: \", eth.Status)\n```\n***\n\n### :white_check_mark: Validate Address with Coin Symbol\nAllows user to verify that their receiving address is a valid address according to a given wallet daemon. If isvalid returns true, this address is valid according to the coin daemon indicated by the currency symbol.\n```go\naddress, err := shapeshift.Validate(\"16FdfRFVPUwiKAceRSqgEfn1tmB4sVUmLh\", \"btc\")\n\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(\"Address is: \", address.Valid)\nfmt.Println(\"Error: \",address.Error)\n```\n***\n\n# Primary Requests\n\n### :white_check_mark: Create New Transaction\nThis is the primary data input into ShapeShift.\n```go\nnew := shapeshift.New{\n\t\tPair:        \"eth_btc\",\n\t\tToAddress:   \"16FdfRFVPUwiKAceRSqgEfn1tmB4sVUmLh\",\n\t\tFromAddress: \"0xcf2f204aC8D7714990912fA422874371c001217D\",\n\t}\n\nresponse, err := new.Shift()\n\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(\"Send To Address: \", response.SendTo)\nfmt.Println(\"Send Type: \", response.SendType)\nfmt.Println(\"Receiving at Address: \", response.ReturnTo)\nfmt.Println(\"Receiving Type: \", response.ReturnType)\nfmt.Println(\"Send Type: \", response.SendType)\nfmt.Println(\"API Key: \", response.ApiKey)\nfmt.Println(\"Public Data: \", response.Public)\nfmt.Println(\"XrpDestTag: \", response.XrpDestTag)\n```\n***\n\n### :white_check_mark: Request Email Receipt\nThis call requests a receipt for a transaction. The email address will be added to the conduit associated with that transaction as well. (Soon it will also send receipts to subsequent transactions on that conduit)\n```go\ninfo := shapeshift.Receipt{\n\t\tEmail: \"user@awesome.com\",\n\t\tTransactionID: \"owkdwodkkwokdwdw\",\n\t}\n\nresponse, err := info.Send();\n\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(response)\n```\n***\n\n### :white_check_mark: Fixed Amount Transaction\nWhen a transaction is created with a fixed amount requested there is a 10 minute window for the deposit. After the 10 minute window if the deposit has not been received the transaction expires and a new one must be created. This api call returns how many seconds are left before the transaction expires. Please note that if the address is a ripple address, it will include the \"?dt=destTagNUM\" appended on the end, and you will need to use the URIEncodeComponent() function on the address before sending it in as a param, to get a successful response.\n```go\nnew := shapeshift.New{\n\t\tPair: \"eth_btc\",\n\t\tAmount: 0.25,\n\t\tToAddress: \"16FdfRFVPUwiKAceRSqgEfn1tmB4sVUmLh\",\n\t\tFromAddress: \"0xcf2f204aC8D7714990912fA422874371c001217D\",\n\t}\n\nresponse, err := new.FixedShift()\n\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(\"Pair: \", response.Pair)\nfmt.Println(\"Quoted Rate: \", response.QuotedRate)\nfmt.Println(\"Deposit Address: \", response.Deposit)\nfmt.Println(\"Deposit Amount: \", response.DepositAmount)\nfmt.Println(\"Withdraw Amount: \", response.WithdrawalAmount)\nfmt.Println(\"Withdraw Address: \", response.Withdrawal)\nfmt.Println(\"Expiration: \", response.Expiration)\n```\n***\n\n### :white_check_mark: Cancel Pending Transaction\nThis call allows you to request for canceling a pending transaction by the deposit address. If there is fund sent to the deposit address, this pending transaction cannot be canceled.\n```go\nold := shapeshift.Address{\n\t\tId: newSendToAddress,\n\t}\n\n\tresponse, err := old.Cancel()\n\n\tif err != nil {\n        panic(err)\n    }\n\n```\n***\n\n\n# API Key Required Requests\n\n### :white_check_mark: Get Transactions from Private API Key\nAllows vendors to get a list of all transactions that have ever been done using a specific API key. Transactions are created with an affilliate PUBLIC KEY, but they are looked up using the linked PRIVATE KEY, to protect the privacy of our affiliates' account details.\n```go\napi := shapeshift.API{\n\t\tKey: \"oskdfoijsfuhsdhufhewhuf\",\n\t   }\n\nlist, err := api.ListTransactions()\n\nif err != nil {\n    panic(err)\n}\n\nfor _,v := range list.Transactions {\n    fmt.Println(\"Input: \",v.InputAddress)\n    fmt.Println(\"Amount: \",v.InputAmount)\n}\n```\n###### there was no way for me to test this transaction since i'm not a vendor\n***\n\n### :white_check_mark: Get Transactions from Output Address\nAllows vendors to get a list of all transactions that have ever been sent to one of their addresses. The affilliate's PRIVATE KEY must be provided, and will only return transactions that were sent to output address AND were created using / linked to the affiliate's PUBLIC KEY. Please note that if the address is a ripple address and it includes the \"?dt=destTagNUM\" appended on the end, you will need to use the URIEncodeComponent() function on the address before sending it in as a param, to get a successful response.\n```go\napi := shapeshift.API{\n\t\tKey: \"oskdfoijsfuhsdhufhewhuf\",\n\t\tAddress: \"1JP7QWC9GbpKEHSvefygWk5woFy9xeQHKc\",\n\t}\n\nlist, err := api.ListTransactions()\n\nif err != nil {\n    panic(err)\n}\n\nfor _,v := range list.Transactions {\n    fmt.Println(\"Input: \",v.InputAddress)\n    fmt.Println(\"Amount: \",v.InputAmount)\n}\n```\n###### there was no way for me to test this transaction since i'm not a vendor\n***\n\n# Coin Pairs\nMany of the requests require a 'coin pair'. A coin pair is of the format deposit_withdrawal. Example: 'btc_ltc'. Valid pairs are any combination of the below listed valid coins.* The list will grow as we add more:\n```\nbtc, ltc, ppc, drk, doge, nmc, ftc, blk, nxt, btcd, qrk, rdd, nbt, bts, bitusd, xcp, xmr\n```\n[ShapeShift Coins](https://shapeshift.io/#/coins)\n* If a particular coin goes offline any pairs using it will return a message stating that pair is temporarily unavailable.\n\nAll requests are only available via HTTPS, in the interest of security best practices we do not support API calls over HTTP.\n***\n\n### Package Useful? :beer: :bug:\nIf this package saved you some time, or if you're excited to make that next crypto-bot, feel free to throw some coins my way. If you see an issue with this golang package, please submit a pull request. \n```\nETH: 0x9741C5522B85E195B92C71CE29B54A4C99D76c13\nBTC: 16FdfRFVPUwiKAceRSqgEfn1tmB4sVUmLh\n```\n***\n\n# License\nThis golang package is built for the cryptocurrency community and is released with MIT license. \n\n:thumbsup: :thumbsup: [ShapeShift.io](https://shapeshift.io) :thumbsup: :thumbsup:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunterlong%2Fshapeshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunterlong%2Fshapeshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunterlong%2Fshapeshift/lists"}