@bsv/sdk 1.0.0 → 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.
@@ -1,103 +0,0 @@
1
- # Getting Started with BSV SDK in a Vue TypeScript Project
2
-
3
- Welcome to the quick start guide for integrating the BSV SDK into your Vue TypeScript project. This guide will walk you through the setup and basic usage of the BSV SDK, enabling you to build scalable applications on the BSV Blockchain. Let’s dive into how you can add blockchain capabilities to your Vue application.
4
-
5
- ## Prerequisites
6
-
7
- Before starting, ensure you have the following installed:
8
- - Node.js (12.x or later)
9
- - npm (6.x or later)
10
- - Vue CLI (3.x or later)
11
-
12
- If you're new to Vue or TypeScript, it might be helpful to familiarize yourself with the basics of creating a Vue project with TypeScript support.
13
-
14
- ## Step 1: Create Your Vue Project
15
-
16
- If you haven't already, start by creating a new Vue project. Open your terminal and run:
17
-
18
- ```bash
19
- vue create my-bsv-app
20
- ```
21
-
22
- During the setup, choose "Manually select features" to select TypeScript. Follow the prompts to set up TypeScript with Vue.
23
-
24
- ## Step 2: Install the BSV SDK
25
-
26
- Navigate to your project directory in the terminal and install the BSV SDK by running:
27
-
28
- ```bash
29
- npm install @bsv/sdk
30
- ```
31
-
32
- This command will add the BSV SDK as a dependency to your project, making its functionality available for use in your Vue components.
33
-
34
- ## Step 3: Initialize the SDK in Your Vue Application
35
-
36
- Create a new file `bsvPlugin.ts` in your project's `src` directory. This file will set up the BSV SDK so that it can be easily used throughout your application.
37
-
38
- ```typescript
39
- // src/bsvPlugin.ts
40
-
41
- import { createApp } from 'vue';
42
- import App from './App.vue';
43
-
44
- // Import the SDK
45
- import * as BSV from '@bsv/sdk';
46
-
47
- const app = createApp(App);
48
-
49
- // Here you can add BSV SDK to Vue's global properties for easy access in components
50
- app.config.globalProperties.$bsv = BSV;
51
-
52
- app.mount('#app');
53
- ```
54
-
55
- Update your `main.ts` to use this new setup:
56
-
57
- ```typescript
58
- // src/main.ts
59
-
60
- import './bsvPlugin';
61
- ```
62
-
63
- ## Step 4: Using the BSV SDK in Your Components
64
-
65
- Now that you have the BSV SDK integrated into your Vue application, you can start using it in your components. Here's an example of how to create and sign a transaction within a Vue component:
66
-
67
- 1. **Create a new Vue component** `TransactionComponent.vue` in your `src/components` directory.
68
- 2. **Implement the BSV SDK logic** within your component:
69
-
70
- ```vue
71
- <template>
72
- <div>
73
- <h1>Create and Sign a Transaction</h1>
74
- <!-- Transaction form and submission button will go here -->
75
- </div>
76
- </template>
77
-
78
- <script lang="ts">
79
- import { defineComponent } from 'vue';
80
-
81
- export default defineComponent({
82
- name: 'TransactionComponent',
83
- methods: {
84
- async createAndSignTransaction() {
85
- // Access the BSV SDK from the global properties
86
- const BSV = this.$bsv;
87
-
88
- // Example: Creating a new PublicKey
89
- const privateKey = BSV.PrivateKey.fromRandom();
90
- const publicKey = privateKey.toPublicKey();
91
-
92
- console.log('PublicKey:', publicKey.toString());
93
-
94
- // Add your transaction logic here
95
- }
96
- }
97
- });
98
- </script>
99
- ```
100
-
101
- ## Step 5: Interacting with the Blockchain
102
-
103
- With the BSV SDK now part of your Vue application, you can extend the functionality as needed to interact with the BSV Blockchain. Use the SDK's comprehensive API to create transactions, manage keys, verify signatures, and much more.
package/jest.config.js DELETED
@@ -1,6 +0,0 @@
1
- /** @type {import('ts-jest').JestConfigWithTsJest} */
2
- export default {
3
- preset: 'ts-jest',
4
- testEnvironment: 'node',
5
- testPathIgnorePatterns: ['dist/']
6
- }
package/mod.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from "./src/primitives/index.js"
2
- export * from "./src/script/index.js"
3
- export * from "./src/script/templates/index.js"
4
- export * from "./src/transaction/index.js"
5
- export * from "./src/transaction/fee-models/index.js"
6
- export * from "./src/transaction/broadcasters/index.js"
7
- export * from "./src/messages/index.js"
8
- export * from "./src/compat/index.js"
package/ts2md.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "inputFilename": "mod.ts",
3
- "outputFilename": "./API.md",
4
- "firstHeadingLevel": 1
5
- }
@@ -1,26 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": ["dom", "ESNext"],
4
- "module": "NodeNext",
5
- "target": "esnext",
6
- "moduleResolution": "NodeNext",
7
- "moduleDetection": "force",
8
- "rootDir": "./",
9
- "baseUrl": "./",
10
- "strict": false,
11
- "isolatedModules": true,
12
- "strictNullChecks": false,
13
- "downlevelIteration": false,
14
- "skipLibCheck": true,
15
- "forceConsistentCasingInFileNames": true,
16
- "incremental": true,
17
- "sourceMap": true,
18
- "emitDecoratorMetadata": true,
19
- "experimentalDecorators": true,
20
- "resolveJsonModule": true,
21
- "esModuleInterop": true
22
- },
23
- "files": ["mod.ts"],
24
- "include": ["src"],
25
- "exclude": ["dist", "*/**/__tests"]
26
- }
package/tsconfig.cjs.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "./tsconfig.base.json",
3
- "compilerOptions": {
4
- "target": "es2019",
5
- "module": "commonjs",
6
- "moduleResolution": "node",
7
- "rootDir": "./",
8
- "baseUrl": "./",
9
- "outDir": "./dist/cjs"
10
- }
11
- }
@@ -1,12 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "types": ["@types/node"],
4
- "noEmit": true,
5
- "allowJs": true
6
- },
7
- "include": [
8
- "./src/**/*.ts",
9
- ".eslintrc.js",
10
- "jest.config.js",
11
- ]
12
- }
package/tsconfig.esm.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "./",
5
- "baseUrl": "./",
6
- "outDir": "./dist/esm",
7
- "allowSyntheticDefaultImports": true
8
- }
9
- }
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "files": [],
3
- "compilerOptions": {
4
- "esModuleInterop": true
5
- },
6
- "references": [
7
- {
8
- "path": "tsconfig.esm.json"
9
- },
10
- {
11
- "path": "tsconfig.cjs.json"
12
- },
13
- {
14
- "path": "tsconfig.types.json"
15
- }
16
- ]
17
- }
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "./tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "./",
5
- "baseUrl": "./",
6
- "outDir": "./dist/types",
7
- "emitDeclarationOnly": true,
8
- "declaration": true,
9
- "declarationMap": true
10
- }
11
- }