New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stellar-sdk

Package Overview
Dependencies
Maintainers
1
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stellar-sdk - npm Package Compare versions

Comparing version 0.6.2 to 0.7.0

9

CHANGELOG.md

@@ -5,2 +5,11 @@ # Changelog

## 0.6.2
* Updated `stellar.toml` location
## 0.6.1
* `forUpdate` methods of call builders now accept strings and numbers.
* Create a copy of attribute in a response if there is a link with the same name (ex. `transaction.ledger`, `transaction._links.ledger`).
## 0.6.0

@@ -7,0 +16,0 @@

6

lib/call_builder.js

@@ -22,3 +22,3 @@ "use strict";

var URI = require("urijs");
var URITemplate = require("urijs").URITemplate;
var URITemplate = require("urijs/src/URITemplate");

@@ -162,5 +162,5 @@ var axios = require("axios");

if (link.template) {
if (link.templated) {
var template = URITemplate(link.href);
uri = URI(template.expand(opts));
uri = URI(template.expand(opts || {}));
} else {

@@ -167,0 +167,0 @@ uri = URI(link.href);

@@ -30,3 +30,3 @@ "use strict";

var Account = _stellarBase.Account;
var Keypair = _stellarBase.Keypair;
var StrKey = _stellarBase.StrKey;

@@ -173,3 +173,3 @@ var StellarTomlResolver = require("./stellar_toml_resolver").StellarTomlResolver;

if (value.indexOf("*") < 0) {
if (!Keypair.isValidPublicKey(value)) {
if (!StrKey.isValidEd25519PublicKey(value)) {
return Promise.reject(new Error("Invalid Account ID"));

@@ -176,0 +176,0 @@ } else {

@@ -21,2 +21,6 @@ "use strict";

/**
* StellarTomlResolver allows resolving `stellar.toml` files.
*/
var StellarTomlResolver = exports.StellarTomlResolver = (function () {

@@ -23,0 +27,0 @@ function StellarTomlResolver() {

{
"name": "stellar-sdk",
"version": "0.6.2",
"version": "0.7.0",
"description": "stellar-sdk is a library for working with the Stellar Horizon server.",

@@ -78,3 +78,3 @@ "main": "lib/index.js",

"dependencies": {
"urijs": "^1.16.0",
"urijs": "1.18.4",
"axios": "^0.12.0",

@@ -87,5 +87,5 @@ "bluebird": "^3.1.5",

"lodash": "^4.0.1",
"stellar-base": "^0.6.0",
"stellar-base": "^0.7.1",
"toml": "^2.3.0"
}
}

@@ -5,3 +5,3 @@ import {NotFoundError, NetworkError, BadRequestError} from "./errors";

let URI = require("urijs");
let URITemplate = require("urijs").URITemplate;
let URITemplate = require("urijs/src/URITemplate");

@@ -122,5 +122,5 @@ let axios = require("axios");

if (link.template) {
if (link.templated) {
let template = URITemplate(link.href);
uri = URI(template.expand(opts));
uri = URI(template.expand(opts || {}));
} else {

@@ -127,0 +127,0 @@ uri = URI(link.href);

@@ -7,3 +7,3 @@ import axios from 'axios';

import {Config} from "./config";
import {Account, Keypair} from 'stellar-base';
import {Account, StrKey} from 'stellar-base';
import {StellarTomlResolver} from "./stellar_toml_resolver";

@@ -76,3 +76,3 @@

if (value.indexOf('*') < 0) {
if (!Keypair.isValidPublicKey(value)) {
if (!StrKey.isValidEd25519PublicKey(value)) {
return Promise.reject(new Error('Invalid Account ID'));

@@ -79,0 +79,0 @@ } else {

@@ -6,2 +6,5 @@ import axios from 'axios';

/**
* StellarTomlResolver allows resolving `stellar.toml` files.
*/
export class StellarTomlResolver {

@@ -8,0 +11,0 @@ /**

@@ -7,2 +7,4 @@ describe("integration tests", function () {

StellarSdk.Network.useTestNetwork();
// Docker

@@ -19,3 +21,3 @@ let server = new StellarSdk.Server('http://127.0.0.1:8000', {allowHttp: true});

function checkConnection(done) {
server.loadAccount(master.accountId())
server.loadAccount(master.publicKey())
.then(source => {

@@ -32,3 +34,3 @@ console.log('Horizon up and running!');

function createNewAccount(accountId) {
return server.loadAccount(master.accountId())
return server.loadAccount(master.publicKey())
.then(source => {

@@ -50,3 +52,3 @@ let tx = new StellarSdk.TransactionBuilder(source)

it("submits a new transaction", function (done) {
createNewAccount(StellarSdk.Keypair.random().accountId())
createNewAccount(StellarSdk.Keypair.random().publicKey())
.then(result => {

@@ -60,3 +62,3 @@ expect(result.ledger).to.be.not.null;

it("submits a new transaction with error", function (done) {
server.loadAccount(master.accountId())
server.loadAccount(master.publicKey())
.then(source => {

@@ -66,3 +68,3 @@ source.incrementSequenceNumber(); // This will cause an error

.addOperation(StellarSdk.Operation.createAccount({
destination: StellarSdk.Keypair.random().accountId(),
destination: StellarSdk.Keypair.random().publicKey(),
startingBalance: "20"

@@ -90,3 +92,3 @@ }))

// The first account should be a master account
expect(accounts.records[0].account_id).to.equal(master.accountId());
expect(accounts.records[0].account_id).to.equal(master.publicKey());
done();

@@ -104,3 +106,3 @@ });

onmessage: account => {
expect(account.account_id).to.equal(randomAccount.accountId());
expect(account.account_id).to.equal(randomAccount.publicKey());
done();

@@ -110,3 +112,3 @@ }

createNewAccount(randomAccount.accountId());
createNewAccount(randomAccount.publicKey());
setTimeout(() => eventStreamClose(), 10*1000);

@@ -113,0 +115,0 @@ });

@@ -6,2 +6,3 @@ describe("server.js tests", function () {

StellarSdk.Config.setDefault();
StellarSdk.Network.useTestNetwork();
});

@@ -338,60 +339,62 @@

let transactionsResponse = {
"_embedded": {
"records": [
{
"_links": {
"account": {
"href": "/accounts/GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H"
},
"effects": {
"href": "/transactions/991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3/effects{?cursor,limit,order}",
"templated": true
},
"ledger": {
"href": "/ledgers/34"
},
"operations": {
"href": "/transactions/991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3/operations{?cursor,limit,order}",
"templated": true
},
"precedes": {
"href": "/transactions?cursor=146028892160\u0026order=asc"
},
"self": {
"href": "/transactions/991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3"
},
"succeeds": {
"href": "/transactions?cursor=146028892160\u0026order=desc"
}
},
"id": "991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3",
"paging_token": "146028892160",
"hash": "991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3",
"ledger": 34,
"created_at": "2015-09-29T23:38:10Z",
"account": "GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H",
"account_sequence": 1,
"max_fee": 0,
"fee_paid": 0,
"operation_count": 1,
"result_code": 0,
"result_code_s": "tx_success",
"envelope_xdr": "AAAAAGL8HQvQkbK2HA3WVjRrKmjX00fG8sLI7m0ERwJW/AX3AAAAZAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAZc2EuuEa2W1PAKmaqVquHuzUMHaEiRs//+ODOfgWiz8AAFrzEHpAAAAAAAAAAAABVvwF9wAAAECdBs6M1RCYGMBFKqFb4hmJ3wafkfSE8oXELydY/U1VBmfHcr6QtHmRPgAhkf5dUBwHigKhNKcpvb6v66ClyGoN",
"result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=",
"result_meta_xdr": "AAAAAAAAAAEAAAACAAAAAAAAACIAAAAAAAAAAGXNhLrhGtltTwCpmqlarh7s1DB2hIkbP//jgzn4Fos/AABa8xB6QAAAAAAiAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAQAAACIAAAAAAAAAAGL8HQvQkbK2HA3WVjRrKmjX00fG8sLI7m0ERwJW/AX3DeBbwJbpv5wAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAA"
"_links": {
"self": {
"href": "https://horizon.stellar.org/transactions?order=desc\u0026limit=1\u0026cursor="
},
"next": {
"href": "https://horizon.stellar.org/transactions?order=desc\u0026limit=1\u0026cursor=34156680904183808"
},
"prev": {
"href": "https://horizon.stellar.org/transactions?order=asc\u0026limit=1\u0026cursor=34156680904183808"
}
]
},
"_links": {
"next": {
"href": "/transactions?order=asc\u0026limit=1\u0026cursor=146028892160"
},
"prev": {
"href": "/transactions?order=desc\u0026limit=1\u0026cursor=146028892160"
},
"self": {
"href": "/transactions?order=asc\u0026limit=1\u0026cursor="
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1"
},
"account": {
"href": "https://horizon.stellar.org/accounts/GBURK32BMC7XORYES62HDKY7VTA5MO7JYBDH7KTML4EPN4BV2MIRQOVR"
},
"ledger": {
"href": "https://horizon.stellar.org/ledgers/7952722"
},
"operations": {
"href": "https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1/operations{?cursor,limit,order}",
"templated": true
},
"effects": {
"href": "https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1/effects{?cursor,limit,order}",
"templated": true
},
"precedes": {
"href": "https://horizon.stellar.org/transactions?order=asc\u0026cursor=34156680904183808"
},
"succeeds": {
"href": "https://horizon.stellar.org/transactions?order=desc\u0026cursor=34156680904183808"
}
},
"id": "c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1",
"paging_token": "34156680904183808",
"hash": "c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1",
"ledger": 7952722,
"created_at": "2016-12-09T12:36:51Z",
"source_account": "GBURK32BMC7XORYES62HDKY7VTA5MO7JYBDH7KTML4EPN4BV2MIRQOVR",
"source_account_sequence": "25631492944168311",
"fee_paid": 400,
"operation_count": 4,
"envelope_xdr": "AAAAAGkVb0Fgv3dHBJe0casfrMHWO+nARn+qbF8I9vA10xEYAAABkABbD7UAAAV3AAAAAAAAAAAAAAAEAAAAAAAAAAMAAAABRlVOVAAAAABpigEf7e9h5IpePeEXCoPJPqY8IRt8hpneL5+OXfZ45QAAAAAAAAAABfXhAEeeSWkAKXANAAAAAAAAB74AAAABAAAAAGkVb0Fgv3dHBJe0casfrMHWO+nARn+qbF8I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AAA8e9BZqv1MAAAAAAAAAAAAAAAAAAAABAHlZUgAAAAIAAAAAaRVvQWC/d0cEl7Rxqx+swdY76cBGf6psXwj28DXTERgAAAAAAAAHwgAAAAAAAAABVVNEAAAAAABpigEf7e9h5IpePeEXCoPJPqY8IRt8hpneL5+OXfZ45QAAAAlQL5AAAAkU+A1/qukAAAAAAAAAAAAAAAAAAAACAAAAAwB5VlwAAAACAAAAAGkVb0Fgv3dHBJe0casfrMHWO+nARn+qbF8I9vA10xEYAAAAAAAAB8MAAAABVVNEAAAAAABpigEf7e9h5IpePeEXCoPJPqY8IRt8hpneL5+OXfZ45QAAAAAAAAAABkg0AAFCujYAAM8zAAAAAAAAAAAAAAAAAAAAAQB5WVIAAAACAAAAAGkVb0Fgv3dHBJe0casfrMHWO+nARn+qbF8I9vA10xEYAAAAAAAAB8MAAAABVVNEAAAAAABpigEf7e9h5IpePeEXCoPJPqY8IRt8hpneL5+OXfZ45QAAAAAAAAAABkQTwCl6AxMAGo+PAAAAAAAAAAAAAAAA",
"fee_meta_xdr": "AAAAAgAAAAMAeVZcAAAAAAAAAABpFW9BYL93RwSXtHGrH6zB1jvpwEZ/qmxfCPbwNdMRGAAAABc+8zU9AFsPtQAABXYAAAASAAAAAAAAAAAAAAAPZnVudHJhY2tlci5zaXRlAAEAAAAAAAAAAAAAAAAAAAAAAAABAHlZUgAAAAAAAAAAaRVvQWC/d0cEl7Rxqx+swdY76cBGf6psXwj28DXTERgAAAAXPvMzrQBbD7UAAAV3AAAAEgAAAAAAAAAAAAAAD2Z1bnRyYWNrZXIuc2l0ZQABAAAAAAAAAAAAAAAAAAAA",
"memo_type": "none",
"signatures": [
"pox1kE2/f2oYQw/PdJZHUk74JVWRHDPwcqzGP+lSJljl6ABBRPqXewP1jAzpgY+vicDeLR/35/HyDyeAG7H0Aw=="
]
}
]
}
}
};
};

@@ -401,7 +404,11 @@ describe("without options", function () {

this.axiosMock.expects('get')
.withArgs(sinon.match('https://horizon-live.stellar.org:1337/ledgers/1/transactions'))
.withArgs(sinon.match('https://horizon-live.stellar.org:1337/ledgers/7952722/transactions'))
.returns(Promise.resolve({data: transactionsResponse}));
this.axiosMock.expects('get')
.withArgs(sinon.match(/^https:\/\/horizon.stellar.org\/transactions\/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1\/operations/))
.returns(Promise.resolve({data: {operations: []}}));
this.server.transactions()
.forLedger(1)
.forLedger(7952722)
.call()

@@ -411,6 +418,13 @@ .then(function (response) {

expect(response.records[0].ledger).to.be.function;
expect(response.records[0].ledger_attr).to.be.equal(34);
expect(response.records[0].ledger_attr).to.be.equal(7952722);
expect(response.next).to.be.function;
expect(response.prev).to.be.function;
done();
response.records[0].operations().then(function(response) {
expect(response.operations).to.not.be.undefined;
done();
})
.catch(function (err) {
done(err);
})
})

@@ -425,7 +439,11 @@ .catch(function (err) {

this.axiosMock.expects('get')
.withArgs(sinon.match('https://horizon-live.stellar.org:1337/ledgers/1/transactions?cursor=b&limit=1&order=asc'))
.withArgs(sinon.match('https://horizon-live.stellar.org:1337/ledgers/7952722/transactions?cursor=b&limit=1&order=asc'))
.returns(Promise.resolve({data: transactionsResponse}));
this.axiosMock.expects('get')
.withArgs(sinon.match(/^https:\/\/horizon.stellar.org\/transactions\/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1\/operations\?limit=1/))
.returns(Promise.resolve({data: {operations: []}}));
this.server.transactions()
.forLedger("1")
.forLedger("7952722")
.cursor("b")

@@ -439,3 +457,9 @@ .limit("1")

expect(response.prev).to.be.function;
done();
response.records[0].operations({limit: 1}).then(function(response) {
expect(response.operations).to.not.be.undefined;
done();
})
.catch(function (err) {
done(err);
})
})

@@ -453,3 +477,3 @@ .catch(function (err) {

let keypair = StellarSdk.Keypair.random();
let account = new StellarSdk.Account(keypair.accountId(), "56199647068161");
let account = new StellarSdk.Account(keypair.publicKey(), "56199647068161");
let transaction = new StellarSdk.TransactionBuilder(account)

@@ -456,0 +480,0 @@ .addOperation(StellarSdk.Operation.payment({

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc