0.0.22 • Published 1 year ago

swagmi v0.0.22

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

swagmi

Svelte primitives for working with wagmi and ethers.

Installation

pnpm add swagmi ethers@^5

Usage

<script>
    import { Wagmi, Wallet, NFT, ConnectButton, ContractRead, ContractWrite, wallet, wagmi } from 'swagmi';
</script>

<Wagmi let:connected let:wagmi>
    {#if !connected}
        <ConnectButton />
    {:else}
        <Wallet let:wallet>
            <!-- Read NFT asset from Opensea API (default) -->
            <NFT source="opensea" contract={nftContractAddress} tokenId={tokenId} let:nft>
                <img src={nft.image_url} />
            </NFT>

            <!-- Read NFT tokenUri from contract -->
            <NFT source="contract" contract={nftContractAddress} abi={nftContractAbi} tokenId={tokenId} let:nft>
                <img src={nft.image_url} />
            </NFT>


            <ContractRead address={tokenContract} method="balanceOf" args={[$wallet.address]} let:result>
                <p>Balance: {result}</p>
            </ContractRead>

            <ContractWrite address={nftContract} method="mint" args={[$wallet.address]} value="0.01" let:tx let:result>
                {#if result}
                    <Receipt receipt={result} />
                {:else if tx}
                    <Transaction {tx}>
                {/if}
                <p class="text-red-500" slot="error" let:error>{error.message}</p>
            </ContractWrite>
        </Wallet>
    {/if}
</Wagmi>
0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.0

1 year ago