Skip to content

Commit 7059a9e

Browse files
Diem migration (#172)
* Diem migration (#2) * LIP and url fixes LIP and url fixes Co-authored-by: ericnakagawa <[email protected]>
1 parent d24df76 commit 7059a9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+311
-312
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
/build
44
/dist
55
__pycache__
6-
/src/libra_client_sdk.egg-info
6+
/src/diem_client_sdk.egg-info
7+
8+
# JetBrains IDEs configuration
9+
.idea

.gitmodules

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

.pyre_configuration

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
"taint_models_path": "./venv/lib/pyre_check/taint",
88
"typeshed": "./venv/lib/pyre_check/typeshed",
99
"ignore_all_errors": [
10-
"src/libra/jsonrpc/jsonrpc_pb2.py",
11-
"src/libra/lcs",
12-
"src/libra/libra_types",
13-
"src/libra/serde_binary",
14-
"src/libra/serde_types",
15-
"src/libra/stdlib",
10+
"src/diem/jsonrpc/jsonrpc_pb2.py",
11+
"src/diem/lcs",
12+
"src/diem/diem_types",
13+
"src/diem/serde_binary",
14+
"src/diem/serde_types",
15+
"src/diem/stdlib",
1616
"venv"
1717
]
1818
}

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Code of Conduct
22

3-
The project has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://developers.libra.org/docs/policies/code-of-conduct) so that you can understand what actions will and will not be tolerated.
3+
The project has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://developers.diem.com/docs/policies/code-of-conduct) so that you can understand what actions will and will not be tolerated.

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This project welcomes contributions.
44

55
## Contributor License Agreement (CLA)
66

7-
For pull request to be accepted by any Libra projects, a CLA must be [signed](https://libra.org/en-US/cla-sign). You will only need to do this once to work on any of Libra's open source projects.
7+
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://libra.org/en-US/cla-sign) an Individual CLA for yourself or a Corporate CLA for your company.
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.
1010

1111
## Issues
1212

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33

44
recursive-include src *.py

Makefile

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33

44
init:
@@ -30,25 +30,25 @@ cover: install
3030

3131
build: lint test
3232

33-
libratypes:
34-
(cd libra && cargo build -p transaction-builder-generator)
35-
"libra/target/debug/generate-transaction-builders" \
33+
diemtypes:
34+
(cd diem && cargo build -p transaction-builder-generator)
35+
"diem/target/debug/generate-transaction-builders" \
3636
--language python3 \
3737
--module-name stdlib \
38-
--with-libra-types "libra/testsuite/generate-format/tests/staged/libra.yaml" \
39-
--serde-package-name libra \
40-
--libra-package-name libra \
41-
--target-source-dir src/libra \
42-
--with-custom-libra-code libra-types-ext/*.py \
43-
-- "libra/language/stdlib/compiled/transaction_scripts/abi"
38+
--with-libra-types "diem/testsuite/generate-format/tests/staged/libra.yaml" \
39+
--serde-package-name diem \
40+
--libra-package-name diem \
41+
--target-source-dir src/diem \
42+
--with-custom-libra-code diem-types-ext/*.py \
43+
-- "diem/language/stdlib/compiled/transaction_scripts/abi"
4444

4545
protobuf:
46-
mkdir -p src/libra/jsonrpc
46+
mkdir -p src/diem/jsonrpc
4747
protoc --plugin=protoc-gen-mypy=venv/bin/protoc-gen-mypy \
48-
-Ilibra/json-rpc/types/src/proto --python_out=src/libra/jsonrpc --mypy_out=src/libra/jsonrpc \
48+
-Idiem/json-rpc/types/src/proto --python_out=src/diem/jsonrpc --mypy_out=src/diem/jsonrpc \
4949
jsonrpc.proto
5050

51-
gen: libratypes protobuf format
51+
gen: diemtypes protobuf format
5252

5353

5454
dist:
@@ -65,7 +65,7 @@ tagrelease:
6565

6666
docs: init install
6767
rm -rf docs
68-
./venv/bin/python3 -m pdoc libra --html -o docs
68+
./venv/bin/python3 -m pdoc diem --html -o docs
6969

7070

71-
.PHONY: init check lint format install test cover build libratypes protobuf gen dist pylama docs
71+
.PHONY: init check lint format install test cover build diemtypes protobuf gen dist pylama docs

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
> **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.
22
3-
# The official Libra Client SDK for Python.
3+
# The official Diem Client SDK for Python.
44

5-
[Documentation](https://developers.libra.org/docs/python-client-sdk-docs/libra/)
5+
[Documentation](https://developers.diem.com/docs/python-client-sdk-docs)
66

77
## Modules Overview
88

99
> SPEC = specification
1010
11-
> LIP-X = Libra Improvement Protocol
11+
> DIP-X = Diem Improvement Protocol
1212
13-
Root module name: `libra`
13+
Root module name: `diem`
1414

1515
Sub-modules:
1616

17-
- `jsonrpc`: libra JSON-RPC APIs client and API response types. [SPEC](https://github.com/libra/libra/blob/master/json-rpc/json-rpc-spec.md)
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)
1818
- `stdlib`: generated code, move stdlib script utils for constructing transaction script playload.
19-
- `libra_types`: generated code, Libra on-chain data structure types for encoding and decoding [LCS](https://libra.github.io/libra/libra_canonical_serialization/index.html) data.
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.
2020
- `utils`: utility functions, account address utils, currency code, hashing, hex encoding / decoding, transaction utils.
2121
- `AuthKey` | `auth_key`: auth key utils
22-
- `identifier`: Libra Account Identifier and Libra Intent Identifier. [LIP-5](https://lip.libra.org/lip-5/)
23-
- `txnmetadata`: utils for creating peer to peer transaction metadata. [LIP-4](https://lip.libra.org/lip-4/)
22+
- `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.libra.org/dip-4/)
2424
- `testnet`: Testnet utility, minting coins, create Testnet client, chain id, Testnet JSON-RPC URL.
2525
- `LocalAccount` | `local_account`: utility for managing local account keys, generate random local account.
2626
- `chain_ids`: list of static chain ids
@@ -29,7 +29,7 @@ Sub-modules:
2929

3030
```python3
3131

32-
>>> from libra import jsonrpc, testnet
32+
>>> from diem import jsonrpc, testnet
3333
>>> client = jsonrpc.Client(testnet.JSON_RPC_URL)
3434
>>> client.get_metadata()
3535
version: 3300304
@@ -50,7 +50,7 @@ Note: `make test` runs all examples too, see the Makefile for details.
5050
## Download
5151

5252
```
53-
pip install libra-client-sdk
53+
pip install diem-client-sdk
5454
```
5555

5656
## Bugs/Requests

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Security Policies and Procedures
22

3-
Please see Libra's
4-
[security policies](https://developers.libra.org/docs/policies/security) and
3+
Please see Diem's
4+
[security policies](https://developers.diem.com/docs/reference/security/) and
55
procedures for reporting vulnerabilities.

checklist.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
This file is a checklist of requirement & technical details for a Libra client SDK implementation.
1+
This file is a checklist of requirement & technical details for a Diem client SDK implementation.
22

33
# Basics
44

55
- [x] module structure:
6-
- libra
7-
- LibraClient: JSON-RPC APIs interface, should support application to do easy mock / stub development.
8-
- jsonrpc: jsonrpc client interface, include plain data classes / structs defined in Libra JSON-RPC SPEC document.
6+
- diem
7+
- Client: JSON-RPC APIs interface, should support application to do easy mock / stub development.
8+
- jsonrpc: jsonrpc client interface, include plain data classes / structs defined in Diem JSON-RPC SPEC document.
99
- types: data transfer object types for jsonrpc client, should match server side JSON-RPC spec data types.
1010
- stdlib: move stdlib script utils.
1111
- testnet: testnet utils, should include FaucetService for handling testnet mint.
12-
- libra-types: Libra onchain data structure types.
12+
- diem_types: Diem onchain data structure types.
1313
- utils:
1414
- signing
1515
- sha3 hashing, address parsing and converting, hex encoding / decoding
16-
- [LIP-4] transaction metadata
17-
- [LIP-5] intent identifier, account identifier
16+
- [DIP-4] transaction metadata
17+
- [DIP-5] intent identifier, account identifier
1818
- [ ] JSON-RPC 2.0 Spec:
1919
- spec version validation.
2020
- batch requests and responses handling.
2121
- [x] JSON-RPC client error handling should distinguish the following 3 type errors:
2222
- Transport layer error, e.g. HTTP call failure.
23-
- JSON-RPC protocol error: e.g. server responds to non json data, or can't be parsed into [Libra JSON-RPC SPEC][1] defined data structure, or missing result & error field.
23+
- JSON-RPC protocol error: e.g. server responds to non json data, or can't be parsed into [Diem JSON-RPC SPEC][1] defined data structure, or missing result & error field.
2424
- JSON-RPC error: error returned from server.
2525
- [x] https.
2626
- [ ] Client connection pool.
@@ -29,7 +29,7 @@ This file is a checklist of requirement & technical details for a Libra client S
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.
3131
- [x] parse and use libra_chain_id, libra_ledger_version and libra_ledger_tiemstamp in the JSONRPC response.
32-
- [x] Parsing and gen Libra Account Identifier (see [LIP-5][2])
32+
- [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
3535
- [x] Multi-network: initialize Client with chain id, JSON-RPC server URL
@@ -39,14 +39,14 @@ This file is a checklist of requirement & technical details for a Libra client S
3939
- [ ] Send request with "client sdk name / version" as HTTP User-Agent: this is for server to recognize client sdk version, so that server can block a specific client version if we found unacceptable bugs.
4040
- [x] Decode transaction script bytes
4141

42-
# [LIP-4][7] support
42+
# [DIP-4][7] support
4343

4444
- [x] Non-custodial to custodial transaction
4545
- [x] Custodial to non-custodial transaction
4646
- [x] Custodial to Custodial transaction
4747
- [x] Refund
4848

49-
# [LIP-5][2] support
49+
# [DIP-5][2] support
5050

5151
- [x] Encode and decode account identifier
5252
- [x] Encode and decode intent identifier
@@ -88,7 +88,7 @@ See [doc][5] for above concepts.
8888

8989
# Examples
9090

91-
- [x] [p2p transfer examples](https://github.com/libra/lip/blob/master/lips/lip-4.md#transaction-examples)
91+
- [x] [p2p transfer examples](https://github.com/libra/dip/blob/master/dips/dip-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 "Libra JSON-RPC SPEC"
102-
[2]: https://github.com/libra/lip/blob/master/lips/lip-5.md "LIP-5"
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"
103103
[3]: https://github.com/libra/libra/blob/master/language/stdlib/transaction_scripts/doc/peer_to_peer_with_metadata.md "P2P Transafer"
104104
[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 "Libra Client Dev Doc"
105+
[5]: https://github.com/libra/libra/blob/master/client/libra-dev/README.md "Diem Client Dev Doc"
106106
[6]: https://github.com/libra/libra/blob/master/json-rpc/docs/service_testnet_faucet.md "Faucet service"
107-
[7]: https://github.com/libra/lip/blob/master/lips/lip-4.md "Transaction Metadata Specification"
107+
[7]: https://github.com/libra/dip/blob/master/dips/dip-4.md "Transaction Metadata Specification"
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/create_child_vasp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33

44

55
import time
66

7-
from libra import (
8-
libra_types,
7+
from diem import (
8+
diem_types,
99
stdlib,
1010
testnet,
1111
utils,
@@ -22,10 +22,10 @@ def test_create_child_vasp():
2222

2323
child_vasp = LocalAccount.generate()
2424
currency = testnet.TEST_CURRENCY_CODE
25-
raw_txn = libra_types.RawTransaction(
25+
raw_txn = diem_types.RawTransaction(
2626
sender=parent_vasp.account_address,
2727
sequence_number=seq_num,
28-
payload=libra_types.TransactionPayload__Script(
28+
payload=diem_types.TransactionPayload__Script(
2929
stdlib.encode_create_child_vasp_account_script(
3030
coin_type=utils.currency_code(currency),
3131
child_address=child_vasp.account_address,

examples/intent_identifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33

44

55
import secrets
66

7-
from libra import identifier, utils, LocalAccount
7+
from diem import identifier, utils, LocalAccount
88

99

1010
def test_intent_identifier():
@@ -18,4 +18,4 @@ def test_intent_identifier():
1818
)
1919
intent_id = identifier.encode_intent(account_id, currency_code, amount)
2020

21-
assert intent_id == "libra://tlb1p6uu2pwv9zvzalcw3wurlppqahjg895qjqd9gsrc5pe4ul?c=Coin1&am=10000000"
21+
assert intent_id == "diem://tlb1p6uu2pwv9zvzalcw3wurlppqahjg895qjqd9gsrc5pe4ul?c=Coin1&am=10000000"

examples/p2p_transfer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33

44
import time, secrets, typing
55

6-
from libra import (
6+
from diem import (
77
identifier,
88
jsonrpc,
9-
libra_types,
9+
diem_types,
1010
stdlib,
1111
testnet,
1212
txnmetadata,
@@ -165,10 +165,10 @@ def test_custodial_to_custodial_above_threshold():
165165

166166

167167
def create_transaction(sender, sender_account_sequence, script, currency):
168-
return libra_types.RawTransaction(
168+
return diem_types.RawTransaction(
169169
sender=sender.account_address,
170170
sequence_number=sender_account_sequence,
171-
payload=libra_types.TransactionPayload__Script(script),
171+
payload=diem_types.TransactionPayload__Script(script),
172172
max_gas_amount=1_000_000,
173173
gas_unit_price=0,
174174
gas_currency_code=currency,

examples/refund.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33

4-
from libra import (
4+
from diem import (
55
identifier,
66
stdlib,
77
testnet,

examples/stubs.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33

44
import time, secrets, typing
55
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
6-
from libra import (
6+
from diem import (
77
identifier,
88
jsonrpc,
9-
libra_types,
9+
diem_types,
1010
stdlib,
1111
testnet,
1212
utils,
@@ -91,17 +91,17 @@ def available_child_vasp(self) -> LocalAccount:
9191

9292
def submit_and_wait(
9393
self,
94-
txn: typing.Union[libra_types.SignedTransaction, str],
94+
txn: typing.Union[diem_types.SignedTransaction, str],
9595
) -> jsonrpc.Transaction:
9696
self._client.submit(txn)
9797
return self._client.wait_for_transaction(txn)
9898

99-
def create_transaction(self, sender, script, currency) -> libra_types.RawTransaction:
99+
def create_transaction(self, sender, script, currency) -> diem_types.RawTransaction:
100100
sender_account_sequence = self.get_sequence_number(sender)
101-
return libra_types.RawTransaction(
101+
return diem_types.RawTransaction(
102102
sender=sender.account_address,
103103
sequence_number=sender_account_sequence,
104-
payload=libra_types.TransactionPayload__Script(script),
104+
payload=diem_types.TransactionPayload__Script(script),
105105
max_gas_amount=1_000_000,
106106
gas_unit_price=0,
107107
gas_currency_code=currency,

libra

Lines changed: 0 additions & 1 deletion
This file was deleted.

pylama.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33

44
[pylama]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) The Libra Core Contributors
1+
# Copyright (c) The Diem Core Contributors
22
# SPDX-License-Identifier: Apache-2.0
33
[tool.black]
44
line-length = 120

0 commit comments

Comments
 (0)