Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart multisig #90

Merged
merged 82 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
be2c5e7
smartMultisig contract first draft completed
leo42 Mar 15, 2024
5b4da99
minor fix
leo42 Mar 15, 2024
7d1c489
Implement Before and after for smart-multisig
leo42 Mar 15, 2024
937d97c
Minor fix in types
leo42 Mar 15, 2024
5b69ec3
Update to Aiken 1.1.0
leo42 Sep 5, 2024
57b6a8f
Implement NFT delegation
leo42 Sep 5, 2024
a754656
First Iteration completed with full functionality.
leo42 Sep 9, 2024
0dc8224
add datum check
leo42 Sep 9, 2024
c94e210
Made safe for delegation checking
leo42 Sep 9, 2024
aa79499
rename
leo42 Sep 9, 2024
0efcea3
Upgrade to Aiken 1.1
leo42 Sep 11, 2024
3b5305f
Create mintSmartWallet.ak
leo42 Sep 11, 2024
6ea0acc
Create couponMint.ak
leo42 Sep 12, 2024
d969530
Move Contracts to separate folder
leo42 Sep 12, 2024
3432d18
Sucsessfully merge typscript into the project
leo42 Sep 12, 2024
24840f7
Imported Lucid Evolution and upgrated
leo42 Sep 12, 2024
771712e
working with lucid evolution
leo42 Sep 12, 2024
8c768f7
halfpoint implementing minting, lucid-evolution Type building change
leo42 Sep 12, 2024
48cf978
Implemented the updateWalletModal
leo42 Sep 13, 2024
e7ec32f
debounce get Token info
leo42 Sep 13, 2024
5938262
fetch NftData completed
leo42 Sep 16, 2024
b5cec6a
Loading from admint datum with new sceema is now operational
leo42 Sep 16, 2024
bcf9049
midpoint
leo42 Sep 16, 2024
430f2db
Minting and transaction composing operational with lucid evolution
leo42 Sep 16, 2024
f22f53b
apply tokenName suffix scheema
leo42 Sep 16, 2024
5fefa23
Encoding enum datum experiment
leo42 Sep 17, 2024
2b58264
initial encoding working
leo42 Sep 23, 2024
b59dc52
completed encoding atLeast
leo42 Sep 23, 2024
c773b2b
Encoding AtLeast
leo42 Sep 23, 2024
de19619
Finished the Ecoders
leo42 Sep 23, 2024
c4ce453
completed Decoder
leo42 Sep 23, 2024
6300db0
restructure and better define types
leo42 Sep 25, 2024
7d9aab3
Importing of legacy components into SmartWallet, merging JS and TS
leo42 Sep 26, 2024
74f13a1
Halfpoint to createTx
leo42 Sep 27, 2024
4e140be
transaction building and percistancy completed
leo42 Sep 27, 2024
6bf87bb
fix transaction loading and storing
leo42 Sep 28, 2024
3e6fe0b
Tx creation operating
leo42 Sep 28, 2024
79ac09f
Importing wallet from Id completed
leo42 Sep 28, 2024
dc40013
update Tx froging completed
leo42 Sep 29, 2024
4343018
fix initi error
leo42 Sep 29, 2024
57d1b44
completed testing on no-subscription contract
leo42 Sep 29, 2024
05f9da0
minor fix
leo42 Sep 29, 2024
f42559d
completed delegation
leo42 Oct 1, 2024
567e5f1
fix delegation quering
leo42 Oct 1, 2024
26ddbb0
move contracts to dedicated folder, integrate scriptRef
leo42 Oct 7, 2024
0f69f0d
Added ScriptRef to Config updater
leo42 Oct 7, 2024
ef7d21b
Start updater from current config
leo42 Oct 7, 2024
3db13bb
fix deleteWallet not persistings
leo42 Oct 7, 2024
8b4bfea
fix Delegation building
leo42 Oct 7, 2024
d1177de
fix Koios integration
leo42 Oct 7, 2024
f34f87d
Implement delegation
leo42 Oct 8, 2024
e80a829
remove minting module
leo42 Oct 8, 2024
398477a
Implement keyHash Addressbook
leo42 Oct 8, 2024
01f4f57
Fix keyHashName for pendingTx
leo42 Oct 8, 2024
8482be0
implemented checkSigners function
leo42 Oct 8, 2024
9e013c0
fix Nft checkSigners
leo42 Oct 8, 2024
f545499
Implement NftHolder
leo42 Oct 8, 2024
c7e574d
add animation when loading
leo42 Oct 8, 2024
a88c9f3
fix crash when no wallet
leo42 Oct 8, 2024
9535a18
config cashing for faster tx building
leo42 Oct 8, 2024
7f32ac8
fixed getAddress (working with external address)
leo42 Oct 8, 2024
b88a1d7
Implement timelocks
leo42 Oct 9, 2024
c3fec36
Minor fix(reqremets added to update Tx)
leo42 Oct 10, 2024
ff2c089
Clear Txs when no longer valid
leo42 Oct 10, 2024
897a27b
Performance fix
leo42 Oct 10, 2024
a5546ed
clearing tx's when no longer valid
leo42 Oct 10, 2024
feaea47
Implement and apply address select
leo42 Oct 10, 2024
a4867a3
Implement address select in smart wallets
leo42 Oct 10, 2024
6f9c21c
remove depricated component
leo42 Oct 10, 2024
7d90e27
set colateral donor
leo42 Oct 10, 2024
19b9018
Imlement Collateral Utxo cashing, collateral Utxo provider selection,…
leo42 Oct 10, 2024
45fc64f
set Signer Names for Multisig and smart wallets
leo42 Oct 10, 2024
f181a44
fix naming
leo42 Oct 10, 2024
88a1416
fix all selection
leo42 Oct 10, 2024
a6b098a
Segrigate smaet wallets by network
leo42 Oct 10, 2024
fd09e7c
Fix Minting module
leo42 Oct 11, 2024
21476f5
Clear uneeded sections
leo42 Oct 11, 2024
36a0432
Update UpdateWalletModal.css
leo42 Oct 11, 2024
57b930e
Implement rudementery CoinSelect
leo42 Oct 11, 2024
c1dcde0
fix signature export
leo42 Oct 11, 2024
1a5aa1c
fix wallet naming config
leo42 Oct 11, 2024
fdf2315
Fix config update
leo42 Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
3,071 changes: 1,883 additions & 1,188 deletions Fe/package-lock.json

