-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2df96e
commit c5f7746
Showing
5 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { BRC20Deploy, JsonRpcDatasource, Ordit } from '@sadoprotocol/ordit-sdk' | ||
|
||
const network = 'regtest' | ||
const wallet = new Ordit({ | ||
bip39: '<mnemonic>', | ||
network | ||
}) | ||
wallet.setDefaultAddress('taproot') | ||
const datasource = new JsonRpcDatasource({ network }) | ||
|
||
async function main() { | ||
const tx = new BRC20Deploy({ | ||
address: wallet.selectedAddress, | ||
pubKey: wallet.publicKey, | ||
destinationAddress: wallet.selectedAddress, | ||
feeRate: 2, | ||
network: 'regtest', | ||
tick: 'TEST', | ||
supply: 1000000000, | ||
limit: 100, | ||
}) | ||
|
||
const revealData = await tx.reveal() | ||
console.log({ revealData }) | ||
|
||
const hex = await tx.deploy() | ||
const signedTxHex = wallet.signPsbt(hex, { isRevealTx: true }) | ||
const txId = await datasource.relay({ hex: signedTxHex }) | ||
|
||
console.log({ txId }) | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { BRC20Mint, JsonRpcDatasource, Ordit } from '@sadoprotocol/ordit-sdk' | ||
|
||
const network = 'regtest' | ||
const wallet = new Ordit({ | ||
bip39: '<mnemonic>', | ||
network | ||
}) | ||
wallet.setDefaultAddress('taproot') | ||
const datasource = new JsonRpcDatasource({ network }) | ||
|
||
async function main() { | ||
const tx = new BRC20Mint({ | ||
address: wallet.selectedAddress, | ||
pubKey: wallet.publicKey, | ||
destinationAddress: wallet.selectedAddress, | ||
feeRate: 2, | ||
network, | ||
tick: 'TEST', | ||
amount: 100 | ||
}) | ||
|
||
const revealData = await tx.reveal() | ||
console.log({ revealData }) | ||
|
||
const hex = await tx.mint() | ||
if(!hex) return | ||
|
||
const signedTxHex = wallet.signPsbt(hex, { isRevealTx: true }) | ||
const txId = await datasource.relay({ hex: signedTxHex }) | ||
|
||
console.log({ txId }) | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { BRC20TransferExecutor, JsonRpcDatasource, Ordit } from '@sadoprotocol/ordit-sdk' | ||
|
||
const network = 'regtest' | ||
const wallet = new Ordit({ | ||
bip39: '<mnemonic>', | ||
network | ||
}) | ||
|
||
const destWallet = new Ordit({ | ||
bip39: '<mnemonic>', | ||
network | ||
}) | ||
|
||
wallet.setDefaultAddress('taproot') | ||
destWallet.setDefaultAddress('taproot') | ||
const datasource = new JsonRpcDatasource({ network }) | ||
const destinationAddress = wallet.selectedAddress | ||
|
||
async function main() { | ||
const tx = new BRC20TransferExecutor({ | ||
address: wallet.selectedAddress, | ||
pubKey: wallet.publicKey, | ||
destinationAddress, | ||
feeRate: 2, | ||
network, | ||
tick: 'TEST', | ||
amount: 10 | ||
}) | ||
|
||
const hex = await tx.transfer() | ||
if(hex) { | ||
const signedTxHex = wallet.signPsbt(hex, { isRevealTx: true }) | ||
const txId = await datasource.relay({ hex: signedTxHex }) | ||
console.log({ txId }) | ||
} | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { BRC20TransferGenerator, JsonRpcDatasource, Ordit } from '@sadoprotocol/ordit-sdk' | ||
|
||
const network = 'regtest' | ||
const wallet = new Ordit({ | ||
bip39: '<mnemonic>', | ||
network | ||
}) | ||
wallet.setDefaultAddress('taproot') | ||
const datasource = new JsonRpcDatasource({ network }) | ||
|
||
async function main() { | ||
const tx = new BRC20TransferGenerator({ | ||
address: wallet.selectedAddress, | ||
pubKey: wallet.publicKey, | ||
feeRate: 3, | ||
network, | ||
tick: 'TEST', | ||
amount: 10 | ||
}) | ||
|
||
const revealData = await tx.reveal() | ||
console.log({ revealData }) | ||
|
||
// generate transfer inscription | ||
const hex = await tx.generate() | ||
|
||
if(hex) { | ||
const signedTxHex = wallet.signPsbt(hex, { isRevealTx: true }) | ||
const txId = await datasource.relay({ hex: signedTxHex }) | ||
console.log({ txId }) | ||
} | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters