Skip to content

Commit

Permalink
feat: implement function for set (#6)
Browse files Browse the repository at this point in the history
* build(docker): add dockerized local near network

* test: add test script to run tests against the docker image and create test to depoy social contract

* feat: add successful implementation of get version

* build: add convenient scripts to start/stop a local near node

* feat: add get function to get information

* feat: add set function and remove dependency on near-api-js contract class

* test: separate tests by function

* chore: squash

* test: add function to create ephemeral accounts to be used in tests

* chore: squash

* build: fix linit errors

* docs: add docs for get & set contract methods, added types and reading data

* docs: add stroing data guide

* test: fix typo in social contract account import
  • Loading branch information
kieranroneill authored May 15, 2024
1 parent 3d9ef10 commit 8b7406f
Show file tree
Hide file tree
Showing 88 changed files with 2,433 additions and 99 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.docs/
.docusaurus/
.git/
.idea/
.temp/
.vscode/
dist/
node_modules/
283 changes: 283 additions & 0 deletions .near/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
{
"genesis_file": "genesis.json",
"genesis_records_file": null,
"validator_key_file": "validator_key.json",
"node_key_file": "node_key.json",
"rpc": {
"addr": "0.0.0.0:3030",
"prometheus_addr": null,
"cors_allowed_origins": ["*"],
"polling_config": {
"polling_interval": {
"secs": 0,
"nanos": 500000000
},
"polling_timeout": {
"secs": 10,
"nanos": 0
}
},
"limits_config": {
"json_payload_max_size": 10485760
},
"enable_debug_rpc": false,
"experimental_debug_pages_src_path": null
},
"telemetry": {
"endpoints": [],
"reporting_interval": {
"secs": 10,
"nanos": 0
}
},
"network": {
"addr": "0.0.0.0:24567",
"boot_nodes": "",
"whitelist_nodes": "",
"max_num_peers": 40,
"minimum_outbound_peers": 5,
"ideal_connections_lo": 30,
"ideal_connections_hi": 35,
"peer_recent_time_window": {
"secs": 600,
"nanos": 0
},
"safe_set_size": 20,
"archival_peer_connections_lower_bound": 10,
"handshake_timeout": {
"secs": 20,
"nanos": 0
},
"skip_sync_wait": true,
"ban_window": {
"secs": 10800,
"nanos": 0
},
"blacklist": [],
"ttl_account_id_router": {
"secs": 3600,
"nanos": 0
},
"peer_stats_period": {
"secs": 5,
"nanos": 0
},
"monitor_peers_max_period": {
"secs": 60,
"nanos": 0
},
"peer_states_cache_size": 1000,
"snapshot_hosts_cache_size": 1000,
"peer_expiration_duration": {
"secs": 604800,
"nanos": 0
},
"public_addrs": [],
"allow_private_ip_in_public_addrs": false,
"trusted_stun_servers": [
"stun.l.google.com:19302",
"stun1.l.google.com:19302",
"stun2.l.google.com:19302",
"stun3.l.google.com:19302",
"stun4.l.google.com:19302"
],
"experimental": {
"inbound_disabled": false,
"connect_only_to_boot_nodes": false,
"skip_sending_tombstones_seconds": 0,
"tier1_enable_inbound": true,
"tier1_enable_outbound": true,
"tier1_connect_interval": {
"secs": 60,
"nanos": 0
},
"tier1_new_connections_per_attempt": 50,
"network_config_overrides": {
"connect_to_reliable_peers_on_startup": null,
"max_send_peers": null,
"routed_message_ttl": null,
"max_routes_to_store": null,
"highest_peer_horizon": null,
"push_info_period_millis": null,
"outbound_disabled": null,
"accounts_data_broadcast_rate_limit_burst": null,
"accounts_data_broadcast_rate_limit_qps": null,
"routing_table_update_rate_limit_burst": null,
"routing_table_update_rate_limit_qps": null
}
}
},
"consensus": {
"min_num_peers": 3,
"block_production_tracking_delay": {
"secs": 0,
"nanos": 100000000
},
"min_block_production_delay": {
"secs": 0,
"nanos": 600000000
},
"max_block_production_delay": {
"secs": 2,
"nanos": 0
},
"max_block_wait_delay": {
"secs": 6,
"nanos": 0
},
"produce_empty_blocks": true,
"block_fetch_horizon": 50,
"block_header_fetch_horizon": 50,
"catchup_step_period": {
"secs": 0,
"nanos": 100000000
},
"chunk_request_retry_period": {
"secs": 0,
"nanos": 400000000
},
"header_sync_initial_timeout": {
"secs": 10,
"nanos": 0
},
"header_sync_progress_timeout": {
"secs": 2,
"nanos": 0
},
"header_sync_stall_ban_timeout": {
"secs": 120,
"nanos": 0
},
"state_sync_timeout": {
"secs": 60,
"nanos": 0
},
"header_sync_expected_height_per_second": 10,
"sync_check_period": {
"secs": 10,
"nanos": 0
},
"sync_step_period": {
"secs": 0,
"nanos": 10000000
},
"doomslug_step_period": {
"secs": 0,
"nanos": 100000000
},
"sync_height_threshold": 1
},
"tracked_accounts": [],
"tracked_shards": [0],
"log_summary_style": "colored",
"log_summary_period": {
"secs": 10,
"nanos": 0
},
"enable_multiline_logging": true,
"gc_blocks_limit": 2,
"gc_fork_clean_step": 100,
"gc_num_epochs_to_keep": 5,
"view_client_threads": 4,
"epoch_sync_enabled": false,
"view_client_throttle_period": {
"secs": 30,
"nanos": 0
},
"trie_viewer_state_size_limit": 50000,
"store": {
"path": null,
"enable_statistics": false,
"enable_statistics_export": true,
"max_open_files": 10000,
"col_state_cache_size": 536870912,
"col_flat_state_cache_size": 134217728,
"block_size": 16384,
"trie_cache": {
"default_max_bytes": 500000000,
"per_shard_max_bytes": {
"s1.v1": 50000000,
"s4.v2": 3000000000,
"s1.v2": 50000000,
"s5.v3": 3000000000,
"s3.v1": 3000000000,
"s1.v3": 50000000
},
"shard_cache_deletions_queue_capacity": 100000
},
"view_trie_cache": {
"default_max_bytes": 50000000,
"per_shard_max_bytes": {},
"shard_cache_deletions_queue_capacity": 100000
},
"enable_receipt_prefetching": true,
"sweat_prefetch_receivers": ["token.sweat", "vfinal.token.sweat.testnet"],
"sweat_prefetch_senders": ["oracle.sweat", "sweat_the_oracle.testnet"],
"claim_sweat_prefetch_config": [
{
"receiver": "claim.sweat",
"sender": "token.sweat",
"method_name": "record_batch_for_hold"
}
],
"kaiching_prefetch_config": [
{
"receiver": "earn.kaiching",
"sender": "wallet.kaiching",
"method_name": "ft_on_transfer"
}
],
"load_mem_tries_for_shards": [],
"load_mem_tries_for_all_shards": false,
"background_migration_threads": 8,
"flat_storage_creation_enabled": true,
"flat_storage_creation_period": {
"secs": 1,
"nanos": 0
},
"state_snapshot_config": {
"state_snapshot_type": "ForReshardingOnly"
},
"state_snapshot_enabled": false
},
"state_sync_enabled": true,
"state_sync": {
"sync": {
"ExternalStorage": {
"location": {
"GCS": {
"bucket": "state-parts"
}
},
"num_concurrent_requests": 25,
"num_concurrent_requests_during_catchup": 5
}
}
},
"transaction_pool_size_limit": 100000000,
"resharding_config": {
"batch_size": 500000,
"batch_delay": {
"secs": 0,
"nanos": 100000000
},
"retry_delay": {
"secs": 10,
"nanos": 0
},
"initial_delay": {
"secs": 0,
"nanos": 0
},
"max_poll_time": {
"secs": 7200,
"nanos": 0
}
},
"tx_routing_height_horizon": 4,
"produce_chunk_add_transactions_time_limit": {
"secs": 0,
"nanos": 200000000
},
"max_loaded_contracts": 256
}
92 changes: 92 additions & 0 deletions .near/genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"protocol_version": 65,
"genesis_time": "2024-04-15T07:43:57.099576572Z",
"chain_id": "localnet",
"genesis_height": 0,
"num_block_producer_seats": 50,
"num_block_producer_seats_per_shard": [50],
"avg_hidden_validator_seats_per_shard": [0],
"dynamic_resharding": false,
"protocol_upgrade_stake_threshold": [4, 5],
"epoch_length": 500,
"gas_limit": 1000000000000000,
"min_gas_price": "100000000",
"max_gas_price": "10000000000000000000000",
"block_producer_kickout_threshold": 90,
"chunk_producer_kickout_threshold": 90,
"online_min_threshold": [9, 10],
"online_max_threshold": [99, 100],
"gas_price_adjustment_rate": [1, 100],
"validators": [
{
"account_id": "test.near",
"public_key": "ed25519:AJRAvssSHCrLnSQ38pH93Vc3mmFKn43pQWXMnD8Q5HQU",
"amount": "50000000000000000000000000000000"
}
],
"transaction_validity_period": 100,
"protocol_reward_rate": [1, 10],
"max_inflation_rate": [1, 20],
"total_supply": "2050000000000000000000000000000000",
"num_blocks_per_year": 31536000,
"protocol_treasury_account": "test.near",
"fishermen_threshold": "10000000000000000000000000",
"minimum_stake_divisor": 10,
"shard_layout": {
"V0": {
"num_shards": 1,
"version": 0
}
},
"num_chunk_only_producer_seats": 300,
"minimum_validators_per_shard": 1,
"max_kickout_stake_perc": 100,
"minimum_stake_ratio": [1, 6250],
"use_production_config": false,
"records": [
{
"Account": {
"account_id": "test.near",
"account": {
"amount": "1000000000000000000000000000000000",
"locked": "50000000000000000000000000000000",
"code_hash": "11111111111111111111111111111111",
"storage_usage": 0,
"version": "V1"
}
}
},
{
"AccessKey": {
"account_id": "test.near",
"public_key": "ed25519:AJRAvssSHCrLnSQ38pH93Vc3mmFKn43pQWXMnD8Q5HQU",
"access_key": {
"nonce": 0,
"permission": "FullAccess"
}
}
},
{
"Account": {
"account_id": "near",
"account": {
"amount": "1000000000000000000000000000000000",
"locked": "0",
"code_hash": "11111111111111111111111111111111",
"storage_usage": 0,
"version": "V1"
}
}
},
{
"AccessKey": {
"account_id": "near",
"public_key": "ed25519:546XB2oHhj7PzUKHiH9Xve3Ze5q1JiW2WTh6abXFED3c",
"access_key": {
"nonce": 0,
"permission": "FullAccess"
}
}
}
]
}
5 changes: 5 additions & 0 deletions .near/node_key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"account_id": "node",
"public_key": "ed25519:3oU591sCAX5Hb8MLbtxbBGy9fjdCeo8p6CAtxvvRsicg",
"secret_key": "ed25519:3D1XrtZ8P7yf7Ybjs2EUydCioxTCsqaZGKqh1xqWuayfxjnoMYe4Z9rXaRcY8K3hkZMVC4q9rmFrVKQixbMyYTVr"
}
5 changes: 5 additions & 0 deletions .near/validator_key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"account_id": "test.near",
"public_key": "ed25519:AJRAvssSHCrLnSQ38pH93Vc3mmFKn43pQWXMnD8Q5HQU",
"secret_key": "ed25519:64mbtfHNZE1DC21DNt6TjZe6HrW6NHVR9CieEZBbqRX94uoZYGRkxqVMJMyMaA6vLPvtfzPH1tmmPWmt256c2Lbi"
}
Loading

0 comments on commit 8b7406f

Please sign in to comment.