Skip to content

Instantly share code, notes, and snippets.

@genslein
Created April 7, 2022 20:51
Show Gist options
  • Save genslein/faa381928c7bbdbab3e98230b0d741f9 to your computer and use it in GitHub Desktop.
Save genslein/faa381928c7bbdbab3e98230b0d741f9 to your computer and use it in GitHub Desktop.
testing celsius
const { Celsius, AUTH_METHODS, ENVIRONMENT } = require('celsius-sdk');
const FormData = require('form-data')
const axios = require("axios");
// const partnerKey = process.env.PARTNER_TOKEN // Should be kept secret
const partnerToken = "27ad54f93337ddf5ac9b3c3df7623d05";
const bodyFormData = new FormData({
"first_name": "Jane",
"last_name": "Doe",
"middle_name": "Middle",
"email": "jane.doe+1@email.com",
"title": "Mrs",
"date_of_birth": "1990-04-14",
"citizenship": "United States",
"country": "United States",
"state": "California",
"city": "Los Angeles",
"zip": "90001",
"street": "3rd Street",
"building_number": "22a",
"flat_number": "1b",
"ssn": "571-59-3333",
"itin": "123-456-789",
"national_id": "123-456-789",
"gender": "female",
"phone_number": "+1-202-555-0103",
"user_token": "10a42df0-999d-49da-981d-27117e15310a",
});
Celsius({
authMethod: AUTH_METHODS.USER_TOKEN, // We are telling the SDK that we are authenticating different users using user tokens.
partnerKey: partnerToken,
environment: ENVIRONMENT.STAGING // If not present, default is production.
}).then((celsius) => {
// your code
return celsius.currencies;
// SDK code
// celsius.createUser(CreateUser.constructor(
//
// ))
})
let result = axios({
method: "post",
url: "https://wallet-api.staging.celsius.network/users",
data: bodyFormData,
headers: {
"Content-Type": "multipart/form-data",
"X-Cel-Partner-Token": partnerToken,
},
})
.then(function (response) {
//handle success
console.log(response);
})
.catch(function (response) {
//handle error
console.log(response);
});
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment