Skip to content

Commit

Permalink
chore: Test json
Browse files Browse the repository at this point in the history
  • Loading branch information
rrr523 committed May 7, 2024
1 parent be6ef67 commit 83bd17d
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/js-sdk/hello0503.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "name": "John Doe", "age": 30, "email": "johndoe@example.com" }
1 change: 1 addition & 0 deletions packages/js-sdk/hello0503.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "name": "John Doe", "age": 30, "email": "johndoe@example.com" }
Binary file added packages/js-sdk/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/js-sdk/src/api/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
QueryVerifyPermissionResponse,
} from '@bnb-chain/greenfield-cosmos-types/greenfield/storage/query';
import {
MsgCancelMigrateBucket,
MsgCreateBucket,
MsgDeleteBucket,
MsgDeletePolicy,
Expand Down
3 changes: 2 additions & 1 deletion packages/js-sdk/src/clients/spclient/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export const getCanonicalRequest = (reqMeta: Partial<ReqMeta>, reqHeaders: Heade
};

export const getAuthorization = (canonicalRequest: string, authType: AuthType) => {
// console.log('canonicalRequest', canonicalRequest);
// eslint-disable-next-line no-console
console.log('canonicalRequest', canonicalRequest);

const unsignedMsg = getMsgToSign(utf8ToBytes(canonicalRequest));
let authorization = '';
Expand Down
4 changes: 4 additions & 0 deletions packages/js-sdk/src/clients/spclient/spClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ export class SpClient implements ISpClient {
});
}

debugger;
const file = assertFileType(uploadFile) ? uploadFile.content : uploadFile;
// eslint-disable-next-line no-console
console.log('file::::', file);

const response = await R.send(file);
const { status } = response;

Expand Down
2 changes: 2 additions & 0 deletions packages/js-sdk/src/node/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export function createFile(filePath: string): NodeFile {

if (!type) throw new Error(`Unsupported file type: ${filePath}`);

// console.log('fs.readFileSync(filePath)', fs.readFileSync(filePath));

return {
name: filePath,
type,
Expand Down
13 changes: 10 additions & 3 deletions packages/js-sdk/tests/upload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ describe('upload', () => {
}, 50000);

test('delegrateUpload', async () => {
const file = createFile('./README.md');
// const file = createFile('./hello0503.json');
// const file = createFile('./package.json');
// const file = createFile('./image.png');

const file = createFile('./hello0503.json');
// eslint-disable-next-line no-console
console.log('file', file);

const res = await client.object.delegateUploadObject(
{
bucketName: 'dfg',
objectName: 'b333',
// bucketName: 'dfg',
bucketName: 'nucvscdifk',
objectName: 'b4420',
body: file,
delegatedOpts: {
visibility: VisibilityType.VISIBILITY_TYPE_PUBLIC_READ,
Expand Down
3 changes: 3 additions & 0 deletions packages/js-sdk/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { GREENFIELD_CHAIN_ID, GREENFIELD_URL } from './env';

export const client = Client.create(GREENFIELD_URL, GREENFIELD_CHAIN_ID);

// eslint-disable-next-line no-console
console.log('GREENFIELD_URL', GREENFIELD_URL);

export const ZERO_ACCOUNT_ADDRESS = '0x0000000000000000000000000000000000000000';

export const DEFAULT_SIMULATE_INFO: ISimulateGasFee = {
Expand Down

0 comments on commit 83bd17d

Please sign in to comment.