-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from hypersign-protocol/develop
Develop
- Loading branch information
Showing
38 changed files
with
2,934 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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
113
src/blockchains-metadata/cosmos/contract/schema/hypersign-factory.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.