Skip to content

Commit

Permalink
Merge pull request #336 from kommitters/v0.18
Browse files Browse the repository at this point in the history
Release v0.18.0
  • Loading branch information
EdwinGuayacan authored Sep 20, 2023
2 parents ab4a688 + 9204e55 commit a203ad2
Show file tree
Hide file tree
Showing 53 changed files with 805 additions and 508 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ jobs:
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
github.com:443
hex.pm:443
repo.hex.pm:443
builds.hex.pm:443
egress-policy: audit
# egress-policy: block
# allowed-endpoints: >
# github.com:443
# hex.pm:443
# repo.hex.pm:443
# builds.hex.pm:443

- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: erlef/setup-elixir@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ jobs:
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
coveralls.io:443
github.com:443
repo.hex.pm:443
builds.hex.pm:443
egress-policy: audit
# egress-policy: block
# allowed-endpoints: >
# coveralls.io:443
# github.com:443
# repo.hex.pm:443
# builds.hex.pm:443

- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: erlef/setup-elixir@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0
- uses: erlef/setup-beam@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ jobs:
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
api.osv.dev:443
api.securityscorecards.dev:443
bestpractices.coreinfrastructure.org:443
*.sigstore.dev:443
github.com:443
sigstore-tuf-root.storage.googleapis.com:443
oss-fuzz-build-logs.storage.googleapis.com:443
egress-policy: audit
# egress-policy: block
# allowed-endpoints: >
# api.github.com:443
# api.osv.dev:443
# api.securityscorecards.dev:443
# bestpractices.coreinfrastructure.org:443
# *.sigstore.dev:443
# github.com:443
# sigstore-tuf-root.storage.googleapis.com:443
# oss-fuzz-build-logs.storage.googleapis.com:443

- name: "Checkout code"
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.18.0 (20.09.2023)

* Add Soroban Preview 11 support.

## 0.17.1 (08.08.2023)

* Allow contract_data key to be any type of `SCVal`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The **Stellar SDK** is composed of two complementary components: **`TxBuild`** +
```elixir
def deps do
[
{:stellar_sdk, "~> 0.17.1"}
{:stellar_sdk, "~> 0.18.0"}
]
end
```
Expand Down
25 changes: 14 additions & 11 deletions docs/examples/soroban/bump_footprint_expiration.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Bump Footprint Expiration

The `BumpFootprintExpirationOp` operation is used to extend a contract data entry's lifetime.

A contract instance, wasm hash, and data storage entry (persistent/instance/temporary) can expire, so you can use this bump operation to extend its lifetime.
Read more about it:

- https://soroban.stellar.org/docs/fundamentals-and-concepts/state-expiration#bumpfootprintexpirationop
- https://docs.rs/soroban-sdk/latest/soroban_sdk/storage/struct.Storage.html

