Skip to content

Commit 3949cd0

Browse files
author
Xiao Li
authored
update to latest diem core master (#177)
* add back diem submodule * generate code from latest diem core master and fix tests * rename identifier hrp * add dry-run mainnet HRP * rename all the rest 'libra' to diem * faucet support creates dd account * use devnet for testnet until we deploy new master to testnet * bump up version to 1.0.0
1 parent 1ea5e49 commit 3949cd0

30 files changed

+770
-705
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "diem"]
2+
path = diem
3+
url = https://github.com/diem/diem.git

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This project welcomes contributions.
66

77
For pull request to be accepted by any Diem projects, a CLA must be [signed](https://www.diem.com/en-us/cla-sign/). You will only need to do this once to work on any of Diem's open source projects.
88

9-
When submitting a pull request (PR), the `libra-github-bot` will check your submission for a valid CLA. If one is not found, then you will need to [submit](https://www.diem.com/en-us/cla-sign/) an Individual CLA for yourself or a Corporate CLA for your company.
9+
When submitting a pull request (PR), the `diem-github-bot` will check your submission for a valid CLA. If one is not found, then you will need to [submit](https://www.diem.com/en-us/cla-sign/) an Individual CLA for yourself or a Corporate CLA for your company.
1010

1111
## Issues
1212

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ diemtypes:
3535
"diem/target/debug/generate-transaction-builders" \
3636
--language python3 \
3737
--module-name stdlib \
38-
--with-libra-types "diem/testsuite/generate-format/tests/staged/libra.yaml" \
38+
--with-diem-types "diem/testsuite/generate-format/tests/staged/diem.yaml" \
3939
--serde-package-name diem \
40-
--libra-package-name diem \
40+
--diem-package-name diem \
4141
--target-source-dir src/diem \
42-
--with-custom-libra-code diem-types-ext/*.py \
42+
--with-custom-diem-code diem-types-ext/*.py \
4343
-- "diem/language/stdlib/compiled/transaction_scripts/abi"
4444

4545
protobuf:

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
> **Note to readers:** On December 1, 2020, the Libra Association was renamed to Diem Association. The project repos are in the process of being migrated. All projects will remain available for use here until the migration to a new GitHub Organization is complete.
2-
31
# The official Diem Client SDK for Python.
42

53
[Documentation](https://developers.diem.com/docs/python-client-sdk-docs)
@@ -14,13 +12,13 @@ Root module name: `diem`
1412

1513
Sub-modules:
1614

17-
- `jsonrpc`: diem JSON-RPC APIs client and API response types. [SPEC](https://github.com/libra/libra/blob/master/json-rpc/json-rpc-spec.md)
15+
- `jsonrpc`: diem JSON-RPC APIs client and API response types. [SPEC](https://github.com/diem/diem/blob/master/json-rpc/json-rpc-spec.md)
1816
- `stdlib`: generated code, move stdlib script utils for constructing transaction script playload.
19-
- `diem_types`: generated code, Diem on-chain data structure types for encoding and decoding [LCS](https://libra.github.io/libra/lcs/index.html) data.
17+
- `diem_types`: generated code, Diem on-chain data structure types for encoding and decoding [LCS](https://diem.github.io/diem/lcs/index.html) data.
2018
- `utils`: utility functions, account address utils, currency code, hashing, hex encoding / decoding, transaction utils.
2119
- `AuthKey` | `auth_key`: auth key utils
2220
- `identifier`: Diem Account Identifier and Diem Intent Identifier. [DIP-5](https://dip.diem.com/dip-5/)
23-
- `txnmetadata`: utils for creating peer to peer transaction metadata. [DIP-4](https://dip.diem.org/dip-4/)
21+
- `txnmetadata`: utils for creating peer to peer transaction metadata. [DIP-4](https://dip.diem.com/dip-4/)
2422
- `testnet`: Testnet utility, minting coins, create Testnet client, chain id, Testnet JSON-RPC URL.
2523
- `LocalAccount` | `local_account`: utility for managing local account keys, generate random local account.
2624
- `chain_ids`: list of static chain ids
@@ -55,7 +53,7 @@ pip install diem-client-sdk
5553

5654
## Bugs/Requests
5755

58-
Please use the [GitHub issue tracker](https://github.com/libra/client-sdk-python/issues) to submit bugs or request features.
56+
Please use the [GitHub issue tracker](https://github.com/diem/client-sdk-python/issues) to submit bugs or request features.
5957

6058
## Build & Test
6159

checklist.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This file is a checklist of requirement & technical details for a Diem client SD
2828
- [x] client tracks latest server response block version and timestamp, raise error when received server response contains stale version / timestamp.
2929
- [x] last known blockchain version >= response version: when connecting to a cluster of fullnodes, it is possible some fullnodes are behind the head couple versions.
3030
- [x] last known blockchain timestamp >= response timestamp.
31-
- [x] parse and use libra_chain_id, libra_ledger_version and libra_ledger_tiemstamp in the JSONRPC response.
31+
- [x] parse and use diem_chain_id, diem_ledger_version and diem_ledger_tiemstamp in the JSONRPC response.
3232
- [x] Parsing and gen Diem Account Identifier (see [DIP-5][2])
3333
- bech32 addresses/subaddresses support
3434
- [x] language specific standard release publish: e.g. java maven central repo, python pip
@@ -88,7 +88,7 @@ See [doc][5] for above concepts.
8888

8989
# Examples
9090

91-
- [x] [p2p transfer examples](https://github.com/libra/dip/blob/master/dips/dip-4.md#transaction-examples)
91+
- [x] [p2p transfer examples](https://github.com/diem/lip/blob/master/lips/lip-4.md#transaction-examples)
9292
- [x] refund p2p transfer example
9393
- [x] create childVASP example
9494
- [x] Intent identifier encoding, decoding example
@@ -98,10 +98,10 @@ See [doc][5] for above concepts.
9898
- [ ] Async client
9999
- [ ] CLI connects to testnet for trying out features.
100100

101-
[1]: https://github.com/libra/libra/blob/master/json-rpc/json-rpc-spec.md "Diem JSON-RPC SPEC"
102-
[2]: https://github.com/libra/dip/blob/master/dips/dip-5.md "DIP-5"
103-
[3]: https://github.com/libra/libra/blob/master/language/stdlib/transaction_scripts/doc/peer_to_peer_with_metadata.md "P2P Transafer"
104-
[4]: https://github.com/libra/libra/tree/master/language/stdlib/transaction_scripts/doc "Move Stdlib scripts"
105-
[5]: https://github.com/libra/libra/blob/master/client/libra-dev/README.md "Diem Client Dev Doc"
106-
[6]: https://github.com/libra/libra/blob/master/json-rpc/docs/service_testnet_faucet.md "Faucet service"
107-
[7]: https://github.com/libra/dip/blob/master/dips/dip-4.md "Transaction Metadata Specification"
101+
[1]: https://github.com/diem/diem/blob/master/json-rpc/json-rpc-spec.md "Diem JSON-RPC SPEC"
102+
[2]: https://github.com/diem/lip/blob/master/lips/lip-5.md "Address formatting"
103+
[3]: https://github.com/diem/diem/blob/master/language/stdlib/transaction_scripts/doc/peer_to_peer_with_metadata.md "P2P Transafer"
104+
[4]: https://github.com/diem/diem/tree/master/language/stdlib/transaction_scripts/doc "Move Stdlib scripts"
105+
[5]: https://github.com/diem/diem/blob/master/client/diem-dev/README.md "Diem Client Dev Doc"
106+
[6]: https://github.com/diem/diem/blob/master/json-rpc/docs/service_testnet_faucet.md "Faucet service"
107+
[7]: https://github.com/diem/lip/blob/master/lips/lip-4.md "Transaction Metadata Specification"

diem

Submodule diem added at 838a46d

examples/intent_identifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
def test_intent_identifier():
99
child_vasp_address = "d738a0b9851305dfe1d17707f0841dbc"
1010
user_sub_address = "9072d012034a880f"
11-
currency_code = "Coin1"
11+
currency_code = "XUS"
1212
amount = 10_000_000
1313

1414
account_id = identifier.encode_account(
15-
child_vasp_address, utils.sub_address(user_sub_address), identifier.TLB # testnet HRP
15+
child_vasp_address, utils.sub_address(user_sub_address), identifier.TDM # testnet HRP
1616
)
1717
intent_id = identifier.encode_intent(account_id, currency_code, amount)
1818

19-
assert intent_id == "diem://tlb1p6uu2pwv9zvzalcw3wurlppqahjg895qjqd9gsrc5pe4ul?c=Coin1&am=10000000"
19+
assert intent_id == "diem://tdm1p6uu2pwv9zvzalcw3wurlppqahjg895qjqd9gsrcr9dqh8?c=XUS&am=10000000"

examples/p2p_transfer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_non_custodial_to_custodial():
4949

5050
intent_id = receiver_custodial.payment(user_id=0, amount=1_000_000)
5151

52-
intent = identifier.decode_intent(intent_id, identifier.TLB)
52+
intent = identifier.decode_intent(intent_id, identifier.TDM)
5353

5454
script = stdlib.encode_peer_to_peer_with_metadata_script(
5555
currency=utils.currency_code(intent.currency_code),
@@ -104,7 +104,7 @@ def test_custodial_to_custodial_under_threshold():
104104

105105
intent_id = receiver_custodial.payment(user_id=0, amount=1_000_000)
106106

107-
intent = identifier.decode_intent(intent_id, identifier.TLB)
107+
intent = identifier.decode_intent(intent_id, identifier.TDM)
108108

109109
script = stdlib.encode_peer_to_peer_with_metadata_script(
110110
currency=utils.currency_code(intent.currency_code),
@@ -134,7 +134,7 @@ def test_custodial_to_custodial_above_threshold():
134134

135135
intent_id = receiver_custodial.payment(user_id=0, amount=2_000_000_000)
136136

137-
intent = identifier.decode_intent(intent_id, identifier.TLB)
137+
intent = identifier.decode_intent(intent_id, identifier.TDM)
138138

139139
sender = sender_custodial.available_child_vasp()
140140
# sender & receiver communicate by off chain APIs

examples/refund.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_refund_transaction_of_custodial_to_custodial_under_threshold():
2121

2222
# create a payment transaction
2323
intent_id = receiver_custodial.payment(user_id=0, amount=1_000_000)
24-
intent = identifier.decode_intent(intent_id, identifier.TLB)
24+
intent = identifier.decode_intent(intent_id, identifier.TDM)
2525

2626
receiver_address = utils.account_address(intent.account_address)
2727
script = stdlib.encode_peer_to_peer_with_metadata_script(

examples/stubs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def add_user(self):
7575

7676
def payment(self, user_id: int, amount: int) -> str:
7777
account_id = identifier.encode_account(
78-
self._children[0].account_address, self._users[user_id], identifier.TLB # testnet HRP
78+
self._children[0].account_address, self._users[user_id], identifier.TDM # testnet HRP
7979
)
8080
return identifier.encode_intent(account_id, testnet.TEST_CURRENCY_CODE, amount)
8181

0 commit comments

Comments
 (0)