Use your own Sponsor Wallet
Working with DevNet is similar to working with SE except you usually don't have any predeployed giver in DevNet. So you need to fund your contracts manually or deploy your own giver, which you will be able to use the same way as in SE. Deploying your own giver can be useful, if you need to deploy many contracts or need to frequently redeploy and test contract after subsequent modification.
You can find how to deploy your own Giver here.
In this guide we will show you how you can use your own Giver in the core SDK.
First of all, let's initialize giver's address, keys and ABI. All the data in this example are used from Evernode SE giver, substitute them by your Giver's data.
// Giver address Evernode SE
const giverAddress = '0:b5e9240fc2d2f1ff8cbb1d1dee7fb7cae155e5f6320e585fcc685698994a19a5';
// Giver keys on Evernode SE
const giverSigner = signerKeys({
"public": "2ada2e65ab8eeab09490e3521415f45b6e42df9c760a639bcf53957550b25a16",
"secret": "172af540e43a524763dd53b26a066d472a97c4de37d5498170564510608250c3"
});
// Giver ABI on Evernode SE
const giverAbi = abiContract({
'ABI version': 2,
header: ['time', 'expire'],
functions: [
{
name: 'sendTransaction',
inputs: [
{ 'name': 'dest', 'type': 'address' },
{ 'name': 'value', 'type': 'uint128' },
{ 'name': 'bounce', 'type': 'bool' }
],
outputs: []
},
{
name: 'getMessages',
inputs: [],
outputs: [
{
components: [
{ name: 'hash', type: 'uint256' },
{ name: 'expireAt', type: 'uint64' }
],
name: 'messages',
type: 'tuple[]'
}
]
},
{
name: 'upgrade',
inputs: [
{ name: 'newcode', type: 'cell' }
],
outputs: []
},
{
name: 'constructor',
inputs: [],
outputs: []
}
],
data: [],
events: []
});Next, implement a function to request tokens from the Giver:
Now you can use your new function for funding your contracts before deployment:
Sample Source Code
Full sample: https://github.com/tonlabs/sdk-samples/blob/master/core-examples/node-js/custom-giver/
Last updated