@mysten/enoki
Advanced tools
Comparing version 0.3.17 to 0.4.0
# @mysten/enoki | ||
## 0.4.0 | ||
### Minor Changes | ||
- f589885: Add sdk methods for managing enoki subnames | ||
## 0.3.17 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
import type { CreateSponsoredTransactionApiInput, CreateSponsoredTransactionApiResponse, CreateZkLoginNonceApiInput, CreateZkLoginNonceApiResponse, CreateZkLoginZkpApiInput, CreateZkLoginZkpApiResponse, ExecuteSponsoredTransactionApiInput, ExecuteSponsoredTransactionApiResponse, GetAppApiInput, GetAppApiResponse, GetZkLoginApiInput, GetZkLoginApiResponse } from './type.js'; | ||
import type { CreateSponsoredTransactionApiInput, CreateSponsoredTransactionApiResponse, CreateSubnameApiInput, CreateSubnameApiResponse, CreateZkLoginNonceApiInput, CreateZkLoginNonceApiResponse, CreateZkLoginZkpApiInput, CreateZkLoginZkpApiResponse, DeleteSubnameApiInput, ExecuteSponsoredTransactionApiInput, ExecuteSponsoredTransactionApiResponse, GetAppApiInput, GetAppApiResponse, GetSubnamesApiInput, GetSubnamesApiResponse, GetZkLoginApiInput, GetZkLoginApiResponse } from './type.js'; | ||
export interface EnokiClientConfig { | ||
@@ -14,2 +14,4 @@ /** The API key for the Enoki app, available in the Enoki Portal. */ | ||
}[]; | ||
status: number; | ||
code: string; | ||
constructor(status: number, response: string); | ||
@@ -29,2 +31,5 @@ } | ||
executeSponsoredTransaction(input: ExecuteSponsoredTransactionApiInput): Promise<ExecuteSponsoredTransactionApiResponse>; | ||
getSubnames(input: GetSubnamesApiInput): Promise<GetSubnamesApiResponse>; | ||
createSubname(input: CreateSubnameApiInput): Promise<CreateSubnameApiResponse>; | ||
deleteSubname(input: DeleteSubnameApiInput): void; | ||
} |
@@ -51,2 +51,4 @@ "use strict"; | ||
this.name = "EnokiClientError"; | ||
this.status = status; | ||
this.code = errors?.[0]?.code ?? "unknown_error"; | ||
} | ||
@@ -124,2 +126,41 @@ } | ||
} | ||
getSubnames(input) { | ||
const query = new URLSearchParams(); | ||
if (input.address) { | ||
query.set("address", input.address); | ||
} | ||
if (input.network) { | ||
query.set("network", input.network); | ||
} | ||
if (input.domain) { | ||
query.set("domain", input.domain); | ||
} | ||
return __privateMethod(this, _EnokiClient_instances, fetch_fn).call(this, "subnames" + (query.size > 0 ? `?${query.toString()}` : ""), { | ||
method: "GET" | ||
}); | ||
} | ||
createSubname(input) { | ||
return __privateMethod(this, _EnokiClient_instances, fetch_fn).call(this, "subnames", { | ||
method: "POST", | ||
headers: input.jwt ? { | ||
[ZKLOGIN_HEADER]: input.jwt | ||
} : {}, | ||
body: JSON.stringify({ | ||
network: input.network, | ||
domain: input.domain, | ||
subname: input.subname, | ||
targetAddress: input.targetAddress | ||
}) | ||
}); | ||
} | ||
deleteSubname(input) { | ||
__privateMethod(this, _EnokiClient_instances, fetch_fn).call(this, "subnames", { | ||
method: "DELETE", | ||
body: JSON.stringify({ | ||
network: input.network, | ||
domain: input.domain, | ||
subname: input.subname | ||
}) | ||
}); | ||
} | ||
} | ||
@@ -126,0 +167,0 @@ _version = new WeakMap(); |
@@ -5,5 +5,8 @@ import type { PublicKey } from '@mysten/sui/cryptography'; | ||
export type EnokiNetwork = 'mainnet' | 'testnet' | 'devnet'; | ||
export type EnokiDomainNetwork = 'mainnet' | 'testnet'; | ||
export type EnokiSubanameStatus = 'PENDING' | 'ACTIVE'; | ||
export interface GetAppApiInput { | ||
} | ||
export interface GetAppApiResponse { | ||
allowedOrigins: string[]; | ||
authenticationProviders: { | ||
@@ -13,2 +16,7 @@ providerType: AuthProvider; | ||
}[]; | ||
domains: { | ||
nftId: string; | ||
name: string; | ||
network: EnokiDomainNetwork; | ||
}[]; | ||
} | ||
@@ -68,1 +76,34 @@ export interface GetZkLoginApiInput { | ||
} | ||
export interface GetSubnamesApiInput { | ||
address?: string; | ||
network?: EnokiDomainNetwork; | ||
domain?: string; | ||
} | ||
export interface GetSubnamesApiResponse { | ||
subnames: { | ||
name: string; | ||
status: EnokiSubanameStatus; | ||
}[]; | ||
} | ||
export type CreateSubnameApiInput = { | ||
domain: string; | ||
network?: EnokiDomainNetwork; | ||
subname: string; | ||
} & ({ | ||
jwt: string; | ||
targetAddress?: never; | ||
} | { | ||
targetAddress: string; | ||
jwt?: never; | ||
}); | ||
export interface CreateSubnameApiResponse { | ||
name: string; | ||
} | ||
export interface DeleteSubnameApiInput { | ||
domain: string; | ||
network?: EnokiDomainNetwork; | ||
subname: string; | ||
} | ||
export interface DeleteSubnameApiResponse { | ||
name: string; | ||
} |
@@ -1,2 +0,2 @@ | ||
export { EnokiClient, type EnokiClientConfig } from './EnokiClient/index.js'; | ||
export { EnokiClient, type EnokiClientConfig, EnokiClientError } from './EnokiClient/index.js'; | ||
export { EnokiFlow, type AuthProvider, type EnokiFlowConfig } from './EnokiFlow.js'; | ||
@@ -3,0 +3,0 @@ export { createLocalStorage, createSessionStorage, createInMemoryStorage, type SyncStore, } from './stores.js'; |
@@ -22,2 +22,3 @@ "use strict"; | ||
EnokiClient: () => import_EnokiClient.EnokiClient, | ||
EnokiClientError: () => import_EnokiClient.EnokiClientError, | ||
EnokiFlow: () => import_EnokiFlow.EnokiFlow, | ||
@@ -24,0 +25,0 @@ EnokiKeypair: () => import_EnokiKeypair.EnokiKeypair, |
@@ -1,2 +0,2 @@ | ||
import type { CreateSponsoredTransactionApiInput, CreateSponsoredTransactionApiResponse, CreateZkLoginNonceApiInput, CreateZkLoginNonceApiResponse, CreateZkLoginZkpApiInput, CreateZkLoginZkpApiResponse, ExecuteSponsoredTransactionApiInput, ExecuteSponsoredTransactionApiResponse, GetAppApiInput, GetAppApiResponse, GetZkLoginApiInput, GetZkLoginApiResponse } from './type.js'; | ||
import type { CreateSponsoredTransactionApiInput, CreateSponsoredTransactionApiResponse, CreateSubnameApiInput, CreateSubnameApiResponse, CreateZkLoginNonceApiInput, CreateZkLoginNonceApiResponse, CreateZkLoginZkpApiInput, CreateZkLoginZkpApiResponse, DeleteSubnameApiInput, ExecuteSponsoredTransactionApiInput, ExecuteSponsoredTransactionApiResponse, GetAppApiInput, GetAppApiResponse, GetSubnamesApiInput, GetSubnamesApiResponse, GetZkLoginApiInput, GetZkLoginApiResponse } from './type.js'; | ||
export interface EnokiClientConfig { | ||
@@ -14,2 +14,4 @@ /** The API key for the Enoki app, available in the Enoki Portal. */ | ||
}[]; | ||
status: number; | ||
code: string; | ||
constructor(status: number, response: string); | ||
@@ -29,2 +31,5 @@ } | ||
executeSponsoredTransaction(input: ExecuteSponsoredTransactionApiInput): Promise<ExecuteSponsoredTransactionApiResponse>; | ||
getSubnames(input: GetSubnamesApiInput): Promise<GetSubnamesApiResponse>; | ||
createSubname(input: CreateSubnameApiInput): Promise<CreateSubnameApiResponse>; | ||
deleteSubname(input: DeleteSubnameApiInput): void; | ||
} |
@@ -27,2 +27,4 @@ var __typeError = (msg) => { | ||
this.name = "EnokiClientError"; | ||
this.status = status; | ||
this.code = errors?.[0]?.code ?? "unknown_error"; | ||
} | ||
@@ -100,2 +102,41 @@ } | ||
} | ||
getSubnames(input) { | ||
const query = new URLSearchParams(); | ||
if (input.address) { | ||
query.set("address", input.address); | ||
} | ||
if (input.network) { | ||
query.set("network", input.network); | ||
} | ||
if (input.domain) { | ||
query.set("domain", input.domain); | ||
} | ||
return __privateMethod(this, _EnokiClient_instances, fetch_fn).call(this, "subnames" + (query.size > 0 ? `?${query.toString()}` : ""), { | ||
method: "GET" | ||
}); | ||
} | ||
createSubname(input) { | ||
return __privateMethod(this, _EnokiClient_instances, fetch_fn).call(this, "subnames", { | ||
method: "POST", | ||
headers: input.jwt ? { | ||
[ZKLOGIN_HEADER]: input.jwt | ||
} : {}, | ||
body: JSON.stringify({ | ||
network: input.network, | ||
domain: input.domain, | ||
subname: input.subname, | ||
targetAddress: input.targetAddress | ||
}) | ||
}); | ||
} | ||
deleteSubname(input) { | ||
__privateMethod(this, _EnokiClient_instances, fetch_fn).call(this, "subnames", { | ||
method: "DELETE", | ||
body: JSON.stringify({ | ||
network: input.network, | ||
domain: input.domain, | ||
subname: input.subname | ||
}) | ||
}); | ||
} | ||
} | ||
@@ -102,0 +143,0 @@ _version = new WeakMap(); |
@@ -5,5 +5,8 @@ import type { PublicKey } from '@mysten/sui/cryptography'; | ||
export type EnokiNetwork = 'mainnet' | 'testnet' | 'devnet'; | ||
export type EnokiDomainNetwork = 'mainnet' | 'testnet'; | ||
export type EnokiSubanameStatus = 'PENDING' | 'ACTIVE'; | ||
export interface GetAppApiInput { | ||
} | ||
export interface GetAppApiResponse { | ||
allowedOrigins: string[]; | ||
authenticationProviders: { | ||
@@ -13,2 +16,7 @@ providerType: AuthProvider; | ||
}[]; | ||
domains: { | ||
nftId: string; | ||
name: string; | ||
network: EnokiDomainNetwork; | ||
}[]; | ||
} | ||
@@ -68,1 +76,34 @@ export interface GetZkLoginApiInput { | ||
} | ||
export interface GetSubnamesApiInput { | ||
address?: string; | ||
network?: EnokiDomainNetwork; | ||
domain?: string; | ||
} | ||
export interface GetSubnamesApiResponse { | ||
subnames: { | ||
name: string; | ||
status: EnokiSubanameStatus; | ||
}[]; | ||
} | ||
export type CreateSubnameApiInput = { | ||
domain: string; | ||
network?: EnokiDomainNetwork; | ||
subname: string; | ||
} & ({ | ||
jwt: string; | ||
targetAddress?: never; | ||
} | { | ||
targetAddress: string; | ||
jwt?: never; | ||
}); | ||
export interface CreateSubnameApiResponse { | ||
name: string; | ||
} | ||
export interface DeleteSubnameApiInput { | ||
domain: string; | ||
network?: EnokiDomainNetwork; | ||
subname: string; | ||
} | ||
export interface DeleteSubnameApiResponse { | ||
name: string; | ||
} |
@@ -1,2 +0,2 @@ | ||
export { EnokiClient, type EnokiClientConfig } from './EnokiClient/index.js'; | ||
export { EnokiClient, type EnokiClientConfig, EnokiClientError } from './EnokiClient/index.js'; | ||
export { EnokiFlow, type AuthProvider, type EnokiFlowConfig } from './EnokiFlow.js'; | ||
@@ -3,0 +3,0 @@ export { createLocalStorage, createSessionStorage, createInMemoryStorage, type SyncStore, } from './stores.js'; |
@@ -1,2 +0,2 @@ | ||
import { EnokiClient } from "./EnokiClient/index.js"; | ||
import { EnokiClient, EnokiClientError } from "./EnokiClient/index.js"; | ||
import { EnokiFlow } from "./EnokiFlow.js"; | ||
@@ -12,2 +12,3 @@ import { | ||
EnokiClient, | ||
EnokiClientError, | ||
EnokiFlow, | ||
@@ -14,0 +15,0 @@ EnokiKeypair, |
{ | ||
"name": "@mysten/enoki", | ||
"version": "0.3.17", | ||
"version": "0.4.0", | ||
"description": "TODO: Description", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
327629
2234
2
177