Startrail APIs
  • 🛫Startrail PORT: All in one document for API/SDK
    • 🔀URL per environment
  • Issue transfer api
    • 📬Issue & Transfer SRR (NFT)
      • Request Signed URL for Upload/Download Files
      • File Information Metadata
      • Issue & Transfer
      • Webhook Setup
    • 📂Collection
      • Create Collection
      • Get Collection of LUW
    • 📢Change Logs
      • v1.2.0
      • v1.1.0
      • v1.0.1
  • Metadata Schema
    • 🪅Startrail Registry (SRR)
      • Version 2.2
      • Version 2.1
      • Version 2.0
    • 📤Transfer
      • Version 1.2
      • Version 1.1
      • Version 1.0
    • ☸️Custom History
      • Custom History of Exhibition
        • Version 1.2
      • Custom History of Auction
        • Version 1.3
      • Custom History of Appraisal
        • Version 1.1
      • Custom History of Restoration
        • Version 1.0
      • Custom History of Offchain
        • Version 1.1
  • Get SRR API
    • Get Owned SRRs
    • Get SRR by Collection contract address and Token Id
      • 🚫Get SRR by Token Id
    • Description Of SRR Data
  • Ethereum Signature Validator API
    • 🔏Ethereum Signature Validator API
      • Change Logs
  • Startrail SDK Js
    • 🔰Introduction
    • 🏃Getting Started
      • RPC endpoint and chainId
    • 💳Wallet Methods
    • 🔮Startrail API Methods
      • Add Custom Histories To SRRs
      • Approve SRR By Commitment
      • Bulk
      • Check ERC2981 Royalty
      • Create Collection
      • Convert Metadata
      • Create SRR
      • Transfer Collection Ownership
      • Transfer SRR To Ethereum Address
      • Transfer From With Provenance
      • Update Metadata
    • 📱Login Providers
      • Interface
      • Whitelabeling/Customizing
        • Email Password
      • Hints
      • Multi Factor Account Management
    • 🦊MetaMask
    • 🎎Authentication Integration
    • 👾Errors
    • 📢Change logs
      • v1.35.0
      • v1.34.0
      • v1.33.2
      • v1.33.1
      • v1.32.0
      • v1.31.1
      • v1.30.6
      • v1.30.5
      • v1.30.4
      • v1.30.3
      • v1.30.2
      • v1.30.1
      • v1.30.0
      • v1.29.1
      • v1.29.0
      • v1.28.2
      • v1.28.1
      • v1.28.0
      • v1.27.1
      • v1.27.0
      • v1.26.0
      • v1.25.2(Security Patch)
  • Startrail API
    • 💱Transfer SRR Ownership By RevealHash
    • Get Transaction Data
    • Get Metadata By tokenid
  • Subgraph
    • 📊A introduction of subgraph
    • How to retrieve SRR metadata
Powered by GitBook

©2023 Startbahn, Inc.

On this page
  • NPM Package
  • Add Packages
  • Script Tag
  • Import
  • Constructor
  • Properties
  • Sample Config Values For Each Login Method

Was this helpful?

  1. Startrail SDK Js

Getting Started

To start development with Startrail-Sdk-Js

PreviousIntroductionNextRPC endpoint and chainId

Last updated 11 months ago

Was this helpful?

NPM Package

Env
Tag

Staging

Production

Add Packages

npm install @startbahn/startrail-sdk-js
yarn add @startbahn/startrail-sdk-js

Script Tag

Please ensure to check and update to the latest version when you are developing.

<script src="https://cdn.jsdelivr.net/npm/@startbahn/startrail-sdk-js@1.34.0/dist/startrail-sdk.min.js"></script>
<script src="https://unpkg.com/@startbahn/startrail-sdk-js@1.34.0"></script>

Import

const StartrailSdk = require('@startbahn/startrail-sdk-js').Startrail
// or
import StartrailSdk from "@startbahn/startrail-sdk-js";

const startrail = new StartrailSdk(config)

Constructor

Configure and construct your Startrail SDK instance

new StartrailSdk(config)

Properties

All the properties listed below are optional.

Parameter
Type
Description

apiPath

string

Only define it if you want to do testing. For testing use the Test environment URL of STARTRAIL:

https://api-stg.startrail.startbahn.jp/api/v1

For production purpose do not define it.

wallet

'startrail' | 'metamask'

Wallet to activate. Default is startrail.

  • metamask: Metamask wallet installed in users' environment.

  • startrail: Google or Email/Password powered by Web3Auth.

env

string

The environment of Startrail-Api endpoint, blockchain network and Web3Auth environment.

  • production: Matic network. TORUS production account and Startrail production Auth0 account. It is designed to communicate to Startrail production API.

  • staging: Mumbai network. TORUS production account and Startrail staging Auth0 account. It is designed to communicate to Startrail for testing.

authAction

true hashes the preimage with keccak256

auth0ClientId

string

Client ID of Auth0 account

auth0Domain

string

Domain URL of Auth0

auth0TorusConfigKey

string

Config key name for TORUS initialisations to connect Auth0 domain and Web3Auth network. This key is only provided by Web3Auth

lang

Language displayed on the UI

loginProvider

customUi

callbackUrl

string

A URL to which a user is redirected after completing email verification with email_password

withModal

boolean

Startrail modal powered by Web3Auth is opened instead of direct procedure with a specific login action.

