Skip to content

Commit

Permalink
feature (marketplace): added rudimentary marketplace functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Mar 20, 2024
1 parent 294154b commit c95a873
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 71 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"@masa-finance/masa-contracts-oracle": "^0.2.0",
"@masa-finance/masa-sdk": "^3.20.0",
"@masa-finance/masa-sdk": "^3.22.6",
"@types/clear": "^0.1.4",
"@types/figlet": "^1.5.8",
"chalk": "~4.1.2",
Expand All @@ -29,9 +29,9 @@
"path": "^0.12.7"
},
"devDependencies": {
"@types/node": "^20.11.26",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"eslint": "^8.25.0",
"prettier": "^3.1.0",
"typescript": "^5.3.3"
Expand Down
19 changes: 19 additions & 0 deletions src/cli.ts
Expand Up @@ -27,6 +27,7 @@ import {
identityShow,
login,
logout,
marketplaceStakeShow,
oracleStake,
oracleWithdraw,
sbtBurn,
Expand Down Expand Up @@ -588,6 +589,24 @@ program
.action((amount: string) => oracleWithdraw(amount));
}

{
const marketplace = program
.command("marketplace")
.description("Marketplace commands");

const stake = marketplace
.command("stake")
.argument("<amount>", "Amount to stake");

stake
.command("show")
.argument("<token-id>", "Token ID")
.option("-a, --address <address>", "Address override")
.action((tokenId: string, { address }) =>
marketplaceStakeShow(tokenId, address),
);
}

{
const token = program.command("token").description("Token commands");

Expand Down
1 change: 1 addition & 0 deletions src/commands/index.ts
@@ -1,5 +1,6 @@
export * from "./credit-score/";
export * from "./green/";
export * from "./marketplace/";
export * from "./identity/";
export * from "./sbt/";
export * from "./soul-name/";
Expand Down
1 change: 1 addition & 0 deletions src/commands/marketplace/index.ts
@@ -0,0 +1 @@
export { stakeShow as marketplaceStakeShow } from "./stake-show";
16 changes: 16 additions & 0 deletions src/commands/marketplace/stake-show.ts
@@ -0,0 +1,16 @@
import { masa } from "../../helpers";
import { BigNumber } from "ethers";

export const stakeShow = async (
tokenId: BigNumber | string,
address?: string,
) => {
address = address || (await masa.config.signer.getAddress());

console.log(
await masa.contracts.marketplace.userStakes(
address,
BigNumber.from(tokenId),
),
);
};
141 changes: 74 additions & 67 deletions yarn.lock
Expand Up @@ -438,10 +438,10 @@
dependencies:
ethers "~5.7.2"

"@masa-finance/masa-contracts-marketplace@^2.1.3":
version "2.1.3"
resolved "https://registry.yarnpkg.com/@masa-finance/masa-contracts-marketplace/-/masa-contracts-marketplace-2.1.3.tgz#30e5d098930fd26f28d6bb17ed5fc94f964d69f7"
integrity sha512-GoHHFJImejaY+VYPscR5+I0zlGT75Qp+wha4hpUggetB6WSr1O9jGHSLWSghNYGfDIG9FRs2/rYALGGgQ93D5Q==
"@masa-finance/masa-contracts-marketplace@^2.1.6":
version "2.1.6"
resolved "https://registry.yarnpkg.com/@masa-finance/masa-contracts-marketplace/-/masa-contracts-marketplace-2.1.6.tgz#9ab8b444c0e67fd29c1123ce15a070a25a1d77eb"
integrity sha512-0/CiDpd+oO/XBJ12e8WXRblG9psri/rBHXweFuZb4tjg4P2TdKWr/efpXEQbiolidGNsMEsPN8Z+2xNHiuaVgQ==
dependencies:
ethers "~5.7.2"

Expand All @@ -452,10 +452,10 @@
dependencies:
ethers "~5.7.2"

"@masa-finance/masa-sdk@^3.20.0":
version "3.22.1"
resolved "https://registry.yarnpkg.com/@masa-finance/masa-sdk/-/masa-sdk-3.22.1.tgz#3f2d0ebbceba75ab8324b8edd069b734e74a704c"
integrity sha512-shr5VRtzQN+PJYBP4+LxIkn62XW7j/XFEijCok4rMmi8PHg8qzYiHJuKb2K49eTp4Q3OC67rZxhYbEMpDaJm/g==
"@masa-finance/masa-sdk@^3.22.6":
version "3.22.6"
resolved "https://registry.yarnpkg.com/@masa-finance/masa-sdk/-/masa-sdk-3.22.6.tgz#caf57f1e0ddfd34cac9a3ff48412922c63678f7c"
integrity sha512-XyhdZKXUEhJHmtDsCUElmY18IaRanAtU65C3b8vVG5EQHAGZUdHIpdYyIvN0LwP7nfp7+wgkHmkQUGwIVRLDlg==
dependencies:
"@ethersproject/abi" "^5.7.0"
"@ethersproject/abstract-provider" "^5.7.0"
Expand All @@ -465,10 +465,10 @@
"@layerzerolabs/lz-definitions" "^2.0.25"
"@layerzerolabs/lz-v2-utilities" "^2.0.25"
"@masa-finance/masa-contracts-identity" "^1.12.0"
"@masa-finance/masa-contracts-marketplace" "^2.1.3"
"@masa-finance/masa-contracts-marketplace" "^2.1.6"
"@masa-finance/masa-token" "^2.1.1"
arweave "1.11.8"
axios "^1.6.7"
axios "^1.6.8"
ethers "~5.7.2"
grapheme-splitter "^1.0.4"
typescript "^5.4.2"
Expand Down Expand Up @@ -561,7 +561,7 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==

"@types/node@*", "@types/node@^20.11.26":
"@types/node@*":
version "20.11.28"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.28.tgz#4fd5b2daff2e580c12316e457473d68f15ee6f66"
integrity sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==
Expand All @@ -573,6 +573,13 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240"
integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==

"@types/node@^20.11.30":
version "20.11.30"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.30.tgz#9c33467fc23167a347e73834f788f4b9f399d66f"
integrity sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==
dependencies:
undici-types "~5.26.4"

"@types/semver@^7.5.0":
version "7.5.6"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339"
Expand All @@ -585,90 +592,90 @@
dependencies:
"@types/node" "*"

"@typescript-eslint/eslint-plugin@^7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.2.0.tgz#5a5fcad1a7baed85c10080d71ad901f98c38d5b7"
integrity sha512-mdekAHOqS9UjlmyF/LSs6AIEvfceV749GFxoBAjwAv0nkevfKHWQFDMcBZWUiIC5ft6ePWivXoS36aKQ0Cy3sw==
"@typescript-eslint/eslint-plugin@^7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.3.1.tgz#0d8f38a6c8a1802139e62184ee7a68ed024f30a1"
integrity sha512-STEDMVQGww5lhCuNXVSQfbfuNII5E08QWkvAw5Qwf+bj2WT+JkG1uc+5/vXA3AOYMDHVOSpL+9rcbEUiHIm2dw==
dependencies:
"@eslint-community/regexpp" "^4.5.1"
"@typescript-eslint/scope-manager" "7.2.0"
"@typescript-eslint/type-utils" "7.2.0"
"@typescript-eslint/utils" "7.2.0"
"@typescript-eslint/visitor-keys" "7.2.0"
"@typescript-eslint/scope-manager" "7.3.1"
"@typescript-eslint/type-utils" "7.3.1"
"@typescript-eslint/utils" "7.3.1"
"@typescript-eslint/visitor-keys" "7.3.1"
debug "^4.3.4"
graphemer "^1.4.0"
ignore "^5.2.4"
natural-compare "^1.4.0"
semver "^7.5.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/parser@^7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.2.0.tgz#44356312aea8852a3a82deebdacd52ba614ec07a"
integrity sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg==
"@typescript-eslint/parser@^7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.3.1.tgz#c4ba7dc2744318a5e4506596cbc3a0086255c526"
integrity sha512-Rq49+pq7viTRCH48XAbTA+wdLRrB/3sRq4Lpk0oGDm0VmnjBrAOVXH/Laalmwsv2VpekiEfVFwJYVk6/e8uvQw==
dependencies:
"@typescript-eslint/scope-manager" "7.2.0"
"@typescript-eslint/types" "7.2.0"
"@typescript-eslint/typescript-estree" "7.2.0"
"@typescript-eslint/visitor-keys" "7.2.0"
"@typescript-eslint/scope-manager" "7.3.1"
"@typescript-eslint/types" "7.3.1"
"@typescript-eslint/typescript-estree" "7.3.1"
"@typescript-eslint/visitor-keys" "7.3.1"
debug "^4.3.4"

"@typescript-eslint/scope-manager@7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.2.0.tgz#cfb437b09a84f95a0930a76b066e89e35d94e3da"
integrity sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg==
"@typescript-eslint/scope-manager@7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.3.1.tgz#73fd0cb4211a7be23e49e5b6efec8820caa6ec36"
integrity sha512-fVS6fPxldsKY2nFvyT7IP78UO1/I2huG+AYu5AMjCT9wtl6JFiDnsv4uad4jQ0GTFzcUV5HShVeN96/17bTBag==
dependencies:
"@typescript-eslint/types" "7.2.0"
"@typescript-eslint/visitor-keys" "7.2.0"
"@typescript-eslint/types" "7.3.1"
"@typescript-eslint/visitor-keys" "7.3.1"

"@typescript-eslint/type-utils@7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.2.0.tgz#7be5c30e9b4d49971b79095a1181324ef6089a19"
integrity sha512-xHi51adBHo9O9330J8GQYQwrKBqbIPJGZZVQTHHmy200hvkLZFWJIFtAG/7IYTWUyun6DE6w5InDReePJYJlJA==
"@typescript-eslint/type-utils@7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.3.1.tgz#cbf90d3d7e788466aa8a5c0ab3f46103f098aa0d"
integrity sha512-iFhaysxFsMDQlzJn+vr3OrxN8NmdQkHks4WaqD4QBnt5hsq234wcYdyQ9uquzJJIDAj5W4wQne3yEsYA6OmXGw==
dependencies:
"@typescript-eslint/typescript-estree" "7.2.0"
"@typescript-eslint/utils" "7.2.0"
"@typescript-eslint/typescript-estree" "7.3.1"
"@typescript-eslint/utils" "7.3.1"
debug "^4.3.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/types@7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.2.0.tgz#0feb685f16de320e8520f13cca30779c8b7c403f"
integrity sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==
"@typescript-eslint/types@7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.3.1.tgz#ae104de8efa4227a462c0874d856602c5994413c"
integrity sha512-2tUf3uWggBDl4S4183nivWQ2HqceOZh1U4hhu4p1tPiIJoRRXrab7Y+Y0p+dozYwZVvLPRI6r5wKe9kToF9FIw==

"@typescript-eslint/typescript-estree@7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.2.0.tgz#5beda2876c4137f8440c5a84b4f0370828682556"
integrity sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==
"@typescript-eslint/typescript-estree@7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.3.1.tgz#598848195fad34c7aa73f548bd00a4d4e5f5e2bb"
integrity sha512-tLpuqM46LVkduWP7JO7yVoWshpJuJzxDOPYIVWUUZbW+4dBpgGeUdl/fQkhuV0A8eGnphYw3pp8d2EnvPOfxmQ==
dependencies:
"@typescript-eslint/types" "7.2.0"
"@typescript-eslint/visitor-keys" "7.2.0"
"@typescript-eslint/types" "7.3.1"
"@typescript-eslint/visitor-keys" "7.3.1"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
minimatch "9.0.3"
semver "^7.5.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/utils@7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.2.0.tgz#fc8164be2f2a7068debb4556881acddbf0b7ce2a"
integrity sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA==
"@typescript-eslint/utils@7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.3.1.tgz#fc28fd508ccf89495012561b7c02a6fdad162460"
integrity sha512-jIERm/6bYQ9HkynYlNZvXpzmXWZGhMbrOvq3jJzOSOlKXsVjrrolzWBjDW6/TvT5Q3WqaN4EkmcfdQwi9tDjBQ==
dependencies:
"@eslint-community/eslint-utils" "^4.4.0"
"@types/json-schema" "^7.0.12"
"@types/semver" "^7.5.0"
"@typescript-eslint/scope-manager" "7.2.0"
"@typescript-eslint/types" "7.2.0"
"@typescript-eslint/typescript-estree" "7.2.0"
"@typescript-eslint/scope-manager" "7.3.1"
"@typescript-eslint/types" "7.3.1"
"@typescript-eslint/typescript-estree" "7.3.1"
semver "^7.5.4"

"@typescript-eslint/visitor-keys@7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.2.0.tgz#5035f177752538a5750cca1af6044b633610bf9e"
integrity sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A==
"@typescript-eslint/visitor-keys@7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.3.1.tgz#6ddef14a3ce2a79690f01176f5305c34d7b93d8c"
integrity sha512-9RMXwQF8knsZvfv9tdi+4D/j7dMG28X/wMJ8Jj6eOHyHWwDW4ngQJcqEczSsqIKKjFiLFr40Mnr7a5ulDD3vmw==
dependencies:
"@typescript-eslint/types" "7.2.0"
"@typescript-eslint/types" "7.3.1"
eslint-visitor-keys "^3.4.1"

"@ungap/structured-clone@^1.2.0":
Expand Down Expand Up @@ -817,12 +824,12 @@ axios@^0.27.2:
follow-redirects "^1.14.9"
form-data "^4.0.0"

axios@^1.6.7:
version "1.6.7"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.7.tgz#7b48c2e27c96f9c68a2f8f31e2ab19f59b06b0a7"
integrity sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==
axios@^1.6.8:
version "1.6.8"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.8.tgz#66d294951f5d988a00e87a0ffb955316a619ea66"
integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==
dependencies:
follow-redirects "^1.15.4"
follow-redirects "^1.15.6"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

Expand Down Expand Up @@ -1349,7 +1356,7 @@ flatted@^3.2.9:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf"
integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==

follow-redirects@^1.14.9, follow-redirects@^1.15.4:
follow-redirects@^1.14.9, follow-redirects@^1.15.6:
version "1.15.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
Expand Down

0 comments on commit c95a873

Please sign in to comment.