Skip to content

Commit

Permalink
unknown vk handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dfstio committed Jan 19, 2025
1 parent d2bb582 commit 22cc928
Show file tree
Hide file tree
Showing 20 changed files with 150 additions and 112 deletions.
138 changes: 76 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "minatokens-lib",
"description": "MinaTokens API Library",
"version": "0.15.0",
"version": "0.15.2",
"author": "DFST",
"devDependencies": {
"@types/node": "^22.10.3",
Expand Down
14 changes: 10 additions & 4 deletions packages/abi/dist/node/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ async function buildTokenTransaction(params) {
async function getTokenSymbolAndAdmin(params) {
const { txType, tokenAddress, chain, to, offerAddress, bidAddress } = params;
const vk = tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
const verificationKeyHashes = [];
let verificationKeyHashes = [];
if (bidAddress) {
verificationKeyHashes.push(vk.FungibleTokenBidContract.hash);
}
Expand Down Expand Up @@ -738,7 +738,11 @@ async function getTokenSymbolAndAdmin(params) {
} else if (vk.FungibleTokenAdmin.hash === adminVerificationKey.hash.toJSON() && vk.FungibleTokenAdmin.data === adminVerificationKey.data) {
isAdvanced = false;
} else {
throw new Error("Unknown admin verification key");
console.error("Unknown admin verification key", {
hash: adminVerificationKey.hash.toJSON(),
symbol,
address: adminContractPublicKey.toBase58()
});
}
let isToNewAccount = void 0;
if (to) {
Expand All @@ -760,8 +764,10 @@ async function getTokenSymbolAndAdmin(params) {
const adminAddress = import_o1js2.PublicKey.fromFields([adminAddress0, adminAddress1]);
for (const hash of verificationKeyHashes) {
const found = Object.values(vk).some((key) => key.hash === hash);
if (!found)
throw new Error(`Final check: unknown verification key hash: ${hash}`);
if (!found) {
console.error(`Final check: unknown verification key hash: ${hash}`);
verificationKeyHashes = verificationKeyHashes.filter((h) => h !== hash);
}
}
verificationKeyHashes.sort((a, b) => {
const typeA = Object.values(vk).find((key) => key.hash === a)?.type;
Expand Down
14 changes: 10 additions & 4 deletions packages/abi/dist/node/token/build.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/abi/dist/node/token/build.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/abi/dist/tsconfig.web.tsbuildinfo

Large diffs are not rendered by default.

Loading

0 comments on commit 22cc928

Please sign in to comment.