Giter Club home page Giter Club logo

Comments (4)

jeapostrophe avatar jeapostrophe commented on May 27, 2024 1

That looks to me like the indexer is not set correctly? I believe that @DanBurton will shortly be sending something to elaborate what's going on here

from reach-lang.

DanBurton avatar DanBurton commented on May 27, 2024

I'm working on improving the ergonomics of this. You can do something like the following:

import * as reach from '@reach-sh/stdlib/ALGO';
import algosdk from 'algosdk';
​​
const RANDLABS_PORT = ''; 
const RANDLABS_BASE = 'https://algoexplorerapi.io';
// const RANDLABS_BASE = 'https://testnet.algoexplorerapi.io';
// const RANDLABS_BASE = 'https://betanet.algoexplorerapi.io';
​
const ALGO_SERVER = RANDLABS_BASE;
const ALGO_PORT = RANDLABS_PORT;
const ALGO_TOKEN = '';
const ALGO_INDEXER_SERVER = `${RANDLABS_BASE}/idx2`;
const ALGO_INDEXER_PORT = RANDLABS_PORT;
const ALGO_INDEXER_TOKEN = '';
​
const algodClient = new algosdk.Algodv2(ALGO_TOKEN, ALGO_SERVER, ALGO_PORT);
const indexer = new algosdk.Indexer(ALGO_INDEXER_TOKEN, ALGO_INDEXER_SERVER, ALGO_INDEXER_PORT);
​
reach.setAlgodClient(algodClient);
reach.setIndexer(indexer);

I use the randlabs APIs in this example, but you can just as easily use PureStake, or any other API provider.

This currently only works with the 'mnemonic' signing strategy, but I'm working on getting it to work with the 'AlgoSigner' signing strategy as well.

I'll provide updates on this issue when:

  • I have it working w/ AlgoSigner on MainNet/TestNet
  • I have finished publishing and documenting the more ergonomic solution

from reach-lang.

KBryan avatar KBryan commented on May 27, 2024

Your solution works. Here is a link to the contract running on MainNet. https://algoexplorer.io/application/203455577
Will use this solution until your update has been added.

from reach-lang.

DanBurton avatar DanBurton commented on May 27, 2024

This is now documented:

https://docs.reach.sh/ref-frontends-js-provider.html

The ergonomic solution is:

reach.setProviderByName('MainNet');

And it does work with AlgoSigner. =]

from reach-lang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.