npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@unielon/coin-dogecoin

v1.0.30

Published

Dogecoin SDK is used to interact with the Dogecoin Mainnet or Testnet, it contains various functions can be used to web3 wallet.

Downloads

461

Readme

@unielon/coin-dogecoin

Dogecoin SDK is used to interact with the Dogecoin Mainnet or Testnet, it contains various functions can be used to web3 wallet.

What Can Dogecoin SDK Do

  • Deploy drc-20
  • Mint drc-20
  • Deposit WDOGE
  • Withdraw WDOGE
  • Add or remove the liquidity of pairs
  • Swap the liquidity of pairs
  • Create drc20-paris
  • Create Order
  • Cancel Order
  • Trade Order
  • Mint box
  • Deploy box
  • Stake the liquidity of pairs

Getting Started

Installing Dogecoin SDK

npm install @unielon/coin-dogecoin

Using Dogecoin SDK

import { DogeWallet } from "@unielon/coin-dogecoin";
let wallet = new DogeWallet()
let privateKey = "QRJx7uvj55L3oVRADWJfFjJ31H9Beg75xZ2GcmR8rKFNHA4ZacKJ"
const commitTxPrevOutputList: PrevOutput[] = [];
commitTxPrevOutputList.push({
    txId: "3cb1d8da082b2146b8f4c09b06e38eb37f0263ecefb8a52600accc75ccef4c90",
    vOut: 1,
    amount: 793850000,
    address: "DJu5mMUKprfnyBhot2fqCsW9sZCsfdfcrZ",
    privateKey: privateKey,
});
const inscriptionDataList: DrcInscriptionData[] = [];
inscriptionDataList.push({
  contentType: 'text/plain;charset=utf-8',
  body: `{"p":"drc-20","op":"deploy","tick": "GOODS" ,"max": "210000000000", "lim": "1000000"}`,
  revealAddr: 'DJu5mMUKprfnyBhot2fqCsW9sZCsfdfcrZ',
  repeat: repeat || 1
});
const request = {
  commitTxPrevOutputList,
  commitFeeRate: 50000,
  revealFeeRate: 50000,
  inscriptionDataList,
  changeAddress: 'DJu5mMUKprfnyBhot2fqCsW9sZCsfdfcrZ',
};
const res =  await wallet.inscribeDrc(dogeCoin, request)

Deploy drc-20

Inscribe the deploy function to you ordinal compatible wallet with the desired drc-20 parameters set. It's a example of deploy script as following:

{ 
  "p": "drc-20",
  "op": "deploy",
  "tick": "wow",
  "max": "1000000",
  "lim": "100"
}

command parameter description | Key | Require | Description | |------|---------|--------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (Deploy, Mint, Transfer) | | tick | yes | Ticker: letter identifier of the drc-20, equal to 3 or 4 characters | | max | yes | Max supply: set max supply of the drc-20 | | lim | no | Mint limit: If letting users mint to themsleves, limit per cardinal |

Mint drc-20

Inscribe the mint function to your cardinal compatible wallet. Make sure the ticker matches either a) the drc-20 you deployed in step 1, or b) any drc-20 that has yet to reach its fully diluted supply. Also if the drc-20 has a mint limit, make sure not to surpass this.

It's a example of mint script as following:

{ 
  "p": "drc-20",
  "op": "mint",
  "tick": "wow",
  "amt": "100"
}

command parameter description | Key | Require | Description | |------|---------|--------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (Deploy, Mint, Transfer) | | tick | yes | Ticker: letter identifier of the drc-20, equal to 3 or 4 characters | | amt | yes | Amount to mint: States the amount of the drc-20 to mint. Has to be less than "lim" above if stated |

WDOGE

WDOGE is a special kind of drc20. Its mint volume depends entirely on the user’s pledge amount. User can receive wdoge when he/she deposit dogecoin . The amount he/she withdraw is same with he/she deposit. Hence there are two operator of wdoge: withdraw and deposit.

It's the examples of both scripts as following:

{ 
  "p": "wdoge",
  "op": "deposit",
  "tick": "WDOGE(WRAPPED-DOGE)",
  "amt": "100"
}
{ 
  "p": "wdoge",
  "op": "withdraw",
  "tick": "WDOGE(WRAPPED-DOGE)",
  "amt": "100"
}

Add or remove the liquidity of pairs

The user can add or remove the liquidity of pairs, and the liquidity of pairs provide the price. Every add or remove operation inscribe inscriptions to the dogecoin chain. It's a example of add script as following:

{ 
  "p": "pair-v1",
  "op": "add",
  "tick0": "wow",
  "tick1": "doge",
  "amt0": "1000000", 
  "amt1": "1000",
  "addr": "Dxxxxxxxx"
}

It's a example of remove script as following:

{ 
  "p": "pair-v1",
  "op": "remove",
  "tick0": "wow",
  "tick1": "doge",
  "amt": "1000000", 
  "addr": "Dxxxxxxxx"
}

