From 04f3a7aadba19ee3bf8eaa1c0cfad43941962e13 Mon Sep 17 00:00:00 2001 From: Songkeys Date: Mon, 15 May 2023 14:51:24 +0800 Subject: [PATCH 1/2] feat(indexer): add tipCharacter and tipCharacterForNote to newbie --- src/indexer/subapis/newbie.ts | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/indexer/subapis/newbie.ts b/src/indexer/subapis/newbie.ts index c550ffc1..66e48847 100644 --- a/src/indexer/subapis/newbie.ts +++ b/src/indexer/subapis/newbie.ts @@ -1,5 +1,6 @@ import { type Address } from 'viem' import { + type Numberish, type CharacterMetadata, type EmailUserEntity, type LinkItemNote, @@ -277,6 +278,44 @@ export class NewbieIndexer { ) } + tipCharacter({ + characterId, + amount, + }: { + characterId: Numberish + /** amount to tip. (CSB in wei) */ + amount: Numberish + }) { + return this.base.fetch<{ transactionHash: string; data: boolean }>( + `/newbie/contract/tips`, + { + method: 'POST', + data: { characterId, amount }, + token: this.token, + }, + ) + } + + tipCharacterForNote({ + characterId, + noteId, + amount, + }: { + characterId: Numberish + noteId: Numberish + /** amount to tip. (CSB in wei) */ + amount: Numberish + }) { + return this.base.fetch<{ transactionHash: string; data: boolean }>( + `/newbie/contract/tips`, + { + method: 'POST', + data: { characterId, noteId, amount }, + token: this.token, + }, + ) + } + /** * Get proofs for withdraw to call `withdraw` contract method on client */ From 582e6f4eb0fd3206ce0e81951abcbc00b97ca82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Tue, 16 May 2023 01:12:29 +0800 Subject: [PATCH 2/2] chore: fix lint --- src/indexer/subapis/newbie.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indexer/subapis/newbie.ts b/src/indexer/subapis/newbie.ts index 66e48847..927cb489 100644 --- a/src/indexer/subapis/newbie.ts +++ b/src/indexer/subapis/newbie.ts @@ -1,12 +1,12 @@ import { type Address } from 'viem' import { - type Numberish, type CharacterMetadata, type EmailUserEntity, type LinkItemNote, type LinkItemType, type NoteEntity, type NoteMetadata, + type Numberish, } from '../../types' import { type BaseIndexer } from './base'