@xyo-network/account-model 5.3.20 → 5.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +18 -11
- package/src/Account.ts +0 -74
- package/src/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/account-model",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.24",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,22 +30,29 @@
|
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"src",
|
|
34
33
|
"!**/*.bench.*",
|
|
35
34
|
"!**/*.spec.*",
|
|
36
|
-
"!**/*.test.*"
|
|
35
|
+
"!**/*.test.*",
|
|
36
|
+
"README.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xyo-network/key-model": "~5.3.
|
|
40
|
-
"@xyo-network/previous-hash-store-model": "~5.3.
|
|
39
|
+
"@xyo-network/key-model": "~5.3.24",
|
|
40
|
+
"@xyo-network/previous-hash-store-model": "~5.3.24"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@xylabs/
|
|
46
|
-
"@xylabs/
|
|
43
|
+
"@opentelemetry/api": "^1.9.1",
|
|
44
|
+
"@types/node": "^25.5.0",
|
|
45
|
+
"@xylabs/sdk-js": "^5.0.93",
|
|
46
|
+
"@xylabs/ts-scripts-common": "~7.6.16",
|
|
47
|
+
"@xylabs/ts-scripts-pnpm": "~7.6.16",
|
|
48
|
+
"@xylabs/tsconfig": "~7.6.16",
|
|
49
|
+
"acorn": "^8.16.0",
|
|
50
|
+
"axios": "^1.14.0",
|
|
51
|
+
"esbuild": "^0.28.0",
|
|
47
52
|
"typescript": "~5.9.3",
|
|
48
|
-
"zod": "^4.3.6"
|
|
53
|
+
"zod": "^4.3.6",
|
|
54
|
+
"@xyo-network/key-model": "~5.3.24",
|
|
55
|
+
"@xyo-network/previous-hash-store-model": "~5.3.24"
|
|
49
56
|
},
|
|
50
57
|
"peerDependencies": {
|
|
51
58
|
"@xylabs/sdk-js": "^5",
|
|
@@ -54,4 +61,4 @@
|
|
|
54
61
|
"publishConfig": {
|
|
55
62
|
"access": "public"
|
|
56
63
|
}
|
|
57
|
-
}
|
|
64
|
+
}
|
package/src/Account.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { Address, Hash } from '@xylabs/sdk-js'
|
|
2
|
-
import { isArrayBuffer } from '@xylabs/sdk-js'
|
|
3
|
-
import type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model'
|
|
4
|
-
import type { PreviousHashStore } from '@xyo-network/previous-hash-store-model'
|
|
5
|
-
|
|
6
|
-
export const ethMessagePrefix = '\u0019Ethereum Signed Message:\n'
|
|
7
|
-
|
|
8
|
-
export interface PhraseInitializationConfig {
|
|
9
|
-
phrase: string
|
|
10
|
-
}
|
|
11
|
-
export interface PrivateKeyInitializationConfig {
|
|
12
|
-
privateKey: ArrayBufferLike
|
|
13
|
-
}
|
|
14
|
-
export interface MnemonicInitializationConfig {
|
|
15
|
-
mnemonic: string
|
|
16
|
-
path?: string
|
|
17
|
-
}
|
|
18
|
-
export interface AccountOptions {
|
|
19
|
-
previousHash?: ArrayBufferLike
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig
|
|
23
|
-
|
|
24
|
-
export type AccountConfig = InitializationConfig & AccountOptions
|
|
25
|
-
|
|
26
|
-
export const isPhraseInitializationConfig = (value: unknown): value is PhraseInitializationConfig => {
|
|
27
|
-
if (typeof value === 'object' && value !== null) {
|
|
28
|
-
return typeof (value as PhraseInitializationConfig).phrase === 'string'
|
|
29
|
-
}
|
|
30
|
-
return false
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const isPrivateKeyInitializationConfig = (value: unknown): value is PrivateKeyInitializationConfig => {
|
|
34
|
-
if (typeof value === 'object' && value !== null) {
|
|
35
|
-
return isArrayBuffer((value as PrivateKeyInitializationConfig).privateKey)
|
|
36
|
-
}
|
|
37
|
-
return false
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const isMnemonicInitializationConfig = (value: unknown): value is MnemonicInitializationConfig => {
|
|
41
|
-
if (typeof value === 'object' && value !== null) {
|
|
42
|
-
return (
|
|
43
|
-
typeof (value as MnemonicInitializationConfig).mnemonic === 'string' && typeof ((value as MnemonicInitializationConfig).path ?? '') === 'string'
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
return false
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export const isInitializationConfig = (value: unknown): value is InitializationConfig => {
|
|
50
|
-
return isPhraseInitializationConfig(value) || isPrivateKeyInitializationConfig(value) || isMnemonicInitializationConfig(value)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface AccountInstance {
|
|
54
|
-
readonly address: Address
|
|
55
|
-
readonly addressBytes: ArrayBufferLike
|
|
56
|
-
previousHash: Hash | undefined
|
|
57
|
-
previousHashBytes: ArrayBufferLike | undefined
|
|
58
|
-
readonly private?: PrivateKeyInstance
|
|
59
|
-
readonly public?: PublicKeyInstance
|
|
60
|
-
sign: (hash: ArrayBufferLike, previousHash?: ArrayBufferLike) => Promise<[ArrayBufferLike, Hash?]>
|
|
61
|
-
verify: (msg: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
-
export const isAccountInstance = (account: any): account is AccountInstance => {
|
|
66
|
-
return typeof account === 'object' && typeof account['address'] === 'string'
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface AccountStatic<T extends AccountInstance = AccountInstance, C extends AccountConfig = AccountConfig> {
|
|
70
|
-
previousHashStore?: PreviousHashStore
|
|
71
|
-
create(options?: C): Promise<T>
|
|
72
|
-
fromPrivateKey(key: ArrayBufferLike | bigint | string): Promise<AccountInstance>
|
|
73
|
-
random(): Promise<AccountInstance>
|
|
74
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Account.ts'
|