diff --git a/package-lock.json b/package-lock.json index b5b12cfd..95574c48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cip95-cardano-wallet-connector", - "version": "1.9.2", + "version": "1.10.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index e7dce7ce..96ef3f73 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "homepage": "http://ryun1.github.io/cip95-cardano-wallet-connector", "name": "cip95-cardano-wallet-connector", - "version": "1.9.2", + "version": "1.10.0", "private": true, "dependencies": { "@blueprintjs/core": "^3.53.0", diff --git a/src/App.js b/src/App.js index 23145cb8..33676395 100644 --- a/src/App.js +++ b/src/App.js @@ -70,6 +70,7 @@ import { Language, Int, TxInputsBuilder, + WithdrawalsBuilder, } from "@emurgo/cardano-serialization-lib-asmjs" import "./App.css"; import { @@ -150,6 +151,7 @@ class App extends React.Component { govActionBuilder: undefined, treasuryDonationAmount: undefined, treasuryValueAmount: undefined, + withdrawalAmount: undefined, // Certs voteDelegationTarget: "", voteDelegationStakeCred: "", @@ -409,7 +411,7 @@ class App extends React.Component { try { const raw = await this.API.getChangeAddress(); let address = Address.from_bytes(Buffer.from(raw, "hex")) - const changeAddress = address.to_bech32(address.network_id == 0?"addr":"addr_test") + const changeAddress = address.to_bech32(address.network_id === 0?"addr":"addr_test") this.setState({changeAddress}) } catch (err) { console.log(err) @@ -493,6 +495,7 @@ class App extends React.Component { govActionBuilder: undefined, treasuryDonationAmount: undefined, treasuryValueAmount: undefined, + withdrawalAmount: undefined, // Certs voteDelegationTarget: "", voteDelegationStakeCred: "", @@ -765,6 +768,9 @@ class App extends React.Component { this.setState({certBuilder : undefined}); this.setState({votingBuilder : undefined}); this.setState({govActionBuilder : undefined}); + this.setState({treasuryDonationAmount : undefined}); + this.setState({treasuryValueAmount : undefined}); + this.setState({withdrawalAmount : undefined}); } refreshErrorState = async () => { @@ -863,6 +869,12 @@ class App extends React.Component { if (this.state.treasuryValueAmount){ txBuilder.set_current_treasury_value(BigNum.from_str(this.state.treasuryValueAmount)); } + if (this.state.withdrawalAmount){ + const rewardAddr = RewardAddress.from_address(Address.from_bech32(this.state.rewardAddress)); + const withdrawalsBuilder = WithdrawalsBuilder.new() + withdrawalsBuilder.add(rewardAddr, BigNum.from_str(this.state.withdrawalAmount)); + txBuilder.set_withdrawals_builder(withdrawalsBuilder); + } if(this.state.guardrailScriptUsed){ try{ const scripts = PlutusScripts.new(); @@ -1746,7 +1758,7 @@ class App extends React.Component {

✨demos CIP-95 dApp✨

-

✨v1.9.2✨

+

✨v1.10.0✨

Enable CIP-95? @@ -2699,7 +2711,24 @@ class App extends React.Component {
} /> - + + + this.setState({withdrawalAmount : event.target.value})} + value={this.state.withdrawalAmount} + /> + + + + } /> + } /> - } /> - @@ -2840,6 +2869,12 @@ class App extends React.Component { )} + {this.state.withdrawalAmount && ( + <> +

Withdrawal Amount: {this.state.withdrawalAmount}

+ + )} +