Skip to content

Instantly share code, notes, and snippets.

View saltyskip's full-sized avatar
🤠
Decentralizing

Andrei Terentiev saltyskip

🤠
Decentralizing
View GitHub Profile
//
// CollapsibleStackView.swift
// TemplateApp
//
// Created by Andrei Terentiev on 4/3/22.
//
import Foundation
import SwiftUI
import UniformTypeIdentifiers
let wif = ""
let pubkeyCompressed = "028013a81902a823dec80b54b5e1591b8d2fa359e9024934dae604aaa3be7dc020"
let pubkeyUncompressed = "048013a81902a823dec80b54b5e1591b8d2fa359e9024934dae604aaa3be7dc0202c487e634ab286179f6fefd9689e30465b6bbf658408928ddb01a419a81bf168"
let addressCompressed = "1KM68pTTgD172nJqykCUPpMA7hT7aGnn7w"
let addressUncompressed = "1KRhiKNai3ke3hZgSPZ5TpJoSJvs1aZfWo" //funds are here
var allAvailableUtxos = [
InputUtxo(
@saltyskip
saltyskip / jpmnemonic.swift
Last active December 7, 2020 07:52
JP mnemonic tests
func testJPMnemonic1() throws {
let mnemonic = ["ふうとう", "いがく", "はんろん", "よそう", "たまご", "にちじょう", "かんけい", "いだい", "だんねつ", "くなん", "れいせい", "すきま"]
let wallet = BcomWallet(mnemonic: mnemonic, chain: .bitcoin)
let address = BlockchainAddressGenerator.shared.getDefaultBlockchainAddress(from: wallet, x: 0, y: 0, chain: BcomBlockchain.bitcoin)
XCTAssertEqual(address, "15wZ1znjcz48MDjSgzasvzJBiSyLn8cqZ4")
let xPub = wallet.getExtendedPubKey(for: .bitcoin)
XCTAssertEqual(xPub, "xpub6D9oYGG8TsHWBxYaGMQPyMq7o7xyv6kvqUozhzTGnHgA9gY4WYdPdQJt2WWCUBP3iYW8xs4pymVhJAhR7Mdi7qbTbP2in2FFV7kHcSJdXgv")
}
let txTrust = BcomBlockchainTransactionBuilder(signingWallet: pr.selectedWallet!.masterWallet!, chainAssetProtocol: .bch, amount: 0.00001547, assetId: "bch", destination: pr.toAddress!)
.buildBitcoinCash(utxos: utxos, satsPerByteFee: 1, changeAddress: pr.toAddress!) { baseResult in
baseResult.buildSlp() { slpResult in
slpResult
.withSLPUtxos()
.withSpentSLPUtxos()
}
.withSpentUtxos()
.withChangeUtxos()
}
class BcomBlockchainTransactionBuilder {
private var tx: BcomBlockchainTransaction
init(signingWallet: BcomWallet, chainAssetProtocol: ChainAssetProtocol, amount: Decimal, assetId: String) {
tx = BcomBlockchainTransaction(signingWallet: signingWallet, chainAssetProtocol: chainAssetProtocol, amount: amount, assetId: assetId)
}
//Chain Level Builder
func buildBitcoinCash(utxos: [UTXO], satsPerByteFee: Int) -> BitcoinCashBuilder {
tx.satsPerByteFee = satsPerByteFee
class BcomBlockchainTransaction {
var wallet: BcomWallet
var chainAssetProtocol: ChainAssetProtocol
var amount: Decimal
var assetId: String
//bitcoin specific
var utxo: [UTXO]?
var satsPerByteFee: Int

Keybase proof

I hereby claim:

To claim this, I am signing this object:

import 'package:english_words/english_words.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color color = Theme.of(context).primaryColor;
Widget buttonSection = Container(
@saltyskip
saltyskip / sample_dnft.py
Created May 20, 2019 05:51
Sample of dnft contra t
"""NEO Non-Fungible Token Smart Contract Template
Authors: Joe Stewart, Jonathan Winter
Email: [email protected], [email protected]
Version: 2.0
Date: 15 March 2019
License: MIT
Based on NEP5 template by Tom Saunders