-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(first issue): setup examples, readme, and initial gateways provider
- Loading branch information
1 parent
5d87e2e
commit 5a9e232
Showing
16 changed files
with
273 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
const { DefaultClient } = require('../../lib/index.js'); | ||
const { ArIO } = require('../../lib/cjs/node'); | ||
|
||
(async () => { | ||
const client = new DefaultClient(); | ||
console.log(client); | ||
const arIO = new ArIO({}); | ||
const testnetClient = arIO.testnet; | ||
const devnetClient = arIO.devnet; | ||
|
||
const testnetGateways = await testnetClient.getGateways(); | ||
const devnetGateways = await devnetClient.getGateways(); | ||
|
||
console.dir({ testnetGateways, devnetGateways }, { depth: 2 }); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import { DefaultClient } from '../../lib/index.js'; | ||
import { ArIO } from '../../lib/esm/node/index.js'; | ||
|
||
(async () => { | ||
const client = new DefaultClient(); | ||
console.log(client); | ||
const arIO = new ArIO({}); | ||
const testnetClient = arIO.testnet; | ||
const devnetClient = arIO.devnet; | ||
|
||
const testnetGateways = await testnetClient.getGateways(); | ||
const devnetGateways = await devnetClient.getGateways(); | ||
|
||
console.dir({ testnetGateways, devnetGateways }, { depth: 2 }); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,88 @@ | ||
<html> | ||
<head> | ||
<script type="module" src="./web.bundle.min.js"></script> | ||
<style> | ||
/* Center the button */ | ||
body { | ||
padding: 10px; | ||
} | ||
</style> | ||
<!-- import permanent tailwind --> | ||
<script src="https://arweave.net/RjXXBjP2GCZZUg4gSW1Hyr9GtLG-o59QCHrKiITtpQw"></script> | ||
<script> | ||
tailwind.config = { | ||
theme: { | ||
borderWidth: { | ||
1: '1px', | ||
}, | ||
extend: { | ||
colors: { | ||
primary: '#FFBB38', | ||
background: '#141416', | ||
surface: '#222224', | ||
surfaceSecondary: '#2E2E30', | ||
textPrimary: '#F5F5F5', | ||
textSubtle: '#7A7A7C', | ||
}, | ||
}, | ||
}, | ||
}; | ||
</script> | ||
</head> | ||
<body> | ||
<body class="bg-background flex flex-col items-center p-10"> | ||
<div | ||
class="bg-surface flex flex-col gap-5 items-end justify-center p-5 rounded-md h-full" | ||
style="width: 750px" | ||
> | ||
<div class="h-full w-full" style="overflow-y: scroll"> | ||
<table class="w-full bg-background text-textPrimary"> | ||
<thead> | ||
<tr> | ||
<th class="px-4 py-2">Domain</th> | ||
<th class="px-4 py-2">Owner</th> | ||
<th class="px-4 py-2">Stake</th> | ||
</tr> | ||
</thead> | ||
<tbody id="table-body"> | ||
<!-- Add more rows as needed --> | ||
</tbody> | ||
</table> | ||
</div> | ||
<button | ||
id="fetch-gateways-button" | ||
class="animate-bounce bg-primary text-textPrimary p-2 rounded-md w-full text-surface hover:shadow-xl" | ||
style="color: black" | ||
> | ||
Fetch Gateways | ||
</button> | ||
</div> | ||
<script type="module"> | ||
import { DefaultClient } from './web.bundle.min.js'; | ||
import { ArIO } from './web.bundle.min.js'; | ||
|
||
// set up our client | ||
const client = new DefaultClient(); | ||
const arIO = new ArIO({}).testnet; | ||
|
||
async function setGateways() { | ||
const tableBody = document.getElementById('table-body'); | ||
tableBody.innerHTML = ` | ||
<tr> | ||
<td class="border border-surface px-4 py-2">Loading...</td> | ||
</tr> | ||
`; | ||
const gateways = await arIO.getGateways(); | ||
|
||
tableBody.innerHTML = Object.entries(gateways) | ||
.map(([gatewayOwner, gateway]) => { | ||
return ` | ||
<tr> | ||
<td class="border border-surface px-4 py-2 text-primary"><a href="https://${gateway.settings.fqdn}" target="_blank">${gateway.settings.fqdn}</a></td> | ||
<td class="border border-surface px-4 py-2 text-primary"><a href="https://arscan.io/address/${gatewayOwner}" target="_blank">${gatewayOwner}</a></td> | ||
<td class="border border-surface px-4 py-2">${gateway.operatorStake} IO</td> | ||
</tr> | ||
`; | ||
}) | ||
.join(''); | ||
} | ||
|
||
// print the client to the console | ||
console.log(client); | ||
const fetchGatewaysButton = document.getElementById( | ||
'fetch-gateways-button', | ||
); | ||
fetchGatewaysButton.addEventListener('click', () => { | ||
setGateways(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.