Get your app-key and secret
Get the code for signature
Implement the backend
public function index()
{
return view('legend');
}Implement the frontend
- Load legend-base script
<script defer src="https://www.legendtrading.com/jssdk-base/legend-base.umd.js"></script>- Create an instance
// Global variable
const legend = new LegendBase({ mode: "sandbox" });- Call authorize function
// authorize
const resp = await legend.authorize({
timestamp: data.timestamp,
signature: data.signature,
appId: data["APP-ID"],
appKey: data["APP-KEY"],
appUid: data["APP-UID"],
appUrl: data["APP-URL"],
appEmail: data["APP-EMAIL"],
appPhone: data["APP-PHONE"]
});- Quote by fiat
async () => {
// quote by fiat
const quote = await legend.quoteByFiat({
pair: "USDTUSD",
payment_method_id: "9b722154-6ff1-4175-8ab1-5aa50caf435a",
side: "buy",
size: 50
});
console.log("quote by fiat: \n%o", quote);
}
- Build your own UI with functions from the legend instance.
Basicly you will implement the following workflow.
create an instance
call authorize
gather informations from UI
get required data with instance methods
quote (quoteByFiat)
trade (orderByFiat)
Check out our online demo
https://www.legendtrading.com/jssdk-base/
https://demo.legendtrading.com/
