eosnewyork / eos-transit

Transit Wallet Access Layer for EOS blockchain networks
MIT License
87 stars 49 forks source link

Provide example for eos-transit-anchorlink-provider #51

Open Novusphere opened 4 years ago

Novusphere commented 4 years ago

It's unclear without looking at code that you need to provide a "session id" to anchor's constructor when setting up the access context's wallet providers. Nor does anchor() throw any errors if you don't specify the session id. You just get an obscure error if you don't.

e.g.

        walletProviders: [
            anchor(`discussions`),
            scatter()
        ]
NatPDeveloper commented 3 years ago

I am seeing

./node_modules/anchor-link/lib/link.js
Module parse failed: Unexpected token (100:12)
You may need an appropriate loader to handle this file type.
|         // generate unique callback url
|         let request = await esr.SigningRequest.create({
|             ...args,
|             chainId: this.chainId,
|             broadcast: false,

With

import anchorlink from 'eos-transit-anchorlink-provider';

const appName = 'My Dapp';

const walContext = initDefaultAccessContext({
    appName,
    network: {
        host: 'eos.greymass.com',
        port: 443,
        protocol: 'https',
        chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
    },
    // walletProviders: [ scatter() ]
    walletProviders: [ 
        scatter(),
        ledger({exchangeTimeout : 30000, transport: 'TransportWebBLE', name: 'Ledger Nano S BLE', shortName: 'Ledger Nano S BLE', id: 'ledgerble' }),
        ledger({exchangeTimeout : 30000, transport: 'TransportU2F', name: 'Ledger Nano S U2F', shortName: 'Ledger Nano S U2F', id: 'ledgeru2f' }),
        ledger({exchangeTimeout : 30000, transport: 'TransportWebAuthn', name: 'Ledger Nano S WebAuthn', shortName: 'Ledger Nano S WebAuthn', id: 'ledgeruwebauthn' }),
        ledger({exchangeTimeout : 30000, transport: 'TransportWebusb', name: 'Ledger Nano S Web USB', shortName: 'Ledger Nano S Web USB', id: 'ledgeruwebusb' }),
        anchorlink(Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)) 
    ]
});