skalenetwork / docs.skale.space

https://docs.skale.space/
MIT License
0 stars 2 forks source link

Using Stardust #33

Closed manuelbarbas closed 4 months ago

manuelbarbas commented 9 months ago

Stardust

Stardust solution allows developers to quickly create custodial wallets, manage their NFTs, and monetize their collections on a robust marketplace. With this solution it's possible to create a frictionless user onboarding experience, by removing the need for them to manage their own private keys.

For more information check the Stardust documentation

Implementation Example

The following example provides a number of examples on how to use Stardust WaaS. The default chain used is SKALE Chaos Testnet. For the full code repo go here

const { StardustCustodialSDK, StardustApp, StardustWallet } = require("@stardust-gg/stardust-custodial-sdk");
const { STARDUST_API_KEY, RPC_URL } = require("../../config");
const createStardustWallet = require("./createWallet");
const { providers } = require("ethers");
const getStardustWallet = require("./getWallet");

function stardust() {
    const provider = new providers.JsonRpcProvider(RPC_URL);
    const sdk = new StardustCustodialSDK(STARDUST_API_KEY);

    async function getWallet(walletId) {
        return await getStardustWallet(sdk, walletId);
    }

    return {
        createWallet: async() => createStardustWallet(sdk),
        getWallet,
        getSigner: async(walletId) => {
            const wallet = await getWallet(walletId);
            return wallet.signers.ethers.connect(provider);
        }
    }
}
module.exports = stardust();
manuelbarbas commented 8 months ago

What is: Wallet Language: API Based Target: Web, Mobile, Unity, ...