-
Notifications
You must be signed in to change notification settings - Fork 10
3. Deploy Security Token
Remon Nashid edited this page Sep 22, 2019
·
4 revisions
async function createToken(e) {
e.preventDefault()
const fields = ['symbol', 'name', 'detailsUrl', 'treasuryWallet', 'divisible']
validateFields(fields, { force: true })
.then(async (values) => {
dispatch({type: 'CREATING_TOKEN'})
const reservation = reservations.filter(r => r.symbol === values.symbol)[0]
try {
const q = await reservation.createSecurityToken(values)
const ret = await q.run()
dispatch({ type: 'CREATED_TOKEN'})
message.success(`Token ${reservation.symbol} has been created successfully!`)
resetFields()
}
catch (error) {
dispatch({ type: 'ERROR', error: error.message} )
}
})
}
{reservations &&
<Form
onSubmit={createToken}>
<Title >Create Your Security Token</Title>
<Paragraph>Create your security token using one of your previous symbol reservations. If you let your token reservation expire, the token symbol you selected will be available for others to claim.</Paragraph>
<Item
name="symbol"
label="Reservation">
{getFieldDecorator('symbol', {
rules: [{required: true, message: 'A token reservation is required'}],
})(<Select
placeholder="Select a reservation">
{reservations.map(({symbol}) =>
<Option key={symbol} value={symbol}>{symbol}</Option> )}
</Select>)}
</Item>
<Item
name="name"
label="Token Name"
extra="This is the name of your token for display purposes. For example: Toro Token">
{getFieldDecorator('name', {
rules: [{required: true, message: 'Token name is required'}, {max: 64}],
})(<Input placeholder="Enter Token Name"/>)}
</Item>
<Item
name="detailsUrl"
label="Token Details"
extra="Paste a link to a web page that includes additional information on your token, such as legend.">
{getFieldDecorator('detailsUrl', {initialValue: ''})(<Input placeholder="Paste link here"/>)}
</Item>
<Item
name="treasuryWallet"
label="Treasury Wallet Address"
extra="Address of a wallet to be used to store tokens for some operations. Defaults to current user (eg Token Issuer) address">
{getFieldDecorator('treasuryWallet', {initialValue: walletAddress,
rules: [
{ required: true },
{
validator: (rule, value, callback) => {
if (!web3Utils.isAddress(value)) {
callback('Address is invalid')
return
}
callback()
return
}
}
] })(<Input />)}
</Item>
<Item
name="divisible"
label="Divisible"
extra="Indivisible tokens are typically used to represent an equity, while divisible tokens may be used to represent divisible assets such as bonds. Please connect with your advisor to select the best option..">
{getFieldDecorator('divisible', {
initialValue: false,
valuePropName: 'checked',
})(<Switch/>)}
</Item>
<Row gutter={16}>
<Col span={12}><Button htmlType="reset" onClick={() => resetFields()}>
Reset fields
</Button></Col>
<Col span={12}> <Button type="primary" htmlType="submit">
Create my token
</Button></Col>
</Row>
</Form>
}