Socket
Socket
Sign inDemoInstall

arweave

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arweave - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

26

node/common.js

@@ -41,24 +41,14 @@ "use strict";

}
if (typeof attributes.data === "string") {
attributes.data = ArweaveUtils.stringToBuffer(attributes.data);
}
if (attributes.data && !(attributes.data instanceof Uint8Array)) {
throw new Error("Expected data to be a string or Uint8Array");
}
if (attributes.reward == undefined) {
const length = ((data) => {
if (data == undefined) {
return 0;
}
if (typeof data == "string") {
return data.length;
}
if (data instanceof Uint8Array) {
return data.byteLength;
}
throw new Error("Expected data to be a string or Uint8Array");
})(attributes.data);
const length = attributes.data ? attributes.data.byteLength : 0;
transaction.reward = await this.transactions.getPrice(length, transaction.target);
}
if (attributes.data) {
if (typeof attributes.data == "string") {
transaction.data = ArweaveUtils.stringToB64Url(attributes.data);
}
if (attributes.data instanceof Uint8Array) {
transaction.data = ArweaveUtils.bufferTob64Url(attributes.data);
}
transaction.data = ArweaveUtils.bufferTob64Url(attributes.data);
}

@@ -65,0 +55,0 @@ return new transaction_1.default(transaction);

{
"name": "arweave",
"version": "1.5.2",
"version": "1.5.3",
"description": "Arweave JS client library",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,3 +18,3 @@ # Arweave JS

- [Get the wallet address for a private key](#get-the-wallet-address-for-a-private-key)
- [Get a wallet balance](#get-a-wallet-balance)
- [Get an address balance](#get-an-address-balance)
- [Get the last transaction ID from a wallet](#get-the-last-transaction-id-from-a-wallet)

@@ -65,3 +65,4 @@ - [Transactions](#transactions)

host: '127.0.0.1',
port: 1984
port: 1984,
protocol: 'http'
});

@@ -74,5 +75,10 @@ ```

// Since v1.5.1 you're now able to call the init function for the web version without options. The current path will be used by default, recommended.
const arweave = Arweave.init();
// Or manually specify a host
const arweave = Arweave.init({
host: '127.0.0.1',
port: 1984
port: 1984,
protocol: 'http'
});

@@ -90,6 +96,3 @@ ```

<script>
const arweave = Arweave.init({
host: '127.0.0.1',
port: 1984
});
const arweave = Arweave.init();
arweave.network.getInfo().then(console.log);

@@ -104,12 +107,8 @@ </script>

The default port for nodes is `1984`.
A live list of public arweave nodes and IP adddresses can be found on this [peer explorer](http://arweave.net/bNbA3TEQVL60xlgCcqdz4ZPHFZ711cZ3hmkpGttDt_U).
### Initialisation options
```js
{
host: 'arweave.net',// Hostname or IP address for a Arweave node
port: 443, // Port, defaults to 1984
protocol: 'https', // Network protocol http or https, defaults to http
host: 'arweave.net',// Hostname or IP address for a Arweave host
port: 443, // Port
protocol: 'https', // Network protocol http or https
timeout: 20000, // Network request timeouts in milliseconds

@@ -413,10 +412,10 @@ logging: false, // Enable network request logging

#### Get a list of transaction IDs matching the giver query
ArQL allows you to search for transactions by tags or by wallet address.
ArQL allows you to search for transactions by tags or by wallet. Searching by wallet is done by using the special tag `from`. The allowed operators are `and`, `or`, and `equals` which all accept exactly two expressions. Therefore, to `and` three or more expressions together, you will need to nest `and` expressions. The same goes for `or`.
The allowed operators are `and`, `or`, and `equals` which all accept exactly two expressions. Therefore, to `and` three or more expressions together, you will need to nest `and` expressions. The same goes for `or`. Searching by wallet is done by using the special tag `from`.
`arweave.arql` takes the ArQL query as a JavaScript object and returns the matching transaction IDs as an array or strings.
`arweave.arql` takes the ArQL query as an object and returns the matching transaction IDs as an array of strings.
```javascript
const txids = arweave.arql({
```js
const txids = await arweave.arql({
op: "and",

@@ -451,1 +450,6 @@ expr1: {

```
There are a number of community produced helper packages for building ArQL queries.
- https://www.npmjs.com/package/arlang
- https://www.npmjs.com/package/arql-ops

@@ -41,24 +41,14 @@ "use strict";

}
if (typeof attributes.data === "string") {
attributes.data = ArweaveUtils.stringToBuffer(attributes.data);
}
if (attributes.data && !(attributes.data instanceof Uint8Array)) {
throw new Error("Expected data to be a string or Uint8Array");
}
if (attributes.reward == undefined) {
const length = ((data) => {
if (data == undefined) {
return 0;
}
if (typeof data == "string") {
return data.length;
}
if (data instanceof Uint8Array) {
return data.byteLength;
}
throw new Error("Expected data to be a string or Uint8Array");
})(attributes.data);
const length = attributes.data ? attributes.data.byteLength : 0;
transaction.reward = await this.transactions.getPrice(length, transaction.target);
}
if (attributes.data) {
if (typeof attributes.data == "string") {
transaction.data = ArweaveUtils.stringToB64Url(attributes.data);
}
if (attributes.data instanceof Uint8Array) {
transaction.data = ArweaveUtils.bufferTob64Url(attributes.data);
}
transaction.data = ArweaveUtils.bufferTob64Url(attributes.data);
}

@@ -65,0 +55,0 @@ return new transaction_1.default(transaction);

@@ -10,5 +10,21 @@ "use strict";

function getDefaultConfig() {
const defaults = {
host: "arweave.net",
port: 443,
protocol: "https"
};
if (!window ||
!window.location ||
!window.location.protocol ||
!window.location.hostname) {
return defaults;
}
// window.location.protocol has a trailing colon (http:, https:, file: etc)
const currentProtocol = window.location.protocol.replace(":", "");
const currentHost = window.location.hostname;
const currentPort = window.location.port
? parseInt(window.location.port)
: currentProtocol == "https"
? 443
: 80;
const isLocal = ["localhost", "127.0.0.1"].includes(currentHost) ||

@@ -19,11 +35,7 @@ currentProtocol == "file";

if (isLocal) {
return {
host: "arweave.net",
port: 443,
protocol: "https"
};
return defaults;
}
return {
host: currentHost,
port: currentProtocol == "https" ? 443 : 80,
port: currentPort,
protocol: currentProtocol

@@ -30,0 +42,0 @@ };

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

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

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