Files
ark/pkg/client-sdk/wallet/wallet.go
Pietralberto Mazza 89df461623 Update client sdk (#207)
* Add bitcoin networks

* Refactor client

* Refactor explorer

* Refactor store

* Refactor wallet

* Refactor sdk client

* Refactor wasm & Update examples

* Move common util funcs to internal/utils

* Move to constants for service types

* Add unit tests

* Parallelize tests

* Lint

* Add job to gh action

* go mod tidy

* Fixes

* Fixes

* Fix compose file

* Fixes

* Fixes after review:
* Drop factory pattern
* Drop password from ark client methods
* Make singlekey wallet manage store and wallet store instead of defining WalletStore as extension of Store
* Move constants to arksdk module
* Drop config and expect directory store and wallet as ark client factory args

* Fix

* Add constants for bitcoin/liquid explorer

* Fix test

* Fix wasm

* Rename client.Client to client.ASPClient

* Rename store.Store to store.ConfigStore

* Rename wallet.Wallet to wallet.WalletService

* Renamings

* Lint

* Fixes

* Move everything to internal/utils & move ComputeVtxoTaprootScript to common

* Go mod tidy
2024-07-30 16:08:23 +02:00

34 lines
872 B
Go

package wallet
import (
"context"
"github.com/ark-network/ark-sdk/explorer"
)
const (
SingleKeyWallet = "singlekey"
)
type WalletService interface {
GetType() string
Create(
ctx context.Context, password, seed string,
) (walletSeed string, err error)
Lock(ctx context.Context, password string) (err error)
Unlock(ctx context.Context, password string) (alreadyUnlocked bool, err error)
IsLocked() bool
GetAddresses(
ctx context.Context,
) (offchainAddresses, onchainAddresses, redemptionAddresses []string, err error)
NewAddress(
ctx context.Context, change bool,
) (offchainAddr, onchainAddr string, err error)
NewAddresses(
ctx context.Context, change bool, num int,
) (offchainAddresses, onchainAddresses []string, err error)
SignTransaction(
ctx context.Context, explorerSvc explorer.Explorer, tx string,
) (singedTx string, err error)
}