├── public ├── CNAME ├── logo.PNG ├── favicon.ico ├── logo192.png ├── logo512.png ├── robots.txt ├── manifest.json ├── index.html ├── bsv20Mint_release_desc_6.json ├── bsv20Mint_release_desc_8.json ├── bsv20Mint_release_desc_12.json ├── bsv20Mint_release_desc_16.json └── bsv20Mint_release_desc_20.json ├── src ├── react-app-env.d.ts ├── setupTests.ts ├── App.test.tsx ├── utils.ts ├── index.css ├── reportWebVitals.ts ├── App.css ├── index.tsx ├── contracts │ ├── ordinals1satDemo.ts │ └── bsv20Mint.ts ├── ordinalText.tsx ├── logo.svg ├── ordinalImage.tsx ├── AppContext.tsx ├── App.tsx ├── bsv20v1.tsx └── bsv20v2.tsx ├── README.md ├── .gitignore ├── config-overrides.js ├── tsconfig.json ├── .github └── workflows │ └── pages.yml ├── scripts ├── privateKey.ts └── deploy.ts ├── package.json └── scrypt └── bsv20Mint.scrypt /public/CNAME: -------------------------------------------------------------------------------- 1 | inscribe.scrypt.io -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /public/logo.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sCrypt-Inc/inscribe/HEAD/public/logo.PNG -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sCrypt-Inc/inscribe/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sCrypt-Inc/inscribe/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sCrypt-Inc/inscribe/HEAD/public/logo512.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/1Sat Ordinals Demo/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | 2 | import { randomBytes } from 'crypto'; 3 | import { bsv } from 'scrypt-ts'; 4 | 5 | export function dummyUTXO(address: bsv.Address, satoshis: number = 1) { 6 | return { 7 | txId: randomBytes(32).toString('hex'), 8 | outputIndex: 0, 9 | script: bsv.Script.fromAddress(address).toHex(), // placeholder 10 | satoshis 11 | } 12 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Inscribe 2 | 3 | Use [Panda Wallet](https://github.com/Panda-Wallet/panda-wallet) to inscribe [1Sat Ordinals](https://docs.1satordinals.com/) and mint [BSV-20](https://docs.1satordinals.com/bsv20) Tokens. 4 | 5 | ## Install 6 | 7 | ```bash 8 | npm i 9 | ``` 10 | 11 | ## Run 12 | 13 | ```bash 14 | $ npm start 15 | ``` 16 | 17 | Open http://localhost:3000 to view it in the browser. 18 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /src/reportWebVitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from 'web-vitals'; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | /out 14 | 15 | # misc 16 | .DS_Store 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | .env 27 | /artifacts 28 | scrypt.index.json 29 | tsconfig-scryptTs.json 30 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /config-overrides.js: -------------------------------------------------------------------------------- 1 | const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); 2 | 3 | module.exports = function override(config, env) { 4 | 5 | config.resolve.fallback = { 6 | fs: false, 7 | os: false, 8 | path: false, 9 | module: false 10 | } 11 | 12 | const scopePluginIndex = config.resolve.plugins.findIndex( 13 | ({ constructor }) => constructor && constructor.name === 'ModuleScopePlugin' 14 | ); 15 | 16 | config.resolve.plugins.splice(scopePluginIndex, 1); 17 | 18 | config.plugins.push(new NodePolyfillPlugin({ 19 | excludeAliases: ['console'] 20 | })) 21 | return config; 22 | } -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx", 22 | "experimentalDecorators": true, 23 | "noImplicitAny": false 24 | }, 25 | "include": [ 26 | "src" 27 | ], 28 | "ts-node": { 29 | "compilerOptions": { 30 | "module": "CommonJS" 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | import { AppProvider } from './AppContext'; 8 | 9 | 10 | declare global { 11 | interface Window { 12 | gtag 13 | } 14 | } 15 | 16 | const root = ReactDOM.createRoot( 17 | document.getElementById('root') as HTMLElement 18 | ); 19 | root.render( 20 | 21 | 22 | 23 | 24 | 25 | ); 26 | 27 | // If you want to start measuring performance in your app, pass a function 28 | // to log results (for example: reportWebVitals(console.log)) 29 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 30 | reportWebVitals(); 31 | -------------------------------------------------------------------------------- /src/contracts/ordinals1satDemo.ts: -------------------------------------------------------------------------------- 1 | import { 2 | method, 3 | prop, 4 | SmartContract, 5 | hash256, 6 | assert, 7 | SigHash 8 | } from 'scrypt-ts' 9 | 10 | import type {ByteString} from 'scrypt-ts'; 11 | 12 | export class Ordinals1satDemo extends SmartContract { 13 | @prop(true) 14 | count: bigint 15 | 16 | constructor(count: bigint) { 17 | super(count) 18 | this.count = count 19 | } 20 | 21 | @method(SigHash.SINGLE) 22 | public increment() { 23 | this.count++ 24 | 25 | // make sure balance in the contract does not change 26 | const amount: bigint = this.ctx.utxo.value 27 | // output containing the latest state 28 | const output: ByteString = this.buildStateOutput(amount) 29 | // verify current tx has this single output 30 | assert(this.ctx.hashOutputs === hash256(output), 'hashOutputs mismatch') 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.github/workflows/pages.yml: -------------------------------------------------------------------------------- 1 | name: pages build and deployment 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Prepare git 11 | run: git config --global core.autocrlf false 12 | - name: Checkout 13 | uses: actions/checkout@v3 14 | with: 15 | submodules: true 16 | # Setup .npmrc file to publish to npm 17 | - uses: actions/setup-node@v3 18 | with: 19 | node-version: "18.x" 20 | registry-url: "https://registry.npmjs.org" 21 | - run: npm ci 22 | - name: Build contract 23 | run: npm run build:contract 24 | 25 | # build the react app 26 | - name: Build 27 | run: CI=false npm run build 28 | 29 | # deploy the react app to github pages 30 | - name: Deploy 31 | uses: peaceiris/actions-gh-pages@v3 32 | with: 33 | # NOTE: GITHUB_TOKEN is a secret token that is automatically generated by GitHub 34 | github_token: ${{ secrets.GITHUB_TOKEN }} 35 | publish_dir: ./build # directory to deploy 36 | -------------------------------------------------------------------------------- /scripts/privateKey.ts: -------------------------------------------------------------------------------- 1 | import { bsv } from 'scrypt-ts' 2 | import * as dotenv from 'dotenv' 3 | import * as fs from 'fs' 4 | 5 | const dotenvConfigPath = '.env' 6 | dotenv.config({ path: dotenvConfigPath }) 7 | 8 | // Read the private key from the .env file. 9 | // The default private key inside the .env file is meant to be used for the Bitcoin testnet. 10 | // See https://scrypt.io/docs/bitcoin-basics/bsv/#private-keys 11 | let privKey = process.env.PRIVATE_KEY || '' 12 | if (!privKey) { 13 | genPrivKey() 14 | } else { 15 | showAddr(bsv.PrivateKey.fromWIF(privKey)) 16 | } 17 | 18 | export function genPrivKey() { 19 | const newPrivKey = bsv.PrivateKey.fromRandom('testnet') 20 | console.log(`Missing private key, generating a new one ... 21 | Private key generated: '${newPrivKey.toWIF()}' 22 | You can fund its address '${newPrivKey.toAddress()}' from the sCrypt faucet https://scrypt.io/faucet`) 23 | // auto generate .env file with new generated key 24 | fs.writeFileSync(dotenvConfigPath, `PRIVATE_KEY="${newPrivKey}"`) 25 | privKey = newPrivKey.toWIF() 26 | } 27 | 28 | export function showAddr(privKey: bsv.PrivateKey) { 29 | console.log(`Private key already present ... 30 | You can fund its address '${privKey.toAddress()}' from the sCrypt faucet https://scrypt.io/faucet`) 31 | } 32 | 33 | export const privateKey = bsv.PrivateKey.fromWIF(privKey) 34 | -------------------------------------------------------------------------------- /scripts/deploy.ts: -------------------------------------------------------------------------------- 1 | import { writeFileSync } from 'fs' 2 | import { Ordinals1satDemo } from '../src/contracts/ordinals1satDemo' 3 | import { privateKey } from './privateKey' 4 | import { bsv, TestWallet, DefaultProvider, sha256 } from 'scrypt-ts' 5 | 6 | function getScriptHash(scriptPubKeyHex: string) { 7 | const res = sha256(scriptPubKeyHex).match(/.{2}/g) 8 | if (!res) { 9 | throw new Error('scriptPubKeyHex is not of even length') 10 | } 11 | return res.reverse().join('') 12 | } 13 | 14 | async function main() { 15 | await Ordinals1satDemo.compile() 16 | 17 | // Prepare signer. 18 | // See https://scrypt.io/docs/how-to-deploy-and-call-a-contract/#prepare-a-signer-and-provider 19 | const signer = new TestWallet(privateKey, new DefaultProvider({ 20 | network: bsv.Networks.testnet 21 | })) 22 | 23 | // TODO: Adjust the amount of satoshis locked in the smart contract: 24 | const amount = 100 25 | 26 | const instance = new Ordinals1satDemo( 27 | // TODO: Pass constructor parameter values. 28 | 0n 29 | ) 30 | 31 | // Connect to a signer. 32 | await instance.connect(signer) 33 | 34 | // Contract deployment. 35 | const deployTx = await instance.deploy(amount) 36 | 37 | // Save deployed contracts script hash. 38 | const scriptHash = getScriptHash(instance.lockingScript.toHex()) 39 | const shFile = `.scriptHash`; 40 | writeFileSync(shFile, scriptHash); 41 | 42 | console.log('Ordinals1satDemo contract was successfully deployed!') 43 | console.log(`TXID: ${deployTx.id}`) 44 | console.log(`scriptHash: ${scriptHash}`) 45 | } 46 | 47 | main() 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ordinals-1sat-demo", 3 | "version": "0.1.0", 4 | "homepage": "https://inscribe.scrypt.io", 5 | "private": true, 6 | "dependencies": { 7 | "@emotion/react": "^11.11.1", 8 | "@emotion/styled": "^11.11.0", 9 | "@mui/material": "^5.14.18", 10 | "@testing-library/jest-dom": "^5.17.0", 11 | "@testing-library/react": "^13.4.0", 12 | "@testing-library/user-event": "^13.5.0", 13 | "@types/jest": "^27.5.2", 14 | "@types/node": "^16.18.65", 15 | "@types/react": "^18.2.38", 16 | "@types/react-dom": "^18.2.17", 17 | "axios": "^1.6.2", 18 | "gh-pages": "^6.1.0", 19 | "react": "^18.2.0", 20 | "react-dom": "^18.2.0", 21 | "react-images-uploading": "^3.1.7", 22 | "react-router-dom": "^6.20.0", 23 | "react-scripts": "5.0.1", 24 | "scrypt-ord": "^1.0.16", 25 | "scrypt-ts": "^1.3.23", 26 | "typescript": "^4.9.5", 27 | "usehooks-ts": "^2.9.1", 28 | "web-vitals": "^2.1.4" 29 | }, 30 | "scripts": { 31 | "predeploy": "npm run build", 32 | "deploy": "gh-pages -d build", 33 | "start": "react-app-rewired start", 34 | "build": "react-app-rewired build", 35 | "test": "react-app-rewired test", 36 | "eject": "react-scripts eject", 37 | "pretest": "npx scrypt-cli compile", 38 | "build:contract": "npx scrypt-cli compile", 39 | "deploy:contract": "npx ts-node ./scripts/deploy.ts", 40 | "verify:contract": "npx scrypt-cli verify $(cat .scriptHash) ./src/contracts/ordinals1satDemo.ts", 41 | "genprivkey": "npx ts-node ./scripts/privateKey.ts" 42 | }, 43 | "eslintConfig": { 44 | "extends": [ 45 | "react-app", 46 | "react-app/jest" 47 | ] 48 | }, 49 | "browserslist": { 50 | "production": [ 51 | ">0.2%", 52 | "not dead", 53 | "not op_mini all" 54 | ], 55 | "development": [ 56 | "last 1 chrome version", 57 | "last 1 firefox version", 58 | "last 1 safari version" 59 | ] 60 | }, 61 | "devDependencies": { 62 | "node-polyfill-webpack-plugin": "^2.0.1", 63 | "react-app-rewired": "^2.2.1" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | sCrypt 28 | 29 | 30 | 36 | 37 | 38 | 39 |
40 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/ordinalText.tsx: -------------------------------------------------------------------------------- 1 | import { useState, useRef } from "react"; 2 | import { Container, Box, Typography, Button, TextField } from "@mui/material"; 3 | import { OrdiNFTP2PKH } from "scrypt-ord"; 4 | import { Addr, PandaSigner } from "scrypt-ts"; 5 | import { Navigate } from "react-router-dom"; 6 | import { useAppProvider } from "./AppContext"; 7 | 8 | function OrdinalText(props) { 9 | 10 | const { ordiAddress: _ordiAddress, 11 | signer: _signer, 12 | connected 13 | } = useAppProvider(); 14 | 15 | const [result, setResult] = useState(undefined); 16 | 17 | const mint = async () => { 18 | try { 19 | const signer = _signer as PandaSigner; 20 | await signer.requestAuth() 21 | 22 | const value = text.current?.value; 23 | if (value !== undefined) { 24 | const instance = new OrdiNFTP2PKH(Addr(_ordiAddress!.toByteString())); 25 | console.log("value :", value); 26 | await instance.connect(signer); 27 | const inscriptionTx = await instance.inscribeText(value); 28 | setResult(`Text Inscription ID: ${inscriptionTx.id}`); 29 | } else { 30 | setResult("Error: Input value is undefined"); 31 | } 32 | } catch (e: any) { 33 | console.error('error', e) 34 | setResult(`${e.message ?? e}`) 35 | } 36 | 37 | if (window.gtag) { 38 | window.gtag('event', 'inscribe-text'); 39 | } 40 | }; 41 | 42 | const text: React.RefObject = useRef(null); 43 | 44 | return ( 45 | 46 | {!connected() && } 47 | 48 | 49 | Inscribe Text 50 | 51 | 52 | 53 | 54 | 55 | 63 | 64 | {result && ( 65 | 66 | {result} 67 | 68 | )} 69 | 70 | ); 71 | } 72 | 73 | export default OrdinalText; 74 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/contracts/bsv20Mint.ts: -------------------------------------------------------------------------------- 1 | import { BSV20V2 } from 'scrypt-ord' 2 | import { 3 | ByteString, 4 | Addr, 5 | hash256, 6 | method, 7 | prop, 8 | toByteString, 9 | assert, 10 | MethodCallOptions, 11 | ContractTransaction, 12 | bsv, 13 | } from 'scrypt-ts' 14 | 15 | export class BSV20Mint extends BSV20V2 { 16 | @prop(true) 17 | supply: bigint 18 | 19 | @prop() 20 | lim: bigint 21 | 22 | constructor( 23 | id: ByteString, 24 | sym: ByteString, 25 | max: bigint, 26 | dec: bigint, 27 | lim: bigint 28 | ) { 29 | super(id, sym, max, dec) 30 | this.init(...arguments) 31 | 32 | this.supply = max 33 | this.lim = lim 34 | } 35 | 36 | @method() 37 | public mint(dest: Addr, amount: bigint) { 38 | // Check mint amount doesn't exceed maximum. 39 | assert(amount <= this.lim, 'mint amount exceeds maximum') 40 | assert(amount > 0n, 'mint amount should > 0') 41 | 42 | this.supply -= amount 43 | assert(this.supply >= 0n, 'all supply mint out') 44 | let outputs = toByteString('') 45 | 46 | if (this.supply > 0n) { 47 | outputs += this.buildStateOutputFT(this.supply) 48 | } 49 | 50 | // Build FT P2PKH output to dest paying specified amount of tokens. 51 | outputs += BSV20V2.buildTransferOutput(dest, this.id, amount) 52 | 53 | // Build change output. 54 | outputs += this.buildChangeOutput() 55 | 56 | this.debug.diffOutputs(outputs) 57 | 58 | assert(hash256(outputs) === this.ctx.hashOutputs, 'hashOutputs mismatch') 59 | } 60 | 61 | static async mintTxBuilder( 62 | current: BSV20Mint, 63 | options: MethodCallOptions, 64 | dest: Addr, 65 | amount: bigint 66 | ): Promise { 67 | const defaultAddress = await current.signer.getDefaultAddress() 68 | 69 | const remaining = current.supply - amount 70 | 71 | const tx = new bsv.Transaction().addInput(current.buildContractInput()) 72 | 73 | const nexts: any[] = [] 74 | const tokenId = current.getTokenId() 75 | if (remaining > 0n) { 76 | const next = current.next() 77 | 78 | if (!next.id) { 79 | next.id = toByteString(tokenId, true) 80 | } 81 | 82 | next.supply = remaining 83 | next.setAmt(remaining) 84 | 85 | tx.addOutput( 86 | new bsv.Transaction.Output({ 87 | satoshis: 1, 88 | script: next.lockingScript, 89 | }) 90 | ) 91 | 92 | nexts.push({ 93 | instance: next, 94 | balance: 1, 95 | atOutputIndex: 0, 96 | }) 97 | } 98 | 99 | tx.addOutput( 100 | bsv.Transaction.Output.fromBufferReader( 101 | new bsv.encoding.BufferReader( 102 | Buffer.from( 103 | BSV20V2.buildTransferOutput( 104 | dest, 105 | toByteString(tokenId, true), 106 | amount 107 | ), 108 | 'hex' 109 | ) 110 | ) 111 | ) 112 | ) 113 | 114 | tx.change(options.changeAddress || defaultAddress) 115 | return { tx, atInputIndex: 0, nexts } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/ordinalImage.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | import './App.css'; 3 | import { OrdiNFTP2PKH } from 'scrypt-ord'; 4 | import { Addr, PandaSigner } from 'scrypt-ts'; 5 | import ImageUploading, { ImageListType } from 'react-images-uploading'; 6 | import { Container, Box, Typography, Button } from '@mui/material'; 7 | import { Navigate } from 'react-router-dom'; 8 | import { useAppProvider } from './AppContext'; 9 | 10 | function OrdinalImage(props) { 11 | 12 | const { ordiAddress: _ordiAddress, 13 | signer: _signer, 14 | connected 15 | } = useAppProvider(); 16 | 17 | 18 | const [images, setImages] = useState([]) 19 | 20 | const onImagesChange = (imageList: ImageListType) => { 21 | setImages(imageList); 22 | } 23 | 24 | const [_result, setResult] = useState(undefined) 25 | 26 | const inscribe = async () => { 27 | try { 28 | const signer = _signer as PandaSigner; 29 | await signer.requestAuth() 30 | 31 | const instance = new OrdiNFTP2PKH(Addr(_ordiAddress!.toByteString())) 32 | await instance.connect(signer) 33 | 34 | const image = images[0] 35 | const b64 = Buffer.from(await image.file!.arrayBuffer()).toString('base64') 36 | const inscribeTx = await instance.inscribeImage(b64, image.file!.type) 37 | 38 | setResult(`Inscribe Tx: ${inscribeTx.id}`) 39 | setImages([]) 40 | } catch (e: any) { 41 | console.error('error', e) 42 | setResult(`${e.message ?? e}`) 43 | } 44 | 45 | if (window.gtag) { 46 | window.gtag('event', 'inscribe-image'); 47 | } 48 | } 49 | 50 | return ( 51 | 52 | {!connected() && ()} 53 | 54 | 55 | Inscribe Image 56 | 57 | 58 | 59 | { 60 | 61 | { 62 | ({ imageList, onImageUpload, onImageRemoveAll, isDragging, dragProps }) => ( 63 | <> 64 | 65 | 68 | 71 | 72 | { 73 | imageList.map( 74 | (image, index) => ( 75 | 76 | 77 | 78 | 79 | 80 | 83 | 84 | ) 85 | ) 86 | } 87 | 88 | ) 89 | } 90 | 91 | } 92 | 93 | { 94 | !_result 95 | ? '' 96 | : ({_result}) 97 | } 98 | 99 | ); 100 | } 101 | 102 | export default OrdinalImage; 103 | -------------------------------------------------------------------------------- /src/AppContext.tsx: -------------------------------------------------------------------------------- 1 | import React, { 2 | createContext, 3 | useEffect, 4 | useState, 5 | useRef, 6 | useContext, 7 | } from "react"; 8 | import { PandaSigner, UTXO, bsv } from "scrypt-ts"; 9 | import { OrdiProvider } from "scrypt-ord"; 10 | export interface AppContextProps { 11 | network: bsv.Networks.Network | null; 12 | 13 | price: number; 14 | feePerKb: number; 15 | payAddress: bsv.Address | null; 16 | ordiAddress: bsv.Address | null; 17 | error: string | null; 18 | connect: () => void; 19 | signer: PandaSigner; 20 | connected: () => boolean; 21 | } 22 | 23 | export const AppContext = createContext(undefined); 24 | 25 | interface AppProviderProps { 26 | children: React.ReactNode; 27 | } 28 | 29 | export const AppProvider = (props: AppProviderProps) => { 30 | const { children } = props; 31 | const [_price, setPrice] = useState(0); 32 | 33 | const [_utxos, setUTXOs] = useState([]); 34 | const [_feePerKb, setFeePerKb] = useState(1); 35 | 36 | const signer = useRef(new PandaSigner(new OrdiProvider())); 37 | 38 | const [_payAddress, setPayAddress] = useState(null); 39 | const [_ordiAddress, setOrdiAddress] = useState(null); 40 | const [_network, setNetwork] = useState( 41 | null 42 | ); 43 | const [_error, setError] = useState(null); 44 | 45 | const connect = async () => { 46 | try { 47 | const { isAuthenticated, error } = await signer.current.requestAuth(); 48 | if (!isAuthenticated) { 49 | throw new Error(error); 50 | } 51 | 52 | setPayAddress(await signer.current.getDefaultAddress()); 53 | setOrdiAddress(await signer.current.getOrdAddress()); 54 | setNetwork(await signer.current.getNetwork()); 55 | setError(null); 56 | } catch (e: any) { 57 | console.error("error", e); 58 | setError(`${e.message ?? e}`); 59 | } 60 | }; 61 | 62 | useEffect(() => { 63 | fetch("https://api.whatsonchain.com/v1/bsv/main/exchangerate") 64 | .then((res) => res.json()) 65 | .then((data) => { 66 | setPrice(data?.rate || 0); 67 | }) 68 | .catch((e) => { 69 | setPrice(0); 70 | console.error("error", e); 71 | }); 72 | }, []); 73 | 74 | useEffect(() => { 75 | if (_payAddress) { 76 | signer.current 77 | .listUnspent(_payAddress) 78 | .then((us) => { 79 | setUTXOs(us || []); 80 | }) 81 | .catch((e) => { 82 | console.error("error", e); 83 | }); 84 | } 85 | }, []); 86 | 87 | useEffect(() => { 88 | signer.current 89 | .provider!.getFeePerKb() 90 | .then((fpkb) => { 91 | setFeePerKb(fpkb); 92 | }) 93 | .catch((e) => { 94 | console.error("error", e); 95 | }); 96 | }, []); 97 | 98 | 99 | useEffect(() => { 100 | 101 | const id = setTimeout(() => { 102 | signer.current.isAuthenticated().then(isAuthenticated => { 103 | 104 | if(isAuthenticated) { 105 | 106 | signer.current.getDefaultAddress().then(address => { 107 | setPayAddress(address); 108 | }) 109 | 110 | signer.current.getOrdAddress().then(address => { 111 | setOrdiAddress(address); 112 | }) 113 | 114 | signer.current.getNetwork().then(network => { 115 | setNetwork(network); 116 | }) 117 | } 118 | }) 119 | }, 500) 120 | 121 | return () => clearTimeout(id); 122 | 123 | }, []); 124 | 125 | 126 | 127 | const connected = () => { 128 | return _network !== null && _payAddress !== null && _ordiAddress !== null 129 | }; 130 | 131 | return ( 132 | 145 | {children} 146 | 147 | ); 148 | }; 149 | 150 | export const useAppProvider = (): AppContextProps => { 151 | const context = useContext(AppContext); 152 | if (!context) { 153 | throw new Error("useAppProvider must be used within a AppProvider"); 154 | } 155 | return context; 156 | }; 157 | -------------------------------------------------------------------------------- /scrypt/bsv20Mint.scrypt: -------------------------------------------------------------------------------- 1 | library Ordinal { 2 | static function skipBytes(bytes b) : int { 3 | int len = 0; 4 | int ret = 0; 5 | int header = unpack(b[0 : 1]); 6 | if (header < 0x4c) { 7 | len = header; 8 | ret = 1 + len; 9 | } 10 | else if (header == 0x4c) { 11 | len = Utils.fromLEUnsigned(b[1 : 2]); 12 | ret = 1 + 1 + len; 13 | } 14 | else if (header == 0x4d) { 15 | len = Utils.fromLEUnsigned(b[1 : 3]); 16 | ret = 1 + 2 + len; 17 | } 18 | else if (header == 0x4e) { 19 | len = Utils.fromLEUnsigned(b[1 : 5]); 20 | ret = 1 + 4 + len; 21 | } 22 | else { 23 | ret = -1; 24 | } 25 | return ret; 26 | } 27 | static function isP2PKHOrdinal(bytes script) : bool { 28 | return (len(script) > 25 && Ordinal.isP2PKH(script[0 : 25]) && Ordinal.sizeOfOrdinal(script[25 : len(script)]) > 0); 29 | } 30 | static function isP2PKH(bytes script) : bool { 31 | return (len(script) == 25 && script[0 : 3] == b'76a914' && script[23 : len(script)] == b'88ac'); 32 | } 33 | static function removeInsciption(bytes scriptCode) : bytes { 34 | int inscriptLen = Ordinal.sizeOfOrdinal(scriptCode); 35 | if (inscriptLen > 0) { 36 | scriptCode = scriptCode[inscriptLen : len(scriptCode)]; 37 | } 38 | return scriptCode; 39 | } 40 | static function getInsciptionScript(bytes scriptCode) : bytes { 41 | int inscriptLen = Ordinal.sizeOfOrdinal(scriptCode); 42 | bytes ret = b''; 43 | if (inscriptLen > 0) { 44 | ret = scriptCode[0 : inscriptLen]; 45 | } 46 | return ret; 47 | } 48 | static function sizeOfOrdinal(bytes script) : int { 49 | int ret = -1; 50 | int pos = 0; 51 | if (len(script) >= 11 && script[pos : 7] == b'0063036f726451') { 52 | pos += 7; 53 | int contentTypeLen = Ordinal.skipBytes(script[pos : len(script)]); 54 | if (contentTypeLen > 0) { 55 | pos += contentTypeLen; 56 | if (script[pos : pos + 1] == OpCode.OP_0) { 57 | pos += 1; 58 | int contentLen = Ordinal.skipBytes(script[pos : len(script)]); 59 | if (contentLen > 0) { 60 | pos += contentLen; 61 | if (script[pos : pos + 1] == OpCode.OP_ENDIF) { 62 | pos += 1; 63 | ret = pos; 64 | } 65 | } 66 | } 67 | } 68 | } 69 | return ret; 70 | } 71 | static function createInsciption(bytes content, bytes contentType) : bytes { 72 | return (b'0063036f726451' + VarIntWriter.writeBytes(contentType) + OpCode.OP_FALSE + VarIntWriter.writeBytes(content) + OpCode.OP_ENDIF); 73 | } 74 | 75 | static function txId2str(bytes txid) : bytes { 76 | bytes txidStr = b''; 77 | loop (32) : i { 78 | int index = 32 - i - 1; 79 | bytes char = txid[index : index + 1]; 80 | int cInt = Utils.fromLEUnsigned(char); 81 | int left = cInt / 16 + (cInt / 16 > 9 ? 87 : 48); 82 | int right = cInt % 16 + (cInt % 16 > 9 ? 87 : 48); 83 | txidStr += pack(left) + pack(right); 84 | } 85 | return txidStr; 86 | } 87 | static function int2Str(int n) : bytes { 88 | require(n < 100000000); 89 | bytes res = b''; 90 | bool done = false; 91 | int pow = 1; 92 | loop (8) : i { 93 | if (!done) { 94 | int denominator = pow; 95 | pow = pow * 10; 96 | if (n < denominator) { 97 | done = true; 98 | } 99 | else { 100 | int ithDigit = (n / denominator) % 10; 101 | res = pack(48 + ithDigit) + res; 102 | } 103 | } 104 | } 105 | 106 | return n == 0 ? b'30' : res; 107 | } 108 | } 109 | 110 | contract BSV20Mint { 111 | @state 112 | bytes id; 113 | int max; 114 | int dec; 115 | bytes sym; 116 | @state 117 | int supply; 118 | int lim; 119 | 120 | constructor(bytes id, bytes sym, int max, int dec, int lim) { 121 | this.max = max; 122 | this.dec = dec; 123 | this.id = id; 124 | this.sym = sym; 125 | require(this.max <= 18446744073709551615); 126 | require(this.dec <= 18); 127 | 128 | this.supply = max; 129 | this.lim = lim; 130 | } 131 | function buildStateOutputFT(int amt) : bytes { 132 | bytes stateScript = BSV20Mint.createTransferInsciption(this.id, amt) + Ordinal.removeInsciption(this.getStateScript()); 133 | return Utils.buildOutput(stateScript, 1); 134 | } 135 | 136 | static function buildTransferOutput(Ripemd160 address, bytes id, int amt) : bytes { 137 | bytes transferScript = BSV20Mint.buildTransferScript(address, id, amt); 138 | return Utils.buildOutput(transferScript, 1); 139 | } 140 | static function buildTransferScript(Ripemd160 address, bytes id, int amt) : bytes { 141 | return (BSV20Mint.createTransferInsciption(id, amt) + Utils.buildPublicKeyHashScript(address)); 142 | } 143 | static function createTransferInsciption(bytes id, int amt) : bytes { 144 | bytes amtByteString = Ordinal.int2Str(amt); 145 | bytes transferJSON = "{\"p\":\"bsv-20\",\"op\":\"transfer\",\"id\":\"" + id + "\",\"amt\":\"" + amtByteString + "\"}"; 146 | return Ordinal.createInsciption(transferJSON, "application/bsv-20"); 147 | } 148 | 149 | public function mint(Ripemd160 dest, int amount, SigHashPreimage __scrypt_ts_txPreimage, int __scrypt_ts_changeAmount, Ripemd160 __scrypt_ts_changeAddress) { 150 | require(Tx.checkPreimageSigHashType(__scrypt_ts_txPreimage, SigHashType(b'41'))); 151 | bytes txid = SigHash.outpoint(__scrypt_ts_txPreimage)[0 : 32]; 152 | this.id = this.id == b'' ? (Ordinal.txId2str(txid) + "_0") : this.id; 153 | require(amount <= this.lim); 154 | require(amount > 0); 155 | this.supply -= amount; 156 | require(this.supply >= 0); 157 | bytes output0 = this.supply > 0 ? this.buildStateOutputFT(this.supply) : b''; 158 | 159 | bytes output1 = BSV20Mint.buildTransferOutput(dest, this.id, amount); 160 | bytes output2 = __scrypt_ts_changeAmount > 0 ? Utils.buildOutput(Utils.buildPublicKeyHashScript(__scrypt_ts_changeAddress), __scrypt_ts_changeAmount) : b''; 161 | 162 | require(hash256(output0 + output1 + output2) == SigHash.hashOutputs(__scrypt_ts_txPreimage)); 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | import { BrowserRouter, Routes, Route } from "react-router-dom"; 2 | import { Box, Button, Container, Typography, CssBaseline, Tab, Tabs, Grid } from '@mui/material'; 3 | import { createTheme, ThemeProvider } from '@mui/system'; 4 | import OrdinalImage from './ordinalImage'; 5 | import BSV20v2 from "./bsv20v2"; 6 | import BSV20v1 from "./bsv20v1"; 7 | import { useState } from "react"; 8 | 9 | import OrdinalText from "./ordinalText"; 10 | import { useAppProvider } from "./AppContext"; 11 | 12 | const theme = createTheme({ 13 | palette: { 14 | mode: 'dark', 15 | primary: { 16 | main: "#FE9C2F", 17 | focus: "#FE9C2F", 18 | }, 19 | secondary: { 20 | main: "#FE9C2F", 21 | focus: "#FE9C2F", 22 | }, 23 | info: { 24 | main: "#11cdef", 25 | focus: "#11cdef", 26 | }, 27 | success: { 28 | main: "#2dce89", 29 | focus: "#2dce89", 30 | }, 31 | warning: { 32 | main: "#fb6340", 33 | focus: "#fb6340", 34 | }, 35 | error: { 36 | main: "#f5365c", 37 | focus: "#f5365c", 38 | }, 39 | background: { 40 | default: "#000", 41 | }, 42 | text: { 43 | primary: "#fff", 44 | secondary: "#FE9C2F", 45 | disabled: "#BDBDBD", 46 | hint: "#9E9E9E" 47 | }, 48 | grey: { 49 | 100: "#f8f9fa", 50 | 200: "#e9ecef", 51 | 300: "#dee2e6", 52 | 400: "#ced4da", 53 | 500: "#adb5bd", 54 | 600: "#6c757d", 55 | 700: "#495057", 56 | 800: "#343a40", 57 | 900: "#212529", 58 | }, 59 | common: { 60 | black: '#000', 61 | white: '#fff', 62 | red: '#f00', 63 | }, 64 | action: { 65 | hoverOpacity: 0.1, 66 | }, 67 | }, 68 | typography: { 69 | fontFamily: 'Roboto, sans-serif', 70 | pxToRem: (px) => `${px / 16}rem`, 71 | }, 72 | shadows: ["none", "0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)", /*...*/], 73 | transitions: { 74 | easing: { 75 | easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)', 76 | easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)', 77 | easeIn: 'cubic-bezier(0.4, 0, 1, 1)', 78 | sharp: 'cubic-bezier(0.4, 0, 0.6, 1)', 79 | }, 80 | duration: { 81 | shortest: 150, 82 | shorter: 200, 83 | short: 250, 84 | standard: 300, 85 | complex: 375, 86 | enteringScreen: 225, 87 | leavingScreen: 195, 88 | }, 89 | create: function (property = 'all', options: any = {}) { 90 | let { duration = '300ms', timingFunction = 'ease', delay = '0ms' } = options; 91 | return `${property} ${duration} ${timingFunction} ${delay}`; 92 | }, 93 | }, 94 | components: { 95 | MuiLink: { 96 | styleOverrides: { 97 | root: { 98 | fontWeight: 500, 99 | }, 100 | }, 101 | }, 102 | MuiButton: { 103 | defaultProps: { 104 | size: 'large', 105 | }, 106 | styleOverrides: { 107 | root: { 108 | fontWeight: '700', 109 | '&.Mui-disabled': { 110 | backgroundColor: '#999', 111 | color: '#FFF', 112 | }, 113 | }, 114 | contained: { 115 | color: '#000' 116 | } 117 | }, 118 | }, 119 | MuiOutlinedInput: { 120 | styleOverrides: { 121 | root: { 122 | '& .MuiOutlinedInput-notchedOutline': { 123 | borderColor: '#999', 124 | }, 125 | '&:hover .MuiOutlinedInput-notchedOutline': { 126 | borderColor: '#FE9C2F', 127 | }, 128 | '&.Mui-focused .MuiOutlinedInput-notchedOutline': { 129 | borderColor: '#FE9C2F', 130 | }, 131 | }, 132 | }, 133 | }, 134 | }, 135 | }); 136 | 137 | function Home() { 138 | const { ordiAddress: _ordiAddress, 139 | payAddress: _payAddress, 140 | network: _network, 141 | signer: _signer, 142 | connect, 143 | error: _error, 144 | connected } = useAppProvider(); 145 | 146 | const [_tabIndex, setTabIndex] = useState(0); 147 | 148 | const tabOnChange = (e, tabIndex) => { 149 | if (tabIndex === 0) { 150 | 151 | } else if (tabIndex === 1) { 152 | 153 | } else if (tabIndex === 2) { 154 | 155 | } else if (tabIndex === 3) { 156 | 157 | } 158 | setTabIndex(tabIndex); 159 | }; 160 | 161 | return ( 162 |
163 | 164 | Inscribe on Bitcoin SV 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | {connected() && _tabIndex === 0 && ( 176 | 177 | 178 | 179 | )} 180 | {connected() && _tabIndex === 1 && ( 181 | 182 | 183 | 184 | )} 185 | {connected() && _tabIndex === 2 && ( 186 | 187 | 188 | 189 | )} 190 | {connected() && _tabIndex === 3 && ( 191 | 192 | 193 | 194 | )} 195 | 196 | { 197 | connected() 198 | ? '' 199 | : ( 200 | 201 | 202 | 203 | 204 | 205 |
206 | 207 | 208 | Do not have a Panda Wallet? 209 | 210 |
211 | 212 | 👉 Get it here 213 | 214 |
215 | { 216 | !_error 217 | ? '' 218 | : ( {_error}) 219 | } 220 |
221 | ) 222 | } 223 | 224 | 225 | 226 | Source at Github    227 | Video Tutorial 228 | 229 | 230 | 231 |
232 | ); 233 | } 234 | 235 | function App() { 236 | return ( 237 | 238 | 239 | 240 | 241 | } /> 242 | 243 | 244 | 245 | ) 246 | } 247 | 248 | export default App; 249 | -------------------------------------------------------------------------------- /public/bsv20Mint_release_desc_6.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 9, 3 | "compilerVersion": "1.19.2+commit.f59f89f", 4 | "contract": "BSV20Mint", 5 | "md5": "a0a5706bfb3e105aca3d968ce06f6596", 6 | "structs": [ 7 | { 8 | "name": "SortedItem", 9 | "params": [ 10 | { 11 | "name": "item", 12 | "type": "T" 13 | }, 14 | { 15 | "name": "idx", 16 | "type": "int" 17 | } 18 | ], 19 | "genericTypes": [ 20 | "T" 21 | ] 22 | } 23 | ], 24 | "library": [ 25 | { 26 | "name": "Ordinal", 27 | "params": [], 28 | "properties": [], 29 | "genericTypes": [] 30 | } 31 | ], 32 | "alias": [ 33 | { 34 | "name": "PubKeyHash", 35 | "type": "Ripemd160" 36 | } 37 | ], 38 | "abi": [ 39 | { 40 | "type": "function", 41 | "name": "mint", 42 | "index": 0, 43 | "params": [ 44 | { 45 | "name": "dest", 46 | "type": "Ripemd160" 47 | }, 48 | { 49 | "name": "amount", 50 | "type": "int" 51 | }, 52 | { 53 | "name": "__scrypt_ts_txPreimage", 54 | "type": "SigHashPreimage" 55 | }, 56 | { 57 | "name": "__scrypt_ts_changeAmount", 58 | "type": "int" 59 | }, 60 | { 61 | "name": "__scrypt_ts_changeAddress", 62 | "type": "Ripemd160" 63 | } 64 | ] 65 | }, 66 | { 67 | "type": "constructor", 68 | "params": [ 69 | { 70 | "name": "id", 71 | "type": "bytes" 72 | }, 73 | { 74 | "name": "sym", 75 | "type": "bytes" 76 | }, 77 | { 78 | "name": "max", 79 | "type": "int" 80 | }, 81 | { 82 | "name": "dec", 83 | "type": "int" 84 | }, 85 | { 86 | "name": "lim", 87 | "type": "int" 88 | } 89 | ] 90 | } 91 | ], 92 | "stateProps": [ 93 | { 94 | "name": "id", 95 | "type": "bytes" 96 | }, 97 | { 98 | "name": "supply", 99 | "type": "int" 100 | } 101 | ], 102 | "buildType": "debug", 103 | "file": "file:///c:/Users/myland/code/inscribe/scrypt/bsv20Mint.scrypt", 104 | "hex": "0100010001680176018801a901ac2097dfd76851bf465e8f715593b217714858bbe9570ff3bd5e33840a34e20ff0262102ba79df5f8ae7604a9830f03c7933028186aede0675a16f025dc4f8be8eec0382201008ce7480da41702918d1ec8e6849ba32b4d65b1e40dc669c31a1e6306b266c0000000000000052795b7a755a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a785a7a75597a597a597a597a597a597a597a597a597a54795c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5379597a75587a587a587a587a587a587a587a587a5a7909ffffffffffffffff00a16959790112a1695279587a75577a577a577a577a577a577a577a76577a75567a567a567a567a567a567a6d6d750113797601687f7700005279517f75007f7d7701fd87635379537f75517f777601007e8177537a757b7b5379535479937f75537f777b757c677601fe87635379557f75517f777601007e8177537a757b7b5379555479937f75557f777b757c677601ff87635379597f75517f777601007e8177537a757b7b5379595479937f75597f777b757c675379517f75007f777601007e8177537a757b7b5379515479937f75517f777b757c68686875777777767682776e8c7f757854948c7f7d77815279789454948c777777776e7f75537a757b7b0000707f7776537a757777006e8b7f75787f7778768b537a75777c0100788791777664005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d77775c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d777781587a75577a577a577a577a577a577a577a68011879014178011179011179210ac407f0e4bd44bfc207355a778b046225a7068fc59ee7eda43ad905aadbffc800206c266b30e6a1319c66dc401e5bd6b432ba49688eecd118297041da8074ce081001137956795679aa7676517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01007e817757795679567956795679537956795479577995939521414136d08c5ed2bf3ba048afe6dcaebafeffffffffffffffffffffffffffffff006e6e9776009f636e936776687777777b757c6e5296a0636e7c947b757c6853798277527982775379012080517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01205279947f77545379935279930130787e527e54797e58797e527e53797e52797e57797e777777777777777777777777765779ac7777777777777777777777690118797601687f7501447f777701207f75007f775c790087637600012000948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01208c8c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012052948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012053948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012054948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012055948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012056948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012057948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012058948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012059948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012060948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200111948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200112948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200113948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200114948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200115948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200116948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200117948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200118948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200119948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d77025f307e675c79685d7a755c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a011a795879a169011a7900a0695879011b7994597a75587a587a587a587a587a587a587a587a587975587900a269587900a06358795d797876760340420f9f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011d797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011c797e7777777777770076635167010068775f797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e5b7976009c6301006776687682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e777777777e59797876827754806e7e0051807e77777e77764f00527982775ba2635279577f75787f77070063036f7264518767006863765793775279537982777f75787f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a0636e937b757c537952798b7f7552797f77011e798763788b7b757c5379547982777f7552797f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a06352797893537a757b7b527975547953798b7f7553797f77011d79876352798b537a757b7b5279755279547a7572537a6868756868756875777600a063787682777f75787f777b757c687c777e76517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77777777670068011c795e79011d796f6e76760340420f9f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0123797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0122797e7777777777775379011c79011b797e01147e787e011c797e011a797e777e77777776517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e777777777777011a7900a0630119790116790115797e01147e787e0116797e0114797e77011b797658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77776700686f757e787eaa011d797682776e58947f75780128947f7777778777777777777777777777777777777777777777777777777777777777777777", 105 | "sourceMapFile": "" 106 | } -------------------------------------------------------------------------------- /public/bsv20Mint_release_desc_8.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 9, 3 | "compilerVersion": "1.19.2+commit.f59f89f", 4 | "contract": "BSV20Mint", 5 | "md5": "280849eb7f488dfdd9a9d35f68d00c93", 6 | "structs": [ 7 | { 8 | "name": "SortedItem", 9 | "params": [ 10 | { 11 | "name": "item", 12 | "type": "T" 13 | }, 14 | { 15 | "name": "idx", 16 | "type": "int" 17 | } 18 | ], 19 | "genericTypes": [ 20 | "T" 21 | ] 22 | } 23 | ], 24 | "library": [ 25 | { 26 | "name": "Ordinal", 27 | "params": [], 28 | "properties": [], 29 | "genericTypes": [] 30 | } 31 | ], 32 | "alias": [ 33 | { 34 | "name": "PubKeyHash", 35 | "type": "Ripemd160" 36 | } 37 | ], 38 | "abi": [ 39 | { 40 | "type": "function", 41 | "name": "mint", 42 | "index": 0, 43 | "params": [ 44 | { 45 | "name": "dest", 46 | "type": "Ripemd160" 47 | }, 48 | { 49 | "name": "amount", 50 | "type": "int" 51 | }, 52 | { 53 | "name": "__scrypt_ts_txPreimage", 54 | "type": "SigHashPreimage" 55 | }, 56 | { 57 | "name": "__scrypt_ts_changeAmount", 58 | "type": "int" 59 | }, 60 | { 61 | "name": "__scrypt_ts_changeAddress", 62 | "type": "Ripemd160" 63 | } 64 | ] 65 | }, 66 | { 67 | "type": "constructor", 68 | "params": [ 69 | { 70 | "name": "id", 71 | "type": "bytes" 72 | }, 73 | { 74 | "name": "sym", 75 | "type": "bytes" 76 | }, 77 | { 78 | "name": "max", 79 | "type": "int" 80 | }, 81 | { 82 | "name": "dec", 83 | "type": "int" 84 | }, 85 | { 86 | "name": "lim", 87 | "type": "int" 88 | } 89 | ] 90 | } 91 | ], 92 | "stateProps": [ 93 | { 94 | "name": "id", 95 | "type": "bytes" 96 | }, 97 | { 98 | "name": "supply", 99 | "type": "int" 100 | } 101 | ], 102 | "buildType": "debug", 103 | "file": "file:///c:/Users/myland/code/inscribe/scrypt/bsv20Mint.scrypt", 104 | "hex": "0100010001680176018801a901ac2097dfd76851bf465e8f715593b217714858bbe9570ff3bd5e33840a34e20ff0262102ba79df5f8ae7604a9830f03c7933028186aede0675a16f025dc4f8be8eec0382201008ce7480da41702918d1ec8e6849ba32b4d65b1e40dc669c31a1e6306b266c0000000000000052795b7a755a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a785a7a75597a597a597a597a597a597a597a597a597a54795c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5379597a75587a587a587a587a587a587a587a587a5a7909ffffffffffffffff00a16959790112a1695279587a75577a577a577a577a577a577a577a76577a75567a567a567a567a567a567a6d6d750113797601687f7700005279517f75007f7d7701fd87635379537f75517f777601007e8177537a757b7b5379535479937f75537f777b757c677601fe87635379557f75517f777601007e8177537a757b7b5379555479937f75557f777b757c677601ff87635379597f75517f777601007e8177537a757b7b5379595479937f75597f777b757c675379517f75007f777601007e8177537a757b7b5379515479937f75517f777b757c68686875777777767682776e8c7f757854948c7f7d77815279789454948c777777776e7f75537a757b7b0000707f7776537a757777006e8b7f75787f7778768b537a75777c0100788791777664005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d77775c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d777781587a75577a577a577a577a577a577a577a68011879014178011179011179210ac407f0e4bd44bfc207355a778b046225a7068fc59ee7eda43ad905aadbffc800206c266b30e6a1319c66dc401e5bd6b432ba49688eecd118297041da8074ce081001137956795679aa7676517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01007e817757795679567956795679537956795479577995939521414136d08c5ed2bf3ba048afe6dcaebafeffffffffffffffffffffffffffffff006e6e9776009f636e936776687777777b757c6e5296a0636e7c947b757c6853798277527982775379012080517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01205279947f77545379935279930130787e527e54797e58797e527e53797e52797e57797e777777777777777777777777765779ac7777777777777777777777690118797601687f7501447f777701207f75007f775c790087637600012000948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01208c8c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012052948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012053948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012054948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012055948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012056948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012057948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012058948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012059948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012060948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200111948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200112948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200113948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200114948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200115948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200116948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200117948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200118948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200119948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d77025f307e675c79685d7a755c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a011a795879a169011a7900a0695879011b7994597a75587a587a587a587a587a587a587a587a587975587900a269587900a06358795d797876760400e1f5059f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011d797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011c797e7777777777770076635167010068775f797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e5b7976009c6301006776687682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e777777777e59797876827754806e7e0051807e77777e77764f00527982775ba2635279577f75787f77070063036f7264518767006863765793775279537982777f75787f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a0636e937b757c537952798b7f7552797f77011e798763788b7b757c5379547982777f7552797f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a06352797893537a757b7b527975547953798b7f7553797f77011d79876352798b537a757b7b5279755279547a7572537a6868756868756875777600a063787682777f75787f777b757c687c777e76517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77777777670068011c795e79011d796f6e76760400e1f5059f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0123797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0122797e7777777777775379011c79011b797e01147e787e011c797e011a797e777e77777776517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e777777777777011a7900a0630119790116790115797e01147e787e0116797e0114797e77011b797658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77776700686f757e787eaa011d797682776e58947f75780128947f7777778777777777777777777777777777777777777777777777777777777777777777", 105 | "sourceMapFile": "" 106 | } -------------------------------------------------------------------------------- /public/bsv20Mint_release_desc_12.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 9, 3 | "compilerVersion": "1.19.2+commit.f59f89f", 4 | "contract": "BSV20Mint", 5 | "md5": "a4940e6a1ee52860ed4f26de13a45d39", 6 | "structs": [ 7 | { 8 | "name": "SortedItem", 9 | "params": [ 10 | { 11 | "name": "item", 12 | "type": "T" 13 | }, 14 | { 15 | "name": "idx", 16 | "type": "int" 17 | } 18 | ], 19 | "genericTypes": [ 20 | "T" 21 | ] 22 | } 23 | ], 24 | "library": [ 25 | { 26 | "name": "Ordinal", 27 | "params": [], 28 | "properties": [], 29 | "genericTypes": [] 30 | } 31 | ], 32 | "alias": [ 33 | { 34 | "name": "PubKeyHash", 35 | "type": "Ripemd160" 36 | } 37 | ], 38 | "abi": [ 39 | { 40 | "type": "function", 41 | "name": "mint", 42 | "index": 0, 43 | "params": [ 44 | { 45 | "name": "dest", 46 | "type": "Ripemd160" 47 | }, 48 | { 49 | "name": "amount", 50 | "type": "int" 51 | }, 52 | { 53 | "name": "__scrypt_ts_txPreimage", 54 | "type": "SigHashPreimage" 55 | }, 56 | { 57 | "name": "__scrypt_ts_changeAmount", 58 | "type": "int" 59 | }, 60 | { 61 | "name": "__scrypt_ts_changeAddress", 62 | "type": "Ripemd160" 63 | } 64 | ] 65 | }, 66 | { 67 | "type": "constructor", 68 | "params": [ 69 | { 70 | "name": "id", 71 | "type": "bytes" 72 | }, 73 | { 74 | "name": "sym", 75 | "type": "bytes" 76 | }, 77 | { 78 | "name": "max", 79 | "type": "int" 80 | }, 81 | { 82 | "name": "dec", 83 | "type": "int" 84 | }, 85 | { 86 | "name": "lim", 87 | "type": "int" 88 | } 89 | ] 90 | } 91 | ], 92 | "stateProps": [ 93 | { 94 | "name": "id", 95 | "type": "bytes" 96 | }, 97 | { 98 | "name": "supply", 99 | "type": "int" 100 | } 101 | ], 102 | "buildType": "debug", 103 | "file": "file:///c:/Users/myland/code/inscribe/scrypt/bsv20Mint.scrypt", 104 | "hex": "0100010001680176018801a901ac2097dfd76851bf465e8f715593b217714858bbe9570ff3bd5e33840a34e20ff0262102ba79df5f8ae7604a9830f03c7933028186aede0675a16f025dc4f8be8eec0382201008ce7480da41702918d1ec8e6849ba32b4d65b1e40dc669c31a1e6306b266c0000000000000052795b7a755a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a785a7a75597a597a597a597a597a597a597a597a597a54795c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5379597a75587a587a587a587a587a587a587a587a5a7909ffffffffffffffff00a16959790112a1695279587a75577a577a577a577a577a577a577a76577a75567a567a567a567a567a567a6d6d750113797601687f7700005279517f75007f7d7701fd87635379537f75517f777601007e8177537a757b7b5379535479937f75537f777b757c677601fe87635379557f75517f777601007e8177537a757b7b5379555479937f75557f777b757c677601ff87635379597f75517f777601007e8177537a757b7b5379595479937f75597f777b757c675379517f75007f777601007e8177537a757b7b5379515479937f75517f777b757c68686875777777767682776e8c7f757854948c7f7d77815279789454948c777777776e7f75537a757b7b0000707f7776537a757777006e8b7f75787f7778768b537a75777c0100788791777664005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d77775c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d777781587a75577a577a577a577a577a577a577a68011879014178011179011179210ac407f0e4bd44bfc207355a778b046225a7068fc59ee7eda43ad905aadbffc800206c266b30e6a1319c66dc401e5bd6b432ba49688eecd118297041da8074ce081001137956795679aa7676517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01007e817757795679567956795679537956795479577995939521414136d08c5ed2bf3ba048afe6dcaebafeffffffffffffffffffffffffffffff006e6e9776009f636e936776687777777b757c6e5296a0636e7c947b757c6853798277527982775379012080517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01205279947f77545379935279930130787e527e54797e58797e527e53797e52797e57797e777777777777777777777777765779ac7777777777777777777777690118797601687f7501447f777701207f75007f775c790087637600012000948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01208c8c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012052948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012053948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012054948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012055948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012056948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012057948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012058948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012059948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012060948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200111948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200112948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200113948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200114948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200115948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200116948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200117948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200118948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200119948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d77025f307e675c79685d7a755c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a011a795879a169011a7900a0695879011b7994597a75587a587a587a587a587a587a587a587a587975587900a269587900a06358795d79787676060010a5d4e8009f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011d797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011c797e7777777777770076635167010068775f797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e5b7976009c6301006776687682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e777777777e59797876827754806e7e0051807e77777e77764f00527982775ba2635279577f75787f77070063036f7264518767006863765793775279537982777f75787f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a0636e937b757c537952798b7f7552797f77011e798763788b7b757c5379547982777f7552797f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a06352797893537a757b7b527975547953798b7f7553797f77011d79876352798b537a757b7b5279755279547a7572537a6868756868756875777600a063787682777f75787f777b757c687c777e76517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77777777670068011c795e79011d796f6e7676060010a5d4e8009f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0123797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0122797e7777777777775379011c79011b797e01147e787e011c797e011a797e777e77777776517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e777777777777011a7900a0630119790116790115797e01147e787e0116797e0114797e77011b797658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77776700686f757e787eaa011d797682776e58947f75780128947f7777778777777777777777777777777777777777777777777777777777777777777777", 105 | "sourceMapFile": "" 106 | } -------------------------------------------------------------------------------- /public/bsv20Mint_release_desc_16.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 9, 3 | "compilerVersion": "1.19.2+commit.f59f89f", 4 | "contract": "BSV20Mint", 5 | "md5": "63f5198d7dcd3318feae78e5a7feb216", 6 | "structs": [ 7 | { 8 | "name": "SortedItem", 9 | "params": [ 10 | { 11 | "name": "item", 12 | "type": "T" 13 | }, 14 | { 15 | "name": "idx", 16 | "type": "int" 17 | } 18 | ], 19 | "genericTypes": [ 20 | "T" 21 | ] 22 | } 23 | ], 24 | "library": [ 25 | { 26 | "name": "Shift10", 27 | "params": [], 28 | "properties": [], 29 | "genericTypes": [] 30 | }, 31 | { 32 | "name": "Ordinal", 33 | "params": [], 34 | "properties": [], 35 | "genericTypes": [] 36 | } 37 | ], 38 | "alias": [ 39 | { 40 | "name": "PubKeyHash", 41 | "type": "Ripemd160" 42 | } 43 | ], 44 | "abi": [ 45 | { 46 | "type": "function", 47 | "name": "mint", 48 | "index": 0, 49 | "params": [ 50 | { 51 | "name": "dest", 52 | "type": "Ripemd160" 53 | }, 54 | { 55 | "name": "amount", 56 | "type": "int" 57 | }, 58 | { 59 | "name": "__scrypt_ts_txPreimage", 60 | "type": "SigHashPreimage" 61 | }, 62 | { 63 | "name": "__scrypt_ts_changeAmount", 64 | "type": "int" 65 | }, 66 | { 67 | "name": "__scrypt_ts_changeAddress", 68 | "type": "Ripemd160" 69 | } 70 | ] 71 | }, 72 | { 73 | "type": "constructor", 74 | "params": [ 75 | { 76 | "name": "id", 77 | "type": "bytes" 78 | }, 79 | { 80 | "name": "sym", 81 | "type": "bytes" 82 | }, 83 | { 84 | "name": "max", 85 | "type": "int" 86 | }, 87 | { 88 | "name": "dec", 89 | "type": "int" 90 | }, 91 | { 92 | "name": "lim", 93 | "type": "int" 94 | } 95 | ] 96 | } 97 | ], 98 | "stateProps": [ 99 | { 100 | "name": "id", 101 | "type": "bytes" 102 | }, 103 | { 104 | "name": "supply", 105 | "type": "int" 106 | } 107 | ], 108 | "buildType": "debug", 109 | "file": "file:///c:/Users/myland/code/tmp/scrypt-ord/tests/artifacts/contracts/bsv20Mint.scrypt", 110 | "hex": "0100010001680176018801a901ac2097dfd76851bf465e8f715593b217714858bbe9570ff3bd5e33840a34e20ff0262102ba79df5f8ae7604a9830f03c7933028186aede0675a16f025dc4f8be8eec0382201008ce7480da41702918d1ec8e6849ba32b4d65b1e40dc669c31a1e6306b266c0000000000000052795b7a755a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a785a7a75597a597a597a597a597a597a597a597a597a54795c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5379597a75587a587a587a587a587a587a587a587a5a7909ffffffffffffffff00a16959790112a1695279587a75577a577a577a577a577a577a577a76577a75567a567a567a567a567a567a6d6d750113797601687f7700005279517f75007f7d7701fd87635379537f75517f777601007e8177537a757b7b5379535479937f75537f777b757c677601fe87635379557f75517f777601007e8177537a757b7b5379555479937f75557f777b757c677601ff87635379597f75517f777601007e8177537a757b7b5379595479937f75597f777b757c675379517f75007f777601007e8177537a757b7b5379515479937f75517f777b757c68686875777777767682776e8c7f757854948c7f7d77815279789454948c777777776e7f75537a757b7b0000707f7776537a757777006e8b7f75787f7778768b537a75777c0100788791777664005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d77775c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d777781587a75577a577a577a577a577a577a577a68011879014178011179011179210ac407f0e4bd44bfc207355a778b046225a7068fc59ee7eda43ad905aadbffc800206c266b30e6a1319c66dc401e5bd6b432ba49688eecd118297041da8074ce081001137956795679aa7676517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01007e817757795679567956795679537956795479577995939521414136d08c5ed2bf3ba048afe6dcaebafeffffffffffffffffffffffffffffff006e6e9776009f636e936776687777777b757c6e5296a0636e7c947b757c6853798277527982775379012080517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01205279947f77545379935279930130787e527e54797e58797e527e53797e52797e57797e777777777777777777777777765779ac7777777777777777777777690118797601687f7501447f777701207f75007f775c790087637600012000948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01208c8c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012052948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012053948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012054948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012055948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012056948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012057948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012058948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012059948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012060948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200111948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200112948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200113948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200114948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200115948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200116948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200117948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200118948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200119948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d77025f307e675c79685d7a755c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a011a795879a169011a7900a0695879011b7994597a75587a587a587a587a587a587a587a587a587975587900a269587900a06358795d79787676070000c16ff286239f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011d797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011c797e7777777777770076635167010068775f797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e5b7976009c6301006776687682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e777777777e59797876827754806e7e0051807e77777e77764f00527982775ba2635279577f75787f77070063036f7264518767006863765793775279537982777f75787f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a0636e937b757c537952798b7f7552797f77011e798763788b7b757c5379547982777f7552797f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a06352797893537a757b7b527975547953798b7f7553797f77011d79876352798b537a757b7b5279755279547a7572537a6868756868756875777600a063787682777f75787f777b757c687c777e76517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77777777670068011c795e79011d796f6e7676070000c16ff286239f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0123797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0122797e7777777777775379011c79011b797e01147e787e011c797e011a797e777e77777776517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e777777777777011a7900a0630119790116790115797e01147e787e0116797e0114797e77011b797658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77776700686f757e787eaa011d797682776e58947f75780128947f7777778777777777777777777777777777777777777777777777777777777777777777", 111 | "sourceMapFile": "" 112 | } -------------------------------------------------------------------------------- /src/bsv20v1.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | import { 3 | Container, 4 | Box, 5 | Typography, 6 | Button, 7 | TextField, 8 | Backdrop, 9 | CircularProgress, 10 | Chip, 11 | } from "@mui/material"; 12 | import { Addr, PandaSigner, toByteString, bsv, UTXO } from "scrypt-ts"; 13 | import { Navigate } from "react-router-dom"; 14 | import { BSV20V1P2PKH } from "scrypt-ord"; 15 | import axios from "axios"; 16 | import Radio from "@mui/material/Radio"; 17 | import RadioGroup from "@mui/material/RadioGroup"; 18 | import FormControlLabel from "@mui/material/FormControlLabel"; 19 | import FormControl from "@mui/material/FormControl"; 20 | import FormLabel from "@mui/material/FormLabel"; 21 | import { useAppProvider } from "./AppContext"; 22 | import { dummyUTXO } from "./utils"; 23 | 24 | 25 | const serviceFeePerRepeat = 50; 26 | 27 | function BSV20v1(props) { 28 | const { ordiAddress: _ordiAddress, 29 | price: _price, 30 | payAddress: _payAddress, 31 | network: _network, 32 | feePerKb: _feePerKb, 33 | signer: _signer, 34 | connected } = useAppProvider(); 35 | 36 | const MINT_TICK_TEXT_INVALID = "Invalid! Tick not found."; 37 | const MINT_TICK_TEXT_MINT_OUT = "Tick was already mint out!"; 38 | const [_mintTickText, setMintTickText] = useState( 39 | undefined 40 | ); 41 | const validMintTick = () => 42 | _mintTickText !== undefined && 43 | _mintTickText !== MINT_TICK_TEXT_MINT_OUT && 44 | _mintTickText !== MINT_TICK_TEXT_INVALID; 45 | 46 | const setMintTickInfo = ( 47 | tickText: string | undefined, 48 | max: bigint | undefined, 49 | lim: bigint | undefined, 50 | dec: bigint | undefined 51 | ) => { 52 | setMintTickText(tickText); 53 | setTickInfo(max, lim, dec); 54 | }; 55 | 56 | const [_mintTick, setMintTick] = useState(undefined); 57 | 58 | const [_isLoading, setLoading] = useState(false); 59 | 60 | const [_cost, setCost] = useState(0); 61 | 62 | const mintTickOnChange = (e) => setMintTick(e.target.value); 63 | const mintTickOnBlur = async () => { 64 | try { 65 | if (_mintTick) { 66 | const info = await axios 67 | .get(`${_network === bsv.Networks.mainnet 68 | ? "https://ordinals.gorillapool.io" 69 | : "https://testnet.ordinals.gorillapool.io"}/api/bsv20/tick/${_mintTick}`) 70 | .then((r) => r.data); 71 | console.log(info); 72 | const tickText = 73 | info.available === "0" 74 | ? MINT_TICK_TEXT_MINT_OUT 75 | : `Tick: ${info.tick}`; 76 | setMintTickInfo( 77 | tickText, 78 | BigInt(info.max), 79 | BigInt(info.lim), 80 | BigInt(info.dec) 81 | ); 82 | } else { 83 | setMintTickInfo(undefined, undefined, undefined, undefined); 84 | } 85 | } catch { 86 | setMintTickInfo(MINT_TICK_TEXT_INVALID, undefined, undefined, undefined); 87 | } 88 | }; 89 | 90 | const [_amount, setAmount] = useState(undefined); 91 | const amountOnChange = (e) => { 92 | if (/^\d+$/.test(e.target.value)) { 93 | setAmount(BigInt(e.target.value)); 94 | } else { 95 | setAmount(undefined); 96 | } 97 | }; 98 | 99 | const validMintInput = () => 100 | validMintTick() && 101 | _amount !== undefined && 102 | _amount > 0n && 103 | _amount <= _lim!; 104 | 105 | const mint = async () => { 106 | try { 107 | const signer = _signer as PandaSigner; 108 | await signer.requestAuth(); 109 | 110 | const instance = new BSV20V1P2PKH( 111 | toByteString(_mintTick!, true), 112 | _max!, 113 | _lim!, 114 | _dec!, 115 | Addr(_ordiAddress!.toByteString()) 116 | ); 117 | await instance.connect(signer); 118 | 119 | const mintTx = await instance.mint(_amount!); 120 | setResult(`Mint Tx: ${mintTx.id}`); 121 | } catch (e: any) { 122 | console.error("error", e); 123 | setResult(`${e.message ?? e}`); 124 | } 125 | 126 | if (window.gtag) { 127 | window.gtag("event", "inscribe-bsv20v1-mint"); 128 | } 129 | }; 130 | 131 | const [_max, setMax] = useState(undefined); 132 | const [_lim, setLim] = useState(undefined); 133 | const [_dec, setDec] = useState(undefined); 134 | 135 | const setTickInfo = ( 136 | max: bigint | undefined, 137 | lim: bigint | undefined, 138 | dec: bigint | undefined 139 | ) => { 140 | setMax(max); 141 | setLim(lim); 142 | setDec(dec); 143 | }; 144 | 145 | const [_repeat, setRepeat] = useState(1n); 146 | const repeatOnChange = (e) => { 147 | if (/^\d+$/.test(e.target.value)) { 148 | setRepeat(BigInt(e.target.value)); 149 | setCost(calcCost([dummyUTXO(_ordiAddress!, Number.MAX_SAFE_INTEGER)], Number(e.target.value))); 150 | } else { 151 | setRepeat(undefined); 152 | } 153 | }; 154 | 155 | function buildTx( 156 | utxos: UTXO[], 157 | changeAddress: bsv.Address, 158 | feePerKb: number, 159 | repeat: number 160 | ) { 161 | const fundAddress = "1Lv2HWPcaTKcrh8VHT1MChB6j1gK9xX8iN"; 162 | 163 | const fee = serviceFeePerRepeat * repeat; 164 | const tx = new bsv.Transaction().from(utxos).addOutput( 165 | new bsv.Transaction.Output({ 166 | script: bsv.Script.fromAddress(fundAddress), 167 | satoshis: fee, 168 | }) 169 | ); 170 | 171 | 172 | for (let i = 0; i < repeat; i++) { 173 | tx.addOutput( 174 | new bsv.Transaction.Output({ 175 | satoshis: 2, 176 | script: bsv.Script.buildPublicKeyHashOut( 177 | "12m2mGEMNSZGtKaxyQQ8VLaSstqvuSxZ3D" 178 | ), 179 | }) 180 | ); 181 | } 182 | 183 | tx.change(changeAddress); 184 | tx.feePerKb(feePerKb); 185 | 186 | return tx; 187 | } 188 | 189 | function calcCost(utxos: UTXO[], repeat: number) { 190 | const tx = buildTx(utxos, _ordiAddress!, _feePerKb, repeat); 191 | return tx.inputAmount - tx.getChangeAmount() + Number(repeat!); 192 | } 193 | 194 | const validFireInput = () => 195 | validMintTick() && 196 | _repeat !== undefined && 197 | _repeat > 0n && 198 | _repeat <= 20000n! && 199 | _ordiAddress !== undefined && 200 | _payAddress !== undefined; 201 | 202 | const fire = async () => { 203 | try { 204 | setLoading(true); 205 | const utxos = await _signer.provider!.listUnspent(_payAddress!); 206 | const tx = buildTx(utxos, _payAddress!, _feePerKb, Number(_repeat!)); 207 | const signedTx = await _signer.signTransaction(tx); 208 | const response = await axios 209 | .post(`https://inscribe-api.scrypt.io/bsv20v1/batch_mint`, { 210 | raw: signedTx.toString(), 211 | tick: _mintTick, 212 | lim: _lim!.toString(), 213 | repeat: _repeat!.toString(), 214 | addr: _ordiAddress!.toString(), 215 | }) 216 | .then((r) => r.data); 217 | 218 | const historyTxs = JSON.parse(localStorage.getItem("history") || "[]"); 219 | 220 | historyTxs.push({ 221 | tx: tx.id, 222 | time: new Date().getTime(), 223 | }); 224 | 225 | localStorage.setItem("history", JSON.stringify(historyTxs)); 226 | 227 | setResult( 228 | response?.code === 0 229 | ? `Order Tx: ${tx.id}` 230 | : `Error ${response.code}: ${response.message}` 231 | ); 232 | } catch (e: any) { 233 | console.error("error", e); 234 | setResult(`${e.message ?? e}`); 235 | } finally { 236 | setLoading(false); 237 | } 238 | 239 | if (window.gtag) { 240 | const fee = serviceFeePerRepeat * Number(_repeat!); 241 | window.gtag("event", "inscribe-bsv20v1-batch-mint", { 242 | tick: _mintTick, 243 | amt: _lim!.toString(), 244 | repeat: _repeat!.toString(), 245 | fee: fee!.toString(), 246 | }); 247 | } 248 | }; 249 | 250 | const [_result, setResult] = useState(undefined); 251 | 252 | const [_mintOrDeploy, setMintOrDeploy] = useState("mint"); 253 | const mintOrDeployOnChange = (e) => { 254 | const value = e.target.value as string; 255 | setMintOrDeploy(value); 256 | if (value === "deploy") { 257 | setDeployTickInfo(undefined, undefined, 0n, 0n); 258 | } else { 259 | setMintTickInfo(undefined, undefined, undefined, undefined); 260 | } 261 | setResult(undefined); 262 | }; 263 | 264 | const DEPLOY_TICK_TEXT_INVALID = "Invalid! Tick should be 4 letters."; 265 | const DEPLOY_TICK_TEXT_EXISTED = "Tick existed!"; 266 | const [_deployTickText, setDeployTickText] = useState( 267 | undefined 268 | ); 269 | const validDeployTick = () => 270 | _deployTickText !== undefined && 271 | _deployTickText !== DEPLOY_TICK_TEXT_INVALID && 272 | _deployTickText !== DEPLOY_TICK_TEXT_EXISTED; 273 | 274 | const setDeployTickInfo = ( 275 | tickText: string | undefined, 276 | max: bigint | undefined, 277 | lim: bigint | undefined, 278 | dec: bigint | undefined 279 | ) => { 280 | setDeployTickText(tickText); 281 | setTickInfo(max, lim, dec); 282 | }; 283 | 284 | const [_deployTick, setDeployTick] = useState(undefined); 285 | const deployTickOnChange = (e) => setDeployTick(e.target.value); 286 | const deployTickOnBlur = async () => { 287 | try { 288 | if (!_deployTick) { 289 | setDeployTickText(undefined); 290 | } else if (_deployTick.length !== 4) { 291 | setDeployTickText(DEPLOY_TICK_TEXT_INVALID); 292 | } else { 293 | const info = await axios 294 | .get( 295 | `${_network === bsv.Networks.mainnet 296 | ? "https://ordinals.gorillapool.io" 297 | : "https://testnet.ordinals.gorillapool.io"}/api/bsv20/tick/${_deployTick}` 298 | ) 299 | .then((r) => r.data); 300 | console.log(info); 301 | setDeployTickText(DEPLOY_TICK_TEXT_EXISTED); 302 | } 303 | } catch { 304 | setDeployTickText(`Tick: ${_deployTick?.toUpperCase()}`); 305 | } 306 | }; 307 | 308 | const maxOnChange = (e) => 309 | setMax(/^\d+$/.test(e.target.value) ? BigInt(e.target.value) : undefined); 310 | const limOnChange = (e) => 311 | setLim(/^\d+$/.test(e.target.value) ? BigInt(e.target.value) : undefined); 312 | const decOnChange = (e) => 313 | setDec(/^\d+$/.test(e.target.value) ? BigInt(e.target.value) : undefined); 314 | 315 | const validDeployInput = () => 316 | validDeployTick() && 317 | _max !== undefined && 318 | _lim !== undefined && 319 | _dec !== undefined && 320 | _max > 0 && 321 | _dec <= 18 && 322 | _lim <= _max; 323 | 324 | const deploy = async () => { 325 | try { 326 | const signer = _signer as PandaSigner; 327 | const instance = new BSV20V1P2PKH( 328 | toByteString(_deployTick!, true), 329 | _max!, 330 | _lim!, 331 | _dec!, 332 | Addr(_ordiAddress!.toByteString()) 333 | ); 334 | await instance.connect(signer); 335 | 336 | const deployTx = await instance.deployToken(); 337 | setResult(`Deploy Tx: ${deployTx.id}`); 338 | 339 | setDeployTickInfo(undefined, undefined, 0n, 0n); 340 | } catch (e: any) { 341 | console.error("error", e); 342 | setResult(`${e.message ?? e}`); 343 | } 344 | 345 | if (window.gtag) { 346 | window.gtag("event", "inscribe-bsv20v1-deploy"); 347 | } 348 | }; 349 | 350 | 351 | return ( 352 | 353 | {!connected() && } 354 | 355 | 356 | Inscribe BSV-20 v1 357 | 358 | 359 | 360 | 361 | 362 | Mint or Deploy 363 | 364 | 370 | } 373 | label="Mint Existing Tick" 374 | /> 375 | } 378 | label="Deploy New Tick" 379 | /> 380 | 381 | 382 | 383 | 384 | {_mintOrDeploy === "mint" && ( 385 | 386 | 394 | {_mintTickText !== undefined && ( 395 | 396 | {_mintTickText} 397 | 398 | )} 399 | {_mintTickText !== undefined && 400 | _mintTickText !== MINT_TICK_TEXT_INVALID && 401 | _mintTickText !== MINT_TICK_TEXT_MINT_OUT && ( 402 | 403 | 404 | Max Supply: {_max?.toString()} 405 | 406 | 407 | Limit Per Mint: {_lim?.toString()} 408 | 409 | 410 | Decimal Precision: {_dec?.toString()} 411 | 412 | 413 | )} 414 | {_network === bsv.Networks.testnet && ( 415 | 416 | 424 | 433 | 434 | )} 435 | 436 | { 437 | _network === bsv.Networks.mainnet && ( 438 | 439 | 448 | 449 | 450 | 459 | {_cost > 0 && validFireInput() ? ( 460 | 461 | {_price > 0 462 | ? `Total Cost: ${_cost} sats, $${( 463 | (_price * _cost) / 464 | 100000000 465 | ).toFixed(5)}USD ` 466 | : `Total Cost: ${_cost} sats`} 467 | 468 | ) : ( 469 | <> 470 | )} 471 | 472 | 473 | ) 474 | } 475 | 476 | )} 477 | {_mintOrDeploy === "deploy" && ( 478 | 479 | 487 | {_deployTickText !== undefined && ( 488 | 489 | {_deployTickText} 490 | 491 | )} 492 | {_deployTickText !== undefined && 493 | _deployTickText !== DEPLOY_TICK_TEXT_INVALID && 494 | _deployTickText !== DEPLOY_TICK_TEXT_EXISTED && ( 495 | 496 | 504 | 513 | 522 | 523 | )} 524 | 533 | 534 | )} 535 | {_result && ( 536 | 537 | {_result} 538 | 539 | )} 540 | 541 | 542 | 543 | 544 | 545 | ); 546 | } 547 | 548 | export default BSV20v1; 549 | -------------------------------------------------------------------------------- /public/bsv20Mint_release_desc_20.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 9, 3 | "compilerVersion": "1.19.2+commit.f59f89f", 4 | "contract": "BSV20Mint", 5 | "md5": "63f5198d7dcd3318feae78e5a7feb216", 6 | "structs": [ 7 | { 8 | "name": "SortedItem", 9 | "params": [ 10 | { 11 | "name": "item", 12 | "type": "T" 13 | }, 14 | { 15 | "name": "idx", 16 | "type": "int" 17 | } 18 | ], 19 | "genericTypes": [ 20 | "T" 21 | ] 22 | } 23 | ], 24 | "library": [ 25 | { 26 | "name": "Shift10", 27 | "params": [], 28 | "properties": [], 29 | "genericTypes": [] 30 | }, 31 | { 32 | "name": "Ordinal", 33 | "params": [], 34 | "properties": [], 35 | "genericTypes": [] 36 | } 37 | ], 38 | "alias": [ 39 | { 40 | "name": "PubKeyHash", 41 | "type": "Ripemd160" 42 | } 43 | ], 44 | "abi": [ 45 | { 46 | "type": "function", 47 | "name": "mint", 48 | "index": 0, 49 | "params": [ 50 | { 51 | "name": "dest", 52 | "type": "Ripemd160" 53 | }, 54 | { 55 | "name": "amount", 56 | "type": "int" 57 | }, 58 | { 59 | "name": "__scrypt_ts_txPreimage", 60 | "type": "SigHashPreimage" 61 | }, 62 | { 63 | "name": "__scrypt_ts_changeAmount", 64 | "type": "int" 65 | }, 66 | { 67 | "name": "__scrypt_ts_changeAddress", 68 | "type": "Ripemd160" 69 | } 70 | ] 71 | }, 72 | { 73 | "type": "constructor", 74 | "params": [ 75 | { 76 | "name": "id", 77 | "type": "bytes" 78 | }, 79 | { 80 | "name": "sym", 81 | "type": "bytes" 82 | }, 83 | { 84 | "name": "max", 85 | "type": "int" 86 | }, 87 | { 88 | "name": "dec", 89 | "type": "int" 90 | }, 91 | { 92 | "name": "lim", 93 | "type": "int" 94 | } 95 | ] 96 | } 97 | ], 98 | "stateProps": [ 99 | { 100 | "name": "id", 101 | "type": "bytes" 102 | }, 103 | { 104 | "name": "supply", 105 | "type": "int" 106 | } 107 | ], 108 | "buildType": "debug", 109 | "file": "file:///c:/Users/myland/code/tmp/scrypt-ord/tests/artifacts/contracts/bsv20Mint.scrypt", 110 | "hex": "0100010001680176018801a901ac2097dfd76851bf465e8f715593b217714858bbe9570ff3bd5e33840a34e20ff0262102ba79df5f8ae7604a9830f03c7933028186aede0675a16f025dc4f8be8eec0382201008ce7480da41702918d1ec8e6849ba32b4d65b1e40dc669c31a1e6306b266c0000000000000052795b7a755a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a5a7a785a7a75597a597a597a597a597a597a597a597a597a54795c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5379597a75587a587a587a587a587a587a587a587a5a7909ffffffffffffffff00a16959790112a1695279587a75577a577a577a577a577a577a577a76577a75567a567a567a567a567a567a6d6d750113797601687f7700005279517f75007f7d7701fd87635379537f75517f777601007e8177537a757b7b5379535479937f75537f777b757c677601fe87635379557f75517f777601007e8177537a757b7b5379555479937f75557f777b757c677601ff87635379597f75517f777601007e8177537a757b7b5379595479937f75597f777b757c675379517f75007f777601007e8177537a757b7b5379515479937f75517f777b757c68686875777777767682776e8c7f757854948c7f7d77815279789454948c777777776e7f75537a757b7b0000707f7776537a757777006e8b7f75787f7778768b537a75777c0100788791777664005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d77775c7a755b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a5b7a005379007855798b7f7555797f77815579768b577a75567a567a567a567a567a567a7877014c9f6376547a7572537a527956795579937f7556797f777b757c6776014c9c63527956798b7f7556797f777601007e8177547a7572537a55798b567a757171557a557975527956795579937f7556797f777b757c6776014d9c635279567952937f7556797f777601007e8177547a7572537a55795293567a757171557a557975527956795579937f7556797f777b757c6776014e9c635279567954937f7556797f777601007e8177547a7572537a55795493567a757171557a557975527956795579937f7556797f777b757c670069686868685579547993567a757171557a55796d777781587a75577a577a577a577a577a577a577a68011879014178011179011179210ac407f0e4bd44bfc207355a778b046225a7068fc59ee7eda43ad905aadbffc800206c266b30e6a1319c66dc401e5bd6b432ba49688eecd118297041da8074ce081001137956795679aa7676517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01007e817757795679567956795679537956795479577995939521414136d08c5ed2bf3ba048afe6dcaebafeffffffffffffffffffffffffffffff006e6e9776009f636e936776687777777b757c6e5296a0636e7c947b757c6853798277527982775379012080517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f517f7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e7c7e01205279947f77545379935279930130787e527e54797e58797e527e53797e52797e57797e777777777777777777777777765779ac7777777777777777777777690118797601687f7501447f777701207f75007f775c790087637600012000948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01208c8c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012052948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012053948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012054948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012055948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012056948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012057948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012058948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012059948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01205f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d012060948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200111948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200112948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200113948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200114948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200115948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200116948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200117948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200118948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d01200119948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011a948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011b948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011c948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011d948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011e948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d0120011f948c5279788b7f75787f7d777601007e817776609678609659a063015767013068937860975279609759a0630157670130689355796f757e7e567a757171557a55796d6d6d77025f307e675c79685d7a755c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a5c7a011a795879a169011a7900a0695879011b7994597a75587a587a587a587a587a587a587a587a587975587900a269587900a06358795d79787676090000000000000000019f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011d797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e011c797e7777777777770076635167010068775f797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e5b7976009c6301006776687682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e777777777e59797876827754806e7e0051807e77777e77764f00527982775ba2635279577f75787f77070063036f7264518767006863765793775279537982777f75787f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a0636e937b757c537952798b7f7552797f77011e798763788b7b757c5379547982777f7552797f7700005279517f75007f778176014c9f6376537a757b7b515379937b757c6776014c9c635379527f75517f777601007e8177537a757b7b525379937b757c6776014d9c635379537f75517f777601007e8177537a757b7b5152935379937b757c6776014e9c635379557f75517f777601007e8177537a757b7b5154935379937b757c674f7b757c686868687577777600a06352797893537a757b7b527975547953798b7f7553797f77011d79876352798b537a757b7b5279755279547a7572537a6868756868756875777600a063787682777f75787f777b757c687c777e76517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77777777670068011c795e79011d796f6e7676090000000000000000019f69000051786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a75687568786476765a957b757c5479789f6351537a757b7b67547978965a970130789355797e557a75547a547a547a547a756875685379009c6301306752796877777777247b2270223a226273762d3230222c226f70223a227472616e73666572222c226964223a2253797e09222c22616d74223a227e787e02227d7e76126170706c69636174696f6e2f6273762d3230070063036f726451787682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0123797e52797682770078014c9f6378516e8b80767682778c7f75007f777777777767780200019f63014c5279516e8b80767682778c7f75007f777777777e776778030000019f63014d5279526e8b80767682778c7f75007f777777777e7767780500000000019f63014e5279546e8b80767682778c7f75007f777777777e77670069686868687653797e7777777e0122797e7777777777775379011c79011b797e01147e787e011c797e011a797e777e77777776517658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e777777777777011a7900a0630119790116790115797e01147e787e0116797e0114797e77011b797658805279768277007802fd009f6378516e8b80767682778c7f75007f77777777776778030000019f6301fd5279526e8b80767682778c7f75007f777777777e7767780500000000019f6301fe5279546e8b80767682778c7f75007f777777777e776778090000000000000000019f6301ff5279586e8b80767682778c7f75007f777777777e77686868687653797e7777777e77776700686f757e787eaa011d797682776e58947f75780128947f7777778777777777777777777777777777777777777777777777777777777777777777", 111 | "sourceMapFile": "" 112 | } -------------------------------------------------------------------------------- /src/bsv20v2.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | import { Container, Box, Typography, Button, TextField } from '@mui/material'; 3 | import { OneSatApis, Ordinal, isBSV20v2 } from "scrypt-ord"; 4 | import { Addr, DummyProvider, MethodCallOptions, PandaSigner, TestWallet, UTXO, bsv, fromByteString, toByteString } from "scrypt-ts"; 5 | import { Navigate } from "react-router-dom"; 6 | import Radio from "@mui/material/Radio"; 7 | import RadioGroup from "@mui/material/RadioGroup"; 8 | import FormControlLabel from "@mui/material/FormControlLabel"; 9 | import FormControl from "@mui/material/FormControl"; 10 | import FormLabel from "@mui/material/FormLabel"; 11 | import Backdrop from "@mui/material/Backdrop"; 12 | import CircularProgress from "@mui/material/CircularProgress"; 13 | import { BSV20Mint } from "./contracts/bsv20Mint"; 14 | 15 | import Avatar from "@mui/material/Avatar"; 16 | 17 | import { useAppProvider } from "./AppContext"; 18 | import { dummyUTXO } from "./utils"; 19 | 20 | const serviceFeePerRepeat = 100; 21 | function BSV20v2(props) { 22 | 23 | const [_isLoading, setLoading] = useState(false); 24 | 25 | const [_symbol, setSymbol] = useState(undefined) 26 | const [_max, setMax] = useState(210000000n) 27 | const [_decimal, setDecimal] = useState(0n) 28 | const [_lim, setLim] = useState(1000n) 29 | const [_icon, setIcon] = useState(undefined) 30 | const [_tokenId, setTokenId] = useState(undefined) 31 | const [_available, setAvailable] = useState(undefined) 32 | 33 | const [_mintFee, setMintFee] = useState(20) 34 | 35 | 36 | const [_tokenIdStatus, setTokenIdStatus] = useState<'valid' | 'invalid'>( 37 | 'invalid' 38 | ); 39 | 40 | const [_helperText, setHelperText] = useState( 41 | undefined 42 | ); 43 | 44 | const symbolOnChange = (e) => { 45 | if (e.target.value) { 46 | setSymbol(e.target.value) 47 | } else { 48 | setSymbol(undefined) 49 | } 50 | } 51 | 52 | const { ordiAddress: _ordiAddress, 53 | price: _price, 54 | payAddress: _payAddress, 55 | network: _network, 56 | feePerKb: _feePerKb, 57 | signer: _signer, 58 | connected } = useAppProvider(); 59 | 60 | const [_cost, setCost] = useState(0); 61 | 62 | const [_repeat, setRepeat] = useState(1n); 63 | const repeatOnChange = (e) => { 64 | if (/^\d+$/.test(e.target.value)) { 65 | setRepeat(BigInt(e.target.value)); 66 | setCost(calcCost([dummyUTXO(_ordiAddress!, Number.MAX_SAFE_INTEGER)], _mintFee, Number(e.target.value))); 67 | } else { 68 | setRepeat(undefined); 69 | } 70 | }; 71 | 72 | function calcCost(utxos: UTXO[], mintFee: number, repeat: number) { 73 | 74 | const tx = buildTx(utxos, _payAddress!, mintFee, _feePerKb, repeat); 75 | return tx.inputAmount - tx.getChangeAmount() + Number(repeat!); 76 | } 77 | 78 | function buildTx( 79 | utxos: UTXO[], 80 | changeAddress: bsv.Address, 81 | mintFee: number, 82 | feePerKb: number, 83 | repeat: number 84 | ) { 85 | const fundAddress = "1BK5badc4DyGEjULf5ZY3k93apSb2Abeyw"; 86 | 87 | const fee = serviceFeePerRepeat * repeat; 88 | const tx = new bsv.Transaction().from(utxos).addOutput( 89 | new bsv.Transaction.Output({ 90 | script: bsv.Script.fromAddress(fundAddress), 91 | satoshis: fee, 92 | }) 93 | ); 94 | 95 | 96 | for (let i = 0; i < repeat; i++) { 97 | tx.addOutput( 98 | new bsv.Transaction.Output({ 99 | satoshis: mintFee, 100 | script: bsv.Script.buildPublicKeyHashOut( 101 | "17o3vLY15beFFRz3TDGMqcUrXG3XtEZLxy" 102 | ), 103 | }) 104 | ); 105 | } 106 | 107 | console.log('changeAddress', changeAddress) 108 | 109 | tx.change(changeAddress); 110 | tx.feePerKb(feePerKb); 111 | 112 | return tx; 113 | } 114 | 115 | const maxOnChange = (e) => { 116 | if (/^\d+$/.test(e.target.value)) { 117 | setMax(BigInt(e.target.value)) 118 | } else { 119 | setMax(undefined) 120 | } 121 | } 122 | 123 | const tokenIdOnChange = (e) => { 124 | if (e.target.value) { 125 | setTokenId(e.target.value) 126 | } else { 127 | setTokenId(undefined) 128 | } 129 | } 130 | 131 | const limOnChange = (e) => { 132 | if (/^\d+$/.test(e.target.value)) { 133 | setLim(BigInt(e.target.value)) 134 | } else { 135 | setLim(undefined) 136 | } 137 | } 138 | 139 | 140 | const iconOnChange = (e) => { 141 | if (isBSV20v2(e.target.value)) { 142 | setIcon(e.target.value) 143 | } else { 144 | setIcon(undefined) 145 | } 146 | } 147 | 148 | 149 | const clearDeployInfo = ( 150 | ) => { 151 | 152 | setSymbol(undefined); 153 | setMax(undefined); 154 | setDecimal(undefined); 155 | setLim(undefined); 156 | setIcon(undefined); 157 | }; 158 | 159 | const setTokenInfo = ( 160 | sym: string, 161 | max: bigint, 162 | dec: bigint, 163 | lim: bigint, 164 | available: bigint, 165 | icon?: string 166 | ) => { 167 | 168 | setSymbol(sym); 169 | setMax(max / BigInt(Math.pow(10, Number(dec)))); 170 | setDecimal(BigInt(dec)); 171 | setLim(lim); 172 | setAvailable(available); 173 | setIcon(icon); 174 | setTokenIdStatus('valid') 175 | }; 176 | 177 | const clearTokenId = ( 178 | ) => { 179 | 180 | setTokenId(undefined); 181 | setTokenIdStatus('invalid') 182 | }; 183 | 184 | const [_mintOrDeploy, setMintOrDeploy] = useState("mint"); 185 | const mintOrDeployOnChange = (e) => { 186 | const value = e.target.value as string; 187 | setMintOrDeploy(value); 188 | if (value === "deploy") { 189 | clearDeployInfo(); 190 | } else { 191 | clearTokenId(); 192 | } 193 | setResult(undefined); 194 | setHelperText(undefined) 195 | }; 196 | 197 | const fetchArtifact = async (max: bigint) => { 198 | 199 | let bsv20Mint_release_desc = ""; 200 | 201 | if (max < 100000000n) { 202 | bsv20Mint_release_desc = "bsv20Mint_release_desc_8.json" 203 | } else if (max < 1000000000000n) { 204 | bsv20Mint_release_desc = "bsv20Mint_release_desc_12.json" 205 | } else if (max < 10000000000000000n) { 206 | bsv20Mint_release_desc = "bsv20Mint_release_desc_16.json" 207 | } else { 208 | bsv20Mint_release_desc = "bsv20Mint_release_desc_20.json" 209 | } 210 | 211 | return fetch(`/${bsv20Mint_release_desc}`).then(res => res.json()); 212 | } 213 | 214 | async function getTokenInfo(tokenId: string) { 215 | if (_network === bsv.Networks.mainnet) { 216 | const info = await fetch( 217 | `https://inscribe-api.scrypt.io/bsv20v2/origins/${_tokenId}` 218 | ) 219 | .then((r) => { 220 | if (r.status === 200) { 221 | return r.json() 222 | } 223 | return null; 224 | }) 225 | .catch((e) => { 226 | console.error("get inscriptions by tokenid failed!"); 227 | return null; 228 | }); 229 | 230 | if (info === null) { 231 | setHelperText("No token found!") 232 | clearTokenId() 233 | return null; 234 | } 235 | 236 | if (info.code !== 0) { 237 | setHelperText(info.message || "Unknow error!") 238 | clearTokenId() 239 | return null; 240 | } 241 | 242 | return info; 243 | } else { 244 | const info = await fetch( 245 | `https://testnet.ordinals.gorillapool.io/api/inscriptions/${_tokenId}/latest?script=true` 246 | ) 247 | .then((r) => { 248 | if (r.status === 200) { 249 | return r.json() 250 | } 251 | return null; 252 | }) 253 | .catch((e) => { 254 | console.error("get inscriptions by tokenid failed!"); 255 | return null; 256 | }); 257 | 258 | if (info === null) { 259 | setHelperText("No token found!") 260 | clearTokenId() 261 | return null; 262 | } 263 | 264 | 265 | 266 | const script = bsv.Script.fromHex(Buffer.from(info.script, "base64").toString("hex")); 267 | 268 | 269 | if (Ordinal.isOrdinalP2PKHV2(script)) { 270 | setHelperText("Mint out, no available token!") 271 | clearTokenId(); 272 | return null; 273 | } 274 | 275 | const { amt, sym, icon } = info.origin?.data?.insc?.json || {}; 276 | 277 | return { 278 | utxo: { 279 | script: script.toHex(), 280 | txid: info.txid, 281 | vout: info.vout, 282 | satoshis: info.satoshis 283 | }, 284 | max_supply: amt, 285 | icon 286 | } 287 | } 288 | } 289 | 290 | const mintTokenIdOnBlur = async () => { 291 | 292 | if (_tokenId && isBSV20v2(_tokenId)) { 293 | try { 294 | setTokenIdStatus("invalid") 295 | setHelperText(undefined) 296 | 297 | 298 | const info = await getTokenInfo(_tokenId); 299 | 300 | const utxo = info.utxo; 301 | 302 | const script = bsv.Script.fromHex(utxo.script); 303 | 304 | if (Ordinal.isOrdinalP2PKHV2(script)) { 305 | setHelperText("Mint out, no available token!") 306 | clearTokenId(); 307 | return; 308 | } 309 | 310 | const { max_supply, icon } = info || {}; 311 | 312 | const artifact = await fetchArtifact(BigInt(max_supply || 21000000)); 313 | BSV20Mint.loadArtifact(artifact) 314 | 315 | const instance = BSV20Mint.fromUTXO({ 316 | txId: utxo.txid, 317 | outputIndex: utxo.vout, 318 | script: utxo.script, 319 | satoshis: utxo.satoshis, 320 | }); 321 | 322 | setTokenInfo(fromByteString(instance.sym), instance.max, instance.dec, instance.lim, instance.supply, icon); 323 | setHelperText(undefined) 324 | if (_repeat) { 325 | instance.bindTxBuilder('mint', BSV20Mint.mintTxBuilder) 326 | 327 | await instance.connect(new TestWallet(bsv.PrivateKey.fromRandom(bsv.Networks.testnet), 328 | new DummyProvider())) 329 | 330 | 331 | const { tx } = await instance.methods.mint( 332 | Addr(_ordiAddress!.toByteString()), 333 | instance.lim, 334 | { 335 | partiallySigned: true 336 | } as MethodCallOptions 337 | ) 338 | 339 | const mintFee = tx.getFee() + 2; 340 | 341 | 342 | setMintFee(mintFee); 343 | 344 | setCost(calcCost([dummyUTXO(_ordiAddress!, Number.MAX_SAFE_INTEGER)], mintFee, Number(_repeat))); 345 | } 346 | 347 | } catch (e) { 348 | setHelperText((e as unknown as any).message || "Unknow error") 349 | console.error('mintTokenIdOnBlur error:', e) 350 | } 351 | } else { 352 | if (_tokenId && !isBSV20v2(_tokenId)) { 353 | setHelperText("Invalid Token Id") 354 | } 355 | 356 | clearTokenId() 357 | } 358 | 359 | }; 360 | 361 | const decimalOnChange = (e) => { 362 | if (/^\d+$/.test(e.target.value)) { 363 | setDecimal(BigInt(e.target.value)) 364 | } else { 365 | setDecimal(undefined) 366 | } 367 | } 368 | 369 | const validMintInput = () => { 370 | return _isLoading === false && _tokenIdStatus === 'valid' && _tokenId !== undefined && _symbol !== undefined && _max !== undefined && _decimal !== undefined && _lim !== undefined 371 | } 372 | 373 | const validMintInputRepeat = () => { 374 | return _isLoading === false && _repeat !== undefined && _repeat <= 20000n && _tokenIdStatus === 'valid' && _tokenId !== undefined && _symbol !== undefined && _max !== undefined && _decimal !== undefined && _lim !== undefined 375 | } 376 | 377 | const validDeployInput = () => { 378 | return _isLoading === false && _symbol !== undefined && _max !== undefined && _decimal !== undefined && _lim !== undefined 379 | } 380 | 381 | const [_result, setResult] = useState(undefined) 382 | 383 | const deploy = async () => { 384 | try { 385 | setLoading(true) 386 | const signer = _signer as PandaSigner 387 | await signer.requestAuth(); 388 | 389 | const symbol = toByteString(_symbol!, true) 390 | const total = _max! * BigInt(Math.pow(10, Number(_decimal!))); 391 | const artifact = await fetchArtifact(total); 392 | 393 | BSV20Mint.loadArtifact(artifact) 394 | 395 | const instance = new BSV20Mint(toByteString(''), symbol, total, _decimal!, _lim!) 396 | await instance.connect(signer) 397 | 398 | const tokenId = await instance.deployToken(_icon ? { 399 | icon: _icon 400 | } : {}) 401 | 402 | setResult(`Token ID: ${tokenId}`) 403 | 404 | setSymbol(undefined) 405 | setMax(undefined) 406 | setDecimal(undefined) 407 | setIcon(undefined) 408 | setLim(undefined) 409 | } catch (e: any) { 410 | console.error('error', e) 411 | setResult(`${e.message ?? e}`) 412 | } finally { 413 | setLoading(false) 414 | } 415 | 416 | if (window.gtag) { 417 | window.gtag('event', 'deploy-bsv20v2'); 418 | } 419 | } 420 | 421 | const mint = async () => { 422 | try { 423 | setLoading(true) 424 | const signer = _signer as PandaSigner 425 | await signer.requestAuth(); 426 | 427 | const utxo = await OneSatApis.fetchLatestByOrigin(_tokenId!, _network!); 428 | if (!utxo) { 429 | setResult(`No UTXO found for token id!`) 430 | return; 431 | } 432 | 433 | const instance = BSV20Mint.fromUTXO(utxo); 434 | 435 | await instance.connect(signer) 436 | 437 | instance.bindTxBuilder('mint', BSV20Mint.mintTxBuilder) 438 | 439 | const { tx } = await instance.methods.mint( 440 | Addr(_ordiAddress!.toByteString()), 441 | instance.lim, 442 | {} as MethodCallOptions 443 | ) 444 | 445 | setResult(`Mint Tx: ${tx.id}`) 446 | 447 | 448 | } catch (e: any) { 449 | console.error('error', e) 450 | setResult(`${e.message ?? e}`) 451 | } finally { 452 | setLoading(false) 453 | } 454 | 455 | if (window.gtag) { 456 | window.gtag('event', 'inscribe-bsv20v2'); 457 | } 458 | } 459 | 460 | 461 | const fire = async () => { 462 | try { 463 | try { 464 | setLoading(true); 465 | await _signer.connect() 466 | const utxos = await _signer.provider!.listUnspent(_payAddress!); 467 | const tx = buildTx(utxos, _payAddress!, _mintFee, _feePerKb, Number(_repeat!)); 468 | const signedTx = await _signer.signTransaction(tx); 469 | const response = await fetch(`https://inscribe-api.scrypt.io/bsv20v2/batch_mint`, { 470 | method: 'POST', 471 | mode: "cors", 472 | cache: "no-cache", 473 | credentials: "same-origin", 474 | headers: { 475 | "Content-Type": "application/json", 476 | }, 477 | body: JSON.stringify({ 478 | raw: signedTx.toString(), 479 | origin: _tokenId!, 480 | amt: Number(_lim!), 481 | repeat: Number(_repeat!), 482 | addr: _ordiAddress!.toString(), 483 | }) 484 | }) 485 | .then((r) => r.json()); 486 | 487 | const historyTxs = JSON.parse(localStorage.getItem("history") || "[]"); 488 | 489 | historyTxs.push({ 490 | tx: tx.id, 491 | time: new Date().getTime(), 492 | }); 493 | 494 | localStorage.setItem("history_v2", JSON.stringify(historyTxs)); 495 | 496 | setResult( 497 | response?.code === 0 498 | ? `Order Tx: ${tx.id}` 499 | : `Error ${response.code}: ${response.message}` 500 | ); 501 | } catch (e: any) { 502 | console.error("error", e); 503 | setResult(`${e.message ?? e}`); 504 | } finally { 505 | setLoading(false); 506 | } 507 | 508 | 509 | } catch (e: any) { 510 | console.error('error', e) 511 | setResult(`${e.message ?? e}`) 512 | } finally { 513 | setLoading(false) 514 | } 515 | 516 | if (window.gtag) { 517 | window.gtag('event', 'inscribe-bsv20v2'); 518 | } 519 | } 520 | 521 | return ( 522 | 523 | {!connected() && ()} 524 | 525 | 526 | Inscribe BSV-20 v2 527 | 528 | 529 | 530 | 531 | 532 | 533 | Mint or Deploy 534 | 535 | 541 | } 544 | label="Mint Existing Token" 545 | /> 546 | } 549 | label="Deploy New Token" 550 | /> 551 | 552 | 553 | 554 | {_mintOrDeploy === "deploy" && ( 555 | 556 | 557 | 558 | 565 | 574 | 575 | 576 | 579 | 580 | )} 581 | 582 | {_mintOrDeploy === "mint" && ( 583 | 584 | 590 | 591 | {_tokenIdStatus === 'valid' && ( 592 | 593 | 594 | Symbol: {_symbol?.toString() || "Null"} 595 | 596 | 597 | Max Supply: {_max?.toString()} 598 | 599 | 600 | Available Supply: {_available?.toString() || "0"} 601 | 602 | 603 | Limit Per Mint: {_lim?.toString()} 604 | 605 | 606 | Decimal Precision: {_decimal?.toString()} 607 | 608 | { 609 | _icon && ( 610 | 611 | 612 | 613 | 614 | Icon: 615 | 616 | 617 | 620 | 621 | 622 | 623 | 624 | ) 625 | } 626 | 627 | )} 628 | 629 | 630 | )} 631 | 632 | {_mintOrDeploy === "mint" && _network === bsv.Networks.testnet && ( 633 | 636 | )} 637 | 638 | {_mintOrDeploy === "mint" && ( 639 | 640 | 649 | 650 | 651 | 660 | {_cost > 0 && validMintInputRepeat() ? ( 661 | 662 | {_price > 0 663 | ? `Total Cost: ${_cost} sats, $${( 664 | (_price * _cost) / 665 | 100000000 666 | ).toFixed(5)}USD ` 667 | : `Total Cost: ${_cost} sats`} 668 | 669 | ) : ( 670 | <> 671 | )} 672 | 673 | 674 | ) 675 | } 676 | 677 | { 678 | !_result 679 | ? '' 680 | : ({_result}) 681 | } 682 | 683 | 684 | what's new in v2 685 | 686 | 687 | 688 | 689 | 690 | 691 | ) 692 | } 693 | 694 | export default BSV20v2; 695 | --------------------------------------------------------------------------------