@caict/bop-typescript-sdk 1.0.1 → 1.0.2
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/README.md +7 -1
- package/package.json +1 -1
- package/src/bop/bop-base/test/base.test.ts +3 -1
- package/src/bop/bop-base/test/index.test.ts +3 -1
- package/src/bop/bop-base/test/permit.test.ts +3 -1
- package/src/bop-sdk/interface/test/3rd.test.ts +4 -1
- package/src/bop-sdk/interface/test/account.test.ts +4 -1
- package/src/bop-sdk/interface/test/chain.test.ts +3 -1
- package/src/bop-sdk/interface/test/contract.test.ts +4 -1
- package/src/bop-sdk/interface/test/ledger.test.ts +4 -1
- package/src/bop-sdk/interface/test/provider.test.ts +3 -1
- package/src/bop-sdk/interface/test/signer.test.ts +4 -1
- package/src/bop-sdk/interface/test/transaction.test.ts +4 -1
- package/CHANGELOG.md +0 -34
- package/NOTICE +0 -5
package/README.md
CHANGED
|
@@ -39,7 +39,13 @@ import {
|
|
|
39
39
|
} from "@caict/bop-typescript-sdk";
|
|
40
40
|
|
|
41
41
|
(async () => {
|
|
42
|
-
|
|
42
|
+
const apiKey = "xxx";
|
|
43
|
+
const apiSecret = "xxx";
|
|
44
|
+
const config = new Config(
|
|
45
|
+
"https://bif-mainnet.bitfactory.cn",
|
|
46
|
+
apiKey,
|
|
47
|
+
apiSecret,
|
|
48
|
+
);
|
|
43
49
|
let provider = new ProviderByBop(new BopInterface(config));
|
|
44
50
|
console.log(await provider.chain.getChainInfo());
|
|
45
51
|
|
package/package.json
CHANGED
|
@@ -35,6 +35,8 @@ import { success } from "io-ts";
|
|
|
35
35
|
|
|
36
36
|
// 使用 Sinon 创建模拟对象
|
|
37
37
|
const sandbox = sinon.createSandbox();
|
|
38
|
+
const apiKey = "xxx";
|
|
39
|
+
const apiSecret = "xxx";
|
|
38
40
|
|
|
39
41
|
describe("BaseService", () => {
|
|
40
42
|
let config: Config;
|
|
@@ -44,7 +46,7 @@ describe("BaseService", () => {
|
|
|
44
46
|
let baseServiceMock: sinon.SinonMock;
|
|
45
47
|
|
|
46
48
|
beforeEach(() => {
|
|
47
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
49
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
48
50
|
baseService = new BaseService(config.host, config.apiKey, config.apiSecret);
|
|
49
51
|
baseServiceInvalidApiKey = new BaseService(
|
|
50
52
|
config.host,
|
|
@@ -6,6 +6,8 @@ import { ApplyRequest } from "../../bop-proto/bop";
|
|
|
6
6
|
|
|
7
7
|
// 使用 Sinon 创建模拟对象
|
|
8
8
|
const sandbox = sinon.createSandbox();
|
|
9
|
+
const apiKey = "xxx";
|
|
10
|
+
const apiSecret = "xxx";
|
|
9
11
|
|
|
10
12
|
describe("BopInterface", () => {
|
|
11
13
|
let bopInterface: BopInterface;
|
|
@@ -13,7 +15,7 @@ describe("BopInterface", () => {
|
|
|
13
15
|
let permitServiceMock: sinon.SinonMock; // 假设 PermitService 有一些方法需要模拟
|
|
14
16
|
|
|
15
17
|
beforeEach(() => {
|
|
16
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
18
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
17
19
|
bopInterface = new BopInterface(config);
|
|
18
20
|
|
|
19
21
|
// 模拟 PermitService
|
|
@@ -15,13 +15,15 @@ import {
|
|
|
15
15
|
|
|
16
16
|
// 使用 Sinon 创建模拟对象
|
|
17
17
|
const sandbox = sinon.createSandbox();
|
|
18
|
+
const apiKey = "xxx";
|
|
19
|
+
const apiSecret = "xxx";
|
|
18
20
|
|
|
19
21
|
describe("PermitService", () => {
|
|
20
22
|
let config: Config;
|
|
21
23
|
let permitService: PermitService;
|
|
22
24
|
|
|
23
25
|
beforeEach(() => {
|
|
24
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
26
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
25
27
|
permitService = new PermitService(config.host);
|
|
26
28
|
});
|
|
27
29
|
|
|
@@ -20,6 +20,9 @@ import {
|
|
|
20
20
|
|
|
21
21
|
// 使用 Sinon 创建模拟对象
|
|
22
22
|
const sandbox = sinon.createSandbox();
|
|
23
|
+
const apiKey = "xxx";
|
|
24
|
+
const apiSecret = "xxx";
|
|
25
|
+
|
|
23
26
|
describe("provider-bop-test", () => {
|
|
24
27
|
let bop: BopByBop;
|
|
25
28
|
let baseServiceMock: sinon.SinonMock;
|
|
@@ -28,7 +31,7 @@ describe("provider-bop-test", () => {
|
|
|
28
31
|
let config: Config;
|
|
29
32
|
|
|
30
33
|
beforeEach(() => {
|
|
31
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
34
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
32
35
|
bopInterface = new BopInterface(config);
|
|
33
36
|
|
|
34
37
|
bop = new BopByBop(bopInterface);
|
|
@@ -12,6 +12,9 @@ import {
|
|
|
12
12
|
|
|
13
13
|
// 使用 Sinon 创建模拟对象
|
|
14
14
|
const sandbox = sinon.createSandbox();
|
|
15
|
+
const apiKey = "xxx";
|
|
16
|
+
const apiSecret = "xxx";
|
|
17
|
+
|
|
15
18
|
describe("provider-account-test", () => {
|
|
16
19
|
let account: AccountByBop;
|
|
17
20
|
|
|
@@ -19,7 +22,7 @@ describe("provider-account-test", () => {
|
|
|
19
22
|
let config: Config;
|
|
20
23
|
|
|
21
24
|
beforeEach(() => {
|
|
22
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
25
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
23
26
|
bopInterface = new BopInterface(config);
|
|
24
27
|
|
|
25
28
|
account = new AccountByBop(bopInterface);
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
|
|
10
10
|
// 使用 Sinon 创建模拟对象
|
|
11
11
|
const sandbox = sinon.createSandbox();
|
|
12
|
+
const apiKey = "xxx";
|
|
13
|
+
const apiSecret = "xxx";
|
|
12
14
|
describe("provider-chain-test", () => {
|
|
13
15
|
let chain: ChainByBop;
|
|
14
16
|
|
|
@@ -16,7 +18,7 @@ describe("provider-chain-test", () => {
|
|
|
16
18
|
let config: Config;
|
|
17
19
|
|
|
18
20
|
beforeEach(() => {
|
|
19
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
21
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
20
22
|
bopInterface = new BopInterface(config);
|
|
21
23
|
|
|
22
24
|
chain = new ChainByBop(bopInterface);
|
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
|
|
12
12
|
// 使用 Sinon 创建模拟对象
|
|
13
13
|
const sandbox = sinon.createSandbox();
|
|
14
|
+
const apiKey = "xxx";
|
|
15
|
+
const apiSecret = "xxx";
|
|
16
|
+
|
|
14
17
|
describe("provider-contract-test", () => {
|
|
15
18
|
let contract: ContractByBop;
|
|
16
19
|
|
|
@@ -18,7 +21,7 @@ describe("provider-contract-test", () => {
|
|
|
18
21
|
let config: Config;
|
|
19
22
|
|
|
20
23
|
beforeEach(() => {
|
|
21
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
24
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
22
25
|
bopInterface = new BopInterface(config);
|
|
23
26
|
|
|
24
27
|
contract = new ContractByBop(bopInterface);
|
|
@@ -12,6 +12,9 @@ import {
|
|
|
12
12
|
|
|
13
13
|
// 使用 Sinon 创建模拟对象
|
|
14
14
|
const sandbox = sinon.createSandbox();
|
|
15
|
+
const apiKey = "xxx";
|
|
16
|
+
const apiSecret = "xxx";
|
|
17
|
+
|
|
15
18
|
describe("provider-ledger-test", () => {
|
|
16
19
|
let ledger: LedgerByBop;
|
|
17
20
|
|
|
@@ -19,7 +22,7 @@ describe("provider-ledger-test", () => {
|
|
|
19
22
|
let config: Config;
|
|
20
23
|
|
|
21
24
|
beforeEach(() => {
|
|
22
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
25
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
23
26
|
bopInterface = new BopInterface(config);
|
|
24
27
|
|
|
25
28
|
ledger = new LedgerByBop(bopInterface);
|
|
@@ -40,6 +40,8 @@ import {
|
|
|
40
40
|
QueryResponse,
|
|
41
41
|
} from "bop/bop-proto/bop";
|
|
42
42
|
|
|
43
|
+
const apiKey = "xxx";
|
|
44
|
+
const apiSecret = "xxx";
|
|
43
45
|
describe("provider-test", () => {
|
|
44
46
|
//normal
|
|
45
47
|
let provider: ProviderByBop;
|
|
@@ -54,7 +56,7 @@ describe("provider-test", () => {
|
|
|
54
56
|
let config2: Config;
|
|
55
57
|
|
|
56
58
|
beforeEach(() => {
|
|
57
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
59
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
58
60
|
bopInterface = new BopInterface(config);
|
|
59
61
|
provider = new ProviderByBop(bopInterface);
|
|
60
62
|
|
|
@@ -14,13 +14,16 @@ import {
|
|
|
14
14
|
} from "../../../bop-sdk/proto/bop-sdk-interface";
|
|
15
15
|
import { BopInterface, Config } from "../../../bop/bop-base";
|
|
16
16
|
|
|
17
|
+
const apiKey = "xxx";
|
|
18
|
+
const apiSecret = "xxx";
|
|
19
|
+
|
|
17
20
|
describe("signer-test", () => {
|
|
18
21
|
let bopInterface: BopInterface;
|
|
19
22
|
let config: Config;
|
|
20
23
|
let signer: SignerByBop;
|
|
21
24
|
let provider: ProviderByBop;
|
|
22
25
|
beforeEach(() => {
|
|
23
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
26
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
24
27
|
bopInterface = new BopInterface(config);
|
|
25
28
|
signer = new SignerByBop("your encprivate key");
|
|
26
29
|
provider = new ProviderByBop(bopInterface);
|
|
@@ -32,6 +32,9 @@ import { ProviderByBop } from "../provider";
|
|
|
32
32
|
|
|
33
33
|
// 使用 Sinon 创建模拟对象
|
|
34
34
|
const sandbox = sinon.createSandbox();
|
|
35
|
+
const apiKey = "xxx";
|
|
36
|
+
const apiSecret = "xxx";
|
|
37
|
+
|
|
35
38
|
describe("provider-transaction-test", () => {
|
|
36
39
|
let transaction: TransactionByBop;
|
|
37
40
|
|
|
@@ -43,7 +46,7 @@ describe("provider-transaction-test", () => {
|
|
|
43
46
|
let provider: ProviderByBop;
|
|
44
47
|
|
|
45
48
|
beforeEach(() => {
|
|
46
|
-
config = new Config("https://bif-mainnet.bitfactory.cn",
|
|
49
|
+
config = new Config("https://bif-mainnet.bitfactory.cn", apiKey, apiSecret);
|
|
47
50
|
bopInterface = new BopInterface(config);
|
|
48
51
|
transaction = new TransactionByBop(bopInterface);
|
|
49
52
|
|
package/CHANGELOG.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# bop-typescript-sdk changes
|
|
2
|
-
|
|
3
|
-
* * *
|
|
4
|
-
|
|
5
|
-
**Changes in 1.0.0**
|
|
6
|
-
|
|
7
|
-
适用:bop-typescript-sdk版本v1.0.0
|
|
8
|
-
|
|
9
|
-
[add] 支持星火链相关查询接口
|
|
10
|
-
|
|
11
|
-
[add] 支持账户相关的有效性校验、创建与查询接口
|
|
12
|
-
|
|
13
|
-
[add] 支持合约相关的有效性校验、创建与查询接口
|
|
14
|
-
|
|
15
|
-
[add] 支持构建交易及交易查询接口
|
|
16
|
-
|
|
17
|
-
[add] 支持区块的查询接口
|
|
18
|
-
|
|
19
|
-
[add] 支持星火开放平台相关账号许可接口
|
|
20
|
-
|
|
21
|
-
[add] 支持公私钥地址创建、解析、验签与密钥存储器构建、解析接口
|
|
22
|
-
|
|
23
|
-
[add] 支持助记词生成与解析接口
|
|
24
|
-
|
|
25
|
-
更新日期:2025-3-12
|
|
26
|
-
|
|
27
|
-
* * *
|
|
28
|
-
|
|
29
|
-
*注:*
|
|
30
|
-
[add]代表新增内容
|
|
31
|
-
|
|
32
|
-
[opt]代表优化内容
|
|
33
|
-
|
|
34
|
-
[bug]代表修复的bug
|