With this module & function whitelisting dapps can sponsor only transactions from a whitelisted modules and functions.
;(async () => {
const projectKey = process.env.PROJECT_KEY as string
const privateKey = process.env.PRIVATE_KEY as string
const paymasterSdk = new PaymasterSdk({ privateKey: privateKey }, { projectKey: projectKey, network: Network.TESTNET })
const addWhitelistFunctionsResponse = await paymasterSdk.addWhitelistFunctions({
functions: [
{
module_name: 'aptos_account',
function_name: 'batch_transfer_coins',
module_address: '0x1',
},
],
})
console.log('addWhitelistFunctionsResponse', addWhitelistFunctionsResponse)
})()
Module Whitelist Function
;(async () => {
const projectKey = process.env.PROJECT_KEY as string
const privateKey = process.env.PRIVATE_KEY as string
const paymasterSdk = new PaymasterSdk({ privateKey: privateKey }, { projectKey: projectKey, network: Network.TESTNET })
const addModuleWhitelistFunctionsResponse = await paymasterSdk.addModuleWhitelistFunctions({
functions: [
{
module_address: '0x1',
},
],
})
console.log('addModuleWhitelistFunctionsResponse', addModuleWhitelistFunctionsResponse)
})()