@xyo-network/account-model 2.72.8 → 2.73.0
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/dist/{types/Account.d.ts → index.d.mts} +14 -12
- package/dist/index.d.ts +40 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +31 -18
- package/tsup.config.ts +16 -0
- package/dist/cjs/Account.js +0 -10
- package/dist/cjs/Account.js.map +0 -1
- package/dist/cjs/index.js +0 -5
- package/dist/cjs/index.js.map +0 -1
- package/dist/docs.json +0 -1623
- package/dist/esm/Account.js +0 -6
- package/dist/esm/Account.js.map +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/types/Account.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +0 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataLike, Data } from '@xyo-network/core';
|
|
2
2
|
import { KeyPairInstance } from '@xyo-network/key-model';
|
|
3
3
|
import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
declare const ethMessagePrefix = "\u0019Ethereum Signed Message:\n";
|
|
6
|
+
interface PhraseInitializationConfig {
|
|
6
7
|
phrase: string;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
interface PrivateKeyInitializationConfig {
|
|
9
10
|
privateKey: DataLike;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
interface MnemonicInitializationConfig {
|
|
12
13
|
mnemonic: string;
|
|
13
14
|
path?: string;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
interface AccountOptions {
|
|
16
17
|
previousHash?: Uint8Array | string;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig;
|
|
20
|
+
type AccountConfig = InitializationConfig & AccountOptions;
|
|
21
|
+
interface AccountInstance extends KeyPairInstance {
|
|
21
22
|
address: string;
|
|
22
23
|
addressBytes: Data | undefined;
|
|
23
24
|
previousHash: string | undefined;
|
|
@@ -25,8 +26,8 @@ export interface AccountInstance extends KeyPairInstance {
|
|
|
25
26
|
sign: (hash: DataLike, previousHash: DataLike | undefined) => Uint8Array | Promise<Uint8Array>;
|
|
26
27
|
verify: (msg: DataLike, signature: DataLike) => boolean | Promise<boolean>;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
declare const isAccountInstance: (account: any) => account is AccountInstance;
|
|
30
|
+
interface AccountStatic<T extends AccountInstance = AccountInstance> {
|
|
30
31
|
previousHashStore?: PreviousHashStore;
|
|
31
32
|
new (key: unknown, params?: AccountConfig): T;
|
|
32
33
|
create(opts?: AccountConfig): Promise<T>;
|
|
@@ -35,4 +36,5 @@ export interface AccountStatic<T extends AccountInstance = AccountInstance> {
|
|
|
35
36
|
fromPrivateKey(key: DataLike): Promise<AccountInstance>;
|
|
36
37
|
is(value: unknown): T | undefined;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
|
|
40
|
+
export { AccountConfig, AccountInstance, AccountOptions, AccountStatic, InitializationConfig, MnemonicInitializationConfig, PhraseInitializationConfig, PrivateKeyInitializationConfig, ethMessagePrefix, isAccountInstance };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DataLike, Data } from '@xyo-network/core';
|
|
2
|
+
import { KeyPairInstance } from '@xyo-network/key-model';
|
|
3
|
+
import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
4
|
+
|
|
5
|
+
declare const ethMessagePrefix = "\u0019Ethereum Signed Message:\n";
|
|
6
|
+
interface PhraseInitializationConfig {
|
|
7
|
+
phrase: string;
|
|
8
|
+
}
|
|
9
|
+
interface PrivateKeyInitializationConfig {
|
|
10
|
+
privateKey: DataLike;
|
|
11
|
+
}
|
|
12
|
+
interface MnemonicInitializationConfig {
|
|
13
|
+
mnemonic: string;
|
|
14
|
+
path?: string;
|
|
15
|
+
}
|
|
16
|
+
interface AccountOptions {
|
|
17
|
+
previousHash?: Uint8Array | string;
|
|
18
|
+
}
|
|
19
|
+
type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig;
|
|
20
|
+
type AccountConfig = InitializationConfig & AccountOptions;
|
|
21
|
+
interface AccountInstance extends KeyPairInstance {
|
|
22
|
+
address: string;
|
|
23
|
+
addressBytes: Data | undefined;
|
|
24
|
+
previousHash: string | undefined;
|
|
25
|
+
previousHashBytes: Data | undefined;
|
|
26
|
+
sign: (hash: DataLike, previousHash: DataLike | undefined) => Uint8Array | Promise<Uint8Array>;
|
|
27
|
+
verify: (msg: DataLike, signature: DataLike) => boolean | Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
declare const isAccountInstance: (account: any) => account is AccountInstance;
|
|
30
|
+
interface AccountStatic<T extends AccountInstance = AccountInstance> {
|
|
31
|
+
previousHashStore?: PreviousHashStore;
|
|
32
|
+
new (key: unknown, params?: AccountConfig): T;
|
|
33
|
+
create(opts?: AccountConfig): Promise<T>;
|
|
34
|
+
fromMnemonic(mnemonic: string, path?: string): Promise<T>;
|
|
35
|
+
fromPhrase(phrase: string): Promise<AccountInstance>;
|
|
36
|
+
fromPrivateKey(key: DataLike): Promise<AccountInstance>;
|
|
37
|
+
is(value: unknown): T | undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { AccountConfig, AccountInstance, AccountOptions, AccountStatic, InitializationConfig, MnemonicInitializationConfig, PhraseInitializationConfig, PrivateKeyInitializationConfig, ethMessagePrefix, isAccountInstance };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
ethMessagePrefix: () => ethMessagePrefix,
|
|
24
|
+
isAccountInstance: () => isAccountInstance
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/Account.ts
|
|
29
|
+
var ethMessagePrefix = "Ethereum Signed Message:\n";
|
|
30
|
+
var isAccountInstance = (account) => {
|
|
31
|
+
return typeof account === "object" && typeof account["address"] === "string";
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
ethMessagePrefix,
|
|
36
|
+
isAccountInstance
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Account.ts"],"sourcesContent":["export * from './Account'\n","import { Data, DataLike } from '@xyo-network/core'\nimport { KeyPairInstance } from '@xyo-network/key-model'\nimport { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\n\nexport const ethMessagePrefix = '\\x19Ethereum Signed Message:\\n'\n\nexport interface PhraseInitializationConfig {\n phrase: string\n}\nexport interface PrivateKeyInitializationConfig {\n privateKey: DataLike\n}\nexport interface MnemonicInitializationConfig {\n mnemonic: string\n path?: string\n}\nexport interface AccountOptions {\n previousHash?: Uint8Array | string\n}\n\nexport type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig\n\nexport type AccountConfig = InitializationConfig & AccountOptions\n\nexport interface AccountInstance extends KeyPairInstance {\n address: string\n addressBytes: Data | undefined\n previousHash: string | undefined\n previousHashBytes: Data | undefined\n sign: (hash: DataLike, previousHash: DataLike | undefined) => Uint8Array | Promise<Uint8Array>\n verify: (msg: DataLike, signature: DataLike) => boolean | Promise<boolean>\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isAccountInstance = (account: any): account is AccountInstance => {\n return typeof account === 'object' && typeof account['address'] === 'string'\n}\n\nexport interface AccountStatic<T extends AccountInstance = AccountInstance> {\n previousHashStore?: PreviousHashStore\n new (key: unknown, params?: AccountConfig): T\n create(opts?: AccountConfig): Promise<T>\n fromMnemonic(mnemonic: string, path?: string): Promise<T>\n fromPhrase(phrase: string): Promise<AccountInstance>\n fromPrivateKey(key: DataLike): Promise<AccountInstance>\n is(value: unknown): T | undefined\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,IAAM,mBAAmB;AA8BzB,IAAM,oBAAoB,CAAC,YAA6C;AAC7E,SAAO,OAAO,YAAY,YAAY,OAAO,QAAQ,SAAS,MAAM;AACtE;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/Account.ts
|
|
2
|
+
var ethMessagePrefix = "Ethereum Signed Message:\n";
|
|
3
|
+
var isAccountInstance = (account) => {
|
|
4
|
+
return typeof account === "object" && typeof account["address"] === "string";
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
ethMessagePrefix,
|
|
8
|
+
isAccountInstance
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Account.ts"],"sourcesContent":["import { Data, DataLike } from '@xyo-network/core'\nimport { KeyPairInstance } from '@xyo-network/key-model'\nimport { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\n\nexport const ethMessagePrefix = '\\x19Ethereum Signed Message:\\n'\n\nexport interface PhraseInitializationConfig {\n phrase: string\n}\nexport interface PrivateKeyInitializationConfig {\n privateKey: DataLike\n}\nexport interface MnemonicInitializationConfig {\n mnemonic: string\n path?: string\n}\nexport interface AccountOptions {\n previousHash?: Uint8Array | string\n}\n\nexport type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig\n\nexport type AccountConfig = InitializationConfig & AccountOptions\n\nexport interface AccountInstance extends KeyPairInstance {\n address: string\n addressBytes: Data | undefined\n previousHash: string | undefined\n previousHashBytes: Data | undefined\n sign: (hash: DataLike, previousHash: DataLike | undefined) => Uint8Array | Promise<Uint8Array>\n verify: (msg: DataLike, signature: DataLike) => boolean | Promise<boolean>\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isAccountInstance = (account: any): account is AccountInstance => {\n return typeof account === 'object' && typeof account['address'] === 'string'\n}\n\nexport interface AccountStatic<T extends AccountInstance = AccountInstance> {\n previousHashStore?: PreviousHashStore\n new (key: unknown, params?: AccountConfig): T\n create(opts?: AccountConfig): Promise<T>\n fromMnemonic(mnemonic: string, path?: string): Promise<T>\n fromPhrase(phrase: string): Promise<AccountInstance>\n fromPrivateKey(key: DataLike): Promise<AccountInstance>\n is(value: unknown): T | undefined\n}\n"],"mappings":";AAIO,IAAM,mBAAmB;AA8BzB,IAAM,oBAAoB,CAAC,YAA6C;AAC7E,SAAO,OAAO,YAAY,YAAY,OAAO,QAAQ,SAAS,MAAM;AACtE;","names":[]}
|
package/package.json
CHANGED
|
@@ -10,47 +10,60 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xyo-network/core": "~2.
|
|
14
|
-
"@xyo-network/key-model": "~2.
|
|
15
|
-
"@xyo-network/previous-hash-store-model": "~2.
|
|
13
|
+
"@xyo-network/core": "~2.73.0",
|
|
14
|
+
"@xyo-network/key-model": "~2.73.0",
|
|
15
|
+
"@xyo-network/previous-hash-store-model": "~2.73.0"
|
|
16
16
|
},
|
|
17
17
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@xylabs/ts-scripts-yarn3": "^2.19.
|
|
20
|
-
"@xylabs/tsconfig": "^2.19.
|
|
19
|
+
"@xylabs/ts-scripts-yarn3": "^2.19.5",
|
|
20
|
+
"@xylabs/tsconfig": "^2.19.5",
|
|
21
|
+
"publint": "^0.2.2",
|
|
22
|
+
"tsup": "^7.2.0",
|
|
21
23
|
"typescript": "^5.2.2"
|
|
22
24
|
},
|
|
23
|
-
"browser": "dist/esm/index.js",
|
|
24
|
-
"main": "dist/cjs/index.js",
|
|
25
|
-
"module": "dist/esm/index.js",
|
|
26
25
|
"docs": "dist/docs.json",
|
|
27
26
|
"exports": {
|
|
28
27
|
".": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
32
31
|
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
}
|
|
37
|
-
"default": "./dist/esm/index.js"
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
34
|
+
"default": "./dist/index.mjs"
|
|
35
|
+
}
|
|
38
36
|
},
|
|
39
37
|
"./dist/docs.json": {
|
|
40
38
|
"default": "./dist/docs.json"
|
|
41
39
|
},
|
|
40
|
+
"./cjs": {
|
|
41
|
+
"default": "./dist/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./docs": {
|
|
44
|
+
"default": "./dist/docs.json"
|
|
45
|
+
},
|
|
46
|
+
"./esm": {
|
|
47
|
+
"default": "./dist/index.mjs"
|
|
48
|
+
},
|
|
42
49
|
"./package.json": "./package.json"
|
|
43
50
|
},
|
|
51
|
+
"main": "dist/index.js",
|
|
52
|
+
"module": "dist/index.mjs",
|
|
44
53
|
"homepage": "https://xyo.network",
|
|
45
54
|
"license": "LGPL-3.0",
|
|
46
55
|
"publishConfig": {
|
|
47
56
|
"access": "public"
|
|
48
57
|
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"package-compile": "tsup && publint",
|
|
60
|
+
"package-recompile": "tsup && publint"
|
|
61
|
+
},
|
|
49
62
|
"repository": {
|
|
50
63
|
"type": "git",
|
|
51
64
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
52
65
|
},
|
|
53
66
|
"sideEffects": false,
|
|
54
|
-
"types": "dist/
|
|
55
|
-
"version": "2.
|
|
67
|
+
"types": "dist/index.d.ts",
|
|
68
|
+
"version": "2.73.0"
|
|
56
69
|
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-default-export
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
bundle: true,
|
|
6
|
+
cjsInterop: true,
|
|
7
|
+
clean: true,
|
|
8
|
+
dts: {
|
|
9
|
+
entry: ['src/index.ts'],
|
|
10
|
+
},
|
|
11
|
+
entry: ['src/index.ts'],
|
|
12
|
+
format: ['cjs', 'esm'],
|
|
13
|
+
sourcemap: true,
|
|
14
|
+
splitting: false,
|
|
15
|
+
tsconfig: 'tsconfig.json',
|
|
16
|
+
})
|
package/dist/cjs/Account.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAccountInstance = exports.ethMessagePrefix = void 0;
|
|
4
|
-
exports.ethMessagePrefix = '\x19Ethereum Signed Message:\n';
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const isAccountInstance = (account) => {
|
|
7
|
-
return typeof account === 'object' && typeof account['address'] === 'string';
|
|
8
|
-
};
|
|
9
|
-
exports.isAccountInstance = isAccountInstance;
|
|
10
|
-
//# sourceMappingURL=Account.js.map
|
package/dist/cjs/Account.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../../src/Account.ts"],"names":[],"mappings":";;;AAIa,QAAA,gBAAgB,GAAG,gCAAgC,CAAA;AA6BhE,8DAA8D;AACvD,MAAM,iBAAiB,GAAG,CAAC,OAAY,EAA8B,EAAE;IAC5E,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAA;AAC9E,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B"}
|
package/dist/cjs/index.js
DELETED
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB"}
|