Stake Token
About Credit Token
The credit token functionality is for cases where you want to request your funds back because you, for example, sent an incorrect amount of funds.
Example
To stake a token, you must call stake
on dataset(Dataset.TOKEN)
. stake
takes an object of type Build5Request<
TokenStakeTangleRequest
>
as parameter.
const otrRequest = await otr(otrAddress).dataset(Dataset.TOKEN).stake('tokenid', 10, {
symbol: 'IOTA',
type: 'static',
weeks: 10,
});
OTR Request Deep Link
The SDK provides the helper functions getFireflyDeepLink()
and getBloomDeepLink()
to generate deep links for OTR requests.
Full How-To Code
import { Dataset } from '@build-5/interfaces';
import { otr, SoonaverseOtrAddress } from '@build-5/sdk';
async function main() {
// @ts-ignore
const otrAddress = SoonaverseOtrAddress[origin];
try {
const otrRequest = await otr(otrAddress).dataset(Dataset.TOKEN).stake('tokenid', 10, {
symbol: 'IOTA',
type: 'static',
weeks: 10,
});
var fireflyDeeplink = otrRequest.getFireflyDeepLink();
console.log(fireflyDeeplink);
} catch (e) {
console.log(e);
return;
}
}
main().then(() => process.exit());