Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support contract 0.3.2 and reduce fetch records on the history page #134

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions context/generateLambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function generateFA2Michelson(
) {
if (params.length === 0) throw new Error("Empty fa2 params");

if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
return `{
DROP;
NIL operation ;
Expand Down Expand Up @@ -87,7 +87,7 @@ export function generateFA1_2ApproveMichelson(
version: version,
{ spenderAddress, amount, fa1_2Address }: approve
) {
if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
return `{
DROP ;
NIL operation ;
Expand Down Expand Up @@ -118,7 +118,7 @@ export function generateFA1_2TransferMichelson(
version: version,
{ walletAddress, targetAddress, amount, fa1_2Address }: transfer
) {
if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
return `{
DROP ;
NIL operation ;
Expand Down Expand Up @@ -154,7 +154,7 @@ export function generateExecuteContractMichelson(
michelsonEntrypoint = `%${entrypoint}`;
}

if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
return `{
DROP;
NIL operation ;
Expand Down Expand Up @@ -185,7 +185,7 @@ export function generateDelegateMichelson(
version: version,
{ bakerAddress }: { bakerAddress: string }
) {
if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
return `{
DROP ;
NIL operation ;
Expand All @@ -207,7 +207,7 @@ export function generateDelegateMichelson(
}

export function generateUndelegateMichelson(version: version) {
if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
return `{
DROP ;
NIL operation ;
Expand Down
3 changes: 3 additions & 0 deletions context/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const dispatch: { [key: string]: version } = {
"0.1.1": "0.1.1",
"0.3.0": "0.3.0",
"0.3.1": "0.3.1",
"0.3.2": "0.3.2",
};

// Those values are from tzkt api: /v1/contracts
Expand All @@ -32,6 +33,7 @@ const HASHES: { [k in version]: `${typeHash}:${codeHash}` | undefined } = {
"0.1.1": "-483287042:-426350137",
"0.3.0": "-933474574:1358594366",
"0.3.1": "1576695458:46756700",
"0.3.2": "66001562:-1892417854",
"unknown version": undefined,
};

Expand All @@ -42,6 +44,7 @@ const VERSION_HASH: { [k: `${typeHash}:${codeHash}`]: version } = {
[HASHES["0.1.1"]!]: "0.1.1",
[HASHES["0.3.0"]!]: "0.3.0",
[HASHES["0.3.1"]!]: "0.3.1",
[HASHES["0.3.2"]!]: "0.3.2",
};

async function fetchVersion(
Expand Down
2 changes: 1 addition & 1 deletion context/metadata_blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let meta = {
name: "TzSafe",
description:
"TzSafe is a multisig wallet aiming at providing better assurance of security and management of ownership than a traditional single-signed wallet",
version: "0.3.1",
version: "0.3.2",
license: {
name: "MIT",
},
Expand Down
6 changes: 3 additions & 3 deletions context/parseLambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const parseDelegate = (
):
| [true, LambdaType, { address: string } | undefined]
| [false, undefined, undefined] => {
if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
const delegate_instr_size = 6;

if (lambda.length != delegate_instr_size)
Expand Down Expand Up @@ -237,7 +237,7 @@ const parseUnDelegate = (
version: version,
lambda: Expr[]
): [true, LambdaType] | [false, undefined] => {
if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
const undelegate_instr_size = 5;

if (lambda.length != undelegate_instr_size) return [false, undefined];
Expand Down Expand Up @@ -335,7 +335,7 @@ export const parseLambda = (
}
}

if (version === "0.3.1") {
if (version === "0.3.1" || version === "0.3.2") {
const contract_execution_instr_size = 9;

if (lambda.length != contract_execution_instr_size)
Expand Down
Loading