Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@magic-sdk/extension-icon
Advanced tools
npm i magic-sdk @magic-sdk/extension-icon
Setup IconExtension with magic-sdk
import { Magic } from 'magic-sdk';
import { IconExtension } from '@magic-sdk/extension-icon';
const magic = new Magic('YOUR_API_KEY', {
extensions: {
icon: new IconExtension({
rpcUrl: 'icon rpc url'
})
}
});
// or
const magic = new Magic('YOUR_API_KEY', {
extensions: [
new IconExtension({
rpcUrl: 'icon rpc url'
})
]
});
See the developer documentation to learn how you can master the Magic SDK in a matter of minutes.
Using getAccount function to get Icon public address for current user.
const publicAddress = await magic.icon.getAccount();
console.log('icon public address', publicAddress);
Build the transaction object using builder class.
/* Build `IcxTransaction` instance for sending ICX. */
const txObj = new IconBuilder.IcxTransactionBuilder()
.from("hxe4837d3b902dcaf9abe529f5584489c28d8b4621")
.to("hxe4837d3b902dcaf9abe529f5584489c28d8b4621")
.value(IconAmount.of(0.5, IconAmount.Unit.ICX).toLoop())
.stepLimit(IconConverter.toBigNumber(100000))
.nid(IconConverter.toBigNumber(3))
.nonce(IconConverter.toBigNumber(1))
.version(IconConverter.toBigNumber(3))
.timestamp((new Date()).getTime() * 1000)
.build();
/* Build `MessageTransaction` instance for sending data. */
const txObj = new IconBuilder.MessageTransactionBuilder()
.from('hxe4837d3b902dcaf9abe529f5584489c28d8b4621')
.to('hxe4837d3b902dcaf9abe529f5584489c28d8b4621')
.stepLimit(IconConverter.toBigNumber(1000000))
.nid(IconConverter.toBigNumber(3))
.nonce(IconConverter.toBigNumber(1))
.version(IconConverter.toBigNumber(3))
.timestamp((new Date()).getTime() * 1000)
.data(IconConverter.fromUtf8('Hello'))
.build();
/* Build `DeployTransaction` instance for deploying SCORE. */
const txObj = new DeployTransactionBuilder()
.from('hxe4837d3b902dcaf9abe529f5584489c28d8b4621')
.to('cx0000000000000000000000000000000000000000')
.stepLimit(IconConverter.toBigNumber(2100000000))
.nid(IconConverter.toBigNumber(3))
.nonce(IconConverter.toBigNumber(1))
.version(IconConverter.toBigNumber(3))
.timestamp((new Date()).getTime() * 1000)
.contentType('application/zip')
.content(`0x${content}`)
.params({
initialSupply: IconConverter.toHex('100000000000'),
decimals: IconConverter.toHex(18),
name: 'StandardToken',
symbol: 'ST',
})
.build();
/* Build `CallTransaction` instance for executing SCORE function. */
const txObj = new IconBuilder.CallTransactionBuilder()
.from('hxe4837d3b902dcaf9abe529f5584489c28d8b4621')
.to('cxd1602bde1d4b2b4facc8673c661c5e59e6ac20b4')
.stepLimit(IconConverter.toBigNumber('2000000'))
.nid(IconConverter.toBigNumber('3'))
.nonce(IconConverter.toBigNumber('1'))
.version(IconConverter.toBigNumber('3'))
.timestamp((new Date()).getTime() * 1000)
.method('hello')
.params({})
By passing txObj instance to magic.icon.sendTransaction()
method, it will automatically sign the transaction with current user and
generate transaction object including signature, then send to ICON node.
const txhash = await magic.icon.sendTransaction(txObj);
console.log('transaction result', txhash);
window.open(`https://bicon.tracker.solidwallet.io/transaction/${txhash}`)
FAQs
magic icon extension
We found that @magic-sdk/extension-icon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.