Skip to content

1. Reserve Your Token Symbol

Remon Nashid edited this page Sep 22, 2019 · 5 revisions
const [ formSymbolValue, setFormSymbolValue ] = useState('')

/**
 * Send a transaction to try and reserve symbol $formSymbolValue
 */
async function reserveSymbol() {
  if (formSymbolValue) {
    dispatch({type: 'RESERVING_SYMBOL'})
    try {
      //
      const q = await sdk.reserveSecurityToken({symbol: formSymbolValue})
      const ret = await q.run()
      dispatch({type: 'RESERVED_SYMBOL'})
      message.success(`Symbol ${formSymbolValue} has been reserved successfully!`)
    } catch (error) {
      dispatch({type: 'ERROR', error: error.message})
    }
  } else {
    message.error('Please provide a symbol')
  }
}

<Form>
  <Title>Reserve Your Token Symbol</Title>
  <Paragraph>Reservation ensures that no other organization can create a token symbol identical to yours using the Polymath platform. This operation carries a cost of: 250 POLY.</Paragraph>
  <Item name="symbol" label="Symbol">
    <Input
      placeholder="SYMBOL"
      value={formSymbolValue}
      onChange={({ target: { value }}) => {
        const pattern = RegExp('^[a-zA-Z0-9_-]*$')
        if (pattern.test(value) && value.length <= 10) {
          setFormSymbolValue(value.toUpperCase())
        }
      }}
    />
  </Item>
  <Button type="primary" onClick={reserveSymbol}>Reserve Symbol</Button>
</Form>
Clone this wiki locally