Skip to content

Commit

Permalink
Enoki SDK updates for API (#16049)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Mysten authored Feb 1, 2024
1 parent 6d29a68 commit 4bf3e00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/poor-scissors-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@mysten/enoki": patch
---

Update to latest Enoki API changes
3 changes: 3 additions & 0 deletions sdk/enoki/src/EnokiClient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export class EnokiClient {
return this.#fetch<CreateZkLoginNonceApiResponse>('zklogin/nonce', {
method: 'POST',
body: JSON.stringify({
network: input.network,
ephemeralPublicKey: input.ephemeralPublicKey.toSuiPublicKey(),
additionalEpochs: input.additionalEpochs,
}),
});
}
Expand All @@ -72,6 +74,7 @@ export class EnokiClient {
[ZKLOGIN_HEADER]: input.jwt,
},
body: JSON.stringify({
network: input.network,
ephemeralPublicKey: input.ephemeralPublicKey.toSuiPublicKey(),
maxEpoch: input.maxEpoch,
randomness: input.randomness,
Expand Down
7 changes: 6 additions & 1 deletion sdk/enoki/src/EnokiClient/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import type { ZkLoginSignatureInputs } from '@mysten/sui.js/zklogin';

import type { AuthProvider } from '../EnokiFlow.js';

export type EnokiNetwork = 'mainnet' | 'testnet' | 'devnet';

export interface GetAppApiInput {}
export interface GetAppApiResponse {
authenticationProviders: {
Expand All @@ -23,7 +25,9 @@ export interface GetZkLoginApiResponse {
}

export interface CreateZkLoginNonceApiInput {
network?: EnokiNetwork;
ephemeralPublicKey: PublicKey;
additionalEpochs?: number;
}
export interface CreateZkLoginNonceApiResponse {
nonce: string;
Expand All @@ -34,6 +38,7 @@ export interface CreateZkLoginNonceApiResponse {
}

export interface CreateZkLoginZkpApiInput {
network?: EnokiNetwork;
jwt: string;
ephemeralPublicKey: PublicKey;
randomness: string;
Expand All @@ -42,7 +47,7 @@ export interface CreateZkLoginZkpApiInput {
export interface CreateZkLoginZkpApiResponse extends ZkLoginSignatureInputs {}

export interface CreateSponsoredTransactionBlockApiInput {
network?: 'mainnet' | 'testnet';
network?: EnokiNetwork;
jwt: string;
transactionBlockKindBytes: string;
}
Expand Down

0 comments on commit 4bf3e00

Please sign in to comment.