Skip to content

Commit 91559e5

Browse files
committed
update docs
1 parent a19757b commit 91559e5

File tree

394 files changed

+5067
-1957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

394 files changed

+5067
-1957
lines changed

docs/content/docs/modules/core/Address.mdx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Added in v1.0.0
1616
- [arbitrary](#arbitrary-1)
1717
- [Functions](#functions)
1818
- [fromBech32](#frombech32)
19+
- [Model](#model)
20+
- [AddressDetails (interface)](#addressdetails-interface)
1921
- [Schema](#schema)
2022
- [Address (class)](#address-class)
2123
- [toJSON (method)](#tojson-method)
@@ -28,7 +30,10 @@ Added in v1.0.0
2830
- [FromBytes](#frombytes)
2931
- [FromHex](#fromhex)
3032
- [Utils](#utils)
33+
- [getAddressDetails](#getaddressdetails)
3134
- [getNetworkId](#getnetworkid)
35+
- [getPaymentCredential](#getpaymentcredential)
36+
- [getStakingCredential](#getstakingcredential)
3237
- [hasStakingCredential](#hasstakingcredential)
3338
- [isEnterprise](#isenterprise)
3439
- [utils](#utils-1)
@@ -68,6 +73,29 @@ export declare const fromBech32: (i: string, overrideOptions?: ParseOptions) =>
6873
6974
Added in v1.0.0
7075
76+
# Model
77+
78+
## AddressDetails (interface)
79+
80+
Address details with both structured and serialized formats
81+
82+
**Signature**
83+
84+
```ts
85+
export interface AddressDetails {
86+
readonly type: "Base" | "Enterprise"
87+
readonly networkId: NetworkId.NetworkId
88+
readonly address: {
89+
readonly bech32: string
90+
readonly hex: string
91+
}
92+
readonly paymentCredential: Credential.CredentialSchema
93+
readonly stakingCredential?: Credential.CredentialSchema
94+
}
95+
```
96+
97+
Added in v1.0.0
98+
7199
# Schema
72100

73101
## Address (class)
@@ -178,6 +206,38 @@ Added in v1.0.0
178206

179207
# Utils
180208

209+
## getAddressDetails
210+
211+
Parse address from bech32 or hex string and extract all details
212+
Returns undefined if the address cannot be parsed
213+
214+
Supports:
215+
216+
- Base addresses (payment + staking credentials)
217+
- Enterprise addresses (payment credential only)
218+
219+
**Signature**
220+
221+
```ts
222+
export declare const getAddressDetails: (address: string) => AddressDetails | undefined
223+
```
224+
225+
**Example**
226+
227+
```typescript
228+
import * as Address from "@evolution-sdk/evolution/core/Address"
229+
230+
const details = Address.getAddressDetails("addr_test1qp...")
231+
if (details) {
232+
console.log(details.type) // "Base" | "Enterprise"
233+
console.log(details.networkId) // 0 | 1
234+
console.log(details.paymentCredential)
235+
console.log(details.stakingCredential) // present for Base addresses
236+
}
237+
```
238+
239+
Added in v1.0.0
240+
181241
## getNetworkId
182242

183243
Get network ID from AddressStructure
@@ -190,6 +250,32 @@ export declare const getNetworkId: (address: Address) => NetworkId.NetworkId
190250
191251
Added in v1.0.0
192252
253+
## getPaymentCredential
254+
255+
Extract payment credential from address string
256+
Returns undefined if the address cannot be parsed
257+
258+
**Signature**
259+
260+
```ts
261+
export declare const getPaymentCredential: (address: string) => Credential.CredentialSchema | undefined
262+
```
263+
264+
Added in v1.0.0
265+
266+
## getStakingCredential
267+
268+
Extract staking credential from address string
269+
Returns undefined if the address has no staking credential or cannot be parsed
270+
271+
**Signature**
272+
273+
```ts
274+
export declare const getStakingCredential: (address: string) => Credential.CredentialSchema | undefined
275+
```
276+
277+
Added in v1.0.0
278+
193279
## hasStakingCredential
194280
195281
Check if AddressStructure has staking credential (BaseAddress-like)

0 commit comments

Comments
 (0)