command parameter description | Key | Require | Description | |------|---------|--------------------------------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (create, add, remove, swap) | | tick | yes | Ticker: letter identifier of the two drc-20 | | amt | yes | Amount: the amount of add or remove drc-20 | | addr | optional| add liquidity operation get reward of the pairs operation |

Swap the liquidity of pairs

Any user can swap one drc-20 for another drc-20 using the drc-20 pairs. Every swap operation inscribe inscriptions to the dogecoin chain. It's a example of create script as following:

{ 
  "p": "pair-v1",
  "op": "swap",
  "tick0": "wow",
  "tick1": "doge",
  "amt0": "10", 
  "amt1": "1",
}

command parameter description | Key | Require | Description | |------|---------|--------------------------------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (create, add, remove, swap) | | tick | yes | Ticker: letter identifier of the two drc-20, user transfer from first drc-20 for second drc-20 | | amt | yes | Amount: the amount of swap drc-20, the user balance remove the first one of first drc-20 and get the second one of second drc-20 |

Create drc20-pairs

Inscribe the drc20-pairs function to your compatible wallet with the desired drc-20 parameters set. Here's an example of a create script:

{ 
  "p": "pair-v1",
  "op": "create",
  "tick0": "wow",
  "tick1": "doge",
  "addr": "Dxxxxxxxx"
}

Create Order

Makers can create a depending order at the price they expect. Every order create operation inscribe inscriptions to the dogecoin chain. It's a example of create script as following:

{ 
  "p": "order-v1",
  "op": "create",
  "tick0": "wow",
  "tick1": "doge",
  "amt0": "10", 
  "amt1": "1",
}

command parameter description | Key | Require | Description | |-------|---------|------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (create,) | | tick0 | yes | The drc20 type makers sell | | tick1 | yes | The drc20 type makers buy | | amt0 | yes | The drc20 amount makers buy | | amt1 | yes | The drc20 amount makers buy |

Cancel Order

Makers can cancel a depending order at the amount they expect. Every order cancel operation inscribes inscriptions to the dogecoin chain. Here's an example of a cancel script:

{ 
  "p": "order-v1",
  "op": "cancel",
  "exid": "xxxxxxxxxxxxxxxxx",
  "amt0": "10"
}

command parameter description | Key | Require | Description | |------|---------|---------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (cancel) | | exid | yes | The depending order id | | amt0 | yes | The drc20 amount makers suppose to cancel |

Trade Order

Takers can fill the orders created by the makers. Every order trade operation inscribe inscriptions to the dogecoin chain. It's a example of create script as following:

{ 
  "p": "order-v1",
  "op": "trade",
  "exid": "xxxxxxxxxxxxxxxxx",
  "amt1": "10",
}

command parameter description | Key | Require | Description | |------|---------|--------------------------------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (trade) | | exid | yes | The depending order id | | amt1 | yes | The drc20 amount makers suppose to trade, it's the drc20 type makers buy|

Mint box

Anyone mint a box drc20 token. It's a example of create script as following:

{ 
  "p": "box-v1",
  "op": "mint",
  "tick0": "unix",
  "amt1": "10",
}

command parameter description | Key | Require | Description | |-------|---------|---------------------------------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (mint) | | tick0 | yes | The drc20 type which will be mint | | amt1 | yes | The amount which pay tick1 for tick0 |

Deploy box

Anyone deploy a box drc20 token. He/she can create a deploy a inscription. This inscription contains the token which will deploy and the token which provide liquidity. For example, 50% of the deployment amount will be used for user minting, while the remaining 50% will be automatically added to liquidity after minting is completed.

It's a example of create script as following:

{ 
  "p": "box-v1",
  "op": "deploy",
  "tick0": "unix",
  "tick1": "wdoge",
  "max": "10000",
  "amt0": "5000", 
  "amt1": "0",
  "liqamt": "5000",
  "liqblock": "5xxxxxx"
}

command parameter description | Key | Require | Description | |---------|---------|---------------------------------------------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event (deploy) | | tick0 | yes | The drc20 type which will be mint | | tick1 | yes | The drc20 type for establishing trading pairs, it should be a token with consensus value, such as wdoge | | max | yes | The total amount of the deploying token | | amt0 | yes | The amount of the deploying token which reserved for mining(pre-sale tokens) | | amt1 | no | Reserved | | liqamt | yes | The amount of token1 which will fill in the pairs | | liqblock| yes | The ending block height of box drc20 pre-sale |

Stake the liquidity of pairs

Any user who add liquidity of unix/wdoge pairs can stake their lp to get some reward, or any user stake their unix to get reward. The operation inscribe inscriptinos to the dogecoin chain. It's a example of create script as following:

{ 
  "p": "stake-v1",
  "op": "stake", ["unstake", "getallreward"]
  "tick": "unix-doge", ["unix"]
  "amt": "10", 
}

command parameter description | Key | Require | Description | |------|---------|------------------------------------------------------------| | p | yes | Protocol: Helps other systems identify and process drc-20 events | | op | yes | Operation: Type of event, stake or unstake | | tick | yes | Ticker: support unix-doge or unix | | amt | yes | Amount: the liquidity of the tick0-tick1 pair |

License: MIT