Skip to content

Commit

Permalink
Bump versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbogle committed Feb 4, 2022
1 parent bbe0bda commit 29ce12d
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 38 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

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,6 +1,6 @@
{
"name": "@cardinal/token-manager",
"version": "0.0.5",
"version": "0.0.6",
"description": "Cardinal token manager SDK",
"keywords": [
"solana",
Expand Down
6 changes: 3 additions & 3 deletions programs/cardinal-paid-claim-approver/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardinal-paid-claim-approver"
version = "0.0.5"
version = "0.0.6"
description = "Cardinal paid claim approver"
edition = "2021"
homepage = "https://cardinal.so"
Expand All @@ -25,8 +25,8 @@ anchor-spl = "0.20.1"
spl-associated-token-account = "1.0.2"
spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
solana-program = "1.8.1"
cardinal-token-manager = { version = "^0.0.5", path = "../cardinal-token-manager", features = ["cpi"] }
cardinal-payment-manager = { version = "^0.0.5", path = "../cardinal-payment-manager", features = ["cpi"] }
cardinal-token-manager = { version = "^0.0.6", path = "../cardinal-token-manager", features = ["cpi"] }
cardinal-payment-manager = { version = "^0.0.6", path = "../cardinal-payment-manager", features = ["cpi"] }

[dev-dependencies]
proptest = { version = "1.0" }
4 changes: 2 additions & 2 deletions programs/cardinal-payment-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardinal-payment-manager"
version = "0.0.5"
version = "0.0.6"
description = "Cardinal paid claim approver"
edition = "2021"
homepage = "https://cardinal.so"
Expand All @@ -25,7 +25,7 @@ anchor-spl = "0.20.1"
spl-associated-token-account = "1.0.2"
spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
solana-program = "1.8.1"
cardinal-token-manager = { version = "^0.0.5", path = "../cardinal-token-manager", features = ["cpi"] }
cardinal-token-manager = { version = "^0.0.6", path = "../cardinal-token-manager", features = ["cpi"] }

[dev-dependencies]
proptest = { version = "1.0" }
4 changes: 2 additions & 2 deletions programs/cardinal-rent-receipt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardinal-rent-receipt"
version = "0.0.5"
version = "0.0.6"
description = "Cardinal paid claim approver"
edition = "2021"
homepage = "https://cardinal.so"
Expand All @@ -25,7 +25,7 @@ anchor-spl = "0.20.1"
spl-associated-token-account = "1.0.2"
spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
solana-program = "1.8.1"
cardinal-token-manager = { version = "^0.0.5", path = "../cardinal-token-manager", features = ["cpi"] }
cardinal-token-manager = { version = "^0.0.6", path = "../cardinal-token-manager", features = ["cpi"] }

[dev-dependencies]
proptest = { version = "1.0" }
4 changes: 2 additions & 2 deletions programs/cardinal-rental-counter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardinal-rental-counter"
version = "0.0.5"
version = "0.0.6"
description = "Cardinal paid claim approver"
edition = "2021"
homepage = "https://cardinal.so"
Expand All @@ -25,7 +25,7 @@ anchor-spl = "0.20.1"
spl-associated-token-account = "1.0.2"
spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
solana-program = "1.8.1"
cardinal-token-manager = { version = "^0.0.5", path = "../cardinal-token-manager", features = ["cpi"] }
cardinal-token-manager = { version = "^0.0.6", path = "../cardinal-token-manager", features = ["cpi"] }

[dev-dependencies]
proptest = { version = "1.0" }
4 changes: 2 additions & 2 deletions programs/cardinal-time-invalidator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardinal-time-invalidator"
version = "0.0.5"
version = "0.0.6"
description = "Program for a invalidating token managers based on time"
edition = "2021"
homepage = "https://cardinal.so"
Expand All @@ -25,7 +25,7 @@ anchor-spl = "0.20.1"
spl-associated-token-account = "1.0.2"
spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
solana-program = "1.8.1"
cardinal-token-manager = { version = "^0.0.5", path = "../cardinal-token-manager", features = ["cpi"] }
cardinal-token-manager = { version = "^0.0.6", path = "../cardinal-token-manager", features = ["cpi"] }

[dev-dependencies]
proptest = { version = "1.0" }
2 changes: 1 addition & 1 deletion programs/cardinal-token-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardinal-token-manager"
version = "0.0.5"
version = "0.0.6"
description = "Cardinal token manager"
edition = "2021"
homepage = "https://cardinal.so"
Expand Down
4 changes: 2 additions & 2 deletions programs/cardinal-use-invalidator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardinal-use-invalidator"
version = "0.0.5"
version = "0.0.6"
description = "Cardinal usage invalidator and counter"
edition = "2021"
homepage = "https://cardinal.so"
Expand All @@ -25,7 +25,7 @@ anchor-spl = "0.20.1"
spl-associated-token-account = "1.0.2"
spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
solana-program = "1.8.1"
cardinal-token-manager = { version = "^0.0.5", path = "../cardinal-token-manager", features = ["cpi"] }
cardinal-token-manager = { version = "^0.0.6", path = "../cardinal-token-manager", features = ["cpi"] }

[dev-dependencies]
proptest = { version = "1.0" }
16 changes: 12 additions & 4 deletions src/claimLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,25 @@ import { TokenManagerKind } from "./programs/tokenManager";
import { findTokenManagerAddress } from "./programs/tokenManager/pda";
import { withFindOrInitAssociatedTokenAccount } from "./utils";

export const getLink = (mintId: PublicKey, otp: Keypair): string => {
return `https://claim.cardinal.so/${mintId.toString()}?otp=${utils.bytes.bs58.encode(
export const getLink = (
mintId: PublicKey,
otp: Keypair,
baseUrl = "https://app.cardinal.so"
): string => {
return `${baseUrl}/${mintId.toString()}?otp=${utils.bytes.bs58.encode(
otp.secretKey
)}`;
};

export const fromLink = (link: string): [PublicKey, Keypair] => {
export const fromLink = (
link: string,
baseUrl = "https://app.cardinal.so"
): [PublicKey, Keypair] => {
try {
const [_, mintId, otp] =
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
/https:\/\/claim\.cardinal\.so\/(.*)\?otp=(.*)/.exec(link)!;
new RegExp(`${baseUrl}/(.*)\\?otp=(.*)`).exec(link)!;
console.log(mintId, otp);
return [
new web3.PublicKey(mintId as string),
Keypair.fromSecretKey(utils.bytes.bs58.decode(otp as string)),
Expand Down
41 changes: 31 additions & 10 deletions src/programs/timeInvalidator/accounts.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
import type { AnchorTypes } from "@saberhq/anchor-contrib";
import { Program, Provider } from "@project-serum/anchor";
import type { Connection, PublicKey } from "@solana/web3.js";

import type { TIME_INVALIDATOR_PROGRAM } from "./constants";

export type TimeInvalidatorTypes = AnchorTypes<
import type { AccountData } from "../../utils";
import type {
TIME_INVALIDATOR_PROGRAM,
{
tokenManager: TimeInvalidatorData;
}
>;
TimeInvalidatorData,
} from "./constants";
import { TIME_INVALIDATOR_ADDRESS, TIME_INVALIDATOR_IDL } from "./constants";

// TODO fix types
export const getUseInvalidator = async (
connection: Connection,
timeInvalidatorId: PublicKey
): Promise<AccountData<TimeInvalidatorData>> => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const provider = new Provider(connection, null, {});
const timeInvalidatorProgram = new Program<TIME_INVALIDATOR_PROGRAM>(
TIME_INVALIDATOR_IDL,
TIME_INVALIDATOR_ADDRESS,
provider
);

type Accounts = TimeInvalidatorTypes["Accounts"];
export type TimeInvalidatorData = Accounts["timeInvalidator"];
const parsed = await timeInvalidatorProgram.account.timeInvalidator.fetch(
timeInvalidatorId
);
return {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
parsed,
pubkey: timeInvalidatorId,
};
};
11 changes: 11 additions & 0 deletions src/programs/timeInvalidator/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { AnchorTypes } from "@saberhq/anchor-contrib";
import { PublicKey } from "@solana/web3.js";

import * as TIME_INVALIDATOR_TYPES from "../../idl/cardinal_time_invalidator";
Expand All @@ -12,3 +13,13 @@ export const TIME_INVALIDATOR_IDL = TIME_INVALIDATOR_TYPES.IDL;

export type TIME_INVALIDATOR_PROGRAM =
TIME_INVALIDATOR_TYPES.CardinalTimeInvalidator;

export type TimeInvalidatorTypes = AnchorTypes<
TIME_INVALIDATOR_PROGRAM,
{
tokenManager: TimeInvalidatorData;
}
>;

type Accounts = TimeInvalidatorTypes["Accounts"];
export type TimeInvalidatorData = Accounts["timeInvalidator"];
3 changes: 2 additions & 1 deletion src/programs/timeInvalidator/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./accounts";
export * as accounts from "./accounts";
export * from "./constants";
export * as instruction from "./instruction";
export * as pda from "./pda";
1 change: 0 additions & 1 deletion src/programs/useInvalidator/instruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const incrementUsages = async (
);

const [useInvalidatorId] = await findUseInvalidatorAddress(tokenManagerId);
console.log("-------------", usages);

return useInvalidatorProgram.instruction.incrementUsages(new BN(usages), {
accounts: {
Expand Down

0 comments on commit 29ce12d

Please sign in to comment.