Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
28 changes: 28 additions & 0 deletions add-tags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Arweave from "arweave";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add proper docs to all helpers


const start = async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use Turbo-SDK pala. Kasi yun yung partner natin haha.

const ARWEAVE_INSTANCE = Arweave.init({
host: "arweave.net",
port: 443,
protocol: "https",
});

// TODO: Add/Airdrop me Arweave please
const generated = await ARWEAVE_INSTANCE.wallets.generate();

const tx = await ARWEAVE_INSTANCE.createTransaction(
{
data: "Hello world!",
},
generated
);

tx.addTag("Content-Type", "application/json");
tx.addTag("whatever", "whatever");

await ARWEAVE_INSTANCE.transactions.sign(tx, generated);
ARWEAVE_INSTANCE.transactions.post(tx).then(console.log).catch(console.log);
console.log(`https://arweave.net/${tx.id}`);
};

start();
12 changes: 12 additions & 0 deletions generate-wallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Arweave from "arweave";

const start = async () => {
const ARWEAVE_INSTANCE = Arweave.init({
host: "arweave.net",
port: 443,
protocol: "https",
});
const generated = await ARWEAVE_INSTANCE.wallets.generate();
console.log(generated);
};
start();
16 changes: 16 additions & 0 deletions get-balance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Arweave from "arweave";

const start = async () => {
const ARWEAVE_INSTANCE = Arweave.init({
host: "arweave.net",
port: 443,
protocol: "https",
});
const generated = await ARWEAVE_INSTANCE.wallets.generate();
const address = await ARWEAVE_INSTANCE.wallets.jwkToAddress(generated);
const balance = await ARWEAVE_INSTANCE.wallets.getBalance(address);
console.log(`${address}: ${balance} winston`);
console.log(`${address}: ${ARWEAVE_INSTANCE.ar.winstonToAr(balance)} AR`);
};

start();
13 changes: 13 additions & 0 deletions get-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Arweave from "arweave";

const start = async () => {
const ARWEAVE_INSTANCE = Arweave.init({
host: "arweave.net",
port: 443,
protocol: "https",
});
const info = await ARWEAVE_INSTANCE.network.getInfo();
console.log(info);
};

start();
15 changes: 15 additions & 0 deletions get-last-transaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Arweave from "arweave";

const start = async () => {
const ARWEAVE_INSTANCE = Arweave.init({
host: "arweave.net",
port: 443,
protocol: "https",
});
const generated = await ARWEAVE_INSTANCE.wallets.generate();
const address = await ARWEAVE_INSTANCE.wallets.jwkToAddress(generated);
const tx = await ARWEAVE_INSTANCE.wallets.getLastTransactionID(address);
console.log(tx);
};

start();
25 changes: 25 additions & 0 deletions hello-world.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Arweave from "arweave";

const start = async () => {
const ARWEAVE_INSTANCE = Arweave.init({
host: "arweave.net",
port: 443,
protocol: "https",
});

// TODO: Add/Airdrop me Arweave please
const generated = await ARWEAVE_INSTANCE.wallets.generate();

const tx = await ARWEAVE_INSTANCE.createTransaction(
{
data: "Hello world!",
},
generated
);

await ARWEAVE_INSTANCE.transactions.sign(tx, generated);
ARWEAVE_INSTANCE.transactions.post(tx).then(console.log).catch(console.log);
console.log(`https://arweave.net/${tx.id}`);
};

start();
14 changes: 14 additions & 0 deletions jwk-to-address.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Arweave from "arweave";

const start = async () => {
const ARWEAVE_INSTANCE = Arweave.init({
host: "arweave.net",
port: 443,
protocol: "https",
});
const generated = await ARWEAVE_INSTANCE.wallets.generate();
const address = await ARWEAVE_INSTANCE.wallets.jwkToAddress(generated);
console.log(address);
};

start();
3 changes: 3 additions & 0 deletions nextjs-turbo-sdk/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions nextjs-turbo-sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
36 changes: 36 additions & 0 deletions nextjs-turbo-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
6 changes: 6 additions & 0 deletions nextjs-turbo-sdk/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
};

export default nextConfig;
Loading