rpcEndpoint

string

chainId

number

mfaLevel

"none" | "default" | "optional" | "mandatory"

Sample Config Values For Each Login Method

// For Production (*No need to set auth0 or apiPath)
sdk = new Startrail({
  lang: 'ja',
  withModal: true,
  env: 'production', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
})

// For Development
sdk = new Startrail({
  apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
  lang: 'ja',
  withModal: true,
  env: 'staging', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
  // rpcEndpoint: 'your rpc endpoint url' // IF you want to designate endpoint
})
// For Production (*No need to set auth0 or apiPath)
sdk = new Startrail({
  lang: 'ja',
  loginProvider: ['google'],
  env: 'production', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
})

// For Development
sdk = new Startrail({
  apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
  lang: 'ja',
  loginProvider: ['google'],
  env: 'staging', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
  // rpcEndpoint: 'your rpc endpoint url' // IF you want to designate endpoint
})
// For Production (*apiPath setting is not required)
sdk = new Startrail({
  lang: 'ja',
  loginProvider: ['email_passwordless'],
  env: 'production', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
})

// For Development
sdk = new Startrail({
  apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
  lang: 'ja',
  loginProvider: ['email_passwordless'],
  env: 'staging', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
  // rpcEndpoint: 'your rpc endpoint url' // IF you want to designate endpoint
})
// For Production (*apiPath setting is not required)
sdk = new Startrail({
  lang: 'ja',
  loginProvider: ['line'],
  env: 'production', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
})

// For Development
sdk = new Startrail({
  apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
  lang: 'ja',
  loginProvider: ['line'],
  env: 'staging', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
  // rpcEndpoint: 'your rpc endpoint url' // IF you want to designate endpoint
})
// For Production (*apiPath setting is not required)
sdk = new Startrail({
  lang: 'ja',
  loginProvider: ['facebook'],
  env: 'production', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
})

// For Development
sdk = new Startrail({
  apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
  lang: 'ja',
  loginProvider: ['facebook'],
  env: 'staging', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
  // rpcEndpoint: 'your rpc endpoint url' // IF you want to designate endpoint
})
// For Production (*apiPath setting is not required)
sdk = new Startrail({
  lang: 'ja',
  loginProvider: ['apple'],
  env: 'production', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
})

// For Development
sdk = new Startrail({
  apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
  lang: 'ja',
  loginProvider: ['apple'],
  env: 'staging', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
  // rpcEndpoint: 'your rpc endpoint url' // IF you want to designate endpoint
})
// For Production (*apiPath setting is not required)
sdk = new Startrail({
  lang: 'ja',
  loginProvider: ['twitter'],
  env: 'production', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
})

// For Development
sdk = new Startrail({
  apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
  lang: 'ja',
  loginProvider: ['twitter'],
  env: 'staging', // torusBuildEnv is deprecate after v1.25.0
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
  // rpcEndpoint: 'your rpc endpoint url' // IF you want to designate endpoint
})
// For Production (*No need to set auth0 or apiPath)
sdk = new Startrail({
  env: 'production',
  wallet: 'metamask'
})

// For Development
sdk = new Startrail({
  apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
  env: 'staging',
  wallet: 'metamask'
})
// For Production (*No need to set auth0 or apiPath)
sdk = new Startrail({
  authAction: { login: false, signup: true },
  lang: 'ja',
  loginProvider: ['email_password'],
  env: 'production', // torusBuildEnv is deprecate after v1.25.0
  redirectUrl: 'https://yoursite.com', // Not necessary for login
  customUi: {
    logoUrl: 'https://yoursite.com/logo',
    serviceName: 'your service name'
  }
})

// For Development
sdk = new Startrail({
 authAction: { login: false, signup: true },
 apiPath: 'https://api-stg.startrail.startbahn.jp/api/v1',
 lang: 'ja',
 loginProvider: ['email_password'],
 env: 'staging', // torusBuildEnv is deprecate after v1.25.0
 redirectUrl: 'https://yoursite.com', // Not necessary for login
 customUi: {
  logoUrl: 'https://yoursite.com/logo',
  serviceName: 'your service name'
 },
  // rpcEndpoint: 'your rpc endpoint url' // IF you want to designate endpoint
})

To connect to your wallet, use login method

await sdk.login()

See more details in Wallet Methods

Auth0, managed by Startbahn, is used for certain authentication methods, such as Email Password.

login providers for connecting wallet, more detail .

Values to customise UI only under Startrail wallet powered by Web3Auth. See more details in section.

An rpcEndpoint that is accessed from the wallet you select. See for more detail .

An chainId that is accessed from the wallet you select. See for more detail .

default is none that is not asking for MFA. Further detail is .

We recommend encouraging users to use this SDK in standard web browsers, such as Safari, Chrome, Firefox, etc. Some functionality of the SDK may not work properly in .

🏃
{
  login: boolean
  signup: boolean
}
 'ja' | 'en'
['google' | 'email_passwordless' | 'facebook' | 'twitter' | 'line' | 'apple' | 'email_password']
web-views
Whitelabeling/Customizing
https://www.npmjs.com/package/@startbahn/startrail-sdk-js/v/next
https://www.npmjs.com/package/@startbahn/startrail-sdk-js
here
CustomUI
here
here
here
npm: @startbahn/startrail-sdk-jsnpm
Logo