diff --git a/README.md b/README.md index 5c06c1a..3a3dc0e 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,6 @@ - [`masa sbt`](#masa-sbt) - [`masa sbt info `](#masa-sbt-info-contract-address) - [`masa sbt list `](#masa-sbt-list-contract-address) - - [`masa sbt sign `](#masa-sbt-sign-contract-address-name-types-value) - - [`masa sbt prepare-mint `](#masa-sbt-prepare-mint-contract-address-name-types-value-authority-address-signature) - [`masa sbt burn `](#masa-sbt-burn-contract-address-sbt-id) - [`masa asbt`](#masa-asbt) - [`masa asbt deploy`](#masa-asbt-deploy) @@ -129,8 +127,6 @@ Commands: sbt SBT Commands sbt info Shows info about an SBT sbt list [options] Lists your SBTs - sbt sign Signs an SBT - sbt prepare-mint Prepares an SBT mint operation sbt burn Burns an SBT asbt ASBT Commands asbt deploy Deploys ASBTs @@ -439,26 +435,6 @@ Lists your SBTs - `-a, --address
` Address override -#### `masa sbt sign ` - -Signs an SBT - -- ` Address of the SBT to sign` -- ` Name of the contract` -- ` Types structure to sign` -- ` Values of the structure` - -#### `masa sbt prepare-mint ` - -Prepares an SBT mint operation - -- ` Address of the SBT to sign` -- ` Name of the contract` -- ` Types structure to sign` -- ` Values of the structure` -- ` Authority address used for signing` -- ` Signature from the signing step` - #### `masa sbt burn ` Burns an SBT diff --git a/package.json b/package.json index b4c862a..aacd1c0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "doc": "ts-node ./src/doc.ts" }, "dependencies": { - "@masa-finance/masa-sdk": "^2.0.3", + "@masa-finance/masa-sdk": "^2.2.0", "@types/clear": "^0.1.2", "@types/figlet": "^1.5.5", "chalk": "~4.1.2", diff --git a/src/cli.ts b/src/cli.ts index ae34351..bfb7642 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -32,8 +32,6 @@ import { sbtInfo, sbtList, sbtMintASBT, - sbtPrepareMint, - sbtSign, settingsPreset, settingsPresetNetwork, settingsSet, @@ -346,47 +344,6 @@ program sbtList(contractAddress, address) ); - sbt - .command("sign") - .description("Signs an SBT") - .argument("", "Address of the SBT to sign") - .argument("", "Name of the contract") - .argument("", "Types structure to sign") - .argument("", "Values of the structure") - .action( - (contractAddress: string, name: string, types: string, value: string) => - sbtSign(contractAddress, name, types, value) - ); - - sbt - .command("prepare-mint") - .description("Prepares an SBT mint operation") - .argument("", "Address of the SBT to sign") - .argument("", "Name of the contract") - .argument("", "Types structure to sign") - .argument("", "Values of the structure") - .argument("", "Authority address used for signing") - .argument("", "Signature from the signing step") - .action( - ( - contractAddress: string, - name: string, - types: string, - value: string, - authorityAddress: string, - signature: string - ) => - sbtPrepareMint( - "ETH", - contractAddress, - name, - types, - value, - authorityAddress, - signature - ) - ); - sbt .command("burn") .argument("", "Address of the SBT to sign") diff --git a/src/commands/ASBT/deploy.ts b/src/commands/ASBT/deploy.ts index 2025854..00fd7d0 100644 --- a/src/commands/ASBT/deploy.ts +++ b/src/commands/ASBT/deploy.ts @@ -10,7 +10,7 @@ export const deployASBT = async () => { `Admin address (leave empty to use: '${await masa.config.wallet.getAddress()}'): ` ); - const address = await masa.sbt.ASBT.deploy( + const address = await masa.asbt.deploy( name, symbol, baseTokenUri, diff --git a/src/commands/ASBT/mint.ts b/src/commands/ASBT/mint.ts index d56755e..1bccf36 100644 --- a/src/commands/ASBT/mint.ts +++ b/src/commands/ASBT/mint.ts @@ -1,12 +1,9 @@ import { masa } from "../../helpers"; -import { ReferenceSBTAuthority } from "@masa-finance/masa-contracts-identity"; export const mintASBT = async (contractAddress: string, receiver: string) => { - const { sbtContract } = await masa.sbt.connect( - contractAddress - ); + const { mint } = await masa.asbt.connect(contractAddress); - if (sbtContract) { - await masa.sbt.ASBT.mint(sbtContract, receiver); + if (mint) { + await mint(receiver); } }; diff --git a/src/commands/SSSBT/deploy.ts b/src/commands/SSSBT/deploy.ts index 6f9af29..7691a20 100644 --- a/src/commands/SSSBT/deploy.ts +++ b/src/commands/SSSBT/deploy.ts @@ -13,7 +13,7 @@ export const deploySSSBT = async () => { `Admin address (leave empty to use: '${await masa.config.wallet.getAddress()}'): ` ); - const address = await masa.sbt.SSSBT.deploy( + const address = await masa.sssbt.deploy( name, symbol, baseTokenUri, diff --git a/src/commands/SSSBT/mint.ts b/src/commands/SSSBT/mint.ts index d5a0e96..7e33fc4 100644 --- a/src/commands/SSSBT/mint.ts +++ b/src/commands/SSSBT/mint.ts @@ -1,5 +1,4 @@ import { masa } from "../../helpers"; -import { ReferenceSBTSelfSovereign } from "@masa-finance/masa-contracts-identity"; /** * @@ -14,16 +13,9 @@ export const mintSSSBT = async ( signatureDate: number, signature: string ) => { - const { sbtContract } = await masa.sbt.connect( - contractAddress - ); + const { mint } = await masa.sssbt.connect(contractAddress); - if (sbtContract) { - await masa.sbt.SSSBT.mint( - sbtContract, - authorityAddress, - signatureDate, - signature - ); + if (mint) { + await mint(authorityAddress, signatureDate, signature); } }; diff --git a/src/commands/SSSBT/sign.ts b/src/commands/SSSBT/sign.ts index a5668e7..0f1ef33 100644 --- a/src/commands/SSSBT/sign.ts +++ b/src/commands/SSSBT/sign.ts @@ -1,5 +1,4 @@ import { masa } from "../../helpers"; -import { ReferenceSBTSelfSovereign } from "@masa-finance/masa-contracts-identity"; /** * @@ -7,11 +6,9 @@ import { ReferenceSBTSelfSovereign } from "@masa-finance/masa-contracts-identity * @param receiver */ export const signSSSBT = async (contractAddress: string, receiver: string) => { - const { sbtContract } = await masa.sbt.connect( - contractAddress - ); + const { sign } = await masa.sssbt.connect(contractAddress); - if (sbtContract) { - await masa.sbt.SSSBT.sign(sbtContract, receiver); + if (sign) { + await sign(receiver); } }; diff --git a/src/commands/sbt/index.ts b/src/commands/sbt/index.ts index 54e85f9..5c73755 100644 --- a/src/commands/sbt/index.ts +++ b/src/commands/sbt/index.ts @@ -1,5 +1,3 @@ export { burn as sbtBurn } from "./burn"; export { info as sbtInfo } from "./info"; export { list as sbtList } from "./list"; -export { prepareMint as sbtPrepareMint } from "./prepare-mint"; -export { sign as sbtSign } from "./sign"; diff --git a/src/commands/sbt/info.ts b/src/commands/sbt/info.ts index b94ae7d..8db693b 100644 --- a/src/commands/sbt/info.ts +++ b/src/commands/sbt/info.ts @@ -1,15 +1,19 @@ import { masa } from "../../helpers"; export const info = async (address: string) => { - const { sbtContract } = await masa.contracts.sbt.connect(address); + const { sbtContract } = await masa.sbt.connect(address); if (sbtContract) { + const supply = (await sbtContract.totalSupply()).toNumber(); console.log("Self Sovereign SBT Contract Information:\n"); + console.log(`Network: '${masa.config.networkName}'`); console.log(`Contract Name: '${await sbtContract.name()}'`); console.log(`Contract Symbol: '${await sbtContract.symbol()}'`); + if (supply > 0) { + console.log(`Contract Token URI: '${await sbtContract.tokenURI(0)}'`); + } console.log(`Contract Address: '${sbtContract.address}'`); - console.log(`Total SBTs: ${(await sbtContract.totalSupply()).toNumber()}`); - console.log(`Network: '${masa.config.networkName}'`); + console.log(`Total SBTs: ${supply}`); } else { console.error( `Contract ${address} is not deployed to network: '${masa.config.networkName}'` diff --git a/src/commands/sbt/prepare-mint.ts b/src/commands/sbt/prepare-mint.ts deleted file mode 100644 index 3167e7c..0000000 --- a/src/commands/sbt/prepare-mint.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { masa } from "../../helpers"; -import { PaymentMethod } from "@masa-finance/masa-sdk"; - -export const prepareMint = async ( - paymentMethod: PaymentMethod, - address: string, - name: string, - types: string, - value: string, - authorityAddress: string, - signature: string -) => { - const { prepareMint } = await masa.contracts.sbt.connect(address); - const prepareMintResults = await prepareMint( - paymentMethod, - name, - JSON.parse(types), - JSON.parse(value), - signature, - authorityAddress - ); - - if (prepareMintResults) { - const { price, paymentAddress } = prepareMintResults; - console.log({ price, paymentAddress }); - } -}; diff --git a/src/commands/sbt/sign.ts b/src/commands/sbt/sign.ts deleted file mode 100644 index 18bd4a4..0000000 --- a/src/commands/sbt/sign.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { masa } from "../../helpers"; - -export const sign = async ( - address: string, - name: string, - types: string, - value: string -) => { - const { sign } = await masa.contracts.sbt.connect(address); - const signResult = await sign(name, JSON.parse(types), JSON.parse(value)); - - if (signResult) { - const { signature, authorityAddress } = signResult; - console.log(signature, authorityAddress); - } -}; diff --git a/yarn.lock b/yarn.lock index feadd64..aeed621 100644 --- a/yarn.lock +++ b/yarn.lock @@ -395,19 +395,19 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@masa-finance/masa-contracts-identity@^1.6.1": - version "1.6.1" - resolved "https://registry.yarnpkg.com/@masa-finance/masa-contracts-identity/-/masa-contracts-identity-1.6.1.tgz#1f736c79623f4546fb8bb37b303f990183c179f7" - integrity sha512-V+rJJWez5SyJtPkO7ebPg03cQuxfDrR2krgh34a+/khGBnpT0Lbp48OkuO31yAkHaYXAA+tIecJWmQT7UklJ1A== +"@masa-finance/masa-contracts-identity@^1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@masa-finance/masa-contracts-identity/-/masa-contracts-identity-1.7.0.tgz#4248d1eae9d90a6e558be716b1a864358d44a48d" + integrity sha512-XewBQzADlZJ2tkxrXS9DSbPvwd9An0kBbLg12DpGtHWr4mxNQz8Gg+o0SebajYGAcMmJxvd+K6fsWUEr26l/ow== dependencies: ethers "~5.7.2" -"@masa-finance/masa-sdk@^2.0.3": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@masa-finance/masa-sdk/-/masa-sdk-2.0.3.tgz#624747bc88f029d87f1a14315f866b97ef833da4" - integrity sha512-miqYLM+1eC+B6f4C1KJEp26ByffESjki8o/cf1MqGjWKc3tjVmmhpqRfZ589nlUKPdQvvHuzWBVmnBvMBCYEKg== +"@masa-finance/masa-sdk@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@masa-finance/masa-sdk/-/masa-sdk-2.2.0.tgz#4bde3e55a3cb19978e8093ecee641721048f8c21" + integrity sha512-CDpfyF7H61MglH25La0jXQqHLuiRpO9HUZYIwWVMDbS6cNW0WgGt1YVZ/fC1TNwVbJnRF1KNr2wWLOoEXASlIA== dependencies: - "@masa-finance/masa-contracts-identity" "^1.6.1" + "@masa-finance/masa-contracts-identity" "^1.7.0" "@masa-finance/masa-token" "^2.0.0" arweave "1.11.8" axios "^1.3.2"