Skip to content

Commit

Permalink
Merge pull request #18 from hypersign-protocol/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Vishwas1 authored Jun 21, 2024
2 parents 78aa43d + 2f915bf commit 86e6c8d
Show file tree
Hide file tree
Showing 38 changed files with 2,934 additions and 272 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"deploy": "gh-pages -d dist"
},
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.32.3",
"@cosmjs/crypto": "^0.32.2",
"@cosmjs/proto-signing": "^0.31.0",
"@digitalbazaar/ed25519-signature-2020": "^5.2.0",
"@digitalbazaar/ed25519-verification-key-2020": "^4.1.0",
Expand All @@ -25,8 +27,10 @@
"axios": "^1.4.0",
"babel-eslint": "^10.1.0",
"bip39": "^3.1.0",
"bootstrap": "^4.6.2",
"bootstrap-vue": "^2.23.1",
"core-js": "^3.8.3",
"crypto-browserify": "^3.12.0",
"dotenv": "^16.0.1",
"fs": "^0.0.1-security",
"gh-pages": "^1.2.0",
Expand All @@ -50,7 +54,8 @@
"vue-sidebar-menu": "^4.7.4",
"vue2-leaflet": "^2.7.1",
"vuejs-datetimepicker": "^1.1.13",
"vuex": "^3.4.0"
"vuex": "^3.4.0",
"webpack": "^5.90.3"
},
"devDependencies": {
"@babel/core": "^7.12.16",
Expand Down
16 changes: 15 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,29 @@ export default {
if (id == 'CAVACH_API') {
menu.push({
href: "/studio/sessions/" + this.getSelectedService.appId,
title: "Verifications",
title: "Sessions",
icon: "fa fa-check",
})
// menu.push({
// href: "/studio/onchainkyc/" + this.getSelectedService.appId,
// title: "OnChain KYC",
// icon: "fas fa-network-wired",
// })
menu.push({
href: "/studio/widget-config/" + this.getSelectedService.appId,
title: "Widget",
icon: "fa fa-cogs",
})
menu.push({
href: "/studio/usage/" + this.getSelectedService.appId,
title: "Usages",
icon: "fa fa-chart-bar",
})
} else if (id == 'SSI_API') {
menu.push({
href: "/studio/did/" + this.getSelectedService.appId,
Expand Down
9 changes: 9 additions & 0 deletions src/assets/css/gblStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ body{

a {
color: #636363;
text-decoration-line: underline;
}


Expand All @@ -81,4 +82,12 @@ a:hover {
color: #fff;
background-color: rgba(76, 105, 100, 1);
border-color: rgba(76, 105, 100, 1);
}

.center {
/* d-flex align-items-center justify-content-center */
align-items: center !important;
justify-content: center !important;
display: flex !important;

}
9 changes: 9 additions & 0 deletions src/blockchains-metadata/cosmos/contract/comdex/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const HYPERSIGN_KYC_FACTORY_CODE_ID = 34
export const ISSUER_KYC_CODE_ID = 33
export const SBT_TOKEN_CODE_ID = 21
export const HYPERSIGN_KYC_FACTORY_CONTRACT_ADDRESS = "nibi1yatzc54ln59caxxnj53rff2s359pezx3hqxpzu2tkyl2f9ud9yvsq60lle"

// 4. Issuer onboard himself
// 5. Get the Issuer KYC contract address
// 6. Issuer initialize SBT contract

27 changes: 27 additions & 0 deletions src/blockchains-metadata/cosmos/contract/execute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export async function smartContractExecuteRPC(
client,
coinDenom,
userAddress,
contractAddress,
executeMsg,
) {
// Set the inital fee
const fee = {
amount: [
{
denom: coinDenom,
amount: "200000000",
},
],
gas: "200000000",
};

const txResult = await client.execute(
userAddress,
contractAddress,
executeMsg,
fee
)

return txResult
}
39 changes: 39 additions & 0 deletions src/blockchains-metadata/cosmos/contract/instantiate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export async function smartContractCodeInstantiateRPC(
client,
coinDenom,
userAddress,
codeId,
instantiateMsg,
smartContractlabel,
) {
// Set the inital fee
const fee = {
amount: [
{
denom: coinDenom,
amount: "4000",
},
],
gas: "200000",
};

// Instantitate the smart contract code
try {
const txResult = await client.instantiate(
userAddress,
parseInt(codeId),
instantiateMsg,
smartContractlabel,
fee
)
console.log("Transaction hash: ", txResult["transactionHash"]);
alert("Transaction Successful: " + txResult["transactionHash"]);
const contractAddress = txResult["contractAddress"]
return contractAddress
} catch (err) {
console.log(err.message)
alert("Transaction has failed, Error Log below \n\n " + err.message)
return null
}
}

96 changes: 96 additions & 0 deletions src/blockchains-metadata/cosmos/contract/msg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// Prepares a message for `create_entry` RPC method
export function constructSBTMintMsg(owner, nftTokenId, nftTokenUri) {
return {
"mint": {
"owner": owner,
"token_id": nftTokenId,
"token_uri": nftTokenUri,
}
}
}

export function constructOnBoardIssuer(issuer_did, issuer_kyc_code_id) {
return {
"onboard_issuer": {
"issuer_did": issuer_did,
"issuer_kyc_code_id": issuer_kyc_code_id,
}
}
}

export function constructGetRegistredIssuerMsg(issuer_did) {
return {
"get_registered_issuer": {
issuer_did
}
}
}

export function constructGetRegistredSBTContractAddressMsg() {
return {
"s_b_t_contract_address": {

}
}
}

// Message to get the list of SBT tokens for a user
export function constructQuerySBTTokensMsg() {
return {
"all_tokens": {
"limit": 90,
}
}
}

export function constructQueryTokensByOwner(owner) {
return {
"tokens": {
"owner": owner
}
}
}

// Message to get the details of an SBT token
export function constructQuerySBTTokenDetailsMsg(tokenId) {
return {
"all_nft_info": {
"token_id": tokenId
}
}
}

// Return owner for a token
export function constructQuerySBTTokenOwnerMsg(tokenId) {
return {
"owner_of": {
"token_id": tokenId
}
}
}

export function constructInitSbtMsg(token_code_id) {
return {
"init":
{
token_code_id
}
}
}

// Execute SBT Transfer to new owner
export function constructExecuteSBTTransfer(nftTokenId, newOwner) {
return {
"transfer_nft": {
"recipient": newOwner,
"token_id": nftTokenId
}
}
}

// Query the top-level Smart Contract metadata
export function constructQuerySBTContractMetadata() {
return {
"contract_info": {}
}
}
9 changes: 9 additions & 0 deletions src/blockchains-metadata/cosmos/contract/nibi/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const HYPERSIGN_KYC_FACTORY_CODE_ID = 47 //34
export const ISSUER_KYC_CODE_ID = 36
export const SBT_TOKEN_CODE_ID = 21
export const HYPERSIGN_KYC_FACTORY_CONTRACT_ADDRESS = "nibi1f9tjculwafs6qvrfaxxc9n3z29feel2vwelhj5h4xrvmtzvug76q6qeerx" //"nibi1f5djultkcmtxwyyadkjjjjmcncxf5yxz5qkz4qfjnkwqggrw7pdqe27m2h" //"nibi1yatzc54ln59caxxnj53rff2s359pezx3hqxpzu2tkyl2f9ud9yvsq60lle"

// 4. Issuer onboard himself
// 5. Get the Issuer KYC contract address
// 6. Issuer initialize SBT contract

15 changes: 15 additions & 0 deletions src/blockchains-metadata/cosmos/contract/query.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export async function smartContractQueryRPC(
client,
contractAddress,
queryMsg,
) {
if (!client) {
throw new Error('Connect your wallet to proceed')
}
// Exectute the contract message
const queryResult = await client.queryContractSmart(
contractAddress,
queryMsg,
);
return queryResult;
}
113 changes: 113 additions & 0 deletions src/blockchains-metadata/cosmos/contract/schema/hypersign-factory.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"contract_name": "hypersign-factory",
"contract_version": "0.1.0",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"properties": {
"counter": {
"default": 0,
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
},
"execute": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"oneOf": [
{
"type": "object",
"required": [
"onboard_issuer"
],
"properties": {
"onboard_issuer": {
"type": "object",
"required": [
"issuer_did",
"issuer_kyc_code_id"
],
"properties": {
"issuer_did": {
"type": "string"
},
"issuer_kyc_code_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
},
"query": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"oneOf": [
{
"type": "object",
"required": [
"get_registered_issuer"
],
"properties": {
"get_registered_issuer": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
}
]
},
"migrate": null,
"sudo": null,
"responses": {
"get_registered_issuer": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "RegistredIssuerResp",
"type": "object",
"required": [
"issuer"
],
"properties": {
"issuer": {
"$ref": "#/definitions/Issuer"
}
},
"additionalProperties": false,
"definitions": {
"Issuer": {
"type": "object",
"required": [
"did",
"id"
],
"properties": {
"did": {
"type": "string"
},
"id": {
"type": "string"
},
"kyc_contract_address": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
}
}
}
}
}
Loading

0 comments on commit 86e6c8d

Please sign in to comment.