@mysten/enoki
Advanced tools
Comparing version 0.0.0-experimental-20240819192704 to 0.0.0-experimental-20240820200136
# @mysten/enoki | ||
## 0.0.0-experimental-20240819192704 | ||
## 0.0.0-experimental-20240820200136 | ||
### Minor Changes | ||
- f589885: Add sdk methods for managing enoki subnames | ||
## 0.3.17 | ||
### Patch Changes | ||
@@ -12,4 +18,4 @@ | ||
- Updated dependencies [00a974d] | ||
- @mysten/sui@0.0.0-experimental-20240819192704 | ||
- @mysten/zklogin@0.0.0-experimental-20240819192704 | ||
- @mysten/sui@1.7.0 | ||
- @mysten/zklogin@0.7.17 | ||
@@ -16,0 +22,0 @@ ## 0.3.16 |
@@ -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.0.0-experimental-20240819192704", | ||
"version": "0.0.0-experimental-20240820200136", | ||
"description": "TODO: Description", | ||
@@ -49,4 +49,4 @@ "license": "Apache-2.0", | ||
"nanostores": "^0.10.3", | ||
"@mysten/sui": "0.0.0-experimental-20240819192704", | ||
"@mysten/zklogin": "0.0.0-experimental-20240819192704" | ||
"@mysten/sui": "1.7.0", | ||
"@mysten/zklogin": "0.7.17" | ||
}, | ||
@@ -53,0 +53,0 @@ "peerDependencies": { |
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
327685
2234
3
+ Added@mysten/sui@1.7.0(transitive)
+ Added@mysten/zklogin@0.7.17(transitive)
- Removed@mysten/sui@0.0.0-experimental-20240819192704(transitive)
- Removed@mysten/zklogin@0.0.0-experimental-20240819192704(transitive)
Updated@mysten/sui@1.7.0
Updated@mysten/zklogin@0.7.17