Large diffs are not rendered by default.

22 changes: 16 additions & 6 deletions Fe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
"main": "index.js",
"scripts": {
"build": "webpack --mode=production",
"start": "webpack serve --mode=development",
"dev": "concurrently \"webpack --mode=development --watch\" \"webpack serve --mode=development\"",
"Uidev": "concurrently \"webpack --mode=development --watch\" \"cd build && node --trace-uncaught server.js \""
"start": "webpack serve --mode=development",
"dev": "concurrently \"webpack --mode=development --watch\" \"webpack serve --mode=development\"",
"Uidev": "concurrently \"webpack --mode=development --watch\" \"cd build && node --trace-uncaught server.js \"",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch"
},
"keywords": [],
"author": "",
Expand All @@ -16,26 +18,34 @@
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@effect/schema": "^0.72.3",
"@lucid-evolution/lucid": "^0.3.44",
"axios": "^1.2.2",
"babel-loader": "^8.0.6",
"buffer": "^6.0.3",
"crypto-js": "^4.1.1",
"lucid-cardano": "0.10.7",
"crypto-js": "^4.2.0",
"lucid-cardano": "^0.10.10",
"qrcode": "^1.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-toastify": "^9.1.1",
"socket.io-client": "^4.5.4",
"style-loader": "^3.3.1"
"style-loader": "^3.3.1",
"typescript": "^5.6.2"
},
"devDependencies": {
"@svgr/webpack": "^6.5.1",
"@types/crypto-js": "^4.2.2",
"@types/json-schema": "^7.0.15",
"@types/react": "^17.0.80",
"@types/react-dom": "^17.0.11",
"concurrently": "^7.6.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"html-webpack-plugin": "^5.5.3",
"raw-loader": "^4.0.2",
"svg-url-loader": "^8.0.0",
"ts-loader": "^9.4.2",
"webpack": "^5.75.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.11.1",
Expand Down
2 changes: 2 additions & 0 deletions Fe/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ select{
width: 100vw;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 0px;
position: absolute;
top: 200px;
Expand All @@ -135,6 +136,7 @@ select{
.WalletMain{
align-items: center;
margin: 20px;
width: 100%;
}

.tooltip:hover::after{
Expand Down
29 changes: 27 additions & 2 deletions Fe/src/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ setPendingTxs(pendingTxs){

async checkTransactions(){

await this.loadUtxos()
for (let i = this.pendingTxs.length-1 ; i >= 0 ; i--) {
const isValid = await this.checkTransaction(this.pendingTxs[i].tx)
if (!isValid){
Expand Down Expand Up @@ -681,8 +680,11 @@ setPendingTxs(pendingTxs){
return "Sucsess"
}

getSignerName(keyHash){
return this.signersNames.find(signer => signer.hash === keyHash)?.name || '';
}

async createDelegationTx(pool, signers){
async createDelegationTx(pool, dRepId, signers){
const curentDelegation = await this.getDelegation()
const rewardAddress = this.lucid.utils.validatorToRewardAddress(this.lucidNativeScript)
const sigCheck = this.checkSigners(signers)
Expand Down Expand Up @@ -830,6 +832,29 @@ setPendingTxs(pendingTxs){

}

updateSignerName(keyHash, name){

function changeName(json, keyHash, name){
if (json.keyHash === keyHash){
json.name = name
}
if (json.type === "all" || json.type === "any" || json.type === "atLeast"){
json.scripts.map( (script,index) => {
changeName(script, keyHash, name)
})
}
}

changeName(this.wallet_script, keyHash, name)

this.signersNames.map( (signer,index) => {
if (signer.hash === keyHash){
this.signersNames[index].name = name
}
})
}


resetDefaultSigners(){
const signersNames = this.signersNames.map( (signer) => {
signer.isDefault = false
Expand Down
25 changes: 25 additions & 0 deletions Fe/src/components/AddressSelect.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.address-select-container{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.address-select-container button{
margin-left: 10px;
border-radius: 10px; /* Rounding the right corners */
background-color: var(--clrInputs); /* Setting background color according to project defaults */
color: var(--clrNavText); /* Setting text color according to project defaults */
}

.address-select-container select{
margin-left: 10px;
}

.address-select-container input{
margin-left: 10px;
}
.addressSelect{
max-width: 80vw;

}
39 changes: 39 additions & 0 deletions Fe/src/components/AddressSelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import './AddressSelect.css';
interface AddressSelectProps {
wallet: any;
moduleRoot: any;
selectedAddress: string;
onAddressChange: (address: string) => void;
showAll?: boolean;
setName?: boolean;
}

const AddressSelect: React.FC<AddressSelectProps> = ({ wallet, moduleRoot, selectedAddress, onAddressChange, showAll = true , setName = false}) => {
return (
<div className="address-select-container">
<div>
<select
className="addressSelect"
value={selectedAddress}
onChange={(event) => onAddressChange(event.target.value)}
>
{showAll && <option value="">All</option>}
{wallet.getFundedAddress().map((item: string, index: number) => (
<option key={index} value={item}>
{wallet.getAddressName(item)}
</option>
))}
</select>
{selectedAddress !== wallet.getDefaultAddress() && (
<button className="defaultButton" onClick={() => moduleRoot.setDefaultAddress(selectedAddress)}>
Make Default
</button>
)}
</div>
{setName && !["",wallet.getAddress()].includes(selectedAddress) && <input type="text" placeholder="Name" onChange={(event) => moduleRoot.changeAddressName(selectedAddress, event.target.value)} />}
</div>
);
};

export default AddressSelect;
118 changes: 0 additions & 118 deletions Fe/src/components/Minting/minting.ak

This file was deleted.

10 changes: 10 additions & 0 deletions Fe/src/components/Multisig/MultisigContainer.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
.MultisigContainer{
margin-top: 100px;
height: 0px;
}

.TokenVaultsContainerHeader{
display: flex;
justify-content: space-between;
width: 100vw;
flex-direction: row;
position: absolute;
top: 115px;
z-index: -10;
}
20 changes: 17 additions & 3 deletions Fe/src/components/Multisig/MultisigContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ async setState(state){
myWallet.setAddressNamess(wallets[index].addressNames)
myWallet.setDefaultSigners(wallets[index].defaultSigners)
myWallet.setPendingTxs(wallets[index].pendingTxs)
await myWallet.checkTransactions()
await myWallet.loadUtxos()
await myWallet.setCollateralDonor(wallets[index].collateralDonor)
state.wallets.push(myWallet)
}
Expand Down Expand Up @@ -256,11 +256,20 @@ async setState(state){

}
}
getSigners(){
const wallets = this.state.wallets
return wallets[this.state.selectedWallet].getSigners()
}

async createDelegationTx(pool,signers){
getSignerName(keyHash){
const wallets = this.state.wallets
return wallets[this.state.selectedWallet].getSignerName(keyHash)
}

async createDelegationTx(pool, dRepId, signers){
try{
const wallets = this.state.wallets
await this.state.wallets[this.state.selectedWallet].createDelegationTx(pool,signers)
await this.state.wallets[this.state.selectedWallet].createDelegationTx(pool, dRepId, signers)
this.setState({wallets})
toast.info('Delegation Transaction created');
}catch(e){
Expand Down Expand Up @@ -333,6 +342,11 @@ async setState(state){
}


updateSignerName(keyHash, name){
const wallets = this.state.wallets
wallets[this.state.selectedWallet].updateSignerName(keyHash, name)
this.setState({wallets})
}

changeAddressName(address,name){
try {
Expand Down
4 changes: 2 additions & 2 deletions Fe/src/components/Multisig/WalletMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import WalletDelegation from '../WalletDelegation';
import WalletOverview from '../Overview'
import TransactionHistory from '../TransactionHistory';
import Receive from '../Receive';
import PendingTxs from './PendingTxs';
import PendingTxs from '../PendingTxs';
import './WalletMain.css';

class WalletMain extends React.Component {
Expand All @@ -25,7 +25,7 @@ class WalletMain extends React.Component {
case "pendingTxs":
return( <PendingTxs key={this.props.moduleRoot.state.selectedWallet+"pendingTxs"} wallet={this.props.wallet} root={this.props.root} moduleRoot={this.props.moduleRoot}></PendingTxs>)
case "transactions":
return <TransactionHistory root={this.props.root} wallet={this.props.wallet} key={this.props.moduleRoot.state.selectedWallet}> moduleRoot={this.props.moduleRoot} </TransactionHistory>
return <TransactionHistory root={this.props.root} wallet={this.props.wallet} moduleRoot={this.props.moduleRoot} key={this.props.moduleRoot.state.selectedWallet}> moduleRoot={this.props.moduleRoot} </TransactionHistory>
case "receive":
return <Receive root={this.props.root} wallet={this.props.wallet} key={this.props.moduleRoot.state.selectedWallet}> moduleRoot={this.props.moduleRoot} </Receive>
}
Expand Down
3 changes: 1 addition & 2 deletions Fe/src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ function NavBar(props){

<div className="navMenuPop" ></div>
<div className="navMenuOption" onClick={() => props.root.setModule("multisig")}>Multisig</div>
<div className="navMenuOption" onClick={() => props.root.setModule("tokenVault")}>TokenVaults</div>
<div className="navMenuOption" onClick={() => props.root.setModule("minting")}>Minting</div>
<div className="navMenuOption" onClick={() => props.root.setModule("smartWallets")}>Smart Wallets</div>
<div className="navMenuOption" onClick={() => props.root.showModal("settings")}>Settings</div>
</div>
</div>
Expand Down
Loading