Git Product home page Git Product logo

uphold-sdk-node's People

Contributors

danwebb avatar ruipenso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

uphold-sdk-node's Issues

Issue with getting PAT

I am getting this error: TypeError: Uphold.createPAT is not a function while executing below code when I switched on using PAT creation for authentication :

var Uphold = require('uphold-sdk-node');

Uphold.createPAT('[email protected]', 'XXXX', 'ERNIT PAT desc', false, function(err, res) {

if(err) {
console.log('Error authenticating with Uphold');
}
// add the PAT to the current configs pat property and make authenticated calls
Uphold.addPAT(res.accessToken).user(function(err, user) {
if(err) return customErrorHandler(err);
console.log(user);
});
});

What could be problem here ?

Exception unhandled when parsing response to JSON

I was trying this sdk out and multiple times came across an unhandled exception on the responseHandler funciton.
For some reason uphold sometimes returns and HTML response instead of a JSON response then the code fails to parse it. I tried to read the HTML but it doesn't say anything really important (I was excepting something from uphold like: hey we are busy now try later).
I'd suggest to wrap line 23 in a try/catch statement and handle the exception as an error.

This is what the returned HTML looks like, if it is of any help.
`

<title>Uphold</title> <style>.container::after,.container::before{content:" ";display:table}.container::after{clear:both}a{background-color:transparent;color:#6bc176;text-decoration:none;transition:all .15s linear}a:active,a:hover{outline:0}b,strong{font-weight:700}h1{font-size:2.2em}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;font-size:16px;-webkit-tap-highlight-color:transparent;position:relative;min-height:100%}.sr-only,footer{position:absolute}@media(max-width:991px){html{font-size:14px}}@media(max-width:767px){html{font-size:13px}}body{min-width:20rem;font-family:proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:.9375rem;line-height:1.25;color:#454b5c;background-color:#f6f6f7;margin:0 0 2.5rem}footer{left:0;right:0;bottom:15px}a:focus,a:hover{color:#429d4e;text-decoration:underline;outline:0}small{font-size:.75rem}p{margin:0 0 .625rem}h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:600;line-height:1.5;color:#454b5c;margin:2.5rem 0 1.25rem}.container{margin-right:auto;margin-left:auto;padding-left:.9375rem;padding-right:.9375rem}@media(min-width:768px){.container{width:46.875rem}}@media(min-width:992px){.container{width:60.625rem}}@media(min-width:1200px){.container{width:73.125rem}}.sr-only{width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 ,0 ,0 ,0);border:0}.text-center{text-align:center}.text-muted{color:#8A9297}</style> <script>//i;i++)if(e[i]==n)return!0;return!1}function c(t){if("string"==typeof t.Ha)return t.Ha;var n=t.X.location.protocol;return"about:"==n&&(n=t.qa.location.protocol),"https:"==n?"https:":"http:"}function l(t){return t.X.location.hostname||t.qa.location.hostname}function p(t,n,e,i){function o(t){for(var e=0;eparseInt(n[1],10)||536===parseInt(n[1],10)&&11>=parseInt(n[2],10))}return Bt}function T(t,n,e){for(var i in Ct)if(Ct.hasOwnProperty(i)&&n===t.I[Ct[i]]&&e===t.I[Ct[i]])return!0;return!1}function P(t){var n,e=t.O.r.offsetWidth,i=t.P.r.offsetWidth;(n=e===t.I.serif&&i===t.I["sans-serif"])||(n=N()&&T(t,e,i)),n?At()-t.Ka>=t.fa?N()&&T(t,e,i)&&(null===t.ra||t.ra.hasOwnProperty(t.A.getName()))?C(t,t.ha):C(t,t.Ea):A(t):C(t,t.ha)}function A(t){setTimeout(r(function(){P(this)},t),50)}function C(t,n){setTimeout(r(function(){this.O.remove(),this.P.remove(),this.Q.remove(),this.R.remove(),n(this.A)},t),0)}function B(t,n,e){this.e=t,this.F=n,this.ba=0,this.va=this.pa=!1,this.fa=e}function I(t){0==--t.ba&&t.pa&&(t.va?(t=t.F,t.J&&u(t.u,[t.o.h(t.p,"active")],[t.o.h(t.p,"loading"),t.o.h(t.p,"inactive")]),v(t,"active")):m(t.F))}function E(){this.K=this.T=-1}function M(){var t=[{name:"font-family",value:Jt.c[$t+1]}];this.Ia=[Jt.c[$t]],this.ka=t}function W(t){for(var n=t.Ia.join(","),e=[],i=0;i`

renaming createTransaction and createOrCommitTransaction

When POSTing to form a new transaction, the result is not yet a finalized transaction, it's more like a preview, normally used to obtain confirmation from the end-user, and valid for the duration of params.ttl.

This same endpoint accepts a query string parameter &commit=1, in which case, the transaction is created and committed in a single step server-side, no two calls necessary. I'd suggest changing createOrCommitTransaction to merely add &commit=1 to the URL.

I would suggest renaming:

  • createTransaction --> prepareTransaction
  • createOrCommitTransaction --> createTransaction

So, you'd get the following options:

  • to create a transaction in a single step, one would call createTransaction()
  • to create a transaction in two steps, call prepareTransaction() and then commitTransaction()

Thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.