Skip to content

Commit

Permalink
Merge pull request #27 from DIG-Network/release/v0.0.1-alpha.28
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.28
  • Loading branch information
MichaelTaylor3D authored Sep 18, 2024
2 parents c447a25 + 50019c0 commit 6104b94
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 56 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.1-alpha.28](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.26...v0.0.1-alpha.28) (2024-09-18)


### Features

* update datalayer-driver ([91da6b6](https://github.com/DIG-Network/dig-chia-sdk/commit/91da6b6604fe3dd3342829673de80aea2f4b9847))

### [0.0.1-alpha.27](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.26...v0.0.1-alpha.27) (2024-09-18)

### [0.0.1-alpha.26](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.25...v0.0.1-alpha.26) (2024-09-18)


Expand Down
35 changes: 2 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dignetwork/dig-sdk",
"version": "0.0.1-alpha.26",
"version": "0.0.1-alpha.28",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down Expand Up @@ -34,7 +34,6 @@
"chia-wallet": "^1.0.18",
"cli-progress": "^3.12.0",
"crypto-js": "^4.2.0",
"datalayer-driver": "^0.1.21",
"fs-extra": "^11.2.0",
"ignore": "^5.3.2",
"inquirer": "^10.1.8",
Expand Down
26 changes: 12 additions & 14 deletions src/DigNetwork/DigPeer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { PropagationServer } from "./PropagationServer";
import { IncentiveServer } from "./IncentiveServer";
import { DataStore } from "../blockchain";
import { DataIntegrityTree } from "../DataIntegrityTree";
import { getFilePathFromSha256 } from "../utils/hashUtils";
import {
sendXch,
addressToPuzzleHash,
signCoinSpends,
getCoinId,
} from "datalayer-driver";
Output,
} from "@dignetwork/datalayer-driver";
import { FullNodePeer } from "../blockchain";
import { Wallet } from "../blockchain";
import { selectUnspentCoins } from "../blockchain/coins";
Expand Down Expand Up @@ -196,7 +196,7 @@ export class DigPeer {
walletName: string,
addresses: string[],
totalAmount: bigint,
memo: string[]
memos: Buffer[]
): Promise<void> {
// Use a Set to ensure unique addresses
const uniqueAddresses = Array.from(new Set(addresses));
Expand All @@ -210,21 +210,19 @@ export class DigPeer {
const amountPerPuzzleHash = totalAmount / BigInt(puzzleHashes.length);

// Create outputs array
const outputs: { puzzleHash: Buffer; amount: bigint }[] = puzzleHashes.map(
(puzzleHash) => ({
puzzleHash,
amount: amountPerPuzzleHash,
memo,
})
);
const outputs: Output[] = puzzleHashes.map((puzzleHash) => ({
puzzleHash,
amount: amountPerPuzzleHash,
memos,
}));

// Call the sendBulkPayments function with the generated outputs
return DigPeer.sendBulkPayments(walletName, outputs);
}

public static async sendBulkPayments(
walletName: string,
outputs: { puzzleHash: Buffer; amount: bigint }[]
outputs: Output[]
): Promise<void> {
const feePerCondition = BigInt(1000);
const totalFee = feePerCondition * BigInt(outputs.length);
Expand Down Expand Up @@ -268,14 +266,14 @@ export class DigPeer {
public async sendPayment(
walletName: string,
amount: bigint,
memo: string[] = []
memos: Buffer[] = []
): Promise<void> {
const paymentAddress = await this.contentServer.getPaymentAddress();
const paymentAddressPuzzleHash = addressToPuzzleHash(paymentAddress);
const output: { puzzleHash: Buffer; amount: bigint; memo: string[] } = {
const output: Output = {
puzzleHash: paymentAddressPuzzleHash,
amount,
memo,
memos,
};

return DigPeer.sendBulkPayments(walletName, [output]);
Expand Down
2 changes: 1 addition & 1 deletion src/blockchain/DataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
addFee,
updateStoreMetadata,
syntheticKeyToPuzzleHash,
} from "datalayer-driver";
} from "@dignetwork/datalayer-driver";
import { promisify } from "util";
import { FullNodePeer } from "./FullNodePeer";
import { Wallet } from "./Wallet";
Expand Down
2 changes: 1 addition & 1 deletion src/blockchain/DataStoreSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Proof,
DataStoreMetadata,
DelegatedPuzzle,
} from "datalayer-driver";
} from "@dignetwork/datalayer-driver";
import { Buffer } from "buffer";

export class DataStoreSerializer {
Expand Down
2 changes: 1 addition & 1 deletion src/blockchain/FullNodePeer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from "path";
import os from "os";
import fs from "fs";
import { Peer } from "datalayer-driver";
import { Peer } from "@dignetwork/datalayer-driver";
import { Tls } from "chia-server-coin";
import { resolve4 } from "dns/promises";
import net from "net";
Expand Down
2 changes: 1 addition & 1 deletion src/blockchain/ServerCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
signCoinSpends,
ServerCoin as ServerCoinDriver,
Coin,
} from "datalayer-driver";
} from "@dignetwork/datalayer-driver";
import { FullNodePeer } from "./FullNodePeer";
import { selectUnspentCoins } from "./coins";
import { Wallet } from "./Wallet";
Expand Down
2 changes: 1 addition & 1 deletion src/blockchain/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
getCost,
CoinSpend,
getCoinId,
} from "datalayer-driver";
} from "@dignetwork/datalayer-driver";
import { MIN_HEIGHT, MIN_HEIGHT_HEADER_HASH } from "../utils/config";
import { FileCache } from "../utils/FileCache";

Expand Down
2 changes: 1 addition & 1 deletion src/blockchain/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getCost,
CoinSpend,
getCoinId,
} from "datalayer-driver";
} from "@dignetwork/datalayer-driver";
import { Wallet } from "./Wallet";
import { MIN_HEIGHT, MIN_HEIGHT_HEADER_HASH } from "../utils/config";
import { FileCache } from "../utils/FileCache";
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Coin } from "datalayer-driver";
import { Coin } from "@dignetwork/datalayer-driver";

export interface FileDetails {
filename: string;
Expand Down

0 comments on commit 6104b94

Please sign in to comment.