Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

MetacoSA/Metaco.Gateway.JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metaco Gateway Javascript Client

This project show a javascript client for the Metaco Gateway API for Bitcoin. The REST API is documented on apiary.

How to use

Include gwmtc.js in your page, you can then access gwmtc.

var api = new gwmtc.ApiClient("https://api.gateway.metaco.com/v1/tbtc", "abcdefg");
var signer = new gwmtc.U2FKey('26767c0e98fbdc8e1647ab5f83a473abc88096279758aebeb6d3d464963286c8');
var order = new gwmtc.PostOrderRequest();
order.baseCurrency = "CHF";
order.customReference = "order_chf_btc_1492782718";
order.nonce = 0x163DBE788E9;
order.destination = 'mh653rQbnj5LF6Hb4eLK1q3SeELCgfabAg';
order.amount = 0x186A0;
order.Sign(signer);
var response = await api.PostOrder(order);

while (true) {
    info = await api.GetOrder(response.orderId);
    if (info.state != "Requested")
        break;
}

ApiClient functions returns promise. If you do not have access to async/await, use done(callback) as specified by promisejs.

How to Build?

git clone https://github.com/MetacoSA/Metaco.Gateway.JS
cd Metaco.Gateway.JS
npm install

You can then build with

npm run build_browser

It will produce dist/gwmtc.js.

You can build for NodeJS with

npm run build

You can debug the jasmine tests with Visual Studio Code by pressing F5.

About

Javascirpt API to the Metaco Gateway Service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published