@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.
- package/README.md +25 -3
- package/dist/cjs/package.json +8 -4
- package/dist/cjs/src/transaction/broadcasters/ARC.js +13 -2
- package/dist/cjs/src/transaction/broadcasters/ARC.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/transaction/broadcasters/ARC.js +13 -2
- package/dist/esm/src/transaction/broadcasters/ARC.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/transaction/broadcasters/ARC.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +10 -5
- package/src/transaction/broadcasters/ARC.ts +11 -2
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -40
- package/.github/ISSUE_TEMPLATE/discussion.md +0 -24
- package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -23
- package/CHANGELOG.md +0 -72
- package/CONTRIBUTING.md +0 -85
- package/ROADMAP.md +0 -3
- package/docs/getting-started/COMMONJS.md +0 -94
- package/docs/getting-started/REACT-TS.md +0 -131
- package/docs/getting-started/TS-NODE.md +0 -106
- package/docs/getting-started/VUE.md +0 -103
- package/jest.config.js +0 -6
- package/mod.ts +0 -8
- package/ts2md.json +0 -5
- package/tsconfig.base.json +0 -26
- package/tsconfig.cjs.json +0 -11
- package/tsconfig.eslint.json +0 -12
- package/tsconfig.esm.json +0 -9
- package/tsconfig.json +0 -17
- package/tsconfig.types.json +0 -11
|
@@ -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
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
package/tsconfig.base.json
DELETED
|
@@ -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
package/tsconfig.eslint.json
DELETED
package/tsconfig.esm.json
DELETED
package/tsconfig.json
DELETED