Expand All @@ -19,6 +21,7 @@ alias Stellar.TxBuild.{
Account,
BaseFee,
BumpFootprintExpiration,
LedgerFootprint,
LedgerKey,
SCAddress,
SCVal,
Expand All @@ -28,36 +31,36 @@ alias Stellar.TxBuild.{
SorobanTransactionData
}

contract_address = "CAMGSYINVVL6WP3Q5WPNL7FS4GZP37TWV7MKIRQF5QMYLK3N2SW4P3RC"
alias Stellar.Horizon.Accounts
alias Stellar.KeyPair

contract_address = "CCNVHP2UAOJAICTQUDSRVZDCB5OJKGQNOJFPOXINELWQHGX33EG34NV2"
contract_sc_address = SCAddress.new(contract_address)
key = SCVal.new(ledger_key_contract_instance: nil)

keypair =
{public_key, _secret} =
Stellar.KeyPair.from_secret_seed("SCAVFA3PI3MJLTQNMXOUNBSEUOSY66YMG3T2KCQKLQBENNVLVKNPV3EK")
{public_key, _secret} = KeyPair.from_secret_seed("SCAVFA3PI3MJLTQNMXOUNBSEUOSY66YMG3T2KCQKLQBENNVLVKNPV3EK")

contract_data =
LedgerKey.new(
{:contract_data,
[
contract: contract_sc_address,
key: key,
durability: :persistent,
body_type: :data_entry
durability: :persistent
]}
)

hash = Base.decode16!("067eb7ba419edd3e946e08eb17a81fbe1e850e690ed7692160875c2b65b45f21", case: :lower)
contract_code = LedgerKey.new({:contract_code, [hash: hash, body_type: :data_entry]})
hash = Base.decode16!("d14f427a7d4ad78008e5f18a8d9ed7c9dcc02a868995064b9a88a5a684b86624", case: :lower)
contract_code = LedgerKey.new({:contract_code, [hash: hash]})
footprint = LedgerFootprint.new(read_only: [contract_data, contract_code])

soroban_data =
[
footprint: footprint,
instructions: 0,
read_bytes: 0,
write_bytes: 0,
extended_meta_data_size_bytes: 0
write_bytes: 0
]
|> SorobanResources.new()
|> (&SorobanTransactionData.new(resources: &1, refundable_fee: 0)).()
Expand All @@ -78,9 +81,9 @@ source_account

# Simulate Transaction
soroban_data =
"AAAAAAAAAAIAAAAGAAAAARhpYQ2tV+s/cO2e1fyy4bL9/nav2KRGBewZhatt1K3HAAAAFAAAAAEAAAAAAAAABxhpYQ2tV+s/cO2e1fyy4bL9/nav2KRGBewZhatt1K3HAAAAAAAAAAAAAAAAAAABLAAAAAAAAAJYAAAAAAAAAHY="
"AAAAAAAAAAIAAAAGAAAAAZtTv1QDkgQKcKDlGuRiD1yVGg1ySvddDSLtA5r72Q2+AAAAFAAAAAEAAAAH0U9Cen1K14AI5fGKjZ7XydzAKoaJlQZLmoilpoS4ZiQAAAAAAAAAAAAAAxwAAAAAAAAAAAAAGzI="

min_resource_fee = 11_516
min_resource_fee = 13_946
fee = BaseFee.new(min_resource_fee + 100)

# Use the XDR generated here to send it to the futurenet
Expand Down
11 changes: 9 additions & 2 deletions docs/examples/soroban/create_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ alias Stellar.TxBuild.{
SCAddress
}

alias Stellar.KeyPair
alias Stellar.Horizon.Accounts

wasm_ref = <<some binary here>>
Expand All @@ -47,7 +48,7 @@ invoke_host_function_op = InvokeHostFunction.new(host_function: host_function)

keypair =
{public_key, _secret} =
Stellar.KeyPair.from_secret_seed("SC5J4N7JTTWK6QS34OFEX67PB7X2UDLZMOPX2ORA5KTPQHFCESBKZ46D")
KeyPair.from_secret_seed("SC5J4N7JTTWK6QS34OFEX67PB7X2UDLZMOPX2ORA5KTPQHFCESBKZ46D")

source_account = Account.new(public_key)

Expand All @@ -67,6 +68,11 @@ source_account
soroban_data =
"AAAAAAAAAAEAAAAHuoVwkiq7sFT5+6wPecWIC3zW3SXzDactjjMN9VUNzQIAAAAAAAAAAQAAAAYAAAABet+3VCiKSYoZDd/Ce32Dtp9tYwNFc64V/QfdZUJm4boAAAAUAAAAAQAAAAAAAX/UAAACyAAAAKQAAADYAAAAAAAAACs="

auth = [
"AAAAAAAAAAEAAAAAAAAAAAAAAADJTnjlYcJxSKDat78jbEyDkVqo2uhpNX4BdBtqGrx+1t3O7skFonbhP9PT+l5IGaavsMV+AyUtQF88+kCpS/YbAAAAAIw32Y19ZRfshxeO+Nw4BNSkE0ZhibcEWId4SVzs0PZPAAAAAA=="
]

invoke_host_function_op = InvokeHostFunction.set_auth(invoke_host_function_op, auth)
min_resource_fee = 38_733
fee = BaseFee.new(min_resource_fee + 100)

Expand Down Expand Up @@ -98,9 +104,10 @@ alias Stellar.TxBuild.{
Signature
}

alias Stellar.KeyPair
alias Stellar.Horizon.Accounts

keypair = {public_key, _secret} = Stellar.KeyPair.from_secret_seed("SCA...3EK")
keypair = {public_key, _secret} = KeyPair.from_secret_seed("SCA...3EK")

asset = Asset.new(code: :ABC, issuer: public_key)

Expand Down
Loading

0 comments on commit a203ad2

Please sign in to comment.