@openzeppelin/upgrades-core 1.25.0 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.json +2 -2
- package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.json +2 -2
- package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.json +2 -2
- package/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +7 -7
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +2 -72
- package/artifacts/AdminUpgradeabilityProxy.json +2 -72
- package/artifacts/ProxyAdmin.json +7 -7
- package/artifacts/build-info.json +21225 -12
- package/artifacts/contracts/proxy/AdminUpgradeabilityProxy.sol/AdminUpgradeabilityProxy.json +2 -72
- package/artifacts/contracts/proxy/ProxyAdmin.sol/ProxyAdmin.json +7 -7
- package/dist/deployment.d.ts +28 -4
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +106 -25
- package/dist/deployment.js.map +1 -1
- package/dist/deployment.test.js +116 -0
- package/dist/deployment.test.js.map +1 -1
- package/dist/impl-store.d.ts +27 -2
- package/dist/impl-store.d.ts.map +1 -1
- package/dist/impl-store.js +39 -8
- package/dist/impl-store.js.map +1 -1
- package/dist/impl-store.test.js +30 -0
- package/dist/impl-store.test.js.map +1 -1
- package/dist/manifest.d.ts +3 -3
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +1 -1
- package/dist/manifest.js.map +1 -1
- package/dist/manifest.test.js +1 -0
- package/dist/manifest.test.js.map +1 -1
- package/dist/validate/error.d.ts +3 -0
- package/dist/validate/error.d.ts.map +1 -1
- package/dist/validate/error.js +7 -1
- package/dist/validate/error.js.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +2 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/query.js +1 -1
- package/dist/validate/query.js.map +1 -1
- package/package.json +5 -4
- package/src/deployment.test.ts +182 -1
- package/src/deployment.ts +134 -26
- package/src/impl-store.test.ts +52 -1
- package/src/impl-store.ts +69 -11
- package/src/manifest.test.ts +1 -0
- package/src/manifest.ts +11 -8
- package/src/validate/error.ts +6 -0
- package/src/validate/index.ts +1 -1
- package/src/validate/query.ts +2 -2
package/artifacts/contracts/proxy/AdminUpgradeabilityProxy.sol/AdminUpgradeabilityProxy.json
CHANGED
|
@@ -73,83 +73,13 @@
|
|
|
73
73
|
"stateMutability": "payable",
|
|
74
74
|
"type": "fallback"
|
|
75
75
|
},
|
|
76
|
-
{
|
|
77
|
-
"inputs": [],
|
|
78
|
-
"name": "admin",
|
|
79
|
-
"outputs": [
|
|
80
|
-
{
|
|
81
|
-
"internalType": "address",
|
|
82
|
-
"name": "admin_",
|
|
83
|
-
"type": "address"
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
"stateMutability": "nonpayable",
|
|
87
|
-
"type": "function"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"inputs": [
|
|
91
|
-
{
|
|
92
|
-
"internalType": "address",
|
|
93
|
-
"name": "newAdmin",
|
|
94
|
-
"type": "address"
|
|
95
|
-
}
|
|
96
|
-
],
|
|
97
|
-
"name": "changeAdmin",
|
|
98
|
-
"outputs": [],
|
|
99
|
-
"stateMutability": "nonpayable",
|
|
100
|
-
"type": "function"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"inputs": [],
|
|
104
|
-
"name": "implementation",
|
|
105
|
-
"outputs": [
|
|
106
|
-
{
|
|
107
|
-
"internalType": "address",
|
|
108
|
-
"name": "implementation_",
|
|
109
|
-
"type": "address"
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
"stateMutability": "nonpayable",
|
|
113
|
-
"type": "function"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"inputs": [
|
|
117
|
-
{
|
|
118
|
-
"internalType": "address",
|
|
119
|
-
"name": "newImplementation",
|
|
120
|
-
"type": "address"
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
"name": "upgradeTo",
|
|
124
|
-
"outputs": [],
|
|
125
|
-
"stateMutability": "nonpayable",
|
|
126
|
-
"type": "function"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"inputs": [
|
|
130
|
-
{
|
|
131
|
-
"internalType": "address",
|
|
132
|
-
"name": "newImplementation",
|
|
133
|
-
"type": "address"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"internalType": "bytes",
|
|
137
|
-
"name": "data",
|
|
138
|
-
"type": "bytes"
|
|
139
|
-
}
|
|
140
|
-
],
|
|
141
|
-
"name": "upgradeToAndCall",
|
|
142
|
-
"outputs": [],
|
|
143
|
-
"stateMutability": "payable",
|
|
144
|
-
"type": "function"
|
|
145
|
-
},
|
|
146
76
|
{
|
|
147
77
|
"stateMutability": "payable",
|
|
148
78
|
"type": "receive"
|
|
149
79
|
}
|
|
150
80
|
],
|
|
151
|
-
"bytecode": "
|
|
152
|
-
"deployedBytecode": "
|
|
81
|
+
"bytecode": "0x608060405260405162000ee038038062000ee08339810160408190526200002691620004a3565b8282828281620000398282600062000053565b506200004790508262000090565b505050505050620005d6565b6200005e83620000eb565b6000825111806200006c5750805b156200008b576200008983836200012d60201b620001791760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f620000bb6200015c565b604080516001600160a01b03928316815291841660208301520160405180910390a1620000e88162000195565b50565b620000f6816200024a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606062000155838360405180606001604052806027815260200162000eb960279139620002fe565b9392505050565b60006200018660008051602062000e9983398151915260001b6200037d60201b620001a51760201c565b546001600160a01b0316919050565b6001600160a01b038116620002005760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b806200022960008051602062000e9983398151915260001b6200037d60201b620001a51760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b62000260816200038060201b620001a81760201c565b620002c45760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401620001f7565b80620002297f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6200037d60201b620001a51760201c565b6060600080856001600160a01b0316856040516200031d919062000583565b600060405180830381855af49150503d80600081146200035a576040519150601f19603f3d011682016040523d82523d6000602084013e6200035f565b606091505b50909250905062000373868383876200038f565b9695505050505050565b90565b6001600160a01b03163b151590565b6060831562000400578251620003f8576001600160a01b0385163b620003f85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620001f7565b50816200040c565b6200040c838362000414565b949350505050565b815115620004255781518083602001fd5b8060405162461bcd60e51b8152600401620001f79190620005a1565b80516001600160a01b03811681146200045957600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200049157818101518382015260200162000477565b83811115620000895750506000910152565b600080600060608486031215620004b957600080fd5b620004c48462000441565b9250620004d46020850162000441565b60408501519092506001600160401b0380821115620004f257600080fd5b818601915086601f8301126200050757600080fd5b8151818111156200051c576200051c6200045e565b604051601f8201601f19908116603f011681019083821181831017156200054757620005476200045e565b816040528281528960208487010111156200056157600080fd5b6200057483602083016020880162000474565b80955050505050509250925092565b600082516200059781846020870162000474565b9190910192915050565b6020815260008251806020840152620005c281604085016020870162000474565b601f01601f19169190910160400192915050565b6108b380620005e66000396000f3fe60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220c305b1ecbe12f30c701a08768fe5424f3f90ab320940a940a3ef1f7469a68ab164736f6c63430008090033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564",
|
|
82
|
+
"deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220c305b1ecbe12f30c701a08768fe5424f3f90ab320940a940a3ef1f7469a68ab164736f6c63430008090033",
|
|
153
83
|
"linkReferences": {},
|
|
154
84
|
"deployedLinkReferences": {}
|
|
155
85
|
}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
{
|
|
26
26
|
"inputs": [
|
|
27
27
|
{
|
|
28
|
-
"internalType": "contract
|
|
28
|
+
"internalType": "contract ITransparentUpgradeableProxy",
|
|
29
29
|
"name": "proxy",
|
|
30
30
|
"type": "address"
|
|
31
31
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
{
|
|
44
44
|
"inputs": [
|
|
45
45
|
{
|
|
46
|
-
"internalType": "contract
|
|
46
|
+
"internalType": "contract ITransparentUpgradeableProxy",
|
|
47
47
|
"name": "proxy",
|
|
48
48
|
"type": "address"
|
|
49
49
|
}
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
{
|
|
63
63
|
"inputs": [
|
|
64
64
|
{
|
|
65
|
-
"internalType": "contract
|
|
65
|
+
"internalType": "contract ITransparentUpgradeableProxy",
|
|
66
66
|
"name": "proxy",
|
|
67
67
|
"type": "address"
|
|
68
68
|
}
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
{
|
|
115
115
|
"inputs": [
|
|
116
116
|
{
|
|
117
|
-
"internalType": "contract
|
|
117
|
+
"internalType": "contract ITransparentUpgradeableProxy",
|
|
118
118
|
"name": "proxy",
|
|
119
119
|
"type": "address"
|
|
120
120
|
},
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
{
|
|
133
133
|
"inputs": [
|
|
134
134
|
{
|
|
135
|
-
"internalType": "contract
|
|
135
|
+
"internalType": "contract ITransparentUpgradeableProxy",
|
|
136
136
|
"name": "proxy",
|
|
137
137
|
"type": "address"
|
|
138
138
|
},
|
|
@@ -153,8 +153,8 @@
|
|
|
153
153
|
"type": "function"
|
|
154
154
|
}
|
|
155
155
|
],
|
|
156
|
-
"bytecode": "
|
|
157
|
-
"deployedBytecode": "
|
|
156
|
+
"bytecode": "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61069a8061007e6000396000f3fe60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461011157806399a88ec414610124578063f2fde38b14610144578063f3b7dead1461016457600080fd5b8063204e1c7a14610080578063715018a6146100bc5780637eff275e146100d35780638da5cb5b146100f3575b600080fd5b34801561008c57600080fd5b506100a061009b366004610499565b610184565b6040516001600160a01b03909116815260200160405180910390f35b3480156100c857600080fd5b506100d1610215565b005b3480156100df57600080fd5b506100d16100ee3660046104bd565b610229565b3480156100ff57600080fd5b506000546001600160a01b03166100a0565b6100d161011f36600461050c565b610291565b34801561013057600080fd5b506100d161013f3660046104bd565b610300565b34801561015057600080fd5b506100d161015f366004610499565b610336565b34801561017057600080fd5b506100a061017f366004610499565b6103b4565b6000806000836001600160a01b03166040516101aa90635c60da1b60e01b815260040190565b600060405180830381855afa9150503d80600081146101e5576040519150601f19603f3d011682016040523d82523d6000602084013e6101ea565b606091505b5091509150816101f957600080fd5b8080602001905181019061020d91906105e2565b949350505050565b61021d6103da565b6102276000610434565b565b6102316103da565b6040516308f2839760e41b81526001600160a01b038281166004830152831690638f283970906024015b600060405180830381600087803b15801561027557600080fd5b505af1158015610289573d6000803e3d6000fd5b505050505050565b6102996103da565b60405163278f794360e11b81526001600160a01b03841690634f1ef2869034906102c990869086906004016105ff565b6000604051808303818588803b1580156102e257600080fd5b505af11580156102f6573d6000803e3d6000fd5b5050505050505050565b6103086103da565b604051631b2ce7f360e11b81526001600160a01b038281166004830152831690633659cfe69060240161025b565b61033e6103da565b6001600160a01b0381166103a85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6103b181610434565b50565b6000806000836001600160a01b03166040516101aa906303e1469160e61b815260040190565b6000546001600160a01b031633146102275760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161039f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146103b157600080fd5b6000602082840312156104ab57600080fd5b81356104b681610484565b9392505050565b600080604083850312156104d057600080fd5b82356104db81610484565b915060208301356104eb81610484565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561052157600080fd5b833561052c81610484565b9250602084013561053c81610484565b9150604084013567ffffffffffffffff8082111561055957600080fd5b818601915086601f83011261056d57600080fd5b81358181111561057f5761057f6104f6565b604051601f8201601f19908116603f011681019083821181831017156105a7576105a76104f6565b816040528281528960208487010111156105c057600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6000602082840312156105f457600080fd5b81516104b681610484565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561063b5785810183015185820160600152820161061f565b8181111561064d576000606083870101525b50601f01601f19169290920160600194935050505056fea26469706673582212207ad53e1008cce369999f6b5f2f77109510b404ff1de9b47b639981fd68e6239264736f6c63430008090033",
|
|
157
|
+
"deployedBytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461011157806399a88ec414610124578063f2fde38b14610144578063f3b7dead1461016457600080fd5b8063204e1c7a14610080578063715018a6146100bc5780637eff275e146100d35780638da5cb5b146100f3575b600080fd5b34801561008c57600080fd5b506100a061009b366004610499565b610184565b6040516001600160a01b03909116815260200160405180910390f35b3480156100c857600080fd5b506100d1610215565b005b3480156100df57600080fd5b506100d16100ee3660046104bd565b610229565b3480156100ff57600080fd5b506000546001600160a01b03166100a0565b6100d161011f36600461050c565b610291565b34801561013057600080fd5b506100d161013f3660046104bd565b610300565b34801561015057600080fd5b506100d161015f366004610499565b610336565b34801561017057600080fd5b506100a061017f366004610499565b6103b4565b6000806000836001600160a01b03166040516101aa90635c60da1b60e01b815260040190565b600060405180830381855afa9150503d80600081146101e5576040519150601f19603f3d011682016040523d82523d6000602084013e6101ea565b606091505b5091509150816101f957600080fd5b8080602001905181019061020d91906105e2565b949350505050565b61021d6103da565b6102276000610434565b565b6102316103da565b6040516308f2839760e41b81526001600160a01b038281166004830152831690638f283970906024015b600060405180830381600087803b15801561027557600080fd5b505af1158015610289573d6000803e3d6000fd5b505050505050565b6102996103da565b60405163278f794360e11b81526001600160a01b03841690634f1ef2869034906102c990869086906004016105ff565b6000604051808303818588803b1580156102e257600080fd5b505af11580156102f6573d6000803e3d6000fd5b5050505050505050565b6103086103da565b604051631b2ce7f360e11b81526001600160a01b038281166004830152831690633659cfe69060240161025b565b61033e6103da565b6001600160a01b0381166103a85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6103b181610434565b50565b6000806000836001600160a01b03166040516101aa906303e1469160e61b815260040190565b6000546001600160a01b031633146102275760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161039f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146103b157600080fd5b6000602082840312156104ab57600080fd5b81356104b681610484565b9392505050565b600080604083850312156104d057600080fd5b82356104db81610484565b915060208301356104eb81610484565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561052157600080fd5b833561052c81610484565b9250602084013561053c81610484565b9150604084013567ffffffffffffffff8082111561055957600080fd5b818601915086601f83011261056d57600080fd5b81358181111561057f5761057f6104f6565b604051601f8201601f19908116603f011681019083821181831017156105a7576105a76104f6565b816040528281528960208487010111156105c057600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6000602082840312156105f457600080fd5b81516104b681610484565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561063b5785810183015185820160600152820161061f565b8181111561064d576000606083870101525b50601f01601f19169290920160600194935050505056fea26469706673582212207ad53e1008cce369999f6b5f2f77109510b404ff1de9b47b639981fd68e6239264736f6c63430008090033",
|
|
158
158
|
"linkReferences": {},
|
|
159
159
|
"deployedLinkReferences": {}
|
|
160
160
|
}
|
package/dist/deployment.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ export interface Deployment {
|
|
|
5
5
|
address: string;
|
|
6
6
|
txHash?: string;
|
|
7
7
|
}
|
|
8
|
+
export interface RemoteDeploymentId {
|
|
9
|
+
remoteDeploymentId?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Options for deploying an implementation contract, proxy admin contract, or remote deployment.
|
|
13
|
+
*/
|
|
8
14
|
export interface DeployOpts {
|
|
9
15
|
/**
|
|
10
16
|
* Timeout in milliseconds to wait for the transaction confirmation when deploying an implementation contract or proxy admin contract. Use `0` to wait indefinitely.
|
|
@@ -31,14 +37,22 @@ export interface DeployOpts {
|
|
|
31
37
|
* If not provided, invalid deployments will not be deleted in a dev network (which is not a problem if merge is false,
|
|
32
38
|
* since it will be overwritten with the new deployment).
|
|
33
39
|
* @param merge whether the cached deployment is intended to be merged with the new deployment. Defaults to false.
|
|
40
|
+
* @param getRemoteDeployment a function to get the remote deployment status by id. If the deployment id is not found, returns undefined.
|
|
34
41
|
* @returns the cached deployment if it should be used, otherwise the new deployment from the deploy function
|
|
35
42
|
* @throws {InvalidDeployment} if the cached deployment is invalid and we are not on a dev network
|
|
36
43
|
*/
|
|
37
|
-
export declare function resumeOrDeploy<T extends Deployment, U extends T = T>(provider: EthereumProvider, cached: T | undefined, deploy: () => Promise<U>, type?: string, opts?: DeployOpts, deployment?: ManifestField<T>, merge?: boolean): Promise<T | U>;
|
|
38
|
-
|
|
44
|
+
export declare function resumeOrDeploy<T extends Deployment, U extends T = T>(provider: EthereumProvider, cached: T | undefined, deploy: () => Promise<U>, type?: string, opts?: DeployOpts, deployment?: ManifestField<T>, merge?: boolean, getRemoteDeployment?: (remoteDeploymentId: string) => Promise<RemoteDeployment | undefined>): Promise<T | U>;
|
|
45
|
+
/**
|
|
46
|
+
* A deployment that is performed remotely, which has a status and transaction hash.
|
|
47
|
+
*/
|
|
48
|
+
export interface RemoteDeployment {
|
|
49
|
+
status: 'completed' | 'failed' | 'submitted';
|
|
50
|
+
txHash: string;
|
|
51
|
+
}
|
|
52
|
+
export declare function waitAndValidateDeployment(provider: EthereumProvider, deployment: Deployment & RemoteDeploymentId, type?: string, opts?: DeployOpts, getRemoteDeployment?: (remoteDeploymentId: string) => Promise<RemoteDeployment | undefined>): Promise<void>;
|
|
39
53
|
export declare class TransactionMinedTimeout extends UpgradesError {
|
|
40
|
-
readonly deployment: Deployment;
|
|
41
|
-
constructor(deployment: Deployment, type?: string, configurableTimeout?: boolean);
|
|
54
|
+
readonly deployment: Deployment & RemoteDeploymentId;
|
|
55
|
+
constructor(deployment: Deployment & RemoteDeploymentId, type?: string, configurableTimeout?: boolean);
|
|
42
56
|
}
|
|
43
57
|
export declare class InvalidDeployment extends Error {
|
|
44
58
|
readonly deployment: Deployment;
|
|
@@ -46,4 +60,14 @@ export declare class InvalidDeployment extends Error {
|
|
|
46
60
|
constructor(deployment: Deployment);
|
|
47
61
|
get message(): string;
|
|
48
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks if the deployment id is completed.
|
|
65
|
+
*
|
|
66
|
+
* @param address The expected address of the deployment.
|
|
67
|
+
* @param remoteDeploymentId The deployment id.
|
|
68
|
+
* @param remoteDeploymentResponse The remote deployment response corresponding to the given id.
|
|
69
|
+
* @returns true if the deployment id is completed, false otherwise.
|
|
70
|
+
* @throws {InvalidDeployment} if the deployment id failed.
|
|
71
|
+
*/
|
|
72
|
+
export declare function isDeploymentCompleted(address: string, remoteDeploymentId: string, remoteDeploymentResponse: RemoteDeployment | undefined): Promise<boolean>;
|
|
49
73
|
//# sourceMappingURL=deployment.d.ts.map
|
package/dist/deployment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../src/deployment.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAQjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAoB,aAAa,EAAE,MAAM,cAAc,CAAC;AAI/D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../src/deployment.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAQjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAoB,aAAa,EAAE,MAAM,cAAc,CAAC;AAI/D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,C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F;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,MAAM,EAC1B,wBAAwB,EAAE,gBAAgB,GAAG,SAAS,GACrD,OAAO,CAAC,OAAO,CAAC,CAmBlB"}
|
package/dist/deployment.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.InvalidDeployment = exports.TransactionMinedTimeout = exports.waitAndValidateDeployment = exports.resumeOrDeploy = void 0;
|
|
6
|
+
exports.isDeploymentCompleted = exports.InvalidDeployment = exports.TransactionMinedTimeout = exports.waitAndValidateDeployment = exports.resumeOrDeploy = void 0;
|
|
7
7
|
const util_1 = require("util");
|
|
8
8
|
const debug_1 = __importDefault(require("./utils/debug"));
|
|
9
9
|
const make_non_enumerable_1 = require("./utils/make-non-enumerable");
|
|
@@ -27,11 +27,12 @@ const sleep = (0, util_1.promisify)(setTimeout);
|
|
|
27
27
|
* If not provided, invalid deployments will not be deleted in a dev network (which is not a problem if merge is false,
|
|
28
28
|
* since it will be overwritten with the new deployment).
|
|
29
29
|
* @param merge whether the cached deployment is intended to be merged with the new deployment. Defaults to false.
|
|
30
|
+
* @param getRemoteDeployment a function to get the remote deployment status by id. If the deployment id is not found, returns undefined.
|
|
30
31
|
* @returns the cached deployment if it should be used, otherwise the new deployment from the deploy function
|
|
31
32
|
* @throws {InvalidDeployment} if the cached deployment is invalid and we are not on a dev network
|
|
32
33
|
*/
|
|
33
|
-
async function resumeOrDeploy(provider, cached, deploy, type, opts, deployment, merge) {
|
|
34
|
-
const validated = await validateCached(cached, provider, type, opts, deployment, merge);
|
|
34
|
+
async function resumeOrDeploy(provider, cached, deploy, type, opts, deployment, merge, getRemoteDeployment) {
|
|
35
|
+
const validated = await validateCached(cached, provider, type, opts, deployment, merge, getRemoteDeployment);
|
|
35
36
|
if (validated === undefined || merge) {
|
|
36
37
|
const deployment = await deploy();
|
|
37
38
|
(0, debug_1.default)('initiated deployment', 'transaction hash:', deployment.txHash, 'merge:', merge);
|
|
@@ -42,10 +43,10 @@ async function resumeOrDeploy(provider, cached, deploy, type, opts, deployment,
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
exports.resumeOrDeploy = resumeOrDeploy;
|
|
45
|
-
async function validateCached(cached, provider, type, opts, deployment, merge) {
|
|
46
|
+
async function validateCached(cached, provider, type, opts, deployment, merge, getRemoteDeployment) {
|
|
46
47
|
if (cached !== undefined) {
|
|
47
48
|
try {
|
|
48
|
-
await validateStoredDeployment(cached, provider, type, opts, merge);
|
|
49
|
+
return await validateStoredDeployment(cached, provider, type, opts, merge, getRemoteDeployment);
|
|
49
50
|
}
|
|
50
51
|
catch (e) {
|
|
51
52
|
if (e instanceof InvalidDeployment && (await (0, provider_1.isDevelopmentNetwork)(provider))) {
|
|
@@ -60,43 +61,87 @@ async function validateCached(cached, provider, type, opts, deployment, merge) {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
else {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
64
67
|
}
|
|
65
|
-
async function validateStoredDeployment(stored, provider, type, opts, merge) {
|
|
66
|
-
const { txHash } = stored;
|
|
68
|
+
async function validateStoredDeployment(stored, provider, type, opts, merge, getRemoteDeployment) {
|
|
69
|
+
const { txHash, remoteDeploymentId } = stored;
|
|
70
|
+
let deployment = stored;
|
|
67
71
|
if (txHash !== undefined) {
|
|
68
72
|
// If there is a deployment with txHash stored, we look its transaction up. If the
|
|
69
73
|
// transaction is found, the deployment is reused.
|
|
70
74
|
(0, debug_1.default)('found previous deployment', txHash);
|
|
71
75
|
const tx = await (0, provider_1.getTransactionByHash)(provider, txHash);
|
|
76
|
+
let foundDeployment = undefined;
|
|
72
77
|
if (tx !== null) {
|
|
73
|
-
|
|
78
|
+
foundDeployment = txHash;
|
|
79
|
+
}
|
|
80
|
+
else if (remoteDeploymentId !== undefined && getRemoteDeployment !== undefined) {
|
|
81
|
+
// If the transaction is not found, try checking the deployment id since the transaction may have been replaced
|
|
82
|
+
const response = await getRemoteDeployment(remoteDeploymentId);
|
|
83
|
+
if (response !== undefined) {
|
|
84
|
+
foundDeployment = remoteDeploymentId;
|
|
85
|
+
// update the stored tx hash
|
|
86
|
+
deployment = { ...stored, txHash: response.txHash };
|
|
87
|
+
(0, debug_1.default)('updating previous deployment to tx hash ', response.txHash);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (foundDeployment) {
|
|
91
|
+
(0, debug_1.default)('resuming previous deployment', foundDeployment);
|
|
74
92
|
if (merge) {
|
|
75
93
|
// If merging, wait for the existing deployment to be mined
|
|
76
|
-
waitAndValidateDeployment(provider,
|
|
94
|
+
waitAndValidateDeployment(provider, deployment, type, opts, getRemoteDeployment);
|
|
77
95
|
}
|
|
78
96
|
}
|
|
79
97
|
else {
|
|
80
98
|
// If the transaction is not found we throw an error, except if we're in
|
|
81
99
|
// a development network then we simply silently redeploy.
|
|
82
100
|
// This error should be caught by the caller to determine if we're in a dev network.
|
|
83
|
-
throw new InvalidDeployment(
|
|
101
|
+
throw new InvalidDeployment(deployment);
|
|
84
102
|
}
|
|
85
103
|
}
|
|
86
104
|
else {
|
|
87
|
-
const existingBytecode = await (0, provider_1.getCode)(provider,
|
|
105
|
+
const existingBytecode = await (0, provider_1.getCode)(provider, deployment.address);
|
|
88
106
|
if ((0, provider_1.isEmpty)(existingBytecode)) {
|
|
89
|
-
throw new InvalidDeployment(
|
|
107
|
+
throw new InvalidDeployment(deployment);
|
|
90
108
|
}
|
|
91
109
|
}
|
|
110
|
+
return deployment;
|
|
92
111
|
}
|
|
93
|
-
async function waitAndValidateDeployment(provider, deployment, type, opts) {
|
|
94
|
-
const { txHash, address } = deployment;
|
|
112
|
+
async function waitAndValidateDeployment(provider, deployment, type, opts, getRemoteDeployment) {
|
|
113
|
+
const { txHash, address, remoteDeploymentId } = deployment;
|
|
95
114
|
// Poll for 60 seconds with a 5 second poll interval by default.
|
|
96
115
|
const pollTimeout = opts?.timeout ?? 60e3;
|
|
97
116
|
const pollInterval = opts?.pollingInterval ?? 5e3;
|
|
98
117
|
(0, debug_1.default)('polling timeout', pollTimeout, 'polling interval', pollInterval);
|
|
99
|
-
|
|
118
|
+
let foundCode = false;
|
|
119
|
+
if (remoteDeploymentId !== undefined && getRemoteDeployment !== undefined) {
|
|
120
|
+
const startTime = Date.now();
|
|
121
|
+
// eslint-disable-next-line no-constant-condition
|
|
122
|
+
while (true) {
|
|
123
|
+
if (await (0, provider_1.hasCode)(provider, address)) {
|
|
124
|
+
(0, debug_1.default)('code in target address found', address);
|
|
125
|
+
foundCode = true;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
const completed = await isDeploymentCompleted(address, remoteDeploymentId, await getRemoteDeployment(remoteDeploymentId));
|
|
129
|
+
if (completed) {
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
await sleep(pollInterval);
|
|
134
|
+
}
|
|
135
|
+
if (pollTimeout != 0) {
|
|
136
|
+
const elapsedTime = Date.now() - startTime;
|
|
137
|
+
if (elapsedTime >= pollTimeout) {
|
|
138
|
+
// A timeout is NOT an InvalidDeployment
|
|
139
|
+
throw new TransactionMinedTimeout(deployment, type, !!opts);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (txHash !== undefined) {
|
|
100
145
|
const startTime = Date.now();
|
|
101
146
|
// eslint-disable-next-line no-constant-condition
|
|
102
147
|
while (true) {
|
|
@@ -123,21 +168,25 @@ async function waitAndValidateDeployment(provider, deployment, type, opts) {
|
|
|
123
168
|
}
|
|
124
169
|
}
|
|
125
170
|
}
|
|
126
|
-
(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
171
|
+
if (!foundCode) {
|
|
172
|
+
(0, debug_1.default)('verifying code in target address', address);
|
|
173
|
+
const startTime = Date.now();
|
|
174
|
+
while (!(await (0, provider_1.hasCode)(provider, address))) {
|
|
175
|
+
const elapsedTime = Date.now() - startTime;
|
|
176
|
+
if (elapsedTime >= pollTimeout || txHash === undefined) {
|
|
177
|
+
throw new InvalidDeployment(deployment);
|
|
178
|
+
}
|
|
179
|
+
await sleep(pollInterval);
|
|
132
180
|
}
|
|
133
|
-
|
|
181
|
+
(0, debug_1.default)('code in target address found', address);
|
|
134
182
|
}
|
|
135
|
-
(0, debug_1.default)('code in target address found', address);
|
|
136
183
|
}
|
|
137
184
|
exports.waitAndValidateDeployment = waitAndValidateDeployment;
|
|
138
185
|
class TransactionMinedTimeout extends error_1.UpgradesError {
|
|
139
186
|
constructor(deployment, type, configurableTimeout) {
|
|
140
|
-
super(`Timed out waiting for ${type ? type + ' ' : ''}contract deployment to address ${deployment.address} with
|
|
187
|
+
super(`Timed out waiting for ${type ? type + ' ' : ''}contract deployment to address ${deployment.address} with ${deployment.remoteDeploymentId
|
|
188
|
+
? `deployment id ${deployment.remoteDeploymentId}`
|
|
189
|
+
: `transaction ${deployment.txHash}`}`, () => 'Run the function again to continue waiting for the transaction confirmation.' +
|
|
141
190
|
(configurableTimeout
|
|
142
191
|
? ' If the problem persists, adjust the polling parameters with the timeout and pollingInterval options.'
|
|
143
192
|
: ''));
|
|
@@ -163,4 +212,36 @@ class InvalidDeployment extends Error {
|
|
|
163
212
|
}
|
|
164
213
|
}
|
|
165
214
|
exports.InvalidDeployment = InvalidDeployment;
|
|
215
|
+
/**
|
|
216
|
+
* Checks if the deployment id is completed.
|
|
217
|
+
*
|
|
218
|
+
* @param address The expected address of the deployment.
|
|
219
|
+
* @param remoteDeploymentId The deployment id.
|
|
220
|
+
* @param remoteDeploymentResponse The remote deployment response corresponding to the given id.
|
|
221
|
+
* @returns true if the deployment id is completed, false otherwise.
|
|
222
|
+
* @throws {InvalidDeployment} if the deployment id failed.
|
|
223
|
+
*/
|
|
224
|
+
async function isDeploymentCompleted(address, remoteDeploymentId, remoteDeploymentResponse) {
|
|
225
|
+
(0, debug_1.default)('verifying deployment id', remoteDeploymentId);
|
|
226
|
+
if (remoteDeploymentResponse === undefined) {
|
|
227
|
+
throw new Error(`Could not find remote deployment with id ${remoteDeploymentId}`);
|
|
228
|
+
}
|
|
229
|
+
const status = remoteDeploymentResponse.status;
|
|
230
|
+
if (status === 'completed') {
|
|
231
|
+
(0, debug_1.default)('succeeded verifying deployment id completed', remoteDeploymentId);
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
else if (status === 'failed') {
|
|
235
|
+
(0, debug_1.default)(`deployment id ${remoteDeploymentId} failed with tx hash ${remoteDeploymentResponse.txHash}`);
|
|
236
|
+
throw new InvalidDeployment({ address, txHash: remoteDeploymentResponse.txHash });
|
|
237
|
+
}
|
|
238
|
+
else if (status === 'submitted') {
|
|
239
|
+
(0, debug_1.default)('waiting for deployment id to be completed', remoteDeploymentId);
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
throw new Error(`Broken invariant: Unrecognized status ${status} for deployment id ${remoteDeploymentId}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.isDeploymentCompleted = isDeploymentCompleted;
|
|
166
247
|
//# sourceMappingURL=deployment.js.map
|
package/dist/deployment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../src/deployment.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAiC;AAEjC,0DAAkC;AAClC,qEAAgE;AAChE,yCASoB;AACpB,mCAAwC;AACxC,6CAA+D;AAE/D,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../src/deployment.ts"],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