How to use the edge-core-js.makeEdgeContext function in edge-core-js

To help you get started, we’ve selected a few edge-core-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EdgeApp / edge-login-ui / packages / edge-login-ui-web / src / frame / context-api.js View on Github external
export async function makeUiContext(opts: EdgeUiContextOptions) {
  const {
    apiKey,
    appId,
    hideKeys = false,
    vendorName = '',
    vendorImageUrl = ''
  } = opts

  // Core context:
  const core: EdgeContext = await makeEdgeContext({
    apiKey,
    appId,
    hideKeys,
    plugins: [ethereumCurrencyPluginFactory, shapeshiftPlugin, coincapPlugin]
  })

  // iframe root:
  const root = document.getElementById('app')
  if (root == null) throw new Error('Cannot find document root')

  // State:
  let localUsers: Array = core.localUsers
  let windowVisible = false

  const out: EdgeUiContext = {
    on: onMethod,
github EdgeApp / edge-login-ui / packages / edge-login-ui-web / src / frame / frame-state.js View on Github external
async function makeFrameState (opts: ConnectionMessage): Promise {
  const {
    apiKey,
    appId,
    hideKeys,
    vendorName = '',
    vendorImageUrl = '',
    clientDispatch
  } = opts
  const context = await makeEdgeContext({ apiKey, appId })

  return {
    accounts: {},
    context,
    hideKeys,
    nextAccountId: 0,
    page: '',
    pageAccount: null,
    vendorImageUrl,
    vendorName,

    clientDispatch
  }
}
github EdgeApp / edge-react-gui / src / util / makeContext.js View on Github external
export async function makeCoreContext (): Promise {
  const opts: EdgeContextOptions = {
    apiKey: AIRBITZ_API_KEY,
    appId: '',
    shapeshiftKey: SHAPESHIFT_API_KEY,
    changellyInit: CHANGELLY_INIT,
    changeNowKey: CHANGE_NOW_API_KEY,
    faastInit: FAAST_INIT
  }

  return makeEdgeContext(opts)
}
github EdgeApp / edge-login-ui / packages / edge-login-ui-react / src / demo / index.js View on Github external
constructor(props) {
    super(props)
    makeEdgeContext({
      apiKey: '3ad0717b3eb31f745aba7bd9d51e7fd1b2926431',
      appId: 'com.mydomain.myapp'
    }).then(context => this.setState({ context }))

    this.state = {
      account: null,
      closed: false,
      context: null
    }
  }