Check AlgoSigner See code on GitHub

Check if AlgoSigner library is available

response
if (typeof AlgoSigner !== 'undefined') {
  document.getElementById("check-code").innerHTML = "AlgoSigner is installed.";
} else {
  document.getElementById("check-code").innerHTML = "AlgoSigner is NOT installed.";
};

Connect See code on GitHub

Connect to AlgoSigner

response
AlgoSigner.connect()
.then((d) => {
  document.getElementById("connect-code").innerHTML = JSON.stringify(d);
})
.catch((e) => {
  console.error(e);
  document.getElementById("connect-code").innerHTML = JSON.stringify(e);
});

Get TestNet Accounts See code on GitHub

Gets the users TestNet accounts

response
AlgoSigner.accounts({
  ledger: 'TestNet'
})
.then((d) => {
  document.getElementById("accounts-code").innerHTML = JSON.stringify(d);
})
.catch((e) => {
  console.error(e);
  document.getElementById("accounts-code").innerHTML = JSON.stringify(e);
});

Status See code on GitHub

Query AlgoD to get TestNet status

response
AlgoSigner.algod({
  ledger: 'TestNet',
  path: '/v2/status'
})
.then((d) => {
  document.getElementById("status-code").innerHTML = JSON.stringify(d);
})
.catch((e) => {
  console.error(e);
  document.getElementById("status-code").innerHTML = JSON.stringify(e);
});

Get Assets from Indexer See code on GitHub

Query Indexer to get TestNet assets

response
const name = document.getElementById("name").value;
const limit = document.getElementById("limit").value;

AlgoSigner.indexer({
  ledger: 'TestNet',
  path: `/v2/assets?name=${name}&limit=${limit}`,
})
.then((d) => {
  document.getElementById("assets-code").innerHTML = JSON.stringify(d);
})
.catch((e) => {
  console.error(e);
  document.getElementById("assets-code").innerHTML = JSON.stringify(e);
});