Skip to content

Commit

Permalink
fix upload, contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Saturn-Radius committed Aug 16, 2023
1 parent 4bea6cf commit e999515
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 248 deletions.
7 changes: 1 addition & 6 deletions packages/components/MusicPlayer/UploadAlbumModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ export const UploadAlbumModal: React.FC<UploadAlbumModalProps> = ({
image: albumInfo.image,
audios,
};
console.log("---------metadata");
console.log({
metadata: JSON.stringify(metadata),
identifier: uuidv4(),
});

try {
const res = await client.createMusicAlbum(
Expand Down Expand Up @@ -240,7 +235,7 @@ const Step1Component: React.FC<{
...uploadFiles1,
{
name: file.file.name,
ipfs: "ipfs1", //pinataRes.IpfsHash,
ipfs: pinataRes.IpfsHash,
duration: audio.duration,
},
]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,128 +1,86 @@
//@ts-nocheck

/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.25.0.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

import {
CosmWasmClient,
SigningCosmWasmClient,
ExecuteResult,
} from "@cosmjs/cosmwasm-stargate";
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
import { Coin, StdFee } from "@cosmjs/amino";
import { ConfigResponse, Addr, Config, ExecuteMsg, InstantiateMsg, MusicAlbumResponse, MusicAlbum, QueryMsg } from "./TeritoriMusicPlayer.types";
export interface TeritoriMusicPlayerReadOnlyInterface {
contractAddress: string;
config: () => Promise<ConfigResponse>;
queryMusicAlbum: ({
identifier,
musicAlbum: ({
identifier
}: {
identifier: string;
}) => Promise<QueryMusicAlbumResponse>;
}) => Promise<MusicAlbumResponse>;
}
export class TeritoriMusicPlayerQueryClient
implements TeritoriMusicPlayerReadOnlyInterface
{
export class TeritoriMusicPlayerQueryClient implements TeritoriMusicPlayerReadOnlyInterface {
client: CosmWasmClient;
contractAddress: string;

constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client;
this.contractAddress = contractAddress;
this.config = this.config.bind(this);
this.queryMusicAlbum = this.queryMusicAlbum.bind(this);
this.musicAlbum = this.musicAlbum.bind(this);
}

config = async (): Promise<ConfigResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
config: {},
config: {}
});
};
queryMusicAlbum = async ({
identifier,
musicAlbum = async ({
identifier
}: {
identifier: string;
}): Promise<QueryMusicAlbumResponse> => {
}): Promise<MusicAlbumResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
query_music_album: {
identifier,
},
music_album: {
identifier
}
});
};
}
export interface TeritoriMusicPlayerInterface
extends TeritoriMusicPlayerReadOnlyInterface {
export interface TeritoriMusicPlayerInterface extends TeritoriMusicPlayerReadOnlyInterface {
contractAddress: string;
sender: string;
updateConfig: (
{
owner,
}: {
owner?: string;
},
fee?: number | StdFee | "auto",
memo?: string,
funds?: Coin[]
) => Promise<ExecuteResult>;
createMusicAlbum: (
{
category,
identifier,
metadata,
}: {
category: number;
identifier: string;
metadata: string;
},
fee?: number | StdFee | "auto",
memo?: string,
funds?: Coin[]
) => Promise<ExecuteResult>;
deleteMusicAlbum: (
{
identifier,
}: {
identifier: string;
},
fee?: number | StdFee | "auto",
memo?: string,
funds?: Coin[]
) => Promise<ExecuteResult>;
addToLibrary: (
{
identifier,
}: {
identifier: string;
},
fee?: number | StdFee | "auto",
memo?: string,
funds?: Coin[]
) => Promise<ExecuteResult>;
removeFromLibrary: (
{
identifier,
}: {
identifier: string;
},
fee?: number | StdFee | "auto",
memo?: string,
funds?: Coin[]
) => Promise<ExecuteResult>;
updateConfig: ({
owner
}: {
owner?: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
createMusicAlbum: ({
identifier,
metadata
}: {
identifier: string;
metadata: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
deleteMusicAlbum: ({
identifier
}: {
identifier: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
addToLibrary: ({
identifier
}: {
identifier: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
removeFromLibrary: ({
identifier
}: {
identifier: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
}
export class TeritoriMusicPlayerClient
extends TeritoriMusicPlayerQueryClient
implements TeritoriMusicPlayerInterface
{
export class TeritoriMusicPlayerClient extends TeritoriMusicPlayerQueryClient implements TeritoriMusicPlayerInterface {
client: SigningCosmWasmClient;
sender: string;
contractAddress: string;

constructor(
client: SigningCosmWasmClient,
sender: string,
contractAddress: string
) {
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress);
this.client = client;
this.sender = sender;
Expand All @@ -133,122 +91,63 @@ export class TeritoriMusicPlayerClient
this.addToLibrary = this.addToLibrary.bind(this);
this.removeFromLibrary = this.removeFromLibrary.bind(this);
}
updateConfig = async (
{
owner,
}: {
owner?: string;
},
fee: number | StdFee | "auto" = "auto",
memo?: string,
funds?: Coin[]
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_config: {
owner,
},
},
fee,
memo,
funds
);

updateConfig = async ({
owner
}: {
owner?: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_config: {
owner
}
}, fee, memo, _funds);
};
createMusicAlbum = async (
{
identifier,
metadata,
}: {
identifier: string;
metadata: string;
},
fee: number | StdFee | "auto" = "auto",
memo?: string,
funds?: Coin[]
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
create_music_album: {
identifier,
metadata,
},
},
fee,
memo,
funds
);
createMusicAlbum = async ({
identifier,
metadata
}: {
identifier: string;
metadata: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
create_music_album: {
identifier,
metadata
}
}, fee, memo, _funds);
};
deleteMusicAlbum = async (
{
identifier,
}: {
identifier: string;
},
fee: number | StdFee | "auto" = "auto",
memo?: string,
funds?: Coin[]
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
delete_music_album: {
identifier,
},
},
fee,
memo,
funds
);
deleteMusicAlbum = async ({
identifier
}: {
identifier: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
delete_music_album: {
identifier
}
}, fee, memo, _funds);
};
addToLibrary = async (
{
identifier,
}: {
identifier: string;
},
fee: number | StdFee | "auto" = "auto",
memo?: string,
funds?: Coin[]
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
add_to_library: {
identifier,
},
},
fee,
memo,
funds
);
addToLibrary = async ({
identifier
}: {
identifier: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
add_to_library: {
identifier
}
}, fee, memo, _funds);
};
removeFromLibrary = async (
{
identifier,
}: {
identifier: string;
},
fee: number | StdFee | "auto" = "auto",
memo?: string,
funds?: Coin[]
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
remove_from_library: {
identifier,
},
},
fee,
memo,
funds
);
removeFromLibrary = async ({
identifier
}: {
identifier: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
remove_from_library: {
identifier
}
}, fee, memo, _funds);
};
}
Loading

0 comments on commit e999515

Please sign in to comment.