Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wax
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
wax
Commits
e15228d6
Commit
e15228d6
authored
4 months ago
by
Krzysztof Mochocki
Committed by
Jakub Ziebinski
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
Add misssing methodes to transaction interface
parent
f0f4ad70
No related branches found
No related tags found
1 merge request
!230
Implementation of the python wax interface
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/wax/_private/transaction.py
+8
-0
8 additions, 0 deletions
python/wax/_private/transaction.py
python/wax/interfaces.py
+17
-0
17 additions, 0 deletions
python/wax/interfaces.py
with
25 additions
and
0 deletions
python/wax/_private/transaction.py
+
8
−
0
View file @
e15228d6
...
@@ -35,6 +35,7 @@ from wax.proto.transaction_pb2 import transaction as proto_transaction
...
@@ -35,6 +35,7 @@ from wax.proto.transaction_pb2 import transaction as proto_transaction
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
from
datetime
import
timedelta
from
datetime
import
timedelta
from
beekeepy._interface.abc.asynchronous.wallet
import
UnlockedWallet
as
AsyncUnlockedWallet
from
beekeepy._interface.abc.synchronous.wallet
import
UnlockedWallet
from
beekeepy._interface.abc.synchronous.wallet
import
UnlockedWallet
from
wax
import
IWaxBaseInterface
from
wax
import
IWaxBaseInterface
from
wax._private.models.basic
import
AccountName
,
Hex
,
PublicKey
,
SigDigest
,
Signature
,
TransactionId
from
wax._private.models.basic
import
AccountName
,
Hex
,
PublicKey
,
SigDigest
,
Signature
,
TransactionId
...
@@ -114,6 +115,13 @@ class Transaction(ITransaction):
...
@@ -114,6 +115,13 @@ class Transaction(ITransaction):
self
.
_target
.
signatures
.
append
(
sig
)
self
.
_target
.
signatures
.
append
(
sig
)
return
sig
return
sig
async
def
async_sign
(
self
,
wallet
:
AsyncUnlockedWallet
,
public_key
:
PublicKey
)
->
Signature
:
self
.
validate
()
sig
=
await
wallet
.
sign_digest
(
sig_digest
=
self
.
sig_digest
,
key
=
public_key
)
self
.
_target
.
signatures
.
append
(
sig
)
return
sig
def
add_signature
(
self
,
signature
:
Signature
)
->
Signature
:
def
add_signature
(
self
,
signature
:
Signature
)
->
Signature
:
self
.
_target
.
signatures
.
append
(
signature
)
self
.
_target
.
signatures
.
append
(
signature
)
return
signature
return
signature
...
...
This diff is collapsed.
Click to expand it.
python/wax/interfaces.py
+
17
−
0
View file @
e15228d6
...
@@ -12,6 +12,7 @@ if TYPE_CHECKING:
...
@@ -12,6 +12,7 @@ if TYPE_CHECKING:
from
datetime
import
datetime
from
datetime
import
datetime
from
decimal
import
Decimal
from
decimal
import
Decimal
from
beekeepy._interface.abc.asynchronous.wallet
import
UnlockedWallet
as
AsyncUnlockedWallet
from
beekeepy._interface.abc.synchronous.wallet
import
UnlockedWallet
from
beekeepy._interface.abc.synchronous.wallet
import
UnlockedWallet
from
wax._private.models.asset
import
(
from
wax._private.models.asset
import
(
AssetFactory
,
AssetFactory
,
...
@@ -144,6 +145,22 @@ class ITransactionBase(ABC):
...
@@ -144,6 +145,22 @@ class ITransactionBase(ABC):
WaxValidationFailedError: When the transaction is incorrect.
WaxValidationFailedError: When the transaction is incorrect.
"""
"""
@abstractmethod
async
def
async_sign
(
self
,
wallet
:
AsyncUnlockedWallet
,
public_key
:
PublicKey
)
->
Signature
:
"""
Signs asynchronously the transaction using given public key. Applies the transaction expiration time.
Args:
wallet: Unlocked wallet to be used for signing.
public_key: Public key for signing (remember that should be available in the wallet!)
Returns:
Signature: Transaction signature signed using given key.
Raises:
WaxValidationFailedError: When the transaction is incorrect.
"""
@abstractmethod
@abstractmethod
def
add_signature
(
self
,
signature
:
Signature
)
->
Signature
:
def
add_signature
(
self
,
signature
:
Signature
)
->
Signature
:
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment