hscs/createSmartContract
How to call the API from an app
const snapId = `npm:@hashgraph/hedera-wallet-snap`
type SmartContractFunctionParameter = {
type: 'string' | 'bytes' | 'boolean' | 'int' | 'uint';
value: string | number | boolean | Uint8Array;
}
const createTokenAPI = async () => {
const externalAccountParams = {
externalAccount: {
accountIdOrEvmAddress: '0.0.12345',
curve: 'ED25519'
}
}
await window.ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId,
request: {
method: 'hscs/createSmartContract',
params: {
network: 'testnet',
gas: 100000,
bytecode: "6080604052...0008190033",
initialBalance?, // Optional param - type: number
adminKey?, // Optional param - type: string
constructorParameters?: // Optional param - type: SmartContractFunctionParameter[]
contractMemo?, // Optional param - type: string
stakedNodeId?, // Optional param - type: number
stakedAccountId?, // Optional param - type: string
declineStakingReward?, // Optional param - type: boolean
autoRenewPeriod?, // Optional param - type: number
maxAutomaticTokenAssociations?, // Optional param - type: number
/*
Uncomment the below line if you want to connect
to a non-metamask account
*/
// ...externalAccountParams
}
}
}
})
}What the API does

Live Demo on CodePen
Last updated
Was this helpful?

