Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

.anchor
.DS_Store
.next
target
node_modules
dist
Expand Down
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"singleQuote": true
}
2 changes: 1 addition & 1 deletion migrations/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// single deploy script that's invoked from the CLI, injecting a provider
// configured from the workspace's Anchor.toml.

const anchor = require("@project-serum/anchor");
const anchor = require('@project-serum/anchor');

module.exports = async function (provider) {
// Configure client to use the provider.
Expand Down
6 changes: 3 additions & 3 deletions scripts/copyIdl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require("fs");
const idl = require("../target/idl/canvas.json");
const fs = require('fs');
const idl = require('../target/idl/canvas.json');

fs.writeFileSync("./web/idl.json", JSON.stringify(idl));
fs.writeFileSync('./web/idl.json', JSON.stringify(idl));
27 changes: 10 additions & 17 deletions sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import * as anchor from "@project-serum/anchor";
import { Wallet } from "@project-serum/anchor";
import {
MintLayout,
TOKEN_PROGRAM_ID,
Token,
} from "@solana/spl-token";
import * as anchor from '@project-serum/anchor';
import { Wallet } from '@project-serum/anchor';
import { MintLayout, TOKEN_PROGRAM_ID, Token } from '@solana/spl-token';
import {
Transaction,
Keypair,
SystemProgram,
Connection,
PublicKey,
TransactionInstruction,
} from "@solana/web3.js";
import { Canvas } from "../../target/types/canvas";
} from '@solana/web3.js';
import { Canvas } from '../../target/types/canvas';

/**
* @TODO parameterize all functions, remove test values
Expand Down Expand Up @@ -93,10 +89,10 @@ export class CanvasSdkClient {
}) {
return PublicKey.findProgramAddress(
[
Buffer.from("incrementor"),
Buffer.from('incrementor'),
this.wallet.publicKey.toBuffer(),
canvasModelAddress.toBuffer(),
Buffer.from("canvas_model_slot"),
Buffer.from('canvas_model_slot'),
],
this.program.programId
);
Expand All @@ -111,7 +107,7 @@ export class CanvasSdkClient {
}) {
return PublicKey.findProgramAddress(
[
Buffer.from("canvas_model"),
Buffer.from('canvas_model'),
this.wallet.publicKey.toBuffer(),
Buffer.from(canvasModelName),
collectionMint.toBuffer(),
Expand All @@ -137,10 +133,7 @@ export class CanvasSdkClient {
});

const createCanvasModelSlotIncrementorIx = await this.program.methods
.createCanvasModelSlotIncrementor(
"canvas_model_slot",
canvasModelSlotIncrementorAddress[1]
)
.createCanvasModelSlotIncrementor(canvasModelSlotIncrementorAddress[1])
.accounts({
canvasModel: canvasModelAddress[0],
incrementor: canvasModelSlotIncrementorAddress[0],
Expand Down Expand Up @@ -168,7 +161,7 @@ export class CanvasSdkClient {
}) {
return await PublicKey.findProgramAddress(
[
Buffer.from("canvas_model_slot"),
Buffer.from('canvas_model_slot'),
this.wallet.publicKey.toBuffer(),
canvasModelAddress.toBuffer(),
Buffer.from(slotName),
Expand Down
Loading