Skip to content

Commit

Permalink
Pre-encode things
Browse files Browse the repository at this point in the history
  • Loading branch information
mmjee committed Nov 1, 2023
1 parent 7e27321 commit ccbbb25
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,23 @@ export class ArcanaSolanaAPI {
return this.p.connected
}

async request(args: RequestArguments): Promise<unknown> {
async request(_args: RequestArguments): Promise<unknown> {
const args = structuredClone(_args)

switch (args.method) {
case 'signMessage': {
const p = args.params as {
message: string | Uint8Array | Buffer
display: string
}
if (Buffer.isBuffer(p.message) || p.message instanceof Uint8Array) {
p.message = this.bs58Module.encode(p.message)
}
}
}

const response = await this.p.request(args)

switch (args.method) {
case 'signMessage': {
return this.parseSignatureResponse(response as SignatureResRaw)
Expand Down

0 comments on commit ccbbb25

Please sign in to comment.