Skip to content
GitLab
Explore
Sign in
Register
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
f0f4ad70
Commit
f0f4ad70
authored
3 months ago
by
Krzysztof Mochocki
Committed by
Jakub Ziebinski
3 weeks ago
Browse files
Options
Downloads
Patches
Plain Diff
Move constants to separate file
parent
8d97c352
No related branches found
No related tags found
1 merge request
!230
Implementation of the python wax interface
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python/wax/_private/core/constants.py
+12
-1
12 additions, 1 deletion
python/wax/_private/core/constants.py
python/wax/_private/transaction.py
+4
-2
4 additions, 2 deletions
python/wax/_private/transaction.py
python/wax/wax_options.py
+15
-6
15 additions, 6 deletions
python/wax/wax_options.py
with
31 additions
and
9 deletions
python/wax/_private/core/constants.py
+
12
−
1
View file @
f0f4ad70
from
__future__
import
annotations
from
__future__
import
annotations
from
datetime
import
timedelta
from
math
import
floor
,
log10
from
math
import
floor
,
log10
from
typing
import
Final
from
typing
import
TYPE_CHECKING
,
Final
if
TYPE_CHECKING
:
from
wax._private.models.basic
import
ChainId
PUBLIC_KEY_ADDRESS_PREFIX
:
Final
[
str
]
=
"
STM
"
PUBLIC_KEY_ADDRESS_PREFIX
:
Final
[
str
]
=
"
STM
"
DEFAULT_TRANSACTION_EXPIRATION_TIME
:
Final
[
timedelta
]
=
timedelta
(
minutes
=
1
)
MAINNET_CHAIN_ID
:
Final
[
ChainId
]
=
"
beeab0de00000000000000000000000000000000000000000000000000000000
"
DEFAULT_CHAIN_ID
:
Final
[
ChainId
]
=
MAINNET_CHAIN_ID
HIVE_PERCENT_PRECISION
:
Final
[
int
]
=
100
HIVE_PERCENT_PRECISION
:
Final
[
int
]
=
100
HIVE_PERCENT_PRECISION_DOT_PLACES
:
Final
[
int
]
=
floor
(
log10
(
HIVE_PERCENT_PRECISION
))
HIVE_PERCENT_PRECISION_DOT_PLACES
:
Final
[
int
]
=
floor
(
log10
(
HIVE_PERCENT_PRECISION
))
HIVE_TIME_FORMAT
:
Final
[
str
]
=
"
%Y-%m-%dT%H:%M:%S
"
This diff is collapsed.
Click to expand it.
python/wax/_private/transaction.py
+
4
−
2
View file @
f0f4ad70
...
@@ -2,12 +2,12 @@ from __future__ import annotations
...
@@ -2,12 +2,12 @@ from __future__ import annotations
import
json
import
json
from
copy
import
deepcopy
from
copy
import
deepcopy
from
datetime
import
timedelta
from
typing
import
TYPE_CHECKING
,
TypeAlias
from
typing
import
TYPE_CHECKING
,
TypeAlias
from
google.protobuf.json_format
import
MessageToJson
,
Parse
from
google.protobuf.json_format
import
MessageToJson
,
Parse
from
typing_extensions
import
Self
from
typing_extensions
import
Self
from
wax._private.core.constants
import
DEFAULT_TRANSACTION_EXPIRATION_TIME
from
wax._private.models.hive_date_time
import
HiveDateTime
from
wax._private.models.hive_date_time
import
HiveDateTime
from
wax._private.models.required_authorities
import
TransactionRequiredAuthorities
from
wax._private.models.required_authorities
import
TransactionRequiredAuthorities
from
wax._private.result_tools
import
(
from
wax._private.result_tools
import
(
...
@@ -33,6 +33,8 @@ from wax.interfaces import ITransaction, JsonTransaction, ProtoTransaction
...
@@ -33,6 +33,8 @@ from wax.interfaces import ITransaction, JsonTransaction, ProtoTransaction
from
wax.proto.transaction_pb2
import
transaction
as
proto_transaction
from
wax.proto.transaction_pb2
import
transaction
as
proto_transaction
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
from
datetime
import
timedelta
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
...
@@ -47,7 +49,7 @@ class Transaction(ITransaction):
...
@@ -47,7 +49,7 @@ class Transaction(ITransaction):
self
,
self
,
api
:
IWaxBaseInterface
,
api
:
IWaxBaseInterface
,
tapos_block_id
:
TaposBlockId
|
ProtoTransaction
,
tapos_block_id
:
TaposBlockId
|
ProtoTransaction
,
expiration_time
:
timedelta
=
timedelta
(
minutes
=
30
)
,
expiration_time
:
timedelta
=
DEFAULT_TRANSACTION_EXPIRATION_TIME
,
head_block_time
:
HiveDateTime
|
None
=
None
,
head_block_time
:
HiveDateTime
|
None
=
None
,
)
->
None
:
)
->
None
:
self
.
_api
=
api
self
.
_api
=
api
...
...
This diff is collapsed.
Click to expand it.
python/wax/wax_options.py
+
15
−
6
View file @
f0f4ad70
from
__future__
import
annotations
from
__future__
import
annotations
from
dataclasses
import
dataclass
,
field
from
typing
import
TYPE_CHECKING
from
wax._private.models.basic
import
ChainId
from
wax._private.core.constants
import
DEFAULT_CHAIN_ID
if
TYPE_CHECKING
:
from
wax._private.models.basic
import
ChainId
@dataclass
class
WaxOptions
:
class
WaxOptions
:
chain_id
:
ChainId
=
field
(
"""
Allows configuration of wax itself.
"""
default_factory
=
lambda
:
ChainId
(
"
18dcf0a285365fc58b71f18b3d3fec954aa0c141c44e4e5cb4cf777b9eab274e
"
)
)
def
__init__
(
self
,
chain_id
:
ChainId
=
DEFAULT_CHAIN_ID
)
->
None
:
"""
Constructs WaxOptions.
Args:
chain_id: chain id used for signing. Defaults to mainnet chain id.
"""
self
.
chain_id
=
chain_id
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