1.1.12 • Published 2 years ago

arweave-uploader v1.1.12

Weekly downloads
5
License
LGPL-3.0-or-later
Repository
github
Last release
2 years ago

arweave-uploader (work in progress)

Arweave Uploader - detect and handle arweave upload failures. It attempts high fault tolerance, so not really suitable for non-automated systems (very long timeouts).

  • ** N.B. this only works for value transfer or very small data txs
  • ** N.B. Warning! Tx retry may create multiple txs during periods of unusually high network/gateway load

Installation

npm install arweave-uploader

Example Usage - N.B. API subject to constant change ;-)

import Arweave from 'arweave'

const arweave = ...

const main = async () => {

	/* create your transaction as normal */

	const tx = await arweave.createTransaction({ data: "123" }, wallet)
	tx.addTag('App-Name', 'my-app-name')
	tx.addTag('Content-Type', 'application/json')

	try {

		/* no need to sign or post, just call "uploadTx" with your wallet */

		const txid = await uploadTx(tx, wallet) // this will take a long time!
		
		console.log('tx upload success with id ' + txid)

	}catch(e){
		
		/* bad tx found (e.g. wallet does not enough AR for tx fee) */

		console.error(e.name + ': ' + e.message)
	}
}

Options

setDebugOutput(false) to turn off console messages - not advised, but possible.

1.1.12

2 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago