Skip to content

Commit

Permalink
Update for new stoic
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenandrews committed Sep 20, 2024
1 parent 6ddbc17 commit 34e5431
Show file tree
Hide file tree
Showing 7 changed files with 612 additions and 81 deletions.
667 changes: 598 additions & 69 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"ethereum-blockies-base64": "^1.0.2",
"html-react-parser": "3.0.4",
"https-browserify": "^1.0.0",
"ic-stoic-identity": "^2.0.0",
"ic-stoic-identity": "^6.0.0",
"json-bigint": "^1.0.0",
"localforage": "^1.10.0",
"lodash": "4.17.21",
Expand Down
1 change: 1 addition & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ export default function App() {
return true;
};
const _processPaymentForCanister = async _collection => {
return;//This wont work now...
if (
typeof _collection == 'undefined' ||
!_collection ||
Expand Down
2 changes: 1 addition & 1 deletion src/components/NFT.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default function NFT(props) {
};
useInterval(() => {
refresh();
}, 60 * 1000);
}, 5* 60 * 1000);

React.useEffect(() => {
if (typeof props.listing == 'undefined') {
Expand Down
4 changes: 2 additions & 2 deletions src/components/UserCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export default function UserCollection(props) {
data = data.map(a => ({...a, token: a.id}));
break;
case 'favorites':
var r = await createEntrepotApiWithIdentity(props.identity)
/*var r = await createEntrepotApiWithIdentity(props.identity)
.canister('6z5wo-yqaaa-aaaah-qcsfa-cai')
.liked();
data = offeredResponse.filter((a, i) => offeredResponse.indexOf(a) == i);
Expand All @@ -316,7 +316,7 @@ export default function UserCollection(props) {
owner: false,
canister: decodeNftId(a).canister,
listing: null,
}));
}));*/
break;
case 'offers-made':
const offeredResponse = await createEntrepotApiWithIdentity(props.identity)
Expand Down
11 changes: 6 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ const clipboardCopy = text => {
var b = await defaultEntrepotApi
.canister('rkp4c-7iaaa-aaaaa-aaaca-cai')
.get_icp_xdr_conversion_rate();
var b2 = await fetch(
/*var b2 = await fetch(
'https://free.currconv.com/api/v7/convert?q=XDR_USD&compact=ultra&apiKey=df6440fc0578491bb13eb2088c4f60c7',
).then(r => r.json());
).then(r => r.json());*/
_rate =
Number(b.data.xdr_permyriad_per_icp / 10000n) *
(b2.hasOwnProperty('XDR_USD') ? b2.XDR_USD : 1.331578);
1.3491865;
}
return _rate;
},
Expand All @@ -265,10 +265,11 @@ const clipboardCopy = text => {
return _liked;
},
EntrepotUpdateLiked = async identity => {
if (identity) {
/*if (identity) {
const entrepotApi = createEntrepotApiWithIdentity(identity);
_liked = await entrepotApi.canister('6z5wo-yqaaa-aaaah-qcsfa-cai').liked();
} else _liked = [];
} else _liked = [];*/
_liked = [];
},
EntrepotSaveLiked = async identity => {
if (identity) {
Expand Down
6 changes: 3 additions & 3 deletions src/volt.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createEntrepotApiWithIdentity} from './typescript/api/entrepot-apis/entrepot-data-api';
import {defaultEntrepotApi} from './typescript/api/entrepot-apis/entrepot-data-api';

var loadedVolts = {};
//Will attempt to load volt for principal, returns either false if none, or the principal
Expand All @@ -8,7 +8,7 @@ export async function loadVolt(identity) {
return loadedVolts[currentPrincipal];
}
let newVoltPrincipal = false;
const voltFactoryAPI = createEntrepotApiWithIdentity(identity).canister(
const voltFactoryAPI = defaultEntrepotApi.canister(
'flvm3-zaaaa-aaaak-qazaq-cai',
);
const volt = await voltFactoryAPI.getOwnerCanister(identity.getPrincipal());
Expand All @@ -23,7 +23,7 @@ export async function loadVoltBalance(identity) {
var currentPrincipal = identity.getPrincipal().toText();
if (loadedVolts.hasOwnProperty(currentPrincipal)) {
var voltPrincipal = loadedVolts[currentPrincipal];
const voltAPI = createEntrepotApiWithIdentity(identity).canister(voltPrincipal, 'volt');
const voltAPI = defaultEntrepotApi.canister(voltPrincipal, 'volt');
const resp = await voltAPI.getBalances('icpledger', 'ryjl3-tyaaa-aaaaa-aaaba-cai', []);
if (resp.hasOwnProperty('ok')) {
return [
Expand Down

0 comments on commit 34e5431

Please sign in